echo '<p style="font-size:120%;"><strong>WARNING: The upgrade script failed ...</strong></p>'; echo '<form action="' . $_SERVER['SCRIPT_NAME'] . '">'; echo ' <input name="send" type="submit" value="Restart upgrade script" />'; echo '</form>'; echo '<br /><br /></div></body></html>'; exit; } } /********************************************************** * upgrade modules if newer version is available */ $aModuleList = array('news'); foreach ($aModuleList as $sModul) { if (file_exists(WB_PATH . '/modules/' . $sModul . '/upgrade.php')) { $currModulVersion = get_modul_version($sModul, false); $newModulVersion = get_modul_version($sModul, true); if (version_compare($currModulVersion, $newModulVersion) <= 0) { echo '<h2>Step ' . $stepID++ . ' : Upgrade module \'' . $sModul . '\' to version ' . $newModulVersion . '</h2>'; require_once WB_PATH . '/modules/' . $sModul . '/upgrade.php'; } } } /********************************************************** * - Reload all addons */ echo '<h2>Step ' . $stepID++ . ' : Reload all addons database entry (no upgrade)</h2>'; ////delete modules //$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE type = 'module'"); // Load all modules if ($handle = opendir(WB_PATH . '/modules/')) { while (false !== ($file = readdir($handle))) {
} } } else { $error_msg[] = '<span class="normal bold red">' . $value['directory'] . ' ' . $MESSAGE['RECORD_MODIFIED_FAILED'] . '</span> '; } } } } /** * Now check modules folder with entries in addons */ $modules = scan_current_dir(LEPTON_PATH . '/modules'); if (count($modules['path']) > 0) { foreach ($modules['path'] as &$value) { $code_version = get_modul_version($value); $db_version = get_modul_version($value, false); if ($db_version != null && $code_version != null) { if (versioncompare($db_version, $code_version, '>')) { $error_msg[] = '<span class="normal bold red">' . $value . ' ( ' . $db_version . ' > ' . $code_version . ' ) ' . $MESSAGE['GENERIC_MODULE_VERSION_ERROR'] . '</span>'; continue; } else { require LEPTON_PATH . '/modules/' . $value . "/info.php"; load_module(LEPTON_PATH . '/modules/' . $value); $msg[] = '<span class="normal bold green">' . $value . ' :: ' . $MESSAGE['ADDON_MODULES_RELOADED'] . '</span>'; } } } } else { $error_msg[] = '<span class="normal bold red">' . $MESSAGE['ADDON_ERROR_RELOAD'] . '</span>'; } break;
echo ' <input name="send" type="submit" value="Restart upgrade script" />'; echo '</form>'; echo '<br /><br /></div></body></html>'; exit; } } /********************************************************** * upgrade modules if newer version is available */ echo '<h2>Step ' . ++$stepID . ' : Checking all addons with a newer version (upgrade)</h2>'; $aModuleList = glob(WB_PATH . '/modules/*', GLOB_ONLYDIR); $upgradeID = 0; foreach ($aModuleList as $sModul) { if (in_array(basename($sModul), $aModuleWhiteList) && file_exists($sModul . '/upgrade.php')) { $currModulVersion = get_modul_version(basename($sModul), false); $newModulVersion = get_modul_version(basename($sModul), true); // echo '<h4>Step '.(++$upgradeID).' : Upgrade module \''.$sModul.'\' to version '.$newModulVersion.'</h4>'; if (version_compare($currModulVersion, $newModulVersion, '<=')) { echo '<h5> ' . sprintf("[%2s]", ++$upgradeID) . ' : Upgrade module \'' . basename($sModul) . '\' from version ' . $currModulVersion . ' to version' . $newModulVersion . '</h5>'; require_once $sModul . '/upgrade.php'; } } } /********************************************************** * - Reload all addons */ echo '<h2>Step ' . ++$stepID . ' : Reload all addons database entry (no upgrade)</h2>'; ////delete modules $sql = 'DELETE FROM `' . TABLE_PREFIX . 'addons` ' . 'WHERE `type` = \'module\''; $database->query($sql); // Load all modules