Skip to content

Commit

Permalink
[FEATURE] Update records with wrong references
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 FluidTYPO3#1176
  • Loading branch information
pixelbrackets committed Jan 3, 2017
1 parent e432719 commit c7edb45
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion class.ext_update.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,23 @@ public function access() {
* @return string
*/
public function main() {
$content = '';

$GLOBALS['TYPO3_DB']->exec_UPDATEquery('tt_content', 'colPos = -42', array('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 = \'\'', array('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 c7edb45

Please sign in to comment.