‪TYPO3CMS  10.4
FileStorageExtractionTask.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 ‪$maxFileCount = 100;
42 
48  public function ‪execute()
49  {
50  $success = false;
51  if ((int)$this->storageUid > 0) {
52  $storage = GeneralUtility::makeInstance(ResourceFactory::class)->getStorageObject($this->storageUid);
53  $currentEvaluatePermissionsValue = $storage->getEvaluatePermissions();
54  $storage->setEvaluatePermissions(false);
55  $indexer = $this->‪getIndexer($storage);
56  try {
57  $indexer->runMetaDataExtraction((int)$this->maxFileCount);
58  $success = true;
59  } catch (\Exception $e) {
60  $success = false;
61  $this->‪logException($e);
62  }
63  $storage->setEvaluatePermissions($currentEvaluatePermissionsValue);
64  }
65  return $success;
66  }
67 
74  protected function ‪getIndexer(‪ResourceStorage $storage)
75  {
76  return GeneralUtility::makeInstance(Indexer::class, $storage);
77  }
78 }
‪TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask\getIndexer
‪TYPO3 CMS Core Resource Index Indexer getIndexer(ResourceStorage $storage)
Definition: FileStorageExtractionTask.php:72
‪TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask
Definition: FileStorageExtractionTask.php:28
‪TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask\$maxFileCount
‪int $maxFileCount
Definition: FileStorageExtractionTask.php:39
‪TYPO3\CMS\Core\Resource\Index\Indexer
Definition: Indexer.php:34
‪TYPO3\CMS\Scheduler\Task
Definition: AbstractTask.php:16
‪TYPO3\CMS\Scheduler\Task\AbstractTask
Definition: AbstractTask.php:35
‪TYPO3\CMS\Core\Resource\ResourceFactory
Definition: ResourceFactory.php:41
‪TYPO3\CMS\Scheduler\Task\AbstractTask\logException
‪logException(\Exception $e)
Definition: AbstractTask.php:597
‪TYPO3\CMS\Core\Resource\ResourceStorage
Definition: ResourceStorage.php:122
‪TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask\$storageUid
‪int $storageUid
Definition: FileStorageExtractionTask.php:33
‪TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask\execute
‪bool execute()
Definition: FileStorageExtractionTask.php:46
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46