‪TYPO3CMS  9.5
FileStorageExtractionTask.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
22 {
28  public ‪$storageUid = -1;
29 
35  public ‪$maxFileCount = 100;
36 
42  public function ‪execute()
43  {
44  $success = false;
45  if ((int)$this->storageUid > 0) {
47  $currentEvaluatePermissionsValue = $storage->‪getEvaluatePermissions();
48  $storage->setEvaluatePermissions(false);
49  $indexer = $this->‪getIndexer($storage);
50  try {
51  $indexer->runMetaDataExtraction((int)$this->maxFileCount);
52  $success = true;
53  } catch (\Exception $e) {
54  $success = false;
55  $this->‪logException($e);
56  }
57  $storage->setEvaluatePermissions($currentEvaluatePermissionsValue);
58  }
59  return $success;
60  }
61 
68  protected function ‪getIndexer(\‪TYPO3\CMS\Core\Resource\ResourceStorage $storage)
69  {
70  return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\‪TYPO3\CMS\Core\Resource\Index\Indexer::class, $storage);
71  }
72 }
‪TYPO3\CMS\Core\Resource\ResourceStorage\getEvaluatePermissions
‪bool getEvaluatePermissions()
Definition: ResourceStorage.php:590
‪TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask
Definition: FileStorageExtractionTask.php:22
‪TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask\$maxFileCount
‪int $maxFileCount
Definition: FileStorageExtractionTask.php:33
‪TYPO3
‪TYPO3\CMS\Scheduler\Task
Definition: AbstractTask.php:2
‪TYPO3\CMS\Core\Resource\ResourceFactory\getInstance
‪static ResourceFactory getInstance()
Definition: ResourceFactory.php:39
‪TYPO3\CMS\Scheduler\Task\AbstractTask
Definition: AbstractTask.php:32
‪TYPO3\CMS\Scheduler\Task\AbstractTask\logException
‪logException(\Exception $e)
Definition: AbstractTask.php:594
‪TYPO3\CMS\Core\Resource\ResourceFactory\getStorageObject
‪ResourceStorage getStorageObject($uid, array $recordData=[], &$fileIdentifier=null)
Definition: ResourceFactory.php:131
‪TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask\$storageUid
‪int $storageUid
Definition: FileStorageExtractionTask.php:27
‪TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask\execute
‪bool execute()
Definition: FileStorageExtractionTask.php:40
‪TYPO3\CMS\Scheduler\Task\FileStorageExtractionTask\getIndexer
‪TYPO3 CMS Core Resource Index Indexer getIndexer(\TYPO3\CMS\Core\Resource\ResourceStorage $storage)
Definition: FileStorageExtractionTask.php:66