modules = $modules; } /** * Render the screen: the report, the support form and the constants on * the left; a sticky documentation panel on the right -- the same * layout as the Settings screen. * * @return void */ public function render(): void { $report = $this->build_report(); $user = wp_get_current_user(); $notice = get_transient( 'aiou_support_notice_' . get_current_user_id() ); delete_transient( 'aiou_support_notice_' . get_current_user_id() ); $draft = is_array( $notice ) && 'error' === $notice['type'] ? (array) $notice['draft'] : array(); $draft = array_merge( array( 'reply_to' => $user->user_email, 'subject' => '', 'message' => '', 'format' => 'txt', 'attach' => true, ), $draft ); AdminShell::page_start( array( 'title' => __( 'System Report', 'all-in-one-utilities' ), 'description' => __( 'Your WordPress, server and plugin setup in one place -- copy it, download it, or send it to support.', 'all-in-one-utilities' ), 'class' => 'aiou-tools aiou-report', ) ); ?>

' . esc_html( SupportRequest::support_email() ) . '' ); ?>

$description ) : ?>
' . esc_html( self::show( constant( $name ) ) ) . '' : '' . esc_html__( 'Not set', 'all-in-one-utilities' ) . ''; ?>
get_var( 'SELECT VERSION()' ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- one diagnostic read. return ( str_contains( strtolower( $version ), 'mariadb' ) ? 'MariaDB ' : 'MySQL ' ) . $version; } /** * The constants shown, with what each does. Credentials, keys, salts, * and file system paths are deliberately left out. * * @return array */ public static function constants(): array { return array( 'WP_ENVIRONMENT_TYPE' => __( 'Whether this is a local, development, staging, or production site.', 'all-in-one-utilities' ), 'WP_DEBUG' => __( 'Debug mode: shows or logs PHP notices and warnings.', 'all-in-one-utilities' ), 'WP_DEBUG_LOG' => __( 'Writes errors to a log file (true = wp-content/debug.log).', 'all-in-one-utilities' ), 'WP_DEBUG_DISPLAY' => __( 'Shows errors on the page. Should be false on a live site.', 'all-in-one-utilities' ), 'SCRIPT_DEBUG' => __( 'Loads unminified core scripts and styles.', 'all-in-one-utilities' ), 'SAVEQUERIES' => __( 'Records every database query (slow; for debugging only).', 'all-in-one-utilities' ), 'WP_MEMORY_LIMIT' => __( 'Memory WordPress may use on the site.', 'all-in-one-utilities' ), 'WP_MAX_MEMORY_LIMIT' => __( 'Memory WordPress may use in wp-admin.', 'all-in-one-utilities' ), 'WP_POST_REVISIONS' => __( 'How many revisions to keep (true = all, false = none).', 'all-in-one-utilities' ), 'AUTOSAVE_INTERVAL' => __( 'Seconds between editor autosaves.', 'all-in-one-utilities' ), 'EMPTY_TRASH_DAYS' => __( 'Days before trashed items are deleted for good.', 'all-in-one-utilities' ), 'MEDIA_TRASH' => __( 'Whether media goes to the trash before deletion.', 'all-in-one-utilities' ), 'IMAGE_EDIT_OVERWRITE' => __( 'Whether image edits replace the original sizes.', 'all-in-one-utilities' ), 'DISABLE_WP_CRON' => __( 'Turns off WP-Cron on page loads (a server cron job must call it).', 'all-in-one-utilities' ), 'ALTERNATE_WP_CRON' => __( 'Runs WP-Cron by redirecting the visitor (for hosts that block loopback requests).', 'all-in-one-utilities' ), 'WP_CRON_LOCK_TIMEOUT' => __( 'Seconds before another WP-Cron run may start.', 'all-in-one-utilities' ), 'DISALLOW_FILE_EDIT' => __( 'Removes the plugin and theme file editors.', 'all-in-one-utilities' ), 'DISALLOW_FILE_MODS' => __( 'Blocks installing, updating, and deleting plugins and themes from wp-admin.', 'all-in-one-utilities' ), 'DISALLOW_UNFILTERED_HTML' => __( 'Stops everyone, even administrators, posting unfiltered HTML.', 'all-in-one-utilities' ), 'FORCE_SSL_ADMIN' => __( 'Forces HTTPS for logins and wp-admin.', 'all-in-one-utilities' ), 'WP_AUTO_UPDATE_CORE' => __( 'Which WordPress updates install automatically.', 'all-in-one-utilities' ), 'AUTOMATIC_UPDATER_DISABLED' => __( 'Turns off all automatic updates.', 'all-in-one-utilities' ), 'WP_CACHE' => __( 'Lets a page caching plugin load early (advanced-cache.php).', 'all-in-one-utilities' ), 'CONCATENATE_SCRIPTS' => __( 'Combines wp-admin scripts into one request.', 'all-in-one-utilities' ), 'COMPRESS_SCRIPTS' => __( 'Compresses combined wp-admin scripts.', 'all-in-one-utilities' ), 'WP_HOME' => __( 'The site address, overriding Settings → General.', 'all-in-one-utilities' ), 'WP_SITEURL' => __( 'The WordPress address, overriding Settings → General.', 'all-in-one-utilities' ), 'WP_DEFAULT_THEME' => __( 'The theme used when the active one is missing.', 'all-in-one-utilities' ), 'WP_HTTP_BLOCK_EXTERNAL' => __( 'Blocks WordPress\'s outgoing HTTP requests.', 'all-in-one-utilities' ), 'WP_ACCESSIBLE_HOSTS' => __( 'Hosts still allowed when external requests are blocked.', 'all-in-one-utilities' ), 'MULTISITE' => __( 'Whether this is a multisite network.', 'all-in-one-utilities' ), 'DB_CHARSET' => __( 'Database character set.', 'all-in-one-utilities' ), 'DB_COLLATE' => __( 'Database collation (empty = the database\'s default).', 'all-in-one-utilities' ), ); } /** * A constant's value as text. * * @param mixed $value Value. * @return string */ private static function show( $value ): string { if ( is_bool( $value ) ) { return $value ? 'true' : 'false'; } if ( null === $value ) { return 'null'; } return is_scalar( $value ) ? ( '' === (string) $value ? "''" : (string) $value ) : (string) wp_json_encode( $value ); } /** * Build the plain-text report. * * @return string */ public function build_report(): string { global $wp_version; $lines = array(); $lines[] = 'All-in-One Utilities System Report'; $lines[] = 'Generated: ' . gmdate( 'c' ); $lines[] = ''; $lines[] = '-- Plugin --'; $lines[] = 'Version: ' . AIOU_VERSION; $module_ids = array_keys( $this->modules->all() ); $lines[] = 'Active modules: ' . ( $module_ids ? implode( ', ', $module_ids ) : 'none' ); $lines[] = ''; $lines[] = '-- WordPress --'; $lines[] = 'Version: ' . $wp_version; $lines[] = 'Site URL: ' . site_url(); $lines[] = 'Multisite: ' . ( is_multisite() ? 'Yes' : 'No' ); $theme = wp_get_theme(); $lines[] = 'Active theme: ' . $theme->get( 'Name' ) . ' ' . $theme->get( 'Version' ); $lines[] = 'Language: ' . get_locale(); $lines[] = ''; $lines[] = 'Environment type: ' . wp_get_environment_type(); $lines[] = 'Permalinks: ' . ( get_option( 'permalink_structure' ) ? (string) get_option( 'permalink_structure' ) : 'Plain' ); $lines[] = 'HTTPS: ' . ( is_ssl() ? 'Yes' : 'No' ); $lines[] = 'Timezone: ' . wp_timezone_string(); $lines[] = 'Persistent object cache: ' . ( wp_using_ext_object_cache() ? 'Yes' : 'No' ); $lines[] = 'WP-Cron: ' . ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ? 'Disabled (server cron expected)' : 'Enabled' ); $lines[] = 'Debug mode: ' . ( defined( 'WP_DEBUG' ) && WP_DEBUG ? 'On' : 'Off' ); $lines[] = ''; $lines[] = '-- Server --'; $lines[] = 'PHP version: ' . PHP_VERSION . ' (' . PHP_SAPI . ')'; $lines[] = 'Web server: ' . ( isset( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ) ) : 'Unknown' ); $lines[] = 'Database: ' . self::database_version(); $lines[] = 'Memory limit: ' . WP_MEMORY_LIMIT . ' (PHP: ' . ini_get( 'memory_limit' ) . ', admin: ' . ( defined( 'WP_MAX_MEMORY_LIMIT' ) ? (string) constant( 'WP_MAX_MEMORY_LIMIT' ) : '-' ) . ')'; $lines[] = 'Max execution time: ' . ini_get( 'max_execution_time' ) . 's'; $lines[] = 'Upload max filesize: ' . ini_get( 'upload_max_filesize' ) . ', post max size: ' . ini_get( 'post_max_size' ); $lines[] = 'Max input vars: ' . ini_get( 'max_input_vars' ); foreach ( array( 'curl', 'mbstring', 'gd', 'imagick', 'json', 'mysqli' ) as $extension ) { $lines[] = ucfirst( $extension ) . ': ' . ( extension_loaded( $extension ) ? 'Yes' : 'No' ); } $lines[] = ''; $lines[] = '-- Active Plugins --'; if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $all_plugins = get_plugins(); $active_plugins = (array) get_option( 'active_plugins', array() ); foreach ( $active_plugins as $plugin_file ) { if ( isset( $all_plugins[ $plugin_file ] ) ) { $lines[] = $all_plugins[ $plugin_file ]['Name'] . ' ' . $all_plugins[ $plugin_file ]['Version']; } } $lines[] = ''; $lines[] = '-- Constants --'; foreach ( array_keys( self::constants() ) as $constant ) { if ( defined( $constant ) ) { $lines[] = $constant . ': ' . self::show( constant( $constant ) ); } } /** * Filters the System Report's lines, so Pro, the Woo Add-on, or * other modules can append their own diagnostic sections. * * @since 2.0.0 * * @param string[] $lines Report lines (each one a line of plain text). */ $lines = apply_filters( 'aiou_system_report_lines', $lines ); return implode( "\n", $lines ); } }