[TYPO3-core] RFC: update wizard

Kasper Skårhøj kasper2005 at typo3.com
Mon Dec 19 15:02:29 CET 2005


Great idea, Sebastian,

+1 for concept

I didn't read you code in details, but its a good start I suppose.

- kasper


On Sunday 13 November 2005 16:33, Sebastian Kurfuerst wrote:
> Hi,
> an update wizard was already discussed multiple times on this list, and
> to me it seemed that we really need it for bigger changes, that's why I
> implemented one.
>
> The attached patch creates an update wizard for TYPO3, it adds it to the
> install tool - section database analyser.
>
> Functionality:
>
> Every update consists of some simple steps:
>      1. is update necessary?
>      2. is some alternative information from the user needed?
>      3. perform update
>
>
> With the new API, it is very easy to create such an update, an example
> follows below.
>
> As an example, I implemented Michael's doktype "not in menu" conversion,
> which uses only step (1) and (3), but step 2 is implemented in the API
> as well.
>
> all updates are added to
> $TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update'], so in our
> example, the correct line for the doctype conversion is:
> $TYPO3_CONF_VARS['SC_OPTIONS']['ext/install']['update']['notInMenu_doctype_
>conversion'] = 'tx_coreupdates_notinmenu';
>
> The function called at first is "checkForUpdate", which returns 1 if an
> update is needed and 0 if not. The description contains a description of
> the update and is a pointer.
>
> checkForUpdate($version, description)	 {
> 	$description = 'Removes the doctype "not in menu" which is deprecated and
> sets instead the flag "not in menu".'; if($version >= 400)	{
> 			$res =
> $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid','pages','doktype=5');
> if($GLOBALS['TYPO3_DB']->sql_num_rows($res))	{
> 				return 1;
> 			}
> 		}
> 		return 0;
> 	}
> }
>
> The update itself is defined like this:
>
>
> 	function performUpdate($version, $userInput, $dbQueries,
> $customMessages)	{ if($version >= 400)	{
> 			$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
> 		}
> 	}
>
> This should be pretty self-explanatory. $dbQueries is a pointer which
> needs to contain all DB queries made by the update function, and
> $customMessages is a pointer through which custom messages can be set.
>
>
>
>
> I am very curious to hear your thoughts about this!
> Greets, Sebastian

-- 
- kasper

-----------------
"A 'please' would be nice", John Travolta, Pulp Fiction



More information about the TYPO3-team-core mailing list