[TASK] Use name-resolution instead of strings where possible: 12
[Packages/TYPO3.CMS.git] / typo3 / sysext / scheduler / Classes / Task / TableGarbageCollectionTask.php
index b4ee419..0c3f2a7 100644 (file)
@@ -20,7 +20,7 @@ namespace TYPO3\CMS\Scheduler\Task;
  * 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>
@@ -49,7 +49,7 @@ class TableGarbageCollectionTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask
         * @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) {
@@ -58,7 +58,7 @@ class TableGarbageCollectionTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask
                        }
                }
                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;
        }
@@ -83,18 +83,18 @@ class TableGarbageCollectionTask extends \TYPO3\CMS\Scheduler\Task\AbstractTask
                                $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;
        }