/** * versions_confirm() * * Check the version of an item and compare it to the minimum requirements BackupBuddy requires. * * @param string $type Optional. If left blank '' then all tests will be performed. Valid values: wordpress, php, ''. * @param boolean $notify Optional. Whether or not to alert to the screen (and throw error to log) of a version issue.\ * @return boolean True if the selected type is a bad version */ function versions_confirm($type = '', $notify = false) { $bad_version = false; if ($type == 'wordpress' || $type == '') { global $wp_version; if (version_compare($wp_version, pb_backupbuddy::settings('wp_minimum'), '<=')) { if ($notify === true) { pb_backupbuddy::alert(sprintf(__('ERROR: BackupBuddy requires WordPress version %1$s or higher. You may experience unexpected behavior or complete failure in this environment. Please consider upgrading WordPress.', 'it-l10n-backupbuddy'), $this->_wp_minimum)); pb_backupbuddy::log('Unsupported WordPress Version: ' . $wp_version, 'error'); } $bad_version = true; } } if ($type == 'php' || $type == '') { if (version_compare(PHP_VERSION, pb_backupbuddy::settings('php_minimum'), '<=')) { if ($notify === true) { pb_backupbuddy::alert(sprintf(__('ERROR: BackupBuddy requires PHP version %1$s or higher. You may experience unexpected behavior or complete failure in this environment. Please consider upgrading PHP.', 'it-l10n-backupbuddy'), PHP_VERSION)); pb_backupbuddy::log('Unsupported PHP Version: ' . PHP_VERSION, 'error'); } $bad_version = true; } } return $bad_version; }
/** * pb_backupbuddy::alert() * * Displays a message to the user at the top of the page when in the dashboard. * * @param string $message Message you want to display to the user. * @param boolean $error OPTIONAL! true indicates this alert is an error and displays as red. Default: false * @param int $error_code OPTIONAL! Error code number to use in linking in the wiki for easy reference. * @return null */ public function alert($message, $error = false, $error_code = '', $rel_tag = '') { $log_error = false; echo '<div id="message" style="padding: 9px;" rel="' . $rel_tag . '" class="pb_backupbuddy_alert '; if ($error === false) { echo 'updated fade'; } else { echo 'error'; $log_error = true; } if ($error_code != '') { $message .= '<a href="http://ithemes.com/codex/page/' . pb_backupbuddy::settings('name') . ':_Error_Codes#' . $error_code . '" target="_new"><i>' . pb_backupbuddy::settings('name') . ' Error Code ' . $error_code . ' - Click for more details.</i></a>'; $log_error = true; } if ($log_error === true) { pb_backupbuddy::log($message . ' Error Code: ' . $error_code, 'error'); } echo '" >' . $message . '</div>'; }