Skip to content

Commit

Permalink
[FEATURE] Fix records references in EM update script
Browse files Browse the repository at this point in the history
Enable the update script, which may be run in the
extension manager, to fix records with wrong
references (wrongly assigned »flux parent«) automatically.

Refs #1176
  • Loading branch information
pixelbrackets authored and NamelessCoder committed Jan 4, 2017
1 parent fd288e8 commit 69273f2
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions class.ext_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,37 @@
* Performs update tasks for extension flux
*/
// @codingStandardsIgnoreStart
class ext_update {
class ext_update
{

/**
* @return boolean
*/
public function access() {
return TRUE;
return true;
}

/**
* @return string
*/
public function main() {
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('tt_content', 'colPos = -42', array('colPos' => 18181));
$content = '';

$GLOBALS['TYPO3_DB']->exec_UPDATEquery('tt_content', 'colPos = -42', ['colPos' => 18181]);
$content .= 'Switch to positive colPos (see #477): ' .
$GLOBALS['TYPO3_DB']->sql_affected_rows() . ' rows affected' . PHP_EOL;

// Fix records with wrong references (see #1176)
$GLOBALS['TYPO3_DB']->exec_UPDATEquery('tt_content', 'tx_flux_parent > 0 AND tx_flux_column = \'\'', ['tx_flux_parent' => 0]);
$content .= 'Fix records with wrong references (see #1176): ' .
$GLOBALS['TYPO3_DB']->sql_affected_rows() . ' rows affected' . PHP_EOL;

$GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cf_extbase_reflection');
$GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cf_extbase_reflection_tags');
$GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cf_extbase_object');
$GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cf_extbase_object_tags');
return $GLOBALS['TYPO3_DB']->sql_affected_rows() . ' rows have been updated. System object caches cleared.';
$content .= 'System object caches cleared.' . PHP_EOL;

return nl2br($content);
}
}

0 comments on commit 69273f2

Please sign in to comment.