[TASK] Add hashcolumn to field configuration of sys_file_processedfile
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Updates / TruncateSysFileProcessedFileTable.php
1 <?php
2 namespace TYPO3\CMS\Install\Updates;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2013 Wouter Wolters <typo3@wouterwolters.nl>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 /**
28 * Upgrade wizard which will truncate the sys_file_processedfile table
29 */
30 class TruncateSysFileProcessedFileTable extends AbstractUpdate {
31
32 /**
33 * @var string
34 */
35 protected $title = 'Truncate all processed files to clean up obsolete records.';
36
37 /**
38 * Checks whether updates are required.
39 *
40 * @param string &$description The description for the update
41 * @return boolean Whether an update is required (TRUE) or not (FALSE)
42 */
43 public function checkForUpdate(&$description) {
44 if ($this->isWizardDone() || !$this->checkIfTableExists('sys_file_processedfile')) {
45 return FALSE;
46 }
47
48 $description = 'To re-process all files correctly we truncate the table. This will make sure there are no obsolete files in the database.';
49 return TRUE;
50 }
51
52 /**
53 * Performs the accordant updates.
54 *
55 * @param array &$databaseQueries Queries done in this update
56 * @param mixed &$customMessages Custom messages
57 * @return boolean Whether everything went smoothly or not
58 */
59 public function performUpdate(array &$databaseQueries, &$customMessages) {
60 $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('sys_file_processedfile');
61 $databaseQueries[] = $GLOBALS['TYPO3_DB']->debug_lastBuiltQuery;
62 $this->markWizardAsDone();
63 return TRUE;
64 }
65
66 }
67 ?>