' . esc_html__( 'Another edition of 007AJ Backup Restore Verifier is already active. Please deactivate one of them: they share the same data and cannot run together.', '007aj-backup-restore-verifier' ) . '

'; } ); return; } if ( ! defined( 'BRVERIFY_VERSION' ) ) { define( 'BRVERIFY_VERSION', '0.6.6' ); } if ( ! defined( 'BRVERIFY_FILE' ) ) { define( 'BRVERIFY_FILE', __FILE__ ); } if ( ! defined( 'BRVERIFY_PATH' ) ) { define( 'BRVERIFY_PATH', plugin_dir_path( __FILE__ ) ); } if ( ! defined( 'BRVERIFY_URL' ) ) { define( 'BRVERIFY_URL', plugin_dir_url( __FILE__ ) ); } if ( ! defined( 'BRVERIFY_BASENAME' ) ) { define( 'BRVERIFY_BASENAME', plugin_basename( __FILE__ ) ); } if ( ! defined( 'BRVERIFY_DB_VERSION' ) ) { define( 'BRVERIFY_DB_VERSION', '1' ); } require_once BRVERIFY_PATH . 'includes/compat.php'; /** * Environment problems that stop the plugin from running (checked before anything is used). * * @return list Human-readable problems (empty when all is fine). */ function brverify_requirement_errors(): array { global $wp_version; $errors = array(); if ( version_compare( PHP_VERSION, '7.4', '<' ) ) { /* translators: %s: PHP version. */ $errors[] = sprintf( __( 'PHP 7.4 or newer is required (this server runs %s).', '007aj-backup-restore-verifier' ), PHP_VERSION ); } if ( version_compare( (string) $wp_version, '6.3', '<' ) ) { /* translators: %s: WordPress version. */ $errors[] = sprintf( __( 'WordPress 6.3 or newer is required (this site runs %s).', '007aj-backup-restore-verifier' ), (string) $wp_version ); } $ext = array( 'zlib' => function_exists( 'deflate_init' ) && function_exists( 'inflate_init' ), 'hash' => function_exists( 'hash_init' ), 'json' => function_exists( 'json_encode' ), ); foreach ( $ext as $name => $ok ) { if ( ! $ok ) { /* translators: %s: PHP extension name. */ $errors[] = sprintf( __( 'The PHP extension "%s" is required but not enabled on this server.', '007aj-backup-restore-verifier' ), $name ); } } return $errors; } /** * Admin notice for missing requirements (shown to administrators only). */ function brverify_requirements_notice(): void { if ( ! current_user_can( 'activate_plugins' ) ) { return; } $errors = brverify_requirement_errors(); if ( array() !== $errors ) { echo '

' . esc_html__( '007AJ Backup Restore Verifier is not running:', '007aj-backup-restore-verifier' ) . '

' . esc_html__( 'Please ask your host to update or enable it. Nothing was changed on your site.', '007aj-backup-restore-verifier' ) . '

'; return; } if ( ! class_exists( 'ZipArchive' ) ) { echo '

' . esc_html__( '007AJ Backup Restore Verifier: the PHP ZipArchive class (zip extension) is not available, so the extra archive check before a restore is skipped. Backups and restores still work; ask your host to enable the zip extension for the full check.', '007aj-backup-restore-verifier' ) . '

'; } $failed = (string) get_option( 'brverify_dir_relocate_failed', '' ); if ( '' !== $failed ) { echo '

' . esc_html__( '007AJ Backup Restore Verifier could not move its backup folder from wp-content/brverify-working to the uploads directory, so it keeps using the old folder. Your backups are safe. Make sure the uploads directory is writable and on the same disk; the move is retried automatically.', '007aj-backup-restore-verifier' ) . '

'; } } add_action( 'admin_notices', 'brverify_requirements_notice' ); if ( array() !== brverify_requirement_errors() ) { return; } require_once BRVERIFY_PATH . 'includes/Autoload.php'; \BRVerify\Autoload::register( BRVERIFY_PATH . 'includes/' ); require_once BRVERIFY_PATH . 'includes/settings.php'; require_once BRVERIFY_PATH . 'includes/admin.php'; register_activation_hook( __FILE__, array( \BRVerify\Activator::class, 'activate' ) ); register_deactivation_hook( __FILE__, array( \BRVerify\Deactivator::class, 'deactivate' ) ); /** * Boot the plugin after all plugins are loaded. */ add_action( 'plugins_loaded', static function (): void { \BRVerify\Plugin::instance()->boot(); }, 10 );