28 protected $title =
'Add the file identifier hash to existing sys_file records and update the settings for local storages';
62 $this->storages = $this->storageRepository->findAll();
74 $description =
'Add file identifier hash to sys_file records, where it is missing. Additionally upgrade storage configurations.';
75 $unhashedFileCount = $this->db->exec_SELECTcountRows(
78 'identifier_hash = ' . $this->db->fullQuoteStr(
'',
'sys_file') .
' OR folder_hash = ' . $this->db->fullQuoteStr(
'',
'sys_file')
81 $unmigratedStorageCount = $this->db->exec_SELECTcountRows(
84 'driver = ' . $this->db->fullQuoteStr(
'Local',
'sys_file_storage') .
' AND configuration NOT LIKE ' . $this->db->fullQuoteStr(
'%caseSensitive%',
'sys_file_storage')
87 return $unhashedFileCount > 0 || $unmigratedStorageCount > 0;
99 foreach ($this->storages as $storage) {
103 $dbQueries = array_merge($dbQueries, $this->migrateStorages());
112 protected function migrateStorages() {
113 $dbQueries = array();
114 $unmigratedStorages = $this->db->exec_SELECTgetRows(
115 'uid, configuration',
117 'driver = ' . $this->db->fullQuoteStr(
'Local',
'sys_file_storage') .
' AND configuration NOT LIKE ' . $this->db->fullQuoteStr(
'%caseSensitive%',
'sys_file_storage')
124 foreach ($unmigratedStorages as $storage) {
125 $flexFormXml = $storage[
'configuration'];
129 $configurationArray[
'data'][
'sDEF'][
'lDEF'][
'pathType'][
'vDEF'] ==
'relative' ?
130 PATH_site . $configurationArray[
'data'][
'sDEF'][
'lDEF'][
'basePath'][
'vDEF'] :
131 $configurationArray[
'data'][
'sDEF'][
'lDEF'][
'basePath'][
'vDEF']
133 $configurationArray[
'data'][
'sDEF'][
'lDEF'][
'caseSensitive'] = array(
'vDEF' => $caseSensitive);
135 $configuration = $flexObj->flexArray2Xml($configurationArray);
136 $dbQueries[] = $query = $this->db->UPDATEquery(
138 'uid=' . $storage[
'uid'],
140 'configuration' => $configuration
143 $this->db->sql_query($query);
161 $updateCall =
'SHA1(identifier)';
163 $updateCall =
'SHA1(LOWER(identifier))';
165 $queries[] = $query = sprintf(
166 'UPDATE sys_file SET identifier_hash = %s WHERE storage=%d',
170 $this->db->sql_query($query);
173 $files = $this->db->exec_SELECTgetRows(
'uid, storage, identifier',
'sys_file',
174 sprintf(
'storage=%d AND folder_hash=%s', $storage->
getUid(), $this->db->fullQuoteStr(
'',
'sys_file'))
177 foreach ($files as $file) {
180 $queries[] = $query = $this->db->UPDATEquery(
182 'uid=' . $file[
'uid'],
184 'folder_hash' => $folderHash
188 $this->db->sql_query($query);
192 $files = $this->db->exec_SELECTgetRows(
'uid, storage, identifier',
'sys_file',
193 sprintf(
'storage=%d AND identifier_hash=""', $storage->
getUid())
196 foreach ($files as $file) {
197 $hash = $storage->hashFileIdentifier($file[
'identifier']);
200 $queries[] = $query = $this->db->UPDATEquery(
202 'uid=' . $file[
'uid'],
204 'identifier_hash' => $hash,
205 'folder_hash' => $folderHash
209 $this->db->sql_query($query);
224 $caseSensitive = TRUE;
225 $path = rtrim($absolutePath,
'/') .
'/aAbB';
226 $testFileExists = file_exists($path);
229 if (!$testFileExists) {
234 if (file_exists(strtoupper($path)) && file_exists(strtolower($path))) {
235 $caseSensitive = FALSE;
239 if (!$testFileExists) {
243 return $caseSensitive;
getFolderIdentifierFromFileIdentifier($fileIdentifier)
updateIdentifierHashesForStorage(ResourceStorage $storage)
performUpdate(array &$dbQueries, &$customMessages)
usesCaseSensitiveIdentifiers()
static makeInstance($className)
testCaseSensitivity($absolutePath)
static isLoaded($key, $exitOnError=FALSE)
markWizardAsDone($confValue=1)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static xml2array($string, $NSprefix='', $reportDocTag=FALSE)
checkForUpdate(&$description)