*/ public function collect(): array { $rows = array(); $php_ok = version_compare( PHP_VERSION, '7.4.0', '>=' ); $rows[] = array( 'label' => __( 'PHP version', '007aj-backup-restore-verifier' ), 'value' => PHP_VERSION . ( $php_ok ? '' : ' ' . __( '(7.4+ required)', '007aj-backup-restore-verifier' ) ), 'status' => $php_ok ? 'ok' : 'fail', ); $wp_ok = version_compare( get_bloginfo( 'version' ), '6.3', '>=' ); $rows[] = array( 'label' => __( 'WordPress version', '007aj-backup-restore-verifier' ), 'value' => get_bloginfo( 'version' ) . ( $wp_ok ? '' : ' ' . __( '(6.3+ required)', '007aj-backup-restore-verifier' ) ), 'status' => $wp_ok ? 'ok' : 'fail', ); $zip = class_exists( 'ZipArchive' ); $rows[] = array( 'label' => __( 'ZipArchive', '007aj-backup-restore-verifier' ), 'value' => $zip ? __( 'Available', '007aj-backup-restore-verifier' ) : __( 'Missing', '007aj-backup-restore-verifier' ), 'status' => $zip ? 'ok' : 'warn', ); $sodium = function_exists( 'sodium_crypto_secretbox' ); $rows[] = array( 'label' => __( 'Libsodium', '007aj-backup-restore-verifier' ), 'value' => $sodium ? __( 'Available', '007aj-backup-restore-verifier' ) : __( 'Not available', '007aj-backup-restore-verifier' ), 'status' => $sodium ? 'ok' : 'warn', ); $disk = $this->disk_free_label(); $rows[] = array( 'label' => __( 'Available disk space (content dir)', '007aj-backup-restore-verifier' ), 'value' => $disk['label'], 'status' => $disk['status'], ); $local = new LocalAdapter(); $rows[] = array( 'label' => __( 'Local working directory', '007aj-backup-restore-verifier' ), 'value' => $local->is_configured() ? $local->working_dir() : __( 'Not writable', '007aj-backup-restore-verifier' ), 'status' => $local->is_configured() ? 'ok' : 'fail', ); $server = isset( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : ''; if ( false !== stripos( $server, 'nginx' ) ) { $rows[] = array( 'label' => __( 'Web server protection', '007aj-backup-restore-verifier' ), 'value' => __( 'Nginx ignores .htaccess. Add "location ~* /uploads/brverify-working/ { deny all; }" to your server block so backup files cannot be downloaded directly.', '007aj-backup-restore-verifier' ), 'status' => 'warn', ); } $repo = new Job_Repository(); $tables_ok = $repo->tables_exist(); $rows[] = array( 'label' => __( 'Job tables', '007aj-backup-restore-verifier' ), 'value' => $tables_ok ? sprintf( /* translators: %d: job row count */ __( 'Present (%d jobs)', '007aj-backup-restore-verifier' ), $repo->count() ) : __( 'Missing — re-activate plugin', '007aj-backup-restore-verifier' ), 'status' => $tables_ok ? 'ok' : 'fail', ); $cron_disabled = ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ); $rows[] = array( 'label' => __( 'WP-Cron', '007aj-backup-restore-verifier' ), 'value' => $cron_disabled ? __( 'DISABLE_WP_CRON is true — use system cron to hit wp-cron.php', '007aj-backup-restore-verifier' ) : __( 'Enabled (spawn)', '007aj-backup-restore-verifier' ), 'status' => $cron_disabled ? 'warn' : 'ok', ); $interval = Settings::schedule_interval(); $labels = Settings::interval_labels(); $sched = new Scheduler(); $sched_label = $labels[ $interval ] ?? $interval; if ( Settings::INTERVAL_DISABLED !== $interval ) { $sched_label .= ' — ' . sprintf( /* translators: %s: next run datetime */ __( 'next %s', '007aj-backup-restore-verifier' ), $sched->next_run_label() ); } $rows[] = array( 'label' => __( 'Backup schedule', '007aj-backup-restore-verifier' ), 'value' => $sched_label, 'status' => Settings::INTERVAL_DISABLED === $interval ? 'warn' : 'ok', ); $multisite = is_multisite(); $rows[] = array( 'label' => __( 'Multisite', '007aj-backup-restore-verifier' ), 'value' => $multisite ? __( 'Multisite is not supported — jobs will refuse', '007aj-backup-restore-verifier' ) : __( 'Single site', '007aj-backup-restore-verifier' ), 'status' => $multisite ? 'warn' : 'ok', ); return $rows; } /** * Free disk space where backups are stored (uploads directory). * * @return array{label:string,status:string} */ private function disk_free_label(): array { $path = dirname( \BRVerify\Support\Working_Dir::root() ); $free = @disk_free_space( $path ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged if ( false === $free ) { return array( 'label' => __( 'Unknown', '007aj-backup-restore-verifier' ), 'status' => 'warn', ); } $label = size_format( (int) $free, 2 ); $status = $free < 100 * MB_IN_BYTES ? 'warn' : 'ok'; return array( 'label' => $label, 'status' => $status, ); } }