| [ Index ] |
PHP Cross Reference of Zikula Core 1.3.2 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Copyright Zikula Foundation 2009 - Zikula Application Framework 4 * 5 * This work is contributed to the Zikula Foundation under one or more 6 * Contributor Agreements and licensed to You under the following license: 7 * 8 * @license GNU/LGPLv3 (or at your option, any later version). 9 * @package Installer 10 * 11 * Please see the NOTICE file distributed with this source code for further 12 * information regarding copyright and licensing. 13 */ 14 15 ini_set('mbstring.internal_encoding', 'UTF-8'); 16 ini_set('default_charset', 'UTF-8'); 17 mb_regex_encoding('UTF-8'); 18 ini_set('memory_limit', '64M'); 19 ini_set('max_execution_time', 86400); 20 21 include 'lib/bootstrap.php'; 22 ZLoader::addAutoloader('Users', 'system/Users/lib', '_'); 23 24 $eventManager = $core->getEventManager(); 25 $eventManager->attach('core.init', 'upgrade_suppressErrors'); 26 27 // load zikula core 28 define('_ZINSTALLVER', Zikula_Core::VERSION_NUM); 29 define('_Z_MINUPGVER', '1.2.0'); 30 31 // Signal that upgrade is running. 32 $GLOBALS['_ZikulaUpgrader'] = array(); 33 34 // include config file for retrieving name of temporary directory 35 $GLOBALS['ZConfig']['System']['multilingual'] = true; 36 37 $GLOBALS['ZConfig']['System']['Z_CONFIG_USE_OBJECT_ATTRIBUTION'] = false; 38 $GLOBALS['ZConfig']['System']['Z_CONFIG_USE_OBJECT_LOGGING'] = false; 39 $GLOBALS['ZConfig']['System']['Z_CONFIG_USE_OBJECT_META'] = false; 40 41 // Lazy load DB connection to avoid testing DSNs that are not yet valid (e.g. no DB created yet) 42 $dbEvent = new Zikula_Event('doctrine.init_connection', null, array('lazy' => true)); 43 $connection = $eventManager->notify($dbEvent)->getData(); 44 45 $columns = upgrade_getColumnsForTable($connection, 'modules'); 46 47 if (in_array('pn_id', array_keys($columns))) { 48 upgrade_columns($connection); 49 } 50 51 if (!isset($columns['capabilities'])) { 52 Doctrine_Core::createTablesFromArray(array('Zikula_Doctrine_Model_HookArea', 'Zikula_Doctrine_Model_HookProvider', 'Zikula_Doctrine_Model_HookSubscriber', 'Zikula_Doctrine_Model_HookBinding', 'Zikula_Doctrine_Model_HookRuntime')); 53 ModUtil::dbInfoLoad('Extensions', 'Extensions'); 54 DBUtil::changeTable('modules'); 55 ModUtil::dbInfoLoad('Blocks', 'Blocks'); 56 DBUtil::changeTable('blocks'); 57 } 58 59 $installedVersion = upgrade_getCurrentInstalledCoreVersion($connection); 60 61 if (version_compare($installedVersion, '1.3.0-dev') === -1) { 62 $GLOBALS['_ZikulaUpgrader']['_ZikulaUpgradeFrom12x'] = true; 63 } 64 65 $core->init(Zikula_Core::STAGE_ALL); 66 67 $action = FormUtil::getPassedValue('action', false, 'GETPOST'); 68 69 // login to supplied admin credentials for action the following actions 70 if ($action === 'upgrademodules' || $action === 'convertdb' || $action === 'sanitycheck') { 71 $username = FormUtil::getPassedValue('username', null, 'POST'); 72 $password = FormUtil::getPassedValue('password', null, 'POST'); 73 74 $authenticationInfo = array( 75 'login_id' => $username, 76 'pass' => $password 77 ); 78 $authenticationMethod = array( 79 'modname' => 'Users', 80 'method' => 'uname', 81 ); 82 if (!UserUtil::loginUsing($authenticationMethod, $authenticationInfo)) { 83 // force action to login 84 $action = 'login'; 85 } else { 86 define('_ZINSTALLEDVERSION', $installedVersion); 87 } 88 } 89 90 switch ($action) { 91 case 'upgradeinit': 92 _upg_upgradeinit(); 93 break; 94 case 'login': 95 _upg_login(true); 96 break; 97 case 'sanitycheck': 98 _upg_sanity_check($username, $password); 99 break; 100 case 'upgrademodules': 101 _upg_upgrademodules($username, $password); 102 break; 103 default: 104 _upg_selectlanguage(); 105 break; 106 } 107 108 /** 109 * Generate the header of upgrade page. 110 * 111 * This function generate the header of upgrade page. 112 * 113 * @return void 114 */ 115 function _upg_header() 116 { 117 $lang = ZLanguage::getLanguageCode(); 118 $charset = ZLanguage::getEncoding(); 119 echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">' . "\n"; 120 echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $lang . '">' . "\n"; 121 echo '<head>' . "\n"; 122 echo '<meta http-equiv="Content-Type" content="text/html; charset=' . $charset . '" />' . "\n"; 123 echo '<title>' . __('Zikula Upgrade script') . "</title>\n"; 124 echo '<link rel="stylesheet" href="install/style/installer.css" type="text/css" />' . "\n"; 125 echo '<link rel="stylesheet" href="style/core.css" type="text/css" />' . "\n"; 126 echo '<!--[if IE]><link rel="stylesheet" type="text/css" href="style/core_iehacks.css" media="print,projection,screen" /><![endif]-->' . "\n"; 127 echo '<script src="javascript/ajax/proto_scriptaculous.combined.min.js" type="text/javascript"></script>' . "\n"; 128 echo '<script src="install/javascript/install.js" type="text/javascript"></script>' . "\n"; 129 echo '</head>' . "\n"; 130 echo '<body>' . "\n"; 131 echo '<div id="container"><div id="content">' . "\n"; 132 echo '<div id="header">' . "\n"; 133 echo '<h1>' . __('Zikula Application Framework') . '</h1>' . "\n"; 134 echo '<h2>' . __('Upgrade script') . '</h2></div>' . "\n"; 135 echo '<div id="maincontent">'; 136 if (UserUtil::isLoggedIn()) { 137 echo '<h3>' . __f('Zikula Upgrade script (for Zikula version %s and up)', array(_Z_MINUPGVER)) . '</h3>' . "\n"; 138 echo '<p>' . __f('This script will upgrade any Zikula v%1$s+ installation. Upgrades from less than Zikula v%1$s are not supported by this script.', array(_Z_MINUPGVER)) . "</p>\n"; 139 } 140 } 141 142 /** 143 * Generate the footer of upgrade page. 144 * 145 * This function generate the footer of upgrade page. 146 * 147 * @return void 148 */ 149 function _upg_footer() 150 { 151 $lang = ZLanguage::getLanguageCode(); 152 echo '</div></div>' . "\n"; 153 echo '<div id="footer">' . "\n"; 154 echo '<p id="notice">' . __f('For more information about the upgrade process, please read the <a href="docs/%1$s/UPGRADING">upgrade documentation</a>, visit our <a href="http://community.zikula.org/Wiki.htm">wiki</a> or the <a href="http://community.zikula.org/module-Forum.htm">support forum</a>.', $lang) . '</p>'; 155 echo '</div>' . "\n"; 156 echo '</div></body>' . "\n"; 157 echo '</html>'; 158 exit(); 159 } 160 161 /** 162 * Generate the language selector page. 163 * 164 * This function generate the language selector page. 165 * 166 * @return void 167 */ 168 function _upg_selectlanguage() 169 { 170 _upg_header(); 171 $validupgrade = true; 172 if (!$GLOBALS['ZConfig']['System']['installed']) { 173 $validupgrade = false; 174 echo '<h2>' . __('FATAL ERROR!') . "</h2>\n"; 175 echo '<p class="z-errormsg">' . __("Zikula does not appear to be installed.") . "</p>\n"; 176 } 177 178 if (!$validupgrade) { 179 _upg_footer(); 180 System::shutdown(); 181 } 182 183 $curlang = ZLanguage::getLanguageCode(); 184 echo '<form class="z-form" action="upgrade.php" method="get" enctype="application/x-www-form-urlencoded">' . "\n"; 185 echo '<fieldset><legend>' . __('Please select your language') . '</legend>' . "\n"; 186 echo '<input type="hidden" name="action" value="upgradeinit" />' . "\n"; 187 echo '<div class="z-formrow"><label for="lang">' . __('Choose a language') . '</label>' . "\n"; 188 echo '<select id="lang" name="lang">' . "\n"; 189 $langs = ZLanguage::getInstalledLanguageNames(); 190 foreach ($langs as $lang => $name) { 191 $selected = ($lang == $curlang ? ' selected="selected"' : ''); 192 echo '<option value="' . $lang . '" label="' . $name . '"' . $selected . '>' . $name . "</option>\n"; 193 } 194 echo '</select></div></fieldset>' . "\n"; 195 echo '<div class="z-buttons z-center"><input type="submit" value="' . __('Submit') . '" /></div>' . "\n"; 196 echo '</form>' . "\n"; 197 _upg_footer(); 198 } 199 200 /** 201 * Upgrade initial. 202 * 203 * Display initial upgrade page. 204 * 205 * @return void 206 */ 207 function _upg_upgradeinit() 208 { 209 _upg_header(); 210 211 echo '<h2>' . __('BEFORE proceeding you should backup your database!') . '</h2>' . "\n"; 212 _upg_login(false); 213 214 _upg_footer(); 215 } 216 217 /** 218 * Generate the login bloc of login page. 219 * 220 * This function generate the authentification part of login page. 221 * 222 * @param boolean $showheader Show header and footer. 223 * 224 * @return void 225 */ 226 function _upg_login($showheader = true) 227 { 228 $lang = ZLanguage::getLanguageCode(); 229 if ($showheader == true) { 230 _upg_header(); 231 echo '<p class="z-errormsg">' . __('Failed to login to your site') . '</p>' . "\n"; 232 } 233 echo '<p>' . __('For the next upgrade steps you need to be logged in. Please provide your admin account credentials') . '</p>' . "\n"; 234 echo '<form class="z-form" action="upgrade.php?lang=' . $lang . '" method="post" enctype="application/x-www-form-urlencoded">' . "\n"; 235 echo '<fieldset><legend>' . __('Log-in') . '</legend>' . "\n"; 236 echo '<div class="z-formrow"><label for="username">' . __('User name') . '</label><input id="username" type="text" name="username" size="60" maxlength="25" /></div>' . "\n"; 237 echo '<div class="z-formrow"><label for="password">' . __('Password') . '</label><input id="password" type="password" name="password" size="25" maxlength="40" /></div>' . "\n"; 238 echo '<input type="hidden" name="action" value="sanitycheck" />' . "\n"; 239 240 if ($lang != null) { 241 echo '<input type="hidden" name="lang" value="' . htmlspecialchars($lang) . '" />' . "\n"; 242 } 243 echo '</fieldset>' . "\n"; 244 echo '<div class="z-buttons z-center"><input name="submit" type="submit" value="' . __('Submit') . '" /></div>' . "\n"; 245 echo '</form>' . "\n"; 246 if ($showheader == true) { 247 _upg_footer(); 248 } 249 } 250 251 /** 252 * Generate the upgrade module page. 253 * 254 * This function upgrade available module to an upgrade 255 * 256 * @param string $username Username of the admin user. 257 * @param string $password Password of the admin user. 258 * 259 * @return void 260 */ 261 function _upg_upgrademodules($username, $password) 262 { 263 _upg_header(); 264 265 $modvars = DBUtil::selectObjectArray('module_vars'); 266 foreach ($modvars as $modvar) { 267 if ($modvar['value'] == '0' || $modvar['value'] == '1') { 268 $modvar['value'] = serialize($modvar['value']); 269 DBUtil::updateObject($modvar, 'module_vars'); 270 } 271 } 272 273 // force load the modules admin API 274 ModUtil::loadApi('Extensions', 'admin', true); 275 276 echo '<h2>' . __('Starting upgrade') . '</h2>' . "\n"; 277 echo '<ul id="upgradelist" class="check">' . "\n"; 278 279 // reset for User module 280 //$GLOBALS['_ZikulaUpgrader']['_ZikulaUpgradeFrom12x'] = false; 281 282 $results = ModUtil::apiFunc('Extensions', 'admin', 'upgradeall'); 283 if ($results) { 284 foreach ($results as $modname => $result) { 285 if ($result) { 286 echo '<li class="passed">' . DataUtil::formatForDisplay($modname) . ' ' . __('upgraded') . '</li>' . "\n"; 287 } else { 288 echo '<li class="failed">' . DataUtil::formatForDisplay($modname) . ' ' . __('not upgraded') . '</li>' . "\n"; 289 } 290 } 291 } 292 echo '</ul>' . "\n"; 293 if (!$results) { 294 echo '<ul class="check"><li class="passed">' . __('No modules required upgrading') . '</li></ul>'; 295 } 296 297 // wipe out the deprecated modules from Modules list. 298 $modTable = 'modules'; 299 $sql = "DELETE FROM $modTable WHERE name = 'Header_Footer' OR name = 'AuthPN' OR name = 'pnForm' OR name = 'Workflow' OR name = 'pnRender' OR name = 'Admin_Messages'"; 300 DBUtil::executeSQL($sql); 301 302 // store localized displayname and description for Extensions module 303 $extensionsDisplayname = __('Extensions'); 304 $extensionsDescription = __('Manage your modules and plugins.'); 305 $sql = "UPDATE modules SET name = 'Extensions', displayname = '{$extensionsDisplayname}', description = '{$extensionsDescription}' WHERE modules.name = 'Extensions'"; 306 DBUtil::executeSQL($sql); 307 308 // regenerate the themes list 309 ModUtil::apiFunc('Theme', 'admin', 'regenerate'); 310 311 // store the recent version in a config var for later usage. This enables us to determine the version we are upgrading from 312 System::setVar('Version_Num', Zikula_Core::VERSION_NUM); 313 System::setVar('language_i18n', ZLanguage::getLanguageCode()); 314 315 // Relogin the admin user to give a proper admin link 316 SessionUtil::requireSession(); 317 318 echo '<p class="z-statusmsg">' . __('Finished upgrade') . " - \n"; 319 320 $authenticationInfo = array( 321 'login_id' => $username, 322 'pass' => $password 323 ); 324 $authenticationMethod = array( 325 'modname' => 'Users', 326 'method' => 'uname', 327 ); 328 329 if (!UserUtil::loginUsing($authenticationMethod, $authenticationInfo)) { 330 $url = sprintf('<a href="%s">%s</a>', DataUtil::formatForDisplay(System::getBaseUrl()), DataUtil::formatForDisplay(System::getVar('sitename'))); 331 echo __f('Go to the startpage for %s', $url); 332 } else { 333 upgrade_clear_caches(); 334 $url = sprintf('<a href="%s">%s</a>', ModUtil::url('Admin', 'admin', 'adminpanel'), DataUtil::formatForDisplay(System::getVar('sitename'))); 335 echo __f('Go to the admin panel for %s', $url); 336 } 337 echo "</p>\n"; 338 339 _upg_footer(); 340 } 341 342 /** 343 * Generate the button for the next step of the upgrade. 344 * 345 * This function generate the button to allow users to go to the next step of the upgrade. 346 * 347 * @param string $action Name of the next function called (without upgrade_upg_). 348 * @param string $text Text printed. 349 * @param string $username Username of the admin user. 350 * @param string $password Password of the admin user. 351 * 352 * @return void 353 */ 354 function _upg_continue($action, $text, $username, $password) 355 { 356 $lang = ZLanguage::getLanguageCode(); 357 echo '<form class="z-form z-linear" method="post" action="upgrade.php?lang=' . $lang . "\">\n"; 358 echo '<div><fieldset><legend>' . DataUtil::formatForDisplay($text) . '</legend>' . "\n"; 359 if ($username != null && $password != null) { 360 echo '<input type="hidden" name="username" value="' . DataUtil::formatForDisplay($username) . '" />' . "\n"; 361 echo '<input type="hidden" name="password" value="' . DataUtil::formatForDisplay($password) . '" />' . "\n"; 362 } 363 echo '<input type="hidden" name="action" value="' . htmlspecialchars($action) . '" />' . "\n"; 364 echo '<div class="z-buttons z-center"><input type="submit" name="submit" value="' . htmlspecialchars($text) . '" /></div>' . "\n"; 365 echo '</fieldset></div>' . "\n"; 366 echo '</form>' . "\n"; 367 return; 368 } 369 370 /** 371 * Generate the sanity check page. 372 * 373 * This function do and generate the stanity check page. 374 * 375 * @param string $username Username of the admin user. 376 * @param string $password Password of the admin user. 377 * 378 * @return void 379 */ 380 function _upg_sanity_check($username, $password) 381 { 382 _upg_header(); 383 384 $validupgrade = true; 385 if (version_compare(_ZINSTALLEDVERSION, _ZINSTALLVER, '=')) { 386 // Already installed the correct version 387 $validupgrade = false; 388 echo '<h2>' . __('Already up to date') . "</h2>\n"; 389 echo '<p class="z-errormsg">' . __f("It seems that you have already installed version %s. Please remove this upgrade script, you do not need it anymore.", _ZINSTALLEDVERSION) . "</p>\n"; 390 } elseif (version_compare(_ZINSTALLEDVERSION, _Z_MINUPGVER, '<')) { 391 // Not on version _Z_MINUPGVER yet 392 $validupgrade = false; 393 echo '<h2>' . __('Possible incompatible version found.') . "</h2>\n"; 394 echo '<p class="z-warningmsg">' . __f('The current installed version of Zikula is reporting (%1$s). You must upgrade to version (%2$s) before you can use this upgrade.', array(_ZINSTALLEDVERSION, _Z_MINUPGVER)) . "</p>\n"; 395 } elseif (version_compare(PHP_VERSION, '5.3.0', '>=')) { 396 if (ini_get('date.timezone') == '') { 397 echo '<p class="z-errormsg"><strong>' . __('date.timezone is currently not set. Since PHP 5.3.0, it needs to be set to a valid timezone in your php.ini such as timezone like UTC, GMT+5, Europe/Berlin.') . "</strong></p>\n"; 398 echo _upg_continue('sanitycheck', __('Check again'), $username, $password); 399 $validupgrade = false; 400 } 401 } 402 403 if ($validupgrade) { 404 $pcreUnicodePropertiesEnabled = @preg_match('/^\p{L}+$/u', 'TheseAreLetters'); 405 if (!isset($pcreUnicodePropertiesEnabled) || !$pcreUnicodePropertiesEnabled) { 406 // PCRE Unicode property support is not enabled. 407 $validupgrade = false; 408 echo '<h2>' . __('PCRE Unicode Property Support Needed.') . "</h2>\n"; 409 echo '<p class="z-errormsg">' . __('The PCRE (Perl Compatible Regular Expression) library being used with your PHP installation does not support Unicode properties. This is required to handle multi-byte character sets in regular expressions. The PCRE library used must be compiled with the \'--enable-unicode-properties\' option.') . "</p>\n"; 410 } 411 } 412 413 if ($validupgrade) { 414 $defaultTheme = System::getVar('Default_Theme'); 415 if ($defaultTheme == 'andreas08') { 416 System::setVar('Default_Theme', 'Andreas08'); 417 $defaultTheme = System::getVar('Default_Theme'); 418 } 419 $dir = is_dir("themes/$defaultTheme"); 420 $casing = preg_match('/\p{Lu}/u', substr($defaultTheme, 0, 1)); // first letter is uppercase. 421 $underscore = preg_match('/_/', $defaultTheme); // has underscore 422 if (!$dir || !$casing || $underscore) { 423 // The default theme must be installed! 424 $validupgrade = false; 425 echo '<h2>' . __f("Theme Check Failed", $defaultTheme) . "</h2>\n"; 426 if (!$dir) { 427 echo '<p class="z-errormsg">' . __f("Your configuration specifies a theme called '%s' that doesn't exist. Please ensure that theme exists in themes/%s", array($defaultTheme, $defaultTheme)) . "</p>\n"; 428 } 429 if (!$casing) { 430 echo '<p class="z-errormsg">' . __f("Your configuration specifies a theme called '%s' which begins with a lower case letter. You must first upgrade the theme's name to start with a capital letter. This should be done in your 1.2.x installation before attempting this upgrade again.", array($defaultTheme, $defaultTheme)) . "</p>\n"; 431 } 432 if ($underscore) { 433 echo '<p class="z-errormsg">' . __f("Your theme called '%s' contains an underscore, this is now deprecated. You must first upgrade the theme's name so it does not contain any underscore character. This should be done in your 1.2.x installation before attempting this upgrade again.", array($defaultTheme, $defaultTheme)) . "</p>\n"; 434 } 435 } 436 437 } 438 439 if (!$validupgrade) { 440 _upg_footer(); 441 System::shutdown(); 442 } 443 444 _upg_continue('upgrademodules', __('Proceed to upgrade (click once and wait)'), $username, $password); 445 _upg_footer(); 446 } 447 448 /** 449 * Clear the Zikula cache. 450 * 451 * This function clear the zikula cache. 452 * 453 * @return void 454 */ 455 function upgrade_clear_caches() 456 { 457 Zikula_View_Theme::getInstance()->clear_all_cache(); 458 Zikula_View_Theme::getInstance()->clear_compiled(); 459 Zikula_View_Theme::getInstance()->clear_cssjscombinecache(); 460 Zikula_View::getInstance()->clear_all_cache(); 461 Zikula_View::getInstance()->clear_compiled(); 462 } 463 464 /** 465 * Suppress errors event listener. 466 * 467 * @param Zikula_Event $event Event. 468 * 469 * @return void 470 */ 471 function upgrade_suppressErrors(Zikula_Event $event) 472 { 473 if (!$event['stage'] == Zikula_Core::STAGE_CONFIG) { 474 return; 475 } 476 477 error_reporting(~E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT); 478 $GLOBALS['ZConfig']['System']['development'] = 0; 479 } 480 481 /** 482 * Get current intalled version number 483 * 484 * @param object $connection PDO connection. 485 * 486 * @return string 487 */ 488 function upgrade_getCurrentInstalledCoreVersion($connection) 489 { 490 $moduleTable = 'module_vars'; 491 492 $stmt = $connection->prepare("SELECT value FROM $moduleTable WHERE modname = 'ZConfig' AND name = 'Version_Num'"); 493 if (!$stmt->execute()) { 494 die(__('FATAL ERROR: Cannot start, unable to determine installed Core version.')); 495 } 496 497 $result = $stmt->fetch(PDO::FETCH_NUM); 498 return unserialize($result[0]); 499 } 500 501 /** 502 * Get tables in database from current connection. 503 * 504 * @param object $connection PDO connection. 505 * 506 * @return array 507 */ 508 function upgrade_getTables($connection) 509 { 510 $tables = $connection->import->listTables(); 511 if (!$tables) { 512 die(__('FATAL ERROR: Cannot start, unable to determine installed Core version.')); 513 } 514 515 $prefixLen = strlen($GLOBALS['ZConfig']['System']['prefix'] . '_'); 516 foreach ($tables as $key => $value) { 517 $tables[$key] = substr($value, $prefixLen, strlen($value)); 518 } 519 return $tables; 520 } 521 522 /** 523 * Get tables in database from current connection. 524 * 525 * @param object $connection PDO connection. 526 * @param string $tableName The name of the table. 527 * 528 * @return array 529 */ 530 function upgrade_getColumnsForTable($connection, $tableName) 531 { 532 $tables = $connection->import->listTables(); 533 if (!$tables) { 534 die(__('FATAL ERROR: Cannot start, unable access database.')); 535 } 536 537 try { 538 return $connection->import->listTableColumns(($GLOBALS['ZConfig']['System']['prefix'] ? $GLOBALS['ZConfig']['System']['prefix'].'_' : '').$tableName); 539 } catch (Exception $e) { 540 // TODO - do something with the exception here? 541 } 542 } 543 544 /** 545 * Standardise table columns. 546 * 547 * @param PDOConnection $connection The PDO connection instance. 548 * 549 * @return void 550 */ 551 function upgrade_columns($connection) 552 { 553 $prefix = $GLOBALS['ZConfig']['System']['prefix']; 554 $commands = array(); 555 $commands[] = "ALTER TABLE {$prefix}_admin_category CHANGE pn_cid cid INT(11) NOT NULL AUTO_INCREMENT"; 556 $commands[] = "ALTER TABLE {$prefix}_admin_category CHANGE pn_name name VARCHAR(32) NOT NULL"; 557 $commands[] = "ALTER TABLE {$prefix}_admin_category CHANGE pn_description description VARCHAR(254) NOT NULL"; 558 $commands[] = "RENAME TABLE {$prefix}_admin_category TO admin_category"; 559 560 561 $commands[] = "ALTER TABLE {$prefix}_admin_module CHANGE pn_amid amid INT(11) NOT NULL AUTO_INCREMENT"; 562 $commands[] = "ALTER TABLE {$prefix}_admin_module CHANGE pn_mid mid INT(11) DEFAULT '0' NOT NULL"; 563 $commands[] = "ALTER TABLE {$prefix}_admin_module CHANGE pn_cid cid INT(11) DEFAULT '0' NOT NULL"; 564 $commands[] = "RENAME TABLE {$prefix}_admin_module TO admin_module"; 565 566 $commands[] = "ALTER TABLE {$prefix}_blocks CHANGE pn_bid bid INT(11) AUTO_INCREMENT"; 567 $commands[] = "ALTER TABLE {$prefix}_blocks CHANGE pn_bkey bkey VARCHAR(255) NOT NULL"; 568 $commands[] = "ALTER TABLE {$prefix}_blocks CHANGE pn_title title VARCHAR(255) NOT NULL"; 569 $commands[] = "ALTER TABLE {$prefix}_blocks CHANGE pn_content content LONGTEXT NOT NULL"; 570 $commands[] = "ALTER TABLE {$prefix}_blocks CHANGE pn_url url LONGTEXT NOT NULL"; 571 $commands[] = "ALTER TABLE {$prefix}_blocks CHANGE pn_mid mid INT(11) DEFAULT '0' NOT NULL"; 572 $commands[] = "ALTER TABLE {$prefix}_blocks CHANGE pn_filter filter LONGTEXT NOT NULL"; 573 $commands[] = "ALTER TABLE {$prefix}_blocks CHANGE pn_active active TINYINT DEFAULT '1' NOT NULL"; 574 $commands[] = "ALTER TABLE {$prefix}_blocks CHANGE pn_collapsable collapsable INT(11) DEFAULT '1' NOT NULL"; 575 $commands[] = "ALTER TABLE {$prefix}_blocks CHANGE pn_defaultstate defaultstate INT(11) DEFAULT '1' NOT NULL"; 576 $commands[] = "ALTER TABLE {$prefix}_blocks CHANGE pn_refresh refresh INT(11) DEFAULT '0' NOT NULL"; 577 $commands[] = "ALTER TABLE {$prefix}_blocks CHANGE pn_last_update last_update DATETIME NOT NULL"; 578 $commands[] = "ALTER TABLE {$prefix}_blocks CHANGE pn_language language VARCHAR(30) NOT NULL"; 579 $commands[] = "RENAME TABLE {$prefix}_blocks TO blocks"; 580 581 $commands[] = "ALTER TABLE {$prefix}_userblocks CHANGE pn_uid uid INT(11) DEFAULT '0' NOT NULL"; 582 $commands[] = "ALTER TABLE {$prefix}_userblocks CHANGE pn_bid bid INT(11) DEFAULT '0' NOT NULL"; 583 $commands[] = "ALTER TABLE {$prefix}_userblocks CHANGE pn_active active TINYINT DEFAULT '1' NOT NULL"; 584 $commands[] = "ALTER TABLE {$prefix}_userblocks CHANGE pn_last_update last_update DATETIME"; 585 $commands[] = "RENAME TABLE {$prefix}_userblocks TO userblocks"; 586 587 $commands[] = "ALTER TABLE {$prefix}_block_positions CHANGE pn_pid pid INT(11) AUTO_INCREMENT"; 588 $commands[] = "ALTER TABLE {$prefix}_block_positions CHANGE pn_name name VARCHAR(255) NOT NULL"; 589 $commands[] = "ALTER TABLE {$prefix}_block_positions CHANGE pn_description description VARCHAR(255) NOT NULL"; 590 $commands[] = "RENAME TABLE {$prefix}_block_positions TO block_positions"; 591 592 $commands[] = "ALTER TABLE {$prefix}_block_placements CHANGE pn_pid pid INT(11) DEFAULT '0' NOT NULL"; 593 $commands[] = "ALTER TABLE {$prefix}_block_placements CHANGE pn_bid bid INT(11) DEFAULT '0' NOT NULL"; 594 $commands[] = "ALTER TABLE {$prefix}_block_placements CHANGE pn_order sortorder INT(11) DEFAULT '0' NOT NULL"; 595 $commands[] = "RENAME TABLE {$prefix}_block_placements TO block_placements"; 596 597 $commands[] = "ALTER TABLE {$prefix}_group_membership CHANGE pn_gid gid INT(11) DEFAULT '0' NOT NULL"; 598 $commands[] = "ALTER TABLE {$prefix}_group_membership CHANGE pn_uid uid INT(11) DEFAULT '0' NOT NULL"; 599 $commands[] = "RENAME TABLE {$prefix}_group_membership TO group_membership"; 600 601 $commands[] = "ALTER TABLE {$prefix}_groups CHANGE pn_gid gid INT(11) AUTO_INCREMENT"; 602 $commands[] = "ALTER TABLE {$prefix}_groups CHANGE pn_name name VARCHAR(255) NOT NULL"; 603 $commands[] = "ALTER TABLE {$prefix}_groups CHANGE pn_gtype gtype TINYINT DEFAULT '0' NOT NULL"; 604 $commands[] = "ALTER TABLE {$prefix}_groups CHANGE pn_description description VARCHAR(200) NOT NULL"; 605 $commands[] = "ALTER TABLE {$prefix}_groups CHANGE pn_prefix prefix VARCHAR(25) NOT NULL"; 606 $commands[] = "ALTER TABLE {$prefix}_groups CHANGE pn_state state TINYINT DEFAULT '0' NOT NULL"; 607 $commands[] = "ALTER TABLE {$prefix}_groups CHANGE pn_nbuser nbuser INT(11) DEFAULT '0' NOT NULL"; 608 $commands[] = "ALTER TABLE {$prefix}_groups CHANGE pn_nbumax nbumax INT(11) DEFAULT '0' NOT NULL"; 609 $commands[] = "ALTER TABLE {$prefix}_groups CHANGE pn_link link INT(11) DEFAULT '0' NOT NULL"; 610 $commands[] = "ALTER TABLE {$prefix}_groups CHANGE pn_uidmaster uidmaster INT(11) DEFAULT '0' NOT NULL"; 611 $commands[] = "RENAME TABLE {$prefix}_groups TO groups"; 612 613 $commands[] = "ALTER TABLE {$prefix}_group_applications CHANGE pn_app_id app_id INT(11) NOT NULL AUTO_INCREMENT"; 614 $commands[] = "ALTER TABLE {$prefix}_group_applications CHANGE pn_uid uid INT(11) DEFAULT '0' NOT NULL"; 615 $commands[] = "ALTER TABLE {$prefix}_group_applications CHANGE pn_gid gid INT(11) DEFAULT '0' NOT NULL"; 616 $commands[] = "ALTER TABLE {$prefix}_group_applications CHANGE pn_application application LONGBLOB NOT NULL"; 617 $commands[] = "ALTER TABLE {$prefix}_group_applications CHANGE pn_status status TINYINT DEFAULT '0' NOT NULL"; 618 $commands[] = "RENAME TABLE {$prefix}_group_applications TO group_applications"; 619 620 $commands[] = "ALTER TABLE {$prefix}_hooks CHANGE pn_id id BIGINT AUTO_INCREMENT"; 621 $commands[] = "ALTER TABLE {$prefix}_hooks CHANGE pn_object object VARCHAR(64) NOT NULL"; 622 $commands[] = "ALTER TABLE {$prefix}_hooks CHANGE pn_action action VARCHAR(64) NOT NULL"; 623 $commands[] = "ALTER TABLE {$prefix}_hooks CHANGE pn_smodule smodule VARCHAR(64) NOT NULL"; 624 $commands[] = "ALTER TABLE {$prefix}_hooks CHANGE pn_stype stype VARCHAR(64) NOT NULL"; 625 $commands[] = "ALTER TABLE {$prefix}_hooks CHANGE pn_tarea tarea VARCHAR(64) NOT NULL"; 626 $commands[] = "ALTER TABLE {$prefix}_hooks CHANGE pn_tmodule tmodule VARCHAR(64) NOT NULL"; 627 $commands[] = "ALTER TABLE {$prefix}_hooks CHANGE pn_ttype ttype VARCHAR(64) NOT NULL"; 628 $commands[] = "ALTER TABLE {$prefix}_hooks CHANGE pn_tfunc tfunc VARCHAR(64) NOT NULL"; 629 $commands[] = "ALTER TABLE {$prefix}_hooks CHANGE pn_sequence sequence INT(11) DEFAULT '0' NOT NULL"; 630 $commands[] = "RENAME TABLE {$prefix}_hooks TO hooks"; 631 632 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_id id INT(11) AUTO_INCREMENT"; 633 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_name name VARCHAR(64) NOT NULL"; 634 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_type type TINYINT DEFAULT '0' NOT NULL"; 635 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_displayname displayname VARCHAR(64) NOT NULL"; 636 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_url url VARCHAR(64) NOT NULL"; 637 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_description description VARCHAR(255) NOT NULL"; 638 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_regid regid INT(11) DEFAULT '0' NOT NULL"; 639 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_directory directory VARCHAR(64) NOT NULL"; 640 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_version version VARCHAR(10) DEFAULT '0' NOT NULL"; 641 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_official official TINYINT DEFAULT '0' NOT NULL"; 642 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_author author VARCHAR(255) NOT NULL"; 643 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_contact contact VARCHAR(255) NOT NULL"; 644 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_admin_capable admin_capable TINYINT DEFAULT '0' NOT NULL"; 645 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_user_capable user_capable TINYINT DEFAULT '0' NOT NULL"; 646 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_profile_capable profile_capable TINYINT DEFAULT '0' NOT NULL"; 647 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_message_capable message_capable TINYINT DEFAULT '0' NOT NULL"; 648 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_state state SMALLINT(6) DEFAULT '0' NOT NULL"; 649 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_credits credits VARCHAR(255) NOT NULL"; 650 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_changelog changelog VARCHAR(255) NOT NULL"; 651 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_help help VARCHAR(255) NOT NULL"; 652 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_license license VARCHAR(255) NOT NULL"; 653 $commands[] = "ALTER TABLE {$prefix}_modules CHANGE pn_securityschema securityschema TEXT NOT NULL"; 654 $commands[] = "UPDATE {$prefix}_modules SET name = 'Extensions', displayname = 'Extensions', url = 'extensions', description = 'Manage your modules and plugins.', directory = 'Extensions', securityschema = 'a:1:{s:9:\"Extensions::\";s:2:\"::\";}' WHERE {$prefix}_modules.name = 'Modules'"; 655 $commands[] = "RENAME TABLE {$prefix}_modules TO modules"; 656 657 $commands[] = "ALTER TABLE {$prefix}_module_vars CHANGE pn_id id INT(11) AUTO_INCREMENT"; 658 $commands[] = "ALTER TABLE {$prefix}_module_vars CHANGE pn_modname modname VARCHAR(64) NOT NULL"; 659 $commands[] = "ALTER TABLE {$prefix}_module_vars CHANGE pn_name name VARCHAR(64) NOT NULL"; 660 $commands[] = "ALTER TABLE {$prefix}_module_vars CHANGE pn_value value LONGTEXT"; 661 $commands[] = "UPDATE {$prefix}_module_vars SET modname='Extensions' WHERE modname='Modules'"; 662 $commands[] = "RENAME TABLE {$prefix}_module_vars TO module_vars"; 663 664 $commands[] = "ALTER TABLE {$prefix}_module_deps CHANGE pn_id id INT(11) AUTO_INCREMENT"; 665 $commands[] = "ALTER TABLE {$prefix}_module_deps CHANGE pn_modid modid INT(11) DEFAULT '0' NOT NULL"; 666 $commands[] = "ALTER TABLE {$prefix}_module_deps CHANGE pn_modname modname VARCHAR(64) NOT NULL"; 667 $commands[] = "ALTER TABLE {$prefix}_module_deps CHANGE pn_minversion minversion VARCHAR(10) NOT NULL"; 668 $commands[] = "ALTER TABLE {$prefix}_module_deps CHANGE pn_maxversion maxversion VARCHAR(10) NOT NULL"; 669 $commands[] = "ALTER TABLE {$prefix}_module_deps CHANGE pn_status status TINYINT DEFAULT '0' NOT NULL"; 670 $commands[] = "RENAME TABLE {$prefix}_module_deps TO module_deps"; 671 672 $commands[] = "ALTER TABLE {$prefix}_group_perms CHANGE pn_pid pid INT(11) AUTO_INCREMENT"; 673 $commands[] = "ALTER TABLE {$prefix}_group_perms CHANGE pn_gid gid INT(11) DEFAULT '0' NOT NULL"; 674 $commands[] = "ALTER TABLE {$prefix}_group_perms CHANGE pn_sequence sequence INT(11) DEFAULT '0' NOT NULL"; 675 $commands[] = "ALTER TABLE {$prefix}_group_perms CHANGE pn_realm realm INT(11) DEFAULT '0' NOT NULL"; 676 $commands[] = "ALTER TABLE {$prefix}_group_perms CHANGE pn_component component VARCHAR(255) NOT NULL"; 677 $commands[] = "ALTER TABLE {$prefix}_group_perms CHANGE pn_instance instance VARCHAR(255) NOT NULL"; 678 $commands[] = "ALTER TABLE {$prefix}_group_perms CHANGE pn_level level INT(11) DEFAULT '0' NOT NULL"; 679 $commands[] = "ALTER TABLE {$prefix}_group_perms CHANGE pn_bond bond INT(11) DEFAULT '0' NOT NULL"; 680 $commands[] = "RENAME TABLE {$prefix}_group_perms TO group_perms"; 681 682 $commands[] = "ALTER TABLE {$prefix}_search_stat CHANGE pn_id id INT(11) AUTO_INCREMENT"; 683 $commands[] = "ALTER TABLE {$prefix}_search_stat CHANGE pn_search search VARCHAR(50) NOT NULL"; 684 $commands[] = "ALTER TABLE {$prefix}_search_stat CHANGE pn_count scount INT(11) DEFAULT '0' NOT NULL"; 685 $commands[] = "ALTER TABLE {$prefix}_search_stat CHANGE pn_date date DATE"; 686 $commands[] = "RENAME TABLE {$prefix}_search_stat TO search_stat"; 687 688 $commands[] = "ALTER TABLE {$prefix}_search_result CHANGE sres_id id INT(11) AUTO_INCREMENT"; 689 $commands[] = "ALTER TABLE {$prefix}_search_result CHANGE sres_title title VARCHAR(255) NOT NULL"; 690 $commands[] = "ALTER TABLE {$prefix}_search_result CHANGE sres_text text LONGTEXT"; 691 $commands[] = "ALTER TABLE {$prefix}_search_result CHANGE sres_module module VARCHAR(100)"; 692 $commands[] = "ALTER TABLE {$prefix}_search_result CHANGE sres_extra extra VARCHAR(100)"; 693 $commands[] = "ALTER TABLE {$prefix}_search_result CHANGE sres_created created DATETIME"; 694 $commands[] = "ALTER TABLE {$prefix}_search_result CHANGE sres_found found DATETIME"; 695 $commands[] = "ALTER TABLE {$prefix}_search_result CHANGE sres_sesid sesid VARCHAR(50)"; 696 $commands[] = "RENAME TABLE {$prefix}_search_result TO search_result"; 697 698 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_id id INT(11) AUTO_INCREMENT"; 699 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_name name VARCHAR(64) NOT NULL"; 700 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_type type TINYINT DEFAULT '0' NOT NULL"; 701 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_displayname displayname VARCHAR(64) NOT NULL"; 702 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_description description VARCHAR(255) NOT NULL"; 703 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_regid regid INT(11) DEFAULT '0' NOT NULL"; 704 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_directory directory VARCHAR(64) NOT NULL"; 705 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_version version VARCHAR(10) DEFAULT '0' NOT NULL"; 706 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_official official TINYINT DEFAULT '0' NOT NULL"; 707 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_author author VARCHAR(255) NOT NULL"; 708 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_contact contact VARCHAR(255) NOT NULL"; 709 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_admin admin TINYINT DEFAULT '0' NOT NULL"; 710 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_user user TINYINT DEFAULT '0' NOT NULL"; 711 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_system system TINYINT DEFAULT '0' NOT NULL"; 712 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_state state TINYINT DEFAULT '0' NOT NULL"; 713 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_credits credits VARCHAR(255) NOT NULL"; 714 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_changelog changelog VARCHAR(255) NOT NULL"; 715 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_help help VARCHAR(255) NOT NULL"; 716 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_license license VARCHAR(255) NOT NULL"; 717 $commands[] = "ALTER TABLE {$prefix}_themes CHANGE pn_xhtml xhtml TINYINT DEFAULT '1' NOT NULL"; 718 $commands[] = "RENAME TABLE {$prefix}_themes TO themes"; 719 720 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_uid uid INT(11) AUTO_INCREMENT"; 721 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_uname uname VARCHAR(25) NOT NULL"; 722 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_email email VARCHAR(60) NOT NULL"; 723 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_user_regdate user_regdate DATETIME DEFAULT '1970-01-01 00:00:00' NOT NULL"; 724 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_user_viewemail user_viewemail SMALLINT DEFAULT '0'"; 725 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_user_theme user_theme VARCHAR(64)"; 726 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_pass pass VARCHAR(128) NOT NULL"; 727 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_storynum storynum INT DEFAULT '10' NOT NULL"; 728 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_ublockon ublockon TINYINT DEFAULT '0' NOT NULL"; 729 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_ublock ublock TEXT NOT NULL"; 730 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_theme theme VARCHAR(255) NOT NULL"; 731 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_counter counter INT(11) DEFAULT '0' NOT NULL"; 732 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_activated activated TINYINT DEFAULT '0' NOT NULL"; 733 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_lastlogin lastlogin DATETIME DEFAULT '1970-01-01 00:00:00' NOT NULL"; 734 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_validfrom validfrom INT(11) DEFAULT '0' NOT NULL"; 735 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_validuntil validuntil INT(11) DEFAULT '0' NOT NULL"; 736 $commands[] = "ALTER TABLE {$prefix}_users CHANGE pn_hash_method hash_method TINYINT(4) DEFAULT '8' NOT NULL"; 737 $commands[] = "RENAME TABLE {$prefix}_users TO users"; 738 739 $commands[] = "ALTER TABLE {$prefix}_users_temp CHANGE pn_tid tid INT(11) AUTO_INCREMENT"; 740 $commands[] = "ALTER TABLE {$prefix}_users_temp CHANGE pn_uname uname VARCHAR(25) NOT NULL"; 741 $commands[] = "ALTER TABLE {$prefix}_users_temp CHANGE pn_email email VARCHAR(60) NOT NULL"; 742 $commands[] = "ALTER TABLE {$prefix}_users_temp CHANGE pn_femail femail TINYINT(4) DEFAULT '0' NOT NULL"; 743 $commands[] = "ALTER TABLE {$prefix}_users_temp CHANGE pn_pass pass VARCHAR(128) NOT NULL"; 744 $commands[] = "ALTER TABLE {$prefix}_users_temp CHANGE pn_dynamics dynamics LONGTEXT NOT NULL"; 745 $commands[] = "ALTER TABLE {$prefix}_users_temp CHANGE pn_comment comment VARCHAR(254) NOT NULL"; 746 $commands[] = "ALTER TABLE {$prefix}_users_temp CHANGE pn_type type TINYINT(4) DEFAULT '0' NOT NULL"; 747 $commands[] = "ALTER TABLE {$prefix}_users_temp CHANGE pn_tag tag TINYINT(4) DEFAULT '0' NOT NULL"; 748 $commands[] = "RENAME TABLE {$prefix}_users_temp TO users_temp"; 749 750 $commands[] = "ALTER TABLE {$prefix}_session_info CHANGE pn_sessid sessid VARCHAR(40) NOT NULL"; 751 $commands[] = "ALTER TABLE {$prefix}_session_info CHANGE pn_ipaddr ipaddr VARCHAR(32) NOT NULL"; 752 $commands[] = "ALTER TABLE {$prefix}_session_info CHANGE pn_lastused lastused DATETIME DEFAULT '1970-01-01 00:00:00'"; 753 $commands[] = "ALTER TABLE {$prefix}_session_info CHANGE pn_uid uid INT(11) DEFAULT '0'"; 754 $commands[] = "ALTER TABLE {$prefix}_session_info CHANGE pn_remember remember TINYINT DEFAULT '0' NOT NULL"; 755 $commands[] = "ALTER TABLE {$prefix}_session_info CHANGE pn_vars vars LONGTEXT NOT NULL"; 756 $commands[] = "RENAME TABLE {$prefix}_session_info TO session_info"; 757 758 $commands[] = "RENAME TABLE {$prefix}_categories_category TO categories_category"; 759 $commands[] = "ALTER TABLE `categories_category` CHANGE `cat_id` `id` INT(11) NOT NULL AUTO_INCREMENT, CHANGE `cat_parent_id` `parent_id` INT(11) NOT NULL DEFAULT '1', CHANGE `cat_is_locked` `is_locked` TINYINT(4) NOT NULL DEFAULT '0', CHANGE `cat_is_leaf` `is_leaf` TINYINT(4) NOT NULL DEFAULT '0', CHANGE `cat_name` `name` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `cat_value` `value` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `cat_sort_value` `sort_value` INT(11) NOT NULL DEFAULT '0', CHANGE `cat_display_name` `display_name` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `cat_display_desc` `display_desc` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `cat_path` `path` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `cat_ipath` `ipath` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `cat_status` `status` VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A', CHANGE `cat_obj_status` `obj_status` VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A', CHANGE `cat_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `cat_cr_uid` `cr_uid` INT(11) NOT NULL DEFAULT '0', CHANGE `cat_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `cat_lu_uid` `lu_uid` INT(11) NOT NULL DEFAULT '0'"; 760 $commands[] = "RENAME TABLE {$prefix}_categories_mapmeta TO categories_mapmeta"; 761 $commands[] = "ALTER TABLE `categories_mapmeta` CHANGE `cmm_id` `id` INT( 11 ) NOT NULL AUTO_INCREMENT , 762 CHANGE `cmm_meta_id` `meta_id` INT( 11 ) NOT NULL DEFAULT '0', 763 CHANGE `cmm_category_id` `category_id` INT( 11 ) NOT NULL DEFAULT '0', 764 CHANGE `cmm_obj_status` `obj_status` VARCHAR( 1 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A', 765 CHANGE `cmm_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', 766 CHANGE `cmm_cr_uid` `cr_uid` INT( 11 ) NOT NULL DEFAULT '0', 767 CHANGE `cmm_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', 768 CHANGE `cmm_lu_uid` `lu_uid` INT( 11 ) NOT NULL DEFAULT '0'"; 769 770 $commands[] = "RENAME TABLE {$prefix}_categories_mapobj TO categories_mapobj"; 771 $commands[] = "ALTER TABLE `categories_mapobj` CHANGE `cmo_id` `id` INT(11) NOT NULL AUTO_INCREMENT, CHANGE `cmo_modname` `modname` VARCHAR(60) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `cmo_table` `tablename` VARCHAR(60) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL, CHANGE `cmo_obj_id` `obj_id` INT(11) NOT NULL DEFAULT '0', CHANGE `cmo_obj_idcolumn` `obj_idcolumn` VARCHAR(60) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'id', CHANGE `cmo_reg_id` `reg_id` INT(11) NOT NULL DEFAULT '0', CHANGE `cmo_category_id` `category_id` INT(11) NOT NULL DEFAULT '0', CHANGE `cmo_obj_status` `obj_status` VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A', CHANGE `cmo_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `cmo_cr_uid` `cr_uid` INT(11) NOT NULL DEFAULT '0', CHANGE `cmo_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `cmo_lu_uid` `lu_uid` INT(11) NOT NULL DEFAULT '0'"; 772 773 $commands[] = "RENAME TABLE {$prefix}_categories_registry TO categories_registry"; 774 $commands[] = "ALTER TABLE `categories_registry` CHANGE `crg_id` `id` INT(11) NOT NULL AUTO_INCREMENT, CHANGE `crg_modname` `modname` VARCHAR(60) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `crg_table` `tablename` VARCHAR(60) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `crg_property` `property` VARCHAR(60) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `crg_category_id` `category_id` INT(11) NOT NULL DEFAULT '0', CHANGE `crg_obj_status` `obj_status` VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A', CHANGE `crg_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `crg_cr_uid` `cr_uid` INT(11) NOT NULL DEFAULT '0', CHANGE `crg_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `crg_lu_uid` `lu_uid` INT(11) NOT NULL DEFAULT '0'"; 775 776 $commands[] = "RENAME TABLE {$prefix}_objectdata_attributes TO objectdata_attributes"; 777 $commands[] = "ALTER TABLE `objectdata_attributes` CHANGE `oba_id` `id` INT(11) NOT NULL AUTO_INCREMENT, CHANGE `oba_attribute_name` `attribute_name` VARCHAR(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `oba_object_id` `object_id` INT(11) NOT NULL DEFAULT '0', CHANGE `oba_object_type` `object_type` VARCHAR(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `oba_value` `value` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `oba_obj_status` `obj_status` VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A', CHANGE `oba_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `oba_cr_uid` `cr_uid` INT(11) NOT NULL DEFAULT '0', CHANGE `oba_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `oba_lu_uid` `lu_uid` INT(11) NOT NULL DEFAULT '0'"; 778 779 $commands[] = "RENAME TABLE {$prefix}_objectdata_log TO objectdata_log"; 780 $commands[] = "ALTER TABLE `objectdata_log` CHANGE `obl_id` `id` INT(11) NOT NULL AUTO_INCREMENT, CHANGE `obl_object_type` `object_type` VARCHAR(80) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `obl_object_id` `object_id` INT(11) NOT NULL DEFAULT '0', CHANGE `obl_op` `op` VARCHAR(16) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `obl_diff` `diff` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obl_obj_status` `obj_status` VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A', CHANGE `obl_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `obl_cr_uid` `cr_uid` INT(11) NOT NULL DEFAULT '0', CHANGE `obl_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `obl_lu_uid` `lu_uid` INT(11) NOT NULL DEFAULT '0'"; 781 782 $commands[] = "RENAME TABLE {$prefix}_objectdata_meta TO objectdata_meta"; 783 $commands[] = "ALTER TABLE `objectdata_meta` CHANGE `obm_id` `id` INT(11) NOT NULL AUTO_INCREMENT, CHANGE `obm_module` `module` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `obm_table` `tablename` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `obm_idcolumn` `idcolumn` VARCHAR(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '', CHANGE `obm_obj_id` `obj_id` INT(11) NOT NULL DEFAULT '0', CHANGE `obm_permissions` `permissions` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_title` `dc_title` VARCHAR(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_author` `dc_author` VARCHAR(80) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_subject` `dc_subject` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_keywords` `dc_keywords` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_description` `dc_description` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_publisher` `dc_publisher` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_contributor` `dc_contributor` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_startdate` `dc_startdate` DATETIME NULL DEFAULT '1970-01-01 00:00:00', CHANGE `obm_dc_enddate` `dc_enddate` DATETIME NULL DEFAULT '1970-01-01 00:00:00', CHANGE `obm_dc_type` `dc_type` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_format` `dc_format` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_uri` `dc_uri` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_source` `dc_source` VARCHAR(128) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_language` `dc_language` VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_relation` `dc_relation` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_coverage` `dc_coverage` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_entity` `dc_entity` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_comment` `dc_comment` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_dc_extra` `dc_extra` VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL, CHANGE `obm_obj_status` `obj_status` VARCHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'A', CHANGE `obm_cr_date` `cr_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `obm_cr_uid` `cr_uid` INT(11) NOT NULL DEFAULT '0', CHANGE `obm_lu_date` `lu_date` DATETIME NOT NULL DEFAULT '1970-01-01 00:00:00', CHANGE `obm_lu_uid` `lu_uid` INT(11) NOT NULL DEFAULT '0'"; 784 785 $commands[] = "DROP TABLE {$prefix}_sc_anticracker"; 786 787 $commands[] = "DROP TABLE {$prefix}_sc_log_event"; 788 789 $commands[] = "UPDATE module_vars SET modname = 'ZConfig' WHERE modname = '/PNConfig'"; 790 $silentCommands = array(); 791 $silentCommands[] = "ALTER TABLE {$prefix}_message CHANGE pn_mid mid INT(11) NOT NULL AUTO_INCREMENT , 792 CHANGE pn_title title VARCHAR(100) NOT NULL DEFAULT '', 793 CHANGE pn_content content LONGTEXT NOT NULL , 794 CHANGE pn_date date INT(11) NOT NULL DEFAULT '0', 795 CHANGE pn_expire expire INT(11) NOT NULL DEFAULT '0', 796 CHANGE pn_active active INT(11) NOT NULL DEFAULT '1', 797 CHANGE pn_view view INT(11) NOT NULL DEFAULT '1', 798 CHANGE pn_language language VARCHAR(30) NOT NULL DEFAULT ''"; 799 $silentCommands[] = "ALTER TABLE {$prefix}_pagelock CHANGE plock_id id INT(11) NOT NULL AUTO_INCREMENT"; 800 $silentCommands[] = "ALTER TABLE {$prefix}_pagelock CHANGE plock_name name VARCHAR(100) NOT NULL"; 801 $silentCommands[] = "ALTER TABLE {$prefix}_pagelock CHANGE plock_cdate cdate DATETIME NOT NULL"; 802 $silentCommands[] = "ALTER TABLE {$prefix}_pagelock CHANGE plock_edate edate DATETIME NOT NULL"; 803 $silentCommands[] = "ALTER TABLE {$prefix}_pagelock CHANGE plock_session session VARCHAR(50) NOT NULL"; 804 $silentCommands[] = "ALTER TABLE {$prefix}_pagelock CHANGE plock_title title VARCHAR(100) NOT NULL"; 805 $silentCommands[] = "ALTER TABLE {$prefix}_pagelock CHANGE plock_ipno ipno VARCHAR(30) NOT NULL"; 806 $silentCommands[] = "RENAME TABLE {$prefix}_pagelock TO pagelock"; 807 808 // LONGBLOB is not supported by Doctrine 2 809 $silentCommands[] = "ALTER TABLE {$prefix}_workflows CHANGE debug debug LONGTEXT NULL DEFAULT NULL"; 810 $silentCommands[] = "RENAME TABLE {$prefix}_workflows TO workflows"; 811 $silentCommands[] = "ALTER TABLE group_applications CHANGE application application LONGTEXT NOT NULL"; 812 813 // Handle case of andreas08 themes on linux environments. 814 $silentCommands[] = "UPDATE themes SET name = 'Andreas08', directory = 'Andreas08' WHERE name = 'andreas08'"; 815 $silentCommands[] = "UPDATE module_vars SET value = 's:9:\"Andreas08\";' WHERE modname = 'ZConfig' AND value ='s:9:\"andreas08\";'"; 816 817 foreach ($commands as $sql) { 818 $stmt = $connection->prepare($sql); 819 $stmt->execute(); 820 } 821 822 foreach ($silentCommands as $sql) { 823 $stmt = $connection->prepare($sql); 824 try { 825 $stmt->execute(); 826 } catch (Exception $e) { 827 // Silent - trap and toss exceptions. 828 } 829 } 830 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Feb 20 12:35:30 2012 | Cross-referenced by PHPXref 0.7.1 |