29 protected $title =
'[Optional] Update sys_file_processedfile records to match new checksum calculation.';
42 $join =
'sys_file_processedfile LEFT JOIN sys_registry ON entry_key = sys_file_processedfile.uid AND entry_namespace = \'ProcessedFileChecksumUpdate\'';
43 $count = $this->
getDatabaseConnection()->exec_SELECTcountRows(
'*', $join,
'(entry_key IS NULL AND sys_file_processedfile.identifier <> \'\') OR sys_file_processedfile.width IS NULL');
48 $description =
'The checksum calculation for processed files (image thumbnails) has been changed with TYPO3 CMS 7.3 and 6.2.13. 49 This means that your processed files need to be updated, if you update from versions <strong>below TYPO3 CMS 7.3 or 6.2.13</strong>.<br /> 50 This can either happen on demand, when the processed file is first needed, or by executing this wizard, which updates all processed images at once.<br /> 51 <strong>Important:</strong> If you have lots of processed files, you should prefer using this wizard, otherwise this might cause a lot of work for your server.';
63 public function performUpdate(array &$databaseQueries, &$customMessages) {
67 $db->exec_DELETEquery(
'sys_file_processedfile',
'width IS NULL or height IS NULL');
71 $join =
'sys_file_processedfile LEFT JOIN sys_registry ON entry_key = sys_file_processedfile.uid AND entry_namespace = \'ProcessedFileChecksumUpdate\'';
72 $res = $db->exec_SELECTquery(
'sys_file_processedfile.*', $join,
'entry_key IS NULL AND sys_file_processedfile.identifier <> \'\'');
73 while ($processedFileRow = $db->sql_fetch_assoc($res)) {
74 $storage = $factory->getStorageObject($processedFileRow[
'storage']);
77 $db->exec_DELETEquery(
'sys_file_processedfile',
'uid=' . $processedFileRow[
'uid']);
81 if ($storage->getDriverType() !==
'Local') {
83 $db->exec_INSERTquery(
'sys_registry', array(
'entry_namespace' =>
'ProcessedFileChecksumUpdate',
'entry_key' => $processedFileRow[
'uid']));
87 $configuration = $storage->getConfiguration();
88 if ($configuration[
'pathType'] ===
'relative') {
89 $absoluteBasePath = PATH_site . $configuration[
'basePath'];
91 $absoluteBasePath = $configuration[
'basePath'];
93 $filePath = rtrim($absoluteBasePath,
'/') .
'/' . ltrim($processedFileRow[
'identifier'],
'/');
96 $originalFile = $factory->getFileObject($processedFileRow[
'original']);
100 $db->exec_DELETEquery(
'sys_file_processedfile',
'uid=' . $processedFileRow[
'uid']);
104 $processedFileObject =
new ProcessedFile($originalFile,
'', array(), $processedFileRow);
107 $newChecksum = $processedFileObject->calculateChecksum();
110 if ($newChecksum !== $processedFileRow[
'checksum']) {
111 $newName = str_replace($processedFileRow[
'checksum'], $newChecksum, $processedFileRow[
'name']);
112 $newIdentifier = str_replace($processedFileRow[
'checksum'], $newChecksum, $processedFileRow[
'identifier']);
113 $newFilePath = str_replace($processedFileRow[
'checksum'], $newChecksum, $filePath);
116 if (@rename($filePath, $newFilePath)) {
120 'identifier' => $newIdentifier,
122 'checksum' => $newChecksum
124 $db->exec_UPDATEquery(
'sys_file_processedfile',
'uid=' . $processedFileRow[
'uid'], $fields);
130 $db->exec_INSERTquery(
'sys_registry', array(
'entry_namespace' =>
'ProcessedFileChecksumUpdate',
'entry_key' => $processedFileRow[
'uid']));
133 $db->exec_DELETEquery(
'sys_registry',
'entry_namespace = \'ProcessedFileChecksumUpdate\'');
static makeInstance($className)
markWizardAsDone($confValue=1)
checkForUpdate(&$description)
performUpdate(array &$databaseQueries, &$customMessages)