function verify_vb3_enviroment() { global $upgradecore_phrases, $db; $errorthrown = false; // php version check if (!function_exists('version_compare') or version_compare(PHP_VERSION, '4.3.2', '<=')) { echo "<p>{$upgradecore_phrases['php_version_too_old']}</p>"; $errorthrown = true; } if (version_compare(MYSQL_VERSION, '4.0.15', '<=')) { echo sprintf("<p>{$upgradecore_phrases['mysql_version_too_old']}</p>", MYSQL_VERSION); $errorthrown = true; } // config file check if (!file_exists(DIR . '/includes/config.php')) { echo "<p>{$upgradecore_phrases['ensure_config_exists']}</p>"; $errorthrown = true; } if (($err = verify_optimizer_environment()) !== true) { echo "<p>{$upgradecore_phrases[$err]}</p>"; $errorthrown = true; } if ($errorthrown) { exit; } $db->hide_errors(); // post_parsed needs to be called postparsed for some of the rebuild functions to work correctly $db->query_write("ALTER TABLE " . TABLE_PREFIX . "post_parsed RENAME " . TABLE_PREFIX . "postparsed"); $db->show_errors(); }
function verify_vb3_enviroment() { global $installcore_phrases, $vbulletin; $errorthrown = false; // php version check if (!function_exists('version_compare') or version_compare(PHP_VERSION, '4.3.2', '<=')) { $errorthrown = true; echo "<p>{$installcore_phrases['php_version_too_old']}</p>"; } if (defined('MYSQL_VERSION') and (!function_exists('version_compare') or version_compare(MYSQL_VERSION, '4.0.15', '<='))) { $errorthrown = true; echo sprintf("<p>{$installcore_phrases['mysql_version_too_old']}</p>", MYSQL_VERSION); } // XML check if (!function_exists('xml_set_element_handler')) { // Attempt to load XML extension if we don't have the XML functions // already loaded. $errorthrown = true; if (ini_get('enable_dl') and !SAFEMODE) { $extension_dir = ini_get('extension_dir'); if (strtoupper(substr(PHP_OS, 0, 3) == 'WIN')) { $extension_file = 'php_xml.dll'; } else { $extension_file = 'xml.so'; } if ($extension_dir and file_exists($extension_dir . '/' . $extension_file)) { @ini_set('display_errors', true); if (dl($extension_file)) { $errorthrown = false; } } } if ($errorthrown) { echo "<p>{$installcore_phrases['need_xml']}</p>"; } } // MySQL check if (!function_exists('mysql_connect') and !function_exists('mysqli_connect')) { $errorthrown = true; echo "<p>{$installcore_phrases['need_mysql']}</p>"; } // config file check if (!file_exists(DIR . '/includes/config.php')) { $errorthrown = true; echo "<p>{$installcore_phrases['need_config_file']}</p>"; } // check that we are NOT using the 'mysql' database if (strtolower($vbulletin->config['Database']['dbname']) == 'mysql') { $errorthrown = true; echo "<p>{$installcore_phrases['dbname_is_mysql']}</p>"; } if (($err = verify_optimizer_environment()) !== true) { $errorthrown = true; echo "<p>{$installcore_phrases[$err]}</p>"; } if ($errorthrown) { exit; } }
$news_rows = array(); // look to see if MySQL is running in strict mode if (empty($vbulletin->config['Database']['force_sql_mode'])) { // check to see if MySQL is running strict mode and recommend disabling it $db->hide_errors(); $strict_mode_check = $db->query_first("SHOW VARIABLES LIKE 'sql\\_mode'"); if (strpos(strtolower($strict_mode_check['Value']), 'strict_') !== false) { ob_start(); print_table_header($vbphrase['mysql_strict_mode_warning']); print_description_row('<div class="smallfont">' . $vbphrase['mysql_running_strict_mode'] . '</div>'); $news_rows['sql_strict'] = ob_get_clean(); } $db->show_errors(); } // check if a PHP optimizer with known issues is installed if (($err = verify_optimizer_environment()) !== true) { ob_start(); print_description_row($vbphrase['problematic_php_optimizer_found'], false, 2, 'thead'); print_description_row('<div class="smallfont">' . $vbphrase["{$err}"] . '</div>'); $news_rows['php_optimizer'] = ob_get_clean(); } // look for incomplete admin messages that may have actually been independently completed // and say they're done $donemessages_result = $db->query_read("\n\tSELECT adminmessage.adminmessageid\n\tFROM " . TABLE_PREFIX . "adminmessage AS adminmessage\n\tINNER JOIN " . TABLE_PREFIX . "adminlog AS adminlog ON (adminlog.script = adminmessage.script AND adminlog.action = adminmessage.action)\n\tWHERE adminmessage.status = 'undone'\n\t\tAND adminmessage.script <> ''\n\t\tAND adminlog.dateline > adminmessage.dateline\n\tGROUP BY adminmessage.adminmessageid\n"); while ($donemessage = $db->fetch_array($donemessages_result)) { $db->query_write("\n\t\tUPDATE " . TABLE_PREFIX . "adminmessage\n\t\tSET status = 'done'\n\t\tWHERE adminmessageid = " . intval($donemessage['adminmessageid']) . "\n\t"); } // let's look for any messages that we need to display to the admin $adminmessages_result = $db->query_read("\n\tSELECT *\n\tFROM " . TABLE_PREFIX . "adminmessage\n\tWHERE status = 'undone'\n\tORDER BY dateline\n"); if ($db->num_rows($adminmessages_result)) { ob_start();
/** * Verify conditions are acceptable to perform the upgrade/install * */ protected function verify_environment() { // php version check if (!function_exists('version_compare') or version_compare(PHP_VERSION, '5.2.0', '<')) { $this->startup_errors[] = sprintf($this->phrase['core']['php_version_too_old'], PHP_VERSION); } if (!defined('SKIPDB') and function_exists('version_compare') and version_compare(MYSQL_VERSION, '4.1.0', '<=')) { $this->startup_errors[] = sprintf($this->phrase['core']['mysql_version_too_old'], MYSQL_VERSION); } // config file check if (!file_exists(DIR . '/includes/config.php')) { $this->startup_errors[] = $this->phrase['core']['cant_find_config']; } else { if (!is_readable(DIR . '/includes/config.php')) { $this->startup_errors[] = $this->phrase['core']['cant_read_config']; } } if (($err = verify_optimizer_environment()) !== true) { $this->startup_errors[] = $this->phrase['core'][$err]; } if (function_exists('mmcache_get')) { $this->startup_errors[] = $this->phrase['core']['turck']; } if (!$this->verify_cssdir()) { $this->startup_errors[] = $this->phrase['core']['css_not_writable']; } $this->verify_install_environment(); $this->verify_files(); }