mirror of
https://git.sindominio.net/estibadores/wordpress.git
synced 2024-11-14 23:21:07 +01:00
37 lines
897 B
PHP
37 lines
897 B
PHP
<?php
|
|
// exit if accessed directly
|
|
if ( ! defined( 'ABSPATH' ) )
|
|
exit;
|
|
|
|
new Math_Captcha_Update();
|
|
|
|
class Math_Captcha_Update {
|
|
|
|
public function __construct() {
|
|
// actions
|
|
add_action( 'init', array( $this, 'check_update' ) );
|
|
}
|
|
|
|
/**
|
|
* Check update.
|
|
*/
|
|
public function check_update() {
|
|
if ( ! is_admin() || ! current_user_can( 'manage_options' ) )
|
|
return;
|
|
|
|
// gets current database version
|
|
$current_db_version = get_option( 'math_captcha_version', '1.0.0' );
|
|
|
|
// new version?
|
|
if ( version_compare( $current_db_version, Math_Captcha()->defaults['version'], '<' ) ) {
|
|
if ( version_compare( $current_db_version, '1.0.9', '<' ) ) {
|
|
update_option( 'math_captcha_options', Math_Captcha()->options['general'] );
|
|
delete_option( 'mc_options' );
|
|
}
|
|
|
|
// updates plugin version
|
|
update_option( 'math_captcha_version', Math_Captcha()->defaults['version'] );
|
|
}
|
|
}
|
|
|
|
} |