Project

General

Profile

Bug #24415 » install_tool_upgradewizard.patch

Administrator Admin, 2010-12-26 13:27

View differences:

typo3/sysext/install/ext_autoload.php (Arbeitskopie)
*
* $Id$
*/
$extPath = t3lib_extMgm::extPath('install');
return array(
'tx_install_report_installstatus' => t3lib_extMgm::extPath('install', 'report/class.tx_install_report_installstatus.php'),
'tx_install_report_installstatus' => $extPath . 'report/class.tx_install_report_installstatus.php',
'tx_install_updates_base' => $extPath . 'Classes/Updates/Base.php'
);
?>
typo3/sysext/install/Classes/Updates/Base.php (Revision 0)
<?php
/***************************************************************
* Copyright notice
*
* (c) 2010 Benjamin Mack <benni@typo3.org>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the textfile GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
/**
* Generic class that every update wizard class inherits from.
* Used by the update wizard in the install tool.
*
* @author Benjamin Mack <benni@typo3.org>
* @version $Id:
*/
abstract class Tx_Install_Updates_Base {
/**
* the human-readable title of the upgrade wizard
*/
protected $title;
/**
* parent object
* @var tx_install
*/
public $pObj;
/**
* user input, set from outside
*/
public $userInput;
/**
* current TYPO3 version number, set from outside
* version number coming from t3lib_div::int_from_ver()
*/
public $versionNumber;
/**
*
* API functions
*
**/
/**
* The first function in the update wizard steps
*
* it works like this:
* @param $explanation string HTML that is outputted on the first
* @param $showUpdate int that informs you whether to show this update wizard or not. Possible values that checkForUpdate() should set:
* 0 = don't show this update wizard at all (because it's not needed)
* 1 = show the update wizard (explanation + next step button)
* 2 = show the update wizard (explanation but not the "next step" button), useful for showing a status of a wizard
* @return deprecated since TYPO3 4.5, in previous versions it was used to determine whether the update wizards should be shown, now, the $showUpdate parameter is used for that
*/
// public abstract function checkForUpdate(&$explanation, &$showUpdate);
/**
* second step: get user input if needed
*
* @param string input prefix, all names of form fields have to start with this. Append custom name in [ ... ]
* @return string HTML output
*/
// public abstract function getUserInput($inputPrefix);
/**
* third step: do the updates
*
* @param array &$dbQueries: queries done in this update
* @param mixed &$customMessages: custom messages
* @return boolean whether it worked (true) or not (false)
*/
// public abstract function performUpdate(&$dbQueries, &$customMessages);
/**
* Checks if user input is valid
*
* @param string pointer to output custom messages
* @return boolean true if user input is correct, then the update is performed. When false, return to getUserInput
*/
// public abstract function checkUserInput(&$customMessages);
/**
*
* Helper functions, getters and setters
*
**/
/**
* returns the title attribute
*
* @return the title of this update wizard
**/
public function getTitle() {
if ($this->title) {
return $this->title;
} else {
return $this->identifier;
}
}
/**
* sets the title attribute
*
* @param $title the title of this update wizard
* @return void
**/
public function setTitle($title) {
$this->title = $title;
}
/**
* returns the identifier of this class
*
* @return the identifier of this update wizard
**/
public function getIdentifier() {
return $this->identifier;
}
/**
* sets the identifier attribute
*
* @param $identifier the identifier of this update wizard
* @return void
**/
public function setIdentifier($identifier) {
$this->identifier = $identifier;
}
/**
* simple wrapper function that helps dealing with the compatibility
* layer that some update wizards don't have a second parameter
* thus, it evaluates everything already
*
* @return boolean if the wizard should be shown at all on the overview page
* @see checkForUpdate()
*/
public function shouldRenderWizard() {
$showUpdate = 0;
$explanation = '';
$res = $this->checkForUpdate($explanation, $showUpdate);
return ($showUpdate > 0 || $res == TRUE);
}
/**
* simple wrapper function that helps to check whether (if)
* this feature is cool if you want to tell the user that the update wizard
* is working fine, just as output (useful for the character set / utf8 wizard)
*
* @return boolean if the wizard should render the Next() button on the overview page
* @see checkForUpdate()
*/
public function shouldRenderNextButton() {
$showUpdate = 0;
$explanation = '';
$res = $this->checkForUpdate($explanation, $showUpdate);
return ($showUpdate != 2 || $res == TRUE);
}
}
?>
typo3/sysext/install/Resources/Private/Templates/UpdateWizardParts.html (Arbeitskopie)
</head>
<body>
<!-- ###CHECKFORUPDATE### begin -->
<p>If you upgrade your TYPO3 installation from one major version to another (e.g. 4.4 to 4.5), then the upgrade wizards guide you through the necessary steps to upgrade your database records or explicitly install extensions that ship with the latest TYPO3 version.</p>
<hr />
<!-- ###UPDATESAVAILABLE### begin -->
<!-- ###UPDATEWIZARDBOXES### begin -->
<form action="###ACTION####t3-install-bottom" method="post">
......
</ol>
</fieldset>
<!-- ###SINGLEUPDATEWIZARDBOX### begin -->
<h4>###IDENTIFIER###</h4>
<h4>###TITLE###</h4>
###EXPLANATION###
<fieldset class="t3-install-form-submit">
<ol>
......
</li>
</ol>
</fieldset>
<hr />
<!-- ###SINGLEUPDATEWIZARDBOX### end -->
</form>
<!-- ###UPDATEWIZARDBOXES### end -->
......
</li>
</ol>
</fieldset>
<p>
<h4>
###IDENTIFIER###
</h4>
</p>
<h4>###TITLE###</h4>
###IDENTIFIERMETHOD###
<!-- ###UPDATESAVAILABLE### end -->
<fieldset>
......
<!-- ###UPDATEITEMS### begin -->
<p class="innerWidth">
<strong>
###IDENTIFIER###
###TITLE###
</strong>
</p>
<!-- ###CHECKUSERINPUT### begin -->
......
</strong>
<!-- ###NOPERFORMUPDATE### end -->
<!-- ###UPDATEITEMS### end -->
<!-- ###NEXTUPDATEWIZARD### begin -->
<br /><br /><br /><hr />
<form action="index.php?TYPO3_INSTALL[type]=update" method="post">
<fieldset class="t3-install-hidden">
<ol>
<li>
<input name="TYPO3_INSTALL[database_type]" value="getUserInput" type="hidden">
</li>
</ol>
</fieldset>
<fieldset class="t3-install-form-submit">
<ol>
<li>
<button type="submit" name="TYPO3_INSTALL[update][###NEXTIDENTIFIER###]">
Go to the next update wizard.
</button>
</li>
</ol>
</fieldset>
</form>
<!-- ###NEXTUPDATEWIZARD### end -->
<!-- ###PERFORMUPDATE### end -->
</body>
</html>
typo3/sysext/install/Resources/Private/Templates/WriteToLocalConfControl.html (Arbeitskopie)
</head>
<body>
<!-- ###CONTINUE### begin -->
<h3>About configuration:</h3>
<h4 class="typo3-message message-ok">###HEADER###</h4>
<ul>
<!-- ###MESSAGES### begin -->
......
</p>
<!-- ###CONTINUE### end -->
<!-- ###NOCHANGE### begin -->
<h3>About configuration:</h3>
<h4 class="typo3-message message-warning">###HEADER###</h4>
<p>###MESSAGE###</p>
<p>
typo3/sysext/install/updates/class.tx_coreupdates_notinmenu.php (Arbeitskopie)
* @author Steffen Kamper <info@sk-typo3.de>
* @version $Id$
*/
class tx_coreupdates_notinmenu {
var $versionNumber; // version number coming from t3lib_div::int_from_ver()
/**
* parent object
*
* @var tx_install
*/
var $pObj;
var $userInput; // user input
class tx_coreupdates_notinmenu extends Tx_Install_Updates_Base {
protected $title = 'Update Pages with Doktype "Not in menu"';
/**
typo3/sysext/install/updates/class.tx_coreupdates_charsetdefaults.php (Arbeitskopie)
*
* @version $Id$
*/
class tx_coreupdates_charsetDefaults {
var $versionNumber; // version number coming from t3lib_div::int_from_ver()
var $needsExternalHelp = FALSE;
/**
* parent object
*
* @var tx_install
*/
var $pObj;
var $userInput; // user input
class tx_coreupdates_charsetDefaults extends Tx_Install_Updates_Base {
protected $title = 'Database Character Set';
/**
* Checks if the configuration is relying on old default values or not.
typo3/sysext/install/updates/class.tx_coreupdates_installnewsysexts.php (Arbeitskopie)
* @author Benjamin Mack <benni@typo3.org>
* @author Steffen Kamper <info@sk-typo3.de>
*/
class tx_coreupdates_installnewsysexts {
public $versionNumber; // version number coming from t3lib_div::int_from_ver()
class tx_coreupdates_installnewsysexts extends Tx_Install_Updates_Base {
protected $title = 'Install New System Extensions';
protected $newSystemExtensions = array('recycler', 't3editor', 'reports', 'scheduler');
/**
* parent object
*
* @var tx_install
*/
public $pObj;
public $userInput; // user input
/**
* Checks if an update is needed
*
* @param string &$description: The description for the update
typo3/sysext/install/updates/class.tx_coreupdates_cscsplit.php (Arbeitskopie)
* @author Susanne Moog <typo3@susanne-moog.de>
* @version $Id$
*/
class tx_coreupdates_cscsplit {
class tx_coreupdates_cscsplit extends Tx_Install_Updates_Base {
protected $title = 'Split TypoScript Templates from CSS Styled Content';
/**
* Function which checks if update is needed. Called in the beginning of an update process.
typo3/sysext/install/updates/class.tx_coreupdates_mergeadvanced.php (Arbeitskopie)
* @author Steffen Kamper <info@sk-typo3.de>
* @version $Id$
*/
class tx_coreupdates_mergeadvanced {
var $versionNumber; // version number coming from t3lib_div::int_from_ver()
/**
* parent object
*
* @var tx_install
*/
var $pObj;
var $userInput; // user input
class tx_coreupdates_mergeadvanced extends Tx_Install_Updates_Base {
protected $title = 'Update Pages with Pagetype "Advanced"';
/**
* Checks if an update is needed
typo3/sysext/install/updates/class.tx_coreupdates_imagescols.php (Arbeitskopie)
* @author Steffen Kamper <info@sk-typo3.de>
* @version
*/
class tx_coreupdates_imagecols {
var $versionNumber; // version number coming from t3lib_div::int_from_ver()
/**
* parent object
*
* @var tx_install
*/
var $pObj;
var $userInput; // user input
class tx_coreupdates_imagecols extends Tx_Install_Updates_Base {
protected $title = 'Update Existing Text w/ Image Content Elements';
/**
typo3/sysext/install/updates/class.tx_coreupdates_statictemplates.php (Arbeitskopie)
* @author Steffen Ritter <info@rs-websystems.de>
* @author Benjamin Mack <benni@typo3.org>
*/
class tx_coreupdates_statictemplates {
public $versionNumber; // version number coming from t3lib_div::int_from_ver()
public $pObj; // parent object (tx_install)
public $userInput; // user input
class tx_coreupdates_statictemplates extends Tx_Install_Updates_Base {
protected $title = 'Install Outsourced Static Templates (now in System Extension)';
/**
typo3/sysext/install/updates/class.tx_coreupdates_flagsfromsprite.php (Arbeitskopie)
* @author Ernesto Baschny <ernst@cron-it.de>
* @version $Id$
*/
class tx_coreupdates_flagsfromsprite {
public $versionNumber; // version number coming from t3lib_div::int_from_ver()
class tx_coreupdates_flagsfromsprite extends Tx_Install_Updates_Base {
protected $title = 'Update Graphics, Using Sprites for sys_language Records';
/**
* Checks if an update is needed
typo3/sysext/install/updates/class.tx_coreupdates_compatversion.php (Arbeitskopie)
* @author Sebastian Kurfürst <sebastian@garbage-group.de
* @version $Id$
*/
class tx_coreupdates_compatversion {
var $versionNumber; // version number coming from t3lib_div::int_from_ver()
/**
* parent object
*
* @var tx_install
*/
var $pObj;
var $userInput; // user input
class tx_coreupdates_compatversion extends Tx_Install_Updates_Base {
protected $title = 'Compatibility Version';
/**
* Function which checks if update is needed. Called in the beginning of an update process.
typo3/sysext/install/updates/class.tx_coreupdates_installsysexts.php (Arbeitskopie)
* @author Benjamin Mack <benni@typo3.org>
* @author Steffen Kamper <info@sk-typo3.de>
*/
class tx_coreupdates_installsysexts {
public $versionNumber; // version number coming from t3lib_div::int_from_ver()
class tx_coreupdates_installsysexts extends Tx_Install_Updates_Base {
protected $title = 'Install Outsourced System Extensions';
protected $newSystemExtensions = array('info', 'perm', 'func', 'filelist', 'about', 'cshmanual', 'feedit', 'opendocs', 'simulatestatic');
/**
* parent object
*
* @var tx_install
*/
public $pObj;
public $userInput; // user input
/**
* Checks if an update is needed
*
* @param string &$description: The description for the update
typo3/sysext/install/updates/class.tx_coreupdates_compressionlevel.php (Arbeitskopie)
*
* @author Steffen Ritter <info@rs-websystems.de>
*/
class tx_coreupdates_compressionlevel {
public $versionNumber; // version number coming from t3lib_div::int_from_ver()
public $pObj; // parent object (tx_install)
public $userInput; // user input
class tx_coreupdates_compressionlevel extends Tx_Install_Updates_Base {
protected $title = 'Check Compression Level';
/**
typo3/sysext/install/updates/class.tx_coreupdates_installversioning.php (Arbeitskopie)
*
* @author Rupert Germann
*/
class tx_coreupdates_installversioning {
public $versionNumber; // version number coming from t3lib_div::int_from_ver()
class tx_coreupdates_installversioning extends Tx_Install_Updates_Base {
protected $title = 'Versioning and Workspaces: Install System Extension';
protected $newSystemExtensions = array('version');
/**
* parent object
*
* @var tx_install
*/
public $pObj;
public $userInput; // user input
/**
* Checks if an update is needed
*
* @param string &$description: The description for the update
typo3/sysext/install/updates/class.tx_coreupdates_migrateworkspaces.php (Arbeitskopie)
* @version $Id$
*/
class tx_coreupdates_migrateworkspaces extends tx_coreupdates_installsysexts {
public $versionNumber; // version number coming from t3lib_div::int_from_ver()
/**
* parent object
*
* @var tx_install
*/
public $pObj;
public $userInput; // user input
public $sqlQueries;
/**
typo3/sysext/install/updates/class.tx_coreupdates_t3skin.php (Arbeitskopie)
*
* @author Steffen Ritter <info@rs-websystems.de>
*/
class tx_coreupdates_t3skin {
public $versionNumber; // version number coming from t3lib_div::int_from_ver()
public $pObj; // parent object (tx_install)
public $userInput; // user input
class tx_coreupdates_t3skin extends Tx_Install_Updates_Base {
protected $title = 'Install the new TYPO3 Skin "t3skin"';
/**
typo3/sysext/install/mod/class.tx_install.php (Arbeitskopie)
$singleUpdate = array();
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] as $identifier => $className) {
$tmpObj = $this->getUpgradeObjInstance($className, $identifier);
if (method_exists($tmpObj,'checkForUpdate')) {
if ($tmpObj->shouldRenderWizard()) {
$explanation = '';
$showUpdate = NULL;
// return value kept for backwards compatibility
$returnVal = $tmpObj->checkForUpdate($explanation, $showUpdate);
if ($showUpdate == NULL) {
$showUpdate = $returnVal;
}
if ($showUpdate > 0) {
$updateMarkers = array(
'next' => '<button type="submit" name="TYPO3_INSTALL[update][###IDENTIFIER###]">
Next
<span class="t3-install-form-button-icon-positive">&nbsp;</span>
</button>',
'identifier' => $identifier,
'explanation' => $explanation,
);
$tmpObj->checkForUpdate($explanation);
// only display the message, no button
if ($showUpdate === 2) {
$updateMarkers['next'] = '';
}
$updateMarkers = array(
'next' => '<button type="submit" name="TYPO3_INSTALL[update][###IDENTIFIER###]">
Next
<span class="t3-install-form-button-icon-positive">&nbsp;</span>
</button>',
'identifier' => $identifier,
'title' => $tmpObj->getTitle(),
'explanation' => $explanation,
);
$singleUpdate[] = t3lib_parsehtml::substituteMarkerArray(
$singleUpdateWizardBoxSubpart,
$updateMarkers,
'###|###',
TRUE,
FALSE
);
// only display the message, no button
if (!$tmpObj->shouldRenderNextButton()) {
$updateMarkers['next'] = '';
}
$singleUpdate[] = t3lib_parsehtml::substituteMarkerArray(
$singleUpdateWizardBoxSubpart,
$updateMarkers,
'###|###',
TRUE,
FALSE
);
}
}
......
$tmpObj = $this->getUpgradeObjInstance($className, $identifier);
$updateMarkers['identifier'] = $identifier;
$updateMarkers['title'] = $tmpObj->getTitle();
if (method_exists($tmpObj,'getUserInput')) {
$updateMarkers['identifierMethod'] = $tmpObj->getUserInput('TYPO3_INSTALL[update][' . $identifier . ']');
......
$tmpObj = $this->getUpgradeObjInstance($className, $identifier);
$updateItemsMarkers['identifier'] = $identifier;
$updateItemsMarkers['title'] = $tmpObj->getTitle();
// check user input if testing method is available
if (method_exists($tmpObj,'checkUserInput') && !$tmpObj->checkUserInput($customOutput)) {
$customOutput = '';
......
implode(chr(10), $updateItems)
);
$GLOBALS['TYPO3_DB']->store_lastBuiltQuery = FALSE;
// also render the link to the next update wizard, if available
$nextUpdateWizard = $this->getNextUpdadeWizardInstance($tmpObj);
if ($nextUpdateWizard) {
$content = t3lib_parsehtml::substituteMarkerArray(
$content,
array('NEXTIDENTIFIER' => $nextUpdateWizard->getIdentifier()),
'###|###',
TRUE,
FALSE
);
} else {
// no next wizard, also hide the button to the next update wizard
$content = t3lib_parsehtml::substituteSubpart(
$content,
'###NEXTUPDATEWIZARD###',
''
);
}
break;
}
$this->message('Update Wizard', $title, $content);
......
*/
function getUpgradeObjInstance($className, $identifier) {
$tmpObj = t3lib_div::getUserObj($className);
$tmpObj->setIdentifier($identifier);
$tmpObj->versionNumber = t3lib_div::int_from_ver(TYPO3_version);
$tmpObj->pObj = $this;
$tmpObj->userInput = $this->INSTALL['update'][$identifier];
......
}
/**
* returns the next upgrade wizard object, used to show the link/button to the next upgrade wizard
* @return mixed Upgrade Wizard instance or FALSE
*/
protected function getNextUpdadeWizardInstance($currentObj) {
$nextUpdateWizard = FALSE;
$isPreviousRecord = TRUE;
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] as $identifier => $className) {
// first, find the current update wizard, and then start validating the next ones
if ($currentObj->getIdentifier() == $identifier) {
$isPreviousRecord = FALSE;
continue;
}
if (!$isPreviousRecord) {
$nextUpdateWizard = $this->getUpgradeObjInstance($className, $identifier);
if ($nextUpdateWizard->shouldRenderUpdate()) {
return $nextUpdateWizard;
}
}
}
return FALSE;
}
/**
* Check if at lease one backend admin user has been created
*
* @return integer Amount of backend users in the database
    (1-1/1)