[TASK] Re-work/simplify copyright header in PHP files - Part 1
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Updates / TruncateSysFileProcessedFileTable.php
1 <?php
2 namespace TYPO3\CMS\Install\Updates;
3
4 /**
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 /**
18 * Upgrade wizard which will truncate the sys_file_processedfile table
19 */
20 class TruncateSysFileProcessedFileTable extends AbstractUpdate {
21
22 /**
23 * @var string
24 */
25 protected $title = 'Truncate all processed files to clean up obsolete records.';
26
27 /**
28 * Checks whether updates are required.
29 *
30 * @param string &$description The description for the update
31 * @return boolean Whether an update is required (TRUE) or not (FALSE)
32 */
33 public function checkForUpdate(&$description) {
34 if ($this->isWizardDone() || !$this->checkIfTableExists('sys_file_processedfile')) {
35 return FALSE;
36 }
37
38 $description = 'To re-process all files correctly we truncate the table. This will make sure there are no obsolete files in the database.';
39 return TRUE;
40 }
41
42 /**
43 * Performs the accordant updates.
44 *
45 * @param array &$databaseQueries Queries done in this update
46 * @param mixed &$customMessages Custom messages
47 * @return boolean Whether everything went smoothly or not
48 */
49 public function performUpdate(array &$databaseQueries, &$customMessages) {
50 $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('sys_file_processedfile');
51 $databaseQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
52 $this->markWizardAsDone();
53 return TRUE;
54 }
55
56 }
57 ?>