2 namespace TYPO3\CMS\Core\Resource\Index;
43 'uid',
'pid',
'missing',
'type',
'storage',
'identifier',
'identifier_hash',
'extension',
44 'mime_type',
'name',
'sha1',
'size',
'creation_date',
'modification_date',
'folder_hash'
64 return \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance();
99 implode(
',', $this->fields),
101 'uid=' . (
int)$fileUid
103 return is_array($row) ? $row :
false;
117 $identifierHash = $this->
getResourceFactory()->getStorageObject($storageUid)->hashFileIdentifier($identifier);
133 implode(
',', $this->fields),
135 sprintf(
'storage=%u AND identifier_hash=%s', (
int)$storageUid, $this->
getDatabaseConnection()->fullQuoteStr($identifierHash, $this->table))
137 return is_array($row) ? $row :
false;
150 $storageUid = $fileObject->getStorage()->getUid();
151 $identifierHash = $fileObject->getHashedIdentifier();
164 if (!preg_match(
'/^[0-9a-f]{40}$/i', $hash)) {
168 implode(
',', $this->fields),
184 implode(
',', $this->fields),
187 ' AND storage = ' . (
int)$folder->getStorage()->getUid(),
206 $folderIdentifiers = [];
208 foreach ($folders as $folder) {
209 if (!$folder instanceof \TYPO3\CMS\Core\Resource\
Folder) {
213 $storageUids[] = (int)$folder->getStorage()->getUid();
214 $folderIdentifiers[] = $folder->getHashedIdentifier();
216 $storageUids = array_unique($storageUids);
217 $folderIdentifiers = array_unique($folderIdentifiers);
220 implode(
',', $this->fields),
222 'folder_hash IN ( ' . implode(
',', $this->
getDatabaseConnection()->fullQuoteArray($folderIdentifiers, $this->table)) .
')' .
223 ' AND storage IN (' . implode(
',', $storageUids) .
')' .
224 ($includeMissing ?
'' :
' AND missing = 0'),
273 $data = array_intersect_key($data, array_flip($this->fields));
274 $data[
'tstamp'] = time();
277 $this->updateRefIndex($data[
'uid']);
301 $updateRow = array();
302 foreach ($updatedProperties as $key) {
305 if (!empty($updateRow)) {
306 $updateRow[
'tstamp'] = time();
308 $this->updateRefIndex($file->
getUid());
323 implode(
',', $this->fields),
325 'tstamp > last_indexed AND storage = ' . (
int)$storage->getUid(),
328 (int)$limit > 0 ? (
int)$limit :
''
342 $where =
'storage = ' . (int)$storage->getUid();
343 if (!empty($uidList)) {
344 $where .=
' AND uid NOT IN (' . implode(
',', $this->
getDatabaseConnection()->cleanIntArray($uidList)) .
')';
346 return $this->
getDatabaseConnection()->exec_SELECTgetRows(implode(
',', $this->fields), $this->table, $where);
357 $this->
getDatabaseConnection()->exec_UPDATEquery($this->table,
'uid = ' . (
int)$fileUid, array(
'last_indexed' => time()));
368 $this->
getDatabaseConnection()->exec_UPDATEquery($this->table,
'uid = ' . (
int)$fileUid, array(
'missing' => 1));
382 $where =
'uid=' . (int)$file->
getUid();
385 'storage=%u AND identifier LIKE %s',
399 public function remove($fileUid)
402 $this->updateRefIndex($fileUid);
413 public function updateRefIndex($id)
417 $refIndexObj->updateRefIndexTable($this->table, $id);
428 return $this->
getObjectManager()->get(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
438 return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
451 $this->
getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\Index\FileIndexRepository::class,
'recordUpdated', array($data));
462 $this->
getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\Index\FileIndexRepository::class,
'recordCreated', array($data));
473 $this->
getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\Index\FileIndexRepository::class,
'recordDeleted', array($fileUid));
484 $this->
getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\Index\FileIndexRepository::class,
'recordMarkedAsMissing', array($fileUid));