‪TYPO3CMS  ‪main
FileStorageIndexingTask.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
22 
28 {
34  public ‪$storageUid = -1;
35 
41  public function ‪execute()
42  {
43  if ((int)$this->storageUid > 0) {
44  $storage = GeneralUtility::makeInstance(StorageRepository::class)->findByUid($this->storageUid);
45  if ($storage === null) {
46  throw new \RuntimeException(self::class . ' misconfiguration: "Storage to index" must be an existing storage.', 1615020908);
47  }
48  $currentEvaluatePermissionsValue = $storage->getEvaluatePermissions();
49  $storage->setEvaluatePermissions(false);
50  $indexer = $this->‪getIndexer($storage);
51  $indexer->processChangesInStorages();
52  $storage->setEvaluatePermissions($currentEvaluatePermissionsValue);
53  }
54  return true;
55  }
56 
62  protected function ‪getIndexer(‪ResourceStorage $storage)
63  {
64  return GeneralUtility::makeInstance(Indexer::class, $storage);
65  }
66 }
‪TYPO3\CMS\Core\Resource\Index\Indexer
Definition: Indexer.php:35
‪TYPO3\CMS\Scheduler\Task
Definition: AbstractTask.php:16
‪TYPO3\CMS\Scheduler\Task\FileStorageIndexingTask\execute
‪bool execute()
Definition: FileStorageIndexingTask.php:40
‪TYPO3\CMS\Scheduler\Task\AbstractTask
Definition: AbstractTask.php:33
‪TYPO3\CMS\Scheduler\Task\FileStorageIndexingTask
Definition: FileStorageIndexingTask.php:28
‪TYPO3\CMS\Core\Resource\StorageRepository
Definition: StorageRepository.php:38
‪TYPO3\CMS\Core\Resource\ResourceStorage
Definition: ResourceStorage.php:129
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:52
‪TYPO3\CMS\Scheduler\Task\FileStorageIndexingTask\getIndexer
‪TYPO3 CMS Core Resource Index Indexer getIndexer(ResourceStorage $storage)
Definition: FileStorageIndexingTask.php:61
‪TYPO3\CMS\Scheduler\Task\FileStorageIndexingTask\$storageUid
‪int $storageUid
Definition: FileStorageIndexingTask.php:33