Feature #15302 ยป updatewizard_08-1.patch
TYPO3core_upgrades/t3lib/class.t3lib_div.php 2005-12-23 00:25:39.000000000 +0100 | ||
---|---|---|
}
|
||
/**
|
||
* 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
|
||
*
|
TYPO3core_upgrades/t3lib/class.t3lib_matchcondition.php 2005-12-22 23:54:26.000000000 +0100 | ||
---|---|---|
}
|
||
}
|
||
break;
|
||
case 'compatVersion':
|
||
return t3lib_div::compat_version($pcs[1]);
|
||
case 'userFunc':
|
||
$values = split('\(|\)',$pcs[1]);
|
||
$funcName=trim($values[0]);
|
TYPO3core_upgrades/t3lib/config_default.php 2005-12-23 00:27:20.000000000 +0100 | ||
---|---|---|
),
|
||
'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.
|
||
... | ... | |
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;
|
TYPO3core_upgrades/typo3/sysext/install/ext_localconf.php 2005-12-23 21:15:53.000000000 +0100 | ||
---|---|---|
<?php
|
||
if (!defined ('TYPO3_MODE')) die ('Access denied.');
|
||
require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_compatversion.php');
|
||
$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['compatibilityVersionChange'] = 'tx_coreupdates_compatversion';
|
||
require_once(t3lib_extMgm::extPath('install').'updates/class.tx_coreupdates_notinmenu.php');
|
||
$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['notInMenu_doctype_conversion'] = 'tx_coreupdates_notinmenu';
|
||
$TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['compat_version']['accessibility'] = array('version' => 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.');
|
||
?>
|
TYPO3core_upgrades/typo3/sysext/install/mod/class.tx_install.php 2005-12-23 21:18:35.000000000 +0100 | ||
---|---|---|
var $menuitems = array(
|
||
"config" => "Basic Configuration",
|
||
"database" => "Database Analyser",
|
||
"update" => "Update Wizard",
|
||
"images" => "Image Processing",
|
||
"extConfig" => "All Configuration",
|
||
"typo3temp" => "typo3temp/",
|
||
... | ... | |
$this->silent=0;
|
||
$this->checkTheDatabase();
|
||
break;
|
||
case 'update':
|
||
$this->silent=0;
|
||
$this->updateWizard();
|
||
break;
|
||
case "config":
|
||
$this->silent=0;
|
||
$this->checkIM=1;
|
||
... | ... | |
* @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 = "<BR><BR>".implode($this->messages,"<HR>").'<BR><BR><a href="'.$this->action.'">Click to continue...</a>';
|
||
$this->outputExitBasedOnStep($content);
|
||
break;
|
||
case 'nochange':
|
||
$content = '<strong>Writing to \'localconf.php\':</strong><BR><BR>No values were changed, so nothing is updated!<BR><BR><a href="'.$this->action.'">Click to continue...</a>';
|
||
$this->outputExitBasedOnStep("<BR>".$content);
|
||
break;
|
||
if ($showOutput) {
|
||
switch($returnVal) {
|
||
case 'continue':
|
||
$content = "<BR><BR>".implode($this->messages,"<HR>").'<BR><BR><a href="'.$this->action.'">Click to continue...</a>';
|
||
$this->outputExitBasedOnStep($content);
|
||
break;
|
||
case 'nochange':
|
||
$content = '<strong>Writing to \'localconf.php\':</strong><BR><BR>No values were changed, so nothing is updated!<BR><BR><a href="'.$this->action.'">Click to continue...</a>';
|
||
$this->outputExitBasedOnStep("<BR>".$content);
|
||
break;
|
||
}
|
||
}
|
||
return $returnVal;
|
||
}
|
||
... | ... | |
*
|
||
* @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 = '<strong>No updates registered!</strong>';
|
||
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 .= '<tr><td valign="top"><input type="checkbox" name="TYPO3_INSTALL[update]['.$identifier.']" value="1" checked="checked" /></td><td><strong>'.$identifier.'</strong><br />'.str_replace(chr(10),'<br />',$explanation).'</td></tr><tr><td colspan="2"><hr /></td></tr>';
|
||
}
|
||
}
|
||
}
|
||
if ($tableContent) {
|
||
$tableContent = '<table>'.$tableContent.'</table>';
|
||
$content = $this->getUpdateDbFormWrap('getUserInput', $tableContent,'2 - Configure updates!');
|
||
} else {
|
||
$content = '<strong>No updates to perform!</strong>';
|
||
}
|
||
break;
|
||
case 'getUserInput': // second step - get user input and ask for final confirmation
|
||
$title = '2 - configuration of updates';
|
||
$formContent = '<strong>The following updates will be performed:</strong>';
|
||
if (!$this->INSTALL['update']) {
|
||
$content = '<strong>No updates selected!</strong>';
|
||
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 .= '<p><strong>'.$identifier.'</strong><input type="hidden" name="TYPO3_INSTALL[update][extList][]" value="'.$identifier.'" /><br />';
|
||
if (method_exists($tmpObj,'getUserInput')) {
|
||
$formContent .= $tmpObj->getUserInput('TYPO3_INSTALL[update]['.$identifier.']');
|
||
}
|
||
$formContent .= '</p><hr />';
|
||
}
|
||
$formContent .= '<p><input type="checkbox" name="TYPO3_INSTALL[update][showDatabaseQueries]" value="1" /> Show database queries performed</p>';
|
||
$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 = '<p><strong>'.$identifier.'</strong><br />';
|
||
// check user input if testing method is available
|
||
if (method_exists($tmpObj,'checkUserInput')) {
|
||
$customOutput = '';
|
||
if (!$tmpObj->checkUserInput(&$customOutput)) {
|
||
$content .= '<strong>'.($customOutput?$customOutput:'Something went wrong').'</strong>';
|
||
$content .= '<br /><a href="javascript:history.back()">Go back to update configuration</a>';
|
||
break;
|
||
}
|
||
}
|
||
if (method_exists($tmpObj,'performUpdate')) {
|
||
$customOutput = '';
|
||
$dbQueries = array();
|
||
if ($tmpObj->performUpdate(&$dbQueries, &$customOutput)) {
|
||
$content .= '<strong>Update successful!</strong>';
|
||
} else {
|
||
$content .= '<strong>FAILURE!</strong>';
|
||
}
|
||
if ($this->INSTALL['update']['showDatabaseQueries']) {
|
||
$content .= '<br />' . implode('<br />',$dbQueries);
|
||
}
|
||
$content .= '<br />' . $customOutput;
|
||
} else {
|
||
$content .= '<strong>No update method available!</strong>';
|
||
}
|
||
$content .= '</p><hr />';
|
||
}
|
||
$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);
|
||
... | ... | |
function outputWrapper($content) {
|
||
$out='
|
||
<html>
|
||
<head>
|
||
<STYLE TYPE="text/css">
|
||
<!--
|
||
... | ... | |
A:visited {text-decoration: none}
|
||
A:active {text-decoration: none}
|
||
A:hover {color: #000066}
|
||
p,td {
|
||
font-family:verdana,sans-serif;
|
||
font-size:10px;
|
||
}
|
||
-->
|
||
</STYLE>
|
||
'.$this->headerStyle.'
|
||
<head>
|
||
<title>TYPO3 Install Tool</title>
|
||
'.($this->JSmessage?'
|
||
<script language="javascript" type="text/javascript">alert(unescape(\''.rawurlencode($this->JSmessage).'\'));</script>
|
TYPO3core_upgrades/typo3/sysext/install/updates/class.tx_coreupdates_compatversion.php 2005-12-23 21:14:39.000000000 +0100 | ||
---|---|---|
<?php
|
||
class tx_coreupdates_compatversion {
|
||
var $versionNumber; // version number coming from t3lib_div::int_from_ver()
|
||
var $pObj; // parent object (tx_install)
|
||
var $userInput; // user input
|
||
function checkForUpdate($description) {
|
||
global $TYPO3_CONF_VARS;
|
||
if ($this->compatVersionIsCurrent()) {
|
||
$description = '<b>Your current TYPO3 installation is configured to use all the features included in the current release '.TYPO3_version.'.</b><ul><li><b>I just made a fresh install of TYPO3:</b>
|
||
Perfect! All new features will be used.
|
||
<i>You can stop here and do not need this wizard now.</i></li>
|
||
<li><b>I just updated from a previous version of TYPO3:</b>
|
||
Because of some new features, the frontend output of your site might have changed. To emulate the "old" frontend behavior, change the compatibility version by continuing to step 2.
|
||
This is <b>recommended</b> after every update. When re-running the wizard, you will see the changes needed for using the new features.
|
||
<i>Please continue to step two.</i></li></ul>';
|
||
// set compat_version for upcoming updates
|
||
$this->userInput['version'] = TYPO3_version;
|
||
$this->performUpdate($tmp1,$tmp2);
|
||
} else {
|
||
$description = 'Your current TYPO3 installation is configured to <b>behave like version '.$TYPO3_CONF_VARS['SYS']['compat_version'].'</b> of TYPO3. If you just upgraded from this version, you most likely want to <b>use new features</b> 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 = '<b>I updated from an older version of TYPO3</b>:<br>
|
||
Select the compatibility version: <select name="'.$inputPrefix.'[version]">';
|
||
$versions = array(
|
||
'3.8.1'
|
||
);
|
||
foreach ($versions as $singleVersion) {
|
||
$content .= '<option value="'.$singleVersion.'">'.$singleVersion.'</option>';
|
||
}
|
||
$content .= '</select>';
|
||
} 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.<br>
|
||
<b>Follow the steps below carefully and confirm every step!</b> You will see this list again after you performed the update.';
|
||
$content .= $this->showChangesNeeded($inputPrefix);
|
||
$content .= '<br /><input type="checkbox" name="'.$inputPrefix.'[compatVersion][all]" value="1"> <b>ignore selection above - WARNING: this might break the output of your website.</b>';
|
||
}
|
||
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 .= '<tr><td valign="bottom">'.($inputPrefix?'<input type="checkbox" name="'.$inputPrefix.'[compatVersion]['.$internalName.']" value="1">':' ').'</td><td>'.str_replace(chr(10),'<br />',$details['description']).($inputPrefix?'<br /><b>'.$details['description_acknowledge'].'</b>':'').'</td></tr>';
|
||
}
|
||
}
|
||
if ($tableContents) {
|
||
return '<table>'.$tableContents.'</table>';
|
||
}
|
||
}
|
||
}
|
||
?>
|
TYPO3core_upgrades/typo3/sysext/install/updates/class.tx_coreupdates_notinmenu.php 2005-12-23 21:25:47.000000000 +0100 | ||
---|---|---|
<?php
|
||
class tx_coreupdates_notinmenu {
|
||
var $versionNumber; // version number coming from t3lib_div::int_from_ver()
|
||
var $pObj; // parent object (tx_install)
|
||
var $userInput; // user input
|
||
function checkForUpdate($description) {
|
||
$description = 'Removes the doctype "not in menu" which is deprecated and sets instead the page flag "not in menu".';
|
||
if($this->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
|
||
}
|
||
}
|
||
}
|
||
?>
|