Skip to content

Commit

Permalink
[TASK] Added Migrationscript for *bootstrap elements and pages
Browse files Browse the repository at this point in the history
  • Loading branch information
randomresult committed May 20, 2014
1 parent a11db71 commit 683ff38
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions class.ext_update.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

/**
* Class ext_update
*
* Performs update tasks migrating *bootstrap-EXT to fluidbootstraptheme
*
*
*/
class ext_update {
/**
* @return boolean
*/
public function access() {
return TRUE;
}
/**
* @return string
*/
public function main() {

//select all Contentelements from Fluidcontent_bootstrap and migrate them

$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', '`tx_fed_fcefile` LIKE "FluidTYPO3.Fluidcontentbootstrap:%"', 'tx_fed_fcefile', '', '');

while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$replaced = str_replace('FluidTYPO3.FluidcontentBootstrap', 'fluidbootstraptheme', $row['tx_fed_fcefile']);

$GLOBALS['TYPO3_DB']->exec_UPDATEquery('tt_content', 'tx_fed_fcefile = "'.$row['tx_fed_fcefile'].'"', array('tx_fed_fcefile' => $replaced));
$updated.= $GLOBALS['TYPO3_DB']->sql_affected_rows() . ' rows have been updated for '.$row['tx_fed_fcefile'].'';
$updated.= '<br />';
}

//select all Pagetemplates from Fluidpages_bootstrap and migrate them

$respages = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', '`tx_fed_page_controller_action` LIKE "fluidpages_bootstrap%"', 'tx_fed_page_controller_action', '', '');

while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($respages)) {
$replacedpages = str_replace('fluidpages_bootstrap', 'fluidbootstraptheme', $row['tx_fed_page_controller_action']);

$GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'tx_fed_page_controller_action = "'.$row['tx_fed_page_controller_action'].'"', array('tx_fed_page_controller_action' => $replacedpages));
$updated.= $GLOBALS['TYPO3_DB']->sql_affected_rows() . ' rows have been updated for '.$row['tx_fed_page_controller_action'].'';
$updated.= '<br />';
}

//fix all templates for Subpages

$ressubpages = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'pages', '`tx_fed_page_controller_action_sub` LIKE "fluidpages_bootstrap%"', 'tx_fed_page_controller_action_sub', '', '');

while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($ressubpages)) {
$replacedsubpages = str_replace('fluidpages_bootstrap', 'fluidbootstraptheme', $row['tx_fed_page_controller_action_sub']);

$GLOBALS['TYPO3_DB']->exec_UPDATEquery('pages', 'tx_fed_page_controller_action_sub = "'.$row['tx_fed_page_controller_action_sub'].'"', array('tx_fed_page_controller_action_sub' => $replacedsubpages));
$updated.= $GLOBALS['TYPO3_DB']->sql_affected_rows() . ' rows have been updated for '.$row['tx_fed_page_controller_action_sub'].'';
$updated.= '<br />';

}

return $updated;
}
}

0 comments on commit 683ff38

Please sign in to comment.