diff -ruN TYPO3core_orig_cvs/t3lib/class.t3lib_div.php TYPO3core_upgrades/t3lib/class.t3lib_div.php --- TYPO3core_orig_cvs/t3lib/class.t3lib_div.php 2005-12-19 21:32:28.000000000 +0100 +++ TYPO3core_upgrades/t3lib/class.t3lib_div.php 2005-12-23 00:25:39.000000000 +0100 @@ -751,6 +751,23 @@ } /** + * Returns true if the current TYPO3 version (or compatibility version) is compatible to the input version + * + * @param string Version number on format x.x.x + * @return boolean true or false + */ + function compat_version($verNumberStr) { + global $TYPO3_CONF_VARS; + $currVersionStr = $TYPO3_CONF_VARS['SYS']['compat_version']?$TYPO3_CONF_VARS['SYS']['compat_version']:TYPO3_version; + + if (t3lib_div::int_from_ver($currVersionStr) < t3lib_div::int_from_ver($verNumberStr)) { + return FALSE; + } else { + return TRUE; + } + } + + /** * Makes a positive integer hash out of the first 7 chars from the md5 hash of the input * Usage: 5 * Dateien TYPO3core_orig_cvs/t3lib/.class.t3lib_install.php.marks und TYPO3core_upgrades/t3lib/.class.t3lib_install.php.marks sind verschieden. diff -ruN TYPO3core_orig_cvs/t3lib/class.t3lib_matchcondition.php TYPO3core_upgrades/t3lib/class.t3lib_matchcondition.php --- TYPO3core_orig_cvs/t3lib/class.t3lib_matchcondition.php 2005-12-19 21:32:28.000000000 +0100 +++ TYPO3core_upgrades/t3lib/class.t3lib_matchcondition.php 2005-12-22 23:54:26.000000000 +0100 @@ -284,6 +284,8 @@ } } break; + case 'compatVersion': + return t3lib_div::compat_version($pcs[1]); case 'userFunc': $values = split('\(|\)',$pcs[1]); $funcName=trim($values[0]); diff -ruN TYPO3core_orig_cvs/t3lib/config_default.php TYPO3core_upgrades/t3lib/config_default.php --- TYPO3core_orig_cvs/t3lib/config_default.php 2005-12-19 21:32:28.000000000 +0100 +++ TYPO3core_upgrades/t3lib/config_default.php 2005-12-23 00:27:20.000000000 +0100 @@ -50,6 +50,7 @@ ), 'SYS' => Array( // System related concerning both frontend and backend. 'sitename' => 'TYPO3', // Name of the base-site. This title shows up in the root of the tree structure if you're an 'admin' backend user. + 'compat_version' => '', // Compatibility version. TYPO3 behavior will try to be compatible with the output from the TYPO3 version set here. It is recommended to change this setting with the Upgrade Wizard. 'encryptionKey' => '', // This is a "salt" used for various kinds of encryption, CRC checksums and validations. You can enter any rubbish string here but try to keep it secret. You should notice that a change to this value might invalidate temporary information, URLs etc. At least, clear all cache if you change this so any such information can be rebuild with the new key. 'doNotCheckReferer' => 0, // Boolean. If set, it's NOT checked numerous places that the refering host is the same as the current. This is an option you should set if you have problems with proxies not passing the HTTP_REFERER variable. 'recursiveDomainSearch' => 0, // Boolean. If set, the search for domain records will be done recursively by stripping parts of the host name off until a matching domain record is found. @@ -278,7 +279,7 @@ unset($typo_db_tables_script); unset($typo_db_extTableDef_script); -// Based on the configuration of the image processing some options may be forced: + // Based on the configuration of the image processing some options may be forced: if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['image_processing']) { $GLOBALS['TYPO3_CONF_VARS']['GFX']['im']=0; $GLOBALS['TYPO3_CONF_VARS']['GFX']['gdlib']=0; diff -ruN TYPO3core_orig_cvs/typo3/sysext/install/ext_localconf.php TYPO3core_upgrades/typo3/sysext/install/ext_localconf.php --- TYPO3core_orig_cvs/typo3/sysext/install/ext_localconf.php 1970-01-01 01:00:00.000000000 +0100 +++ TYPO3core_upgrades/typo3/sysext/install/ext_localconf.php 2005-12-23 21:15:53.000000000 +0100 @@ -0,0 +1,12 @@ + 3009000, 'description' => 'The rendering of the elements "tt_content.menu" (used f.e. for sitemaps) and "tt_content.mailform" has been changed. Additionally, the P-Tag has been removed from all table cells.', 'description_acknowledge' => 'Yes, I updated my stylesheets accordingly.'); + +?> \ Kein Zeilenumbruch am Dateiende. diff -ruN TYPO3core_orig_cvs/typo3/sysext/install/mod/class.tx_install.php TYPO3core_upgrades/typo3/sysext/install/mod/class.tx_install.php --- TYPO3core_orig_cvs/typo3/sysext/install/mod/class.tx_install.php 2005-12-19 21:32:45.000000000 +0100 +++ TYPO3core_upgrades/typo3/sysext/install/mod/class.tx_install.php 2005-12-23 21:18:35.000000000 +0100 @@ -203,6 +203,7 @@ var $menuitems = array( "config" => "Basic Configuration", "database" => "Database Analyser", + "update" => "Update Wizard", "images" => "Image Processing", "extConfig" => "All Configuration", "typo3temp" => "typo3temp/", @@ -413,6 +414,10 @@ $this->silent=0; $this->checkTheDatabase(); break; + case 'update': + $this->silent=0; + $this->updateWizard(); + break; case "config": $this->silent=0; $this->checkIM=1; @@ -2174,20 +2179,21 @@ * @param [type] $lines: ... * @return [type] ... */ - function writeToLocalconf_control($lines="") { + function writeToLocalconf_control($lines="", $showOutput=1) { $returnVal = parent::writeToLocalconf_control($lines); - switch($returnVal) { - case 'continue': - $content = "

".implode($this->messages,"
").'

Click to continue...'; - $this->outputExitBasedOnStep($content); - break; - case 'nochange': - $content = 'Writing to \'localconf.php\':

No values were changed, so nothing is updated!

Click to continue...'; - $this->outputExitBasedOnStep("
".$content); - break; + if ($showOutput) { + switch($returnVal) { + case 'continue': + $content = "

".implode($this->messages,"
").'

Click to continue...'; + $this->outputExitBasedOnStep($content); + break; + case 'nochange': + $content = 'Writing to \'localconf.php\':

No values were changed, so nothing is updated!

Click to continue...'; + $this->outputExitBasedOnStep("
".$content); + break; + } } - return $returnVal; } @@ -3810,7 +3816,142 @@ * * @return [type] ... */ - function isBackendAdminUser() { + function updateWizard() { + // clear cache files - adapted from t3lib_tcemain::removeCacheFiles + $cacheFiles=t3lib_extMgm::currentCacheFiles(); + if (is_array($cacheFiles)) { + foreach ($cacheFiles as $cfile) { + @unlink($cfile); + clearstatcache(); + } + } + + $GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache'] = 0; + t3lib_extMgm::typo3_loadExtensions(); + + $action = ($this->INSTALL['database_type']?$this->INSTALL['database_type']:'checkForUpdate'); + $this->updateWizard_parts($action); + echo $this->outputWrapper($this->printAll()); + } + /** + * [Describe function...] + * + * @return [type] ... + */ + function updateWizard_parts($action) { + $content = ''; + switch ($action) { + case 'checkForUpdate': // first step - check for updates available + $title = '1 - available updates'; + $tableContent = ''; + if (!$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']) { + $content = 'No updates registered!'; + break; + } + + // step through list of updates, and check if update is needed and if yes, output an explanation + foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] as $identifier => $className) { + $tmpObj = $this->getUpgradeObjInstance($className, $identifier); + if (method_exists($tmpObj,'checkForUpdate')) { + $explanation = ''; + if ($tmpObj->checkForUpdate(&$explanation)) { + $tableContent .= ''.$identifier.'
'.str_replace(chr(10),'
',$explanation).'
'; + } + } + } + if ($tableContent) { + $tableContent = ''.$tableContent.'
'; + $content = $this->getUpdateDbFormWrap('getUserInput', $tableContent,'2 - Configure updates!'); + } else { + $content = 'No updates to perform!'; + } + break; + case 'getUserInput': // second step - get user input and ask for final confirmation + $title = '2 - configuration of updates'; + $formContent = 'The following updates will be performed:'; + if (!$this->INSTALL['update']) { + $content = 'No updates selected!'; + break; + } + // update methods might need to get custom data + foreach ($this->INSTALL['update'] as $identifier => $tmp) { + $className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][$identifier]; + + $tmpObj = $this->getUpgradeObjInstance($className, $identifier); + + $formContent .= '

'.$identifier.'
'; + if (method_exists($tmpObj,'getUserInput')) { + $formContent .= $tmpObj->getUserInput('TYPO3_INSTALL[update]['.$identifier.']'); + } + $formContent .= '


'; + } + $formContent .= '

Show database queries performed

'; + $content = $this->getUpdateDbFormWrap('performUpdate', $formContent,'3 -Perform updates!'); + break; + case 'performUpdate': // third step - perform update + $title = '3 - perform updates'; + if (!$this->INSTALL['update']['extList']) { break; } + + $GLOBALS['TYPO3_DB']->store_lastBuiltQuery = TRUE; + foreach ($this->INSTALL['update']['extList'] as $identifier) { + $className = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'][$identifier]; + + $tmpObj = &$this->getUpgradeObjInstance($className, $identifier); + + $content = '

'.$identifier.'
'; + // check user input if testing method is available + if (method_exists($tmpObj,'checkUserInput')) { + $customOutput = ''; + if (!$tmpObj->checkUserInput(&$customOutput)) { + $content .= ''.($customOutput?$customOutput:'Something went wrong').''; + $content .= '
Go back to update configuration'; + break; + } + } + + if (method_exists($tmpObj,'performUpdate')) { + $customOutput = ''; + $dbQueries = array(); + if ($tmpObj->performUpdate(&$dbQueries, &$customOutput)) { + $content .= 'Update successful!'; + } else { + $content .= 'FAILURE!'; + } + if ($this->INSTALL['update']['showDatabaseQueries']) { + $content .= '
' . implode('
',$dbQueries); + } + $content .= '
' . $customOutput; + + } else { + $content .= 'No update method available!'; + } + $content .= '


'; + } + $GLOBALS['TYPO3_DB']->store_lastBuiltQuery = FALSE; + break; + } + $this->message('Update Wizard',$title,$content); + } + + /** + * [Describe function...] + * + * @return [type] ... + */ + function getUpgradeObjInstance($className, $identifier) { + $tmpObj = &t3lib_div::getUserObj($className); + $tmpObj->versionNumber = t3lib_div::int_from_ver(TYPO3_version); + $tmpObj->pObj = $this; + $tmpObj->userInput = $this->INSTALL['update'][$identifier]; + return $tmpObj; + } + + /** + * [Describe function...] + * + * @return [type] ... + */ + function isBackendAdminUser() { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('count(*)', 'be_users', 'admin=1'); $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res); return current($row); @@ -4537,7 +4678,7 @@ function outputWrapper($content) { $out=' - + '.$this->headerStyle.' - + TYPO3 Install Tool '.($this->JSmessage?' Dateien TYPO3core_orig_cvs/typo3/sysext/install/mod/.class.tx_install.php.marks und TYPO3core_upgrades/typo3/sysext/install/mod/.class.tx_install.php.marks sind verschieden. diff -ruN TYPO3core_orig_cvs/typo3/sysext/install/updates/class.tx_coreupdates_compatversion.php TYPO3core_upgrades/typo3/sysext/install/updates/class.tx_coreupdates_compatversion.php --- TYPO3core_orig_cvs/typo3/sysext/install/updates/class.tx_coreupdates_compatversion.php 1970-01-01 01:00:00.000000000 +0100 +++ TYPO3core_upgrades/typo3/sysext/install/updates/class.tx_coreupdates_compatversion.php 2005-12-23 21:14:39.000000000 +0100 @@ -0,0 +1,107 @@ +compatVersionIsCurrent()) { + $description = 'Your current TYPO3 installation is configured to use all the features included in the current release '.TYPO3_version.'.'; + // set compat_version for upcoming updates + $this->userInput['version'] = TYPO3_version; + $this->performUpdate($tmp1,$tmp2); + } else { + $description = 'Your current TYPO3 installation is configured to behave like version '.$TYPO3_CONF_VARS['SYS']['compat_version'].' of TYPO3. If you just upgraded from this version, you most likely want to use new features as well. In the next step, you will see the things that need to be adjusted to make your installation compatible with the new features.'; + } + + return 1; + } + + function getUserInput($inputPrefix) { + global $TYPO3_CONF_VARS; + if ($this->compatVersionIsCurrent()) { + $content = 'I updated from an older version of TYPO3:
+ Select the compatibility version: '; + } else { + $content = 'TYPO3 output is currently compatible to version '.$TYPO3_CONF_VARS['SYS']['compat_version'].'. To use all the new features in the current TYPO3 version, make sure you follow the guidelines below to upgrade without problems.
+ Follow the steps below carefully and confirm every step! You will see this list again after you performed the update.'; + + $content .= $this->showChangesNeeded($inputPrefix); + + $content .= '
ignore selection above - WARNING: this might break the output of your website.'; + } + return $content; + } + function checkUserInput($customMessages) { + global $TYPO3_CONF_VARS; + if ($this->compatVersionIsCurrent()) { + return 1; + } else { + if ($this->userInput['compatVersion']['all']) { + return 1; + } else { + $performUpdate = 1; + $oldVersion = t3lib_div::int_from_ver($TYPO3_CONF_VARS['SYS']['compat_version']); + $currentVersion = t3lib_div::int_from_ver(TYPO3_version); + foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['compat_version'] as $internalName => $details) { + if ($details['version'] > $oldVersion && $details['version'] <= $currentVersion) { + if (!$this->userInput['compatVersion'][$internalName]) { + $performUpdate = 0; + $customMessages = 'You did not confirm all steps!'; + break; + } + } + } + return $performUpdate; + } + } + } + function performUpdate($dbQueries, $customMessages) { + $linesArr = $this->pObj->writeToLocalconf_control(); + $this->pObj->setValueInLocalconfFile($linesArr, '$TYPO3_CONF_VARS["SYS"]["compat_version"]', ($this->userInput['version']?$this->userInput['version']:'')); + $this->pObj->writeToLocalconf_control($linesArr,0); + + $customMessages = $this->showChangesNeeded(); + + return 1; + } + + // helper functiopns + function compatVersionIsCurrent() { + global $TYPO3_CONF_VARS; + if ($TYPO3_CONF_VARS['SYS']['compat_version'] && t3lib_div::int_from_ver(TYPO3_version) != t3lib_div::int_from_ver($TYPO3_CONF_VARS['SYS']['compat_version'])) { + return 0; + } else { + return 1; + } + } + function showChangesNeeded($inputPrefix = '') { + global $TYPO3_CONF_VARS; + $oldVersion = t3lib_div::int_from_ver($TYPO3_CONF_VARS['SYS']['compat_version']); + $currentVersion = t3lib_div::int_from_ver(TYPO3_version); + + $tableContents = ''; + foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['compat_version'] as $internalName => $details) { + if ($details['version'] > $oldVersion && $details['version'] <= $currentVersion) { + $tableContents .= ''.($inputPrefix?'':' ').''.str_replace(chr(10),'
',$details['description']).($inputPrefix?'
'.$details['description_acknowledge'].'':'').''; + } + } + if ($tableContents) { + return ''.$tableContents.'
'; + } + } +} +?> \ Kein Zeilenumbruch am Dateiende. diff -ruN TYPO3core_orig_cvs/typo3/sysext/install/updates/class.tx_coreupdates_notinmenu.php TYPO3core_upgrades/typo3/sysext/install/updates/class.tx_coreupdates_notinmenu.php --- TYPO3core_orig_cvs/typo3/sysext/install/updates/class.tx_coreupdates_notinmenu.php 1970-01-01 01:00:00.000000000 +0100 +++ TYPO3core_upgrades/typo3/sysext/install/updates/class.tx_coreupdates_notinmenu.php 2005-12-23 21:25:47.000000000 +0100 @@ -0,0 +1,33 @@ +version >= 3900000) { + $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid','pages','doktype=5'); + if($GLOBALS['TYPO3_DB']->sql_num_rows($res)) { + return 1; + } + } + return 0; + } + + function performUpdate($dbQueries, $customMessages) { + if($this->version >= 3900000) { + $updateArray = array( + 'doktype' => 1, + 'nav_hide' => 1 + ); + + $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'doktype=5', $updateArray); + $dbQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery; + if ($GLOBALS['TYPO3_DB']->sql_affected_rows($res)) { + return 1; + } + return 0; // zero rows affected, maybe error + } + } +} +?>