* This task deletes rows from tables older than the given number of days.
*
* Available tables must be registered in
- * $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask']['options']['tables']
+ * $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables']
* See ext_localconf.php of scheduler extension for an example
*
* @author Christian Kuhn <lolli@schwarzbu.ch>
* @return bool TRUE if task run was successful
*/
public function execute() {
- $tableConfigurations = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask']['options']['tables'];
+ $tableConfigurations = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks'][\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class]['options']['tables'];
$tableHandled = FALSE;
foreach ($tableConfigurations as $tableName => $configuration) {
if ($this->allTables || $tableName === $this->table) {
}
}
if (!$tableHandled) {
- throw new \RuntimeException('TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask misconfiguration: ' . $this->table . ' does not exist in configuration', 1308354399);
+ throw new \RuntimeException(\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class . ' misconfiguration: ' . $this->table . ' does not exist in configuration', 1308354399);
}
return TRUE;
}
$deleteTimestamp = strtotime('-' . $this->numberOfDays . 'days');
} else {
if (!isset($configuration['expirePeriod'])) {
- throw new \RuntimeException('TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask misconfiguration: No expirePeriod defined for table ' . $table, 1308355095);
+ throw new \RuntimeException(\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class . ' misconfiguration: No expirePeriod defined for table ' . $table, 1308355095);
}
$deleteTimestamp = strtotime('-' . $configuration['expirePeriod'] . 'days');
}
$where = $configuration['dateField'] . ' < ' . $deleteTimestamp;
} else {
- throw new \RuntimeException('TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask misconfiguration: Either expireField or dateField must be defined for table ' . $table, 1308355268);
+ throw new \RuntimeException(\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class . ' misconfiguration: Either expireField or dateField must be defined for table ' . $table, 1308355268);
}
$GLOBALS['TYPO3_DB']->exec_DELETEquery($table, $where);
$error = $GLOBALS['TYPO3_DB']->sql_error();
if ($error) {
- throw new \RuntimeException('TYPO3\\CMS\\Scheduler\\Task\\TableGarbageCollectionTask failed for table ' . $this->table . ' with error: ' . $error, 1308255491);
+ throw new \RuntimeException(\TYPO3\CMS\Scheduler\Task\TableGarbageCollectionTask::class . ' failed for table ' . $this->table . ' with error: ' . $error, 1308255491);
}
return TRUE;
}