[CLEANUP] FAL code 28/45628/4
authorBenni Mack <benni@typo3.org>
Thu, 7 Jan 2016 10:05:32 +0000 (11:05 +0100)
committerBenni Mack <benni@typo3.org>
Fri, 8 Jan 2016 11:43:40 +0000 (12:43 +0100)
* Remove absolute namespaces where not necessary
* Define undefined class members and variables
* Add type checks before calling methods

Resolves: #72578
Releases: master
Change-Id: Ie0295be3693885b4ed2386877790d205291a1085
Reviewed-on: https://review.typo3.org/45628
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
36 files changed:
typo3/sysext/core/Classes/Resource/AbstractFile.php
typo3/sysext/core/Classes/Resource/AbstractRepository.php
typo3/sysext/core/Classes/Resource/Collection/AbstractFileCollection.php
typo3/sysext/core/Classes/Resource/Collection/CategoryBasedFileCollection.php
typo3/sysext/core/Classes/Resource/Collection/FileCollectionRegistry.php
typo3/sysext/core/Classes/Resource/Collection/FolderBasedFileCollection.php
typo3/sysext/core/Classes/Resource/Collection/StaticFileCollection.php
typo3/sysext/core/Classes/Resource/Driver/AbstractHierarchicalFilesystemDriver.php
typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php
typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php
typo3/sysext/core/Classes/Resource/File.php
typo3/sysext/core/Classes/Resource/FileCollectionRepository.php
typo3/sysext/core/Classes/Resource/FileReference.php
typo3/sysext/core/Classes/Resource/FileRepository.php
typo3/sysext/core/Classes/Resource/Filter/FileExtensionFilter.php
typo3/sysext/core/Classes/Resource/Filter/FileNameFilter.php
typo3/sysext/core/Classes/Resource/Hook/FileInfoHook.php
typo3/sysext/core/Classes/Resource/InaccessibleFolder.php
typo3/sysext/core/Classes/Resource/Index/ExtractorRegistry.php
typo3/sysext/core/Classes/Resource/Index/FileIndexRepository.php
typo3/sysext/core/Classes/Resource/Index/Indexer.php
typo3/sysext/core/Classes/Resource/Index/MetaDataRepository.php
typo3/sysext/core/Classes/Resource/ProcessedFile.php
typo3/sysext/core/Classes/Resource/ProcessedFileRepository.php
typo3/sysext/core/Classes/Resource/Processing/LocalImageProcessor.php
typo3/sysext/core/Classes/Resource/Processing/TaskTypeRegistry.php
typo3/sysext/core/Classes/Resource/Rendering/RendererRegistry.php
typo3/sysext/core/Classes/Resource/ResourceFactory.php
typo3/sysext/core/Classes/Resource/ResourceStorage.php
typo3/sysext/core/Classes/Resource/Service/FileProcessingService.php
typo3/sysext/core/Classes/Resource/Service/UserFileInlineLabelService.php
typo3/sysext/core/Classes/Resource/Service/UserFileMountService.php
typo3/sysext/core/Classes/Resource/Service/UserStorageCapabilityService.php
typo3/sysext/core/Classes/Resource/StorageRepository.php
typo3/sysext/core/Classes/Resource/Utility/BackendUtility.php
typo3/sysext/core/Classes/Resource/Utility/ListUtility.php

index a06657d..7736871 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Core\Resource;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
 
 /**
@@ -417,7 +418,7 @@ abstract class AbstractFile implements FileInterface
      */
     public function getCombinedIdentifier()
     {
-        if (is_array($this->properties) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->properties['storage'])) {
+        if (is_array($this->properties) && MathUtility::canBeInterpretedAsInteger($this->properties['storage'])) {
             $combinedIdentifier = $this->properties['storage'] . ':' . $this->getIdentifier();
         } else {
             $combinedIdentifier = $this->getStorage()->getUid() . ':' . $this->getIdentifier();
index 19418b9..de1f035 100644 (file)
@@ -13,6 +13,9 @@ namespace TYPO3\CMS\Core\Resource;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\MathUtility;
 
 /**
  * Abstract repository implementing the basic repository methods
@@ -40,11 +43,18 @@ abstract class AbstractRepository implements \TYPO3\CMS\Extbase\Persistence\Repo
     protected $type = '';
 
     /**
+     * The main object type of this class
+     *
+     * @var string
+     */
+    protected $objectType;
+
+    /**
      * Creates this object.
      */
     public function __construct()
     {
-        $this->factory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\ResourceFactory::class);
+        $this->factory = GeneralUtility::makeInstance(ResourceFactory::class);
     }
 
     /**
@@ -119,17 +129,18 @@ abstract class AbstractRepository implements \TYPO3\CMS\Extbase\Persistence\Repo
      */
     public function findAll()
     {
+        $db = $this->getDatabaseConnection();
         $itemList = array();
         $whereClause = '1=1';
         if ($this->type != '') {
-            $whereClause .= ' AND ' . $this->typeField . ' = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($this->type, $this->table) . ' ';
+            $whereClause .= ' AND ' . $this->typeField . ' = ' . $db->fullQuoteStr($this->type, $this->table) . ' ';
         }
         $whereClause .= $this->getWhereClauseForEnabledFields();
-        $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', $this->table, $whereClause);
-        while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
+        $res = $db->exec_SELECTquery('*', $this->table, $whereClause);
+        while ($row = $db->sql_fetch_assoc($res)) {
             $itemList[] = $this->createDomainObject($row);
         }
-        $GLOBALS['TYPO3_DB']->sql_free_result($res);
+        $db->sql_free_result($res);
         return $itemList;
     }
 
@@ -175,10 +186,10 @@ abstract class AbstractRepository implements \TYPO3\CMS\Extbase\Persistence\Repo
      */
     public function findByUid($uid)
     {
-        if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($uid)) {
+        if (!MathUtility::canBeInterpretedAsInteger($uid)) {
             throw new \InvalidArgumentException('The UID has to be an integer. UID given: "' . $uid . '"', 1316779798);
         }
-        $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', $this->table, 'uid=' . (int)$uid . $this->getWhereClauseForEnabledFields());
+        $row = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('*', $this->table, 'uid=' . (int)$uid . $this->getWhereClauseForEnabledFields());
         if (empty($row) || !is_array($row)) {
             throw new \RuntimeException('Could not find row with UID "' . $uid . '" in table "' . $this->table . '"', 1314354065);
         }
@@ -199,8 +210,8 @@ abstract class AbstractRepository implements \TYPO3\CMS\Extbase\Persistence\Repo
             $whereClause .= $GLOBALS['TSFE']->sys_page->deleteClause($this->table);
         } else {
             // backend context
-            $whereClause = \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields($this->table);
-            $whereClause .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($this->table);
+            $whereClause = BackendUtility::BEenableFields($this->table);
+            $whereClause .= BackendUtility::deleteClause($this->table);
         }
         return $whereClause;
     }
index 125fab6..5b00fa8 100644 (file)
@@ -13,6 +13,9 @@ namespace TYPO3\CMS\Core\Resource\Collection;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Collection\CollectionInterface;
+use TYPO3\CMS\Core\Resource\File;
+use TYPO3\CMS\Core\Resource\FileInterface;
 
 /**
  * Abstract collection.
@@ -84,7 +87,7 @@ abstract class AbstractFileCollection extends \TYPO3\CMS\Core\Collection\Abstrac
      */
     public function key()
     {
-        /** @var $currentRecord \TYPO3\CMS\Core\Resource\File */
+        /** @var $currentRecord File */
         $currentRecord = $this->storage->current();
         return $currentRecord->getIdentifier();
     }
@@ -98,7 +101,7 @@ abstract class AbstractFileCollection extends \TYPO3\CMS\Core\Collection\Abstrac
     protected function getItemUidList($includeTableName = false)
     {
         $list = array();
-        /** @var $entry \TYPO3\CMS\Core\Resource\File */
+        /** @var $entry File */
         foreach ($this->storage as $entry) {
             $list[] = $this->getItemTableName() . '_' . $entry->getUid();
         }
@@ -130,7 +133,7 @@ abstract class AbstractFileCollection extends \TYPO3\CMS\Core\Collection\Abstrac
     public function toArray()
     {
         $itemArray = array();
-        /** @var $item \TYPO3\CMS\Core\Resource\File */
+        /** @var $item File */
         foreach ($this->storage as $item) {
             $itemArray[] = $item->toArray();
         }
@@ -150,7 +153,7 @@ abstract class AbstractFileCollection extends \TYPO3\CMS\Core\Collection\Abstrac
     public function getItems()
     {
         $itemArray = array();
-        /** @var $item \TYPO3\CMS\Core\Resource\File */
+        /** @var $item File */
         foreach ($this->storage as $item) {
             $itemArray[] = $item;
         }
@@ -195,9 +198,9 @@ abstract class AbstractFileCollection extends \TYPO3\CMS\Core\Collection\Abstrac
     /**
      * Adds a file to this collection.
      *
-     * @param \TYPO3\CMS\Core\Resource\FileInterface $data
+     * @param FileInterface $data
      */
-    public function add(\TYPO3\CMS\Core\Resource\FileInterface $data)
+    public function add(FileInterface $data)
     {
         $this->storage->push($data);
     }
@@ -205,11 +208,11 @@ abstract class AbstractFileCollection extends \TYPO3\CMS\Core\Collection\Abstrac
     /**
      * Adds all files of another collection to the corrent one.
      *
-     * @param \TYPO3\CMS\Core\Collection\CollectionInterface $other
+     * @param CollectionInterface $other
      */
-    public function addAll(\TYPO3\CMS\Core\Collection\CollectionInterface $other)
+    public function addAll(CollectionInterface $other)
     {
-        /** @var $value \TYPO3\CMS\Core\Resource\File */
+        /** @var $value File */
         foreach ($other as $value) {
             $this->add($value);
         }
@@ -218,12 +221,12 @@ abstract class AbstractFileCollection extends \TYPO3\CMS\Core\Collection\Abstrac
     /**
      * Removes a file from this collection.
      *
-     * @param \TYPO3\CMS\Core\Resource\File $file
+     * @param File $file
      */
-    public function remove(\TYPO3\CMS\Core\Resource\File $file)
+    public function remove(File $file)
     {
         $offset = 0;
-        /** @var $value \TYPO3\CMS\Core\Resource\File */
+        /** @var $value File */
         foreach ($this->storage as $value) {
             if ($value === $file) {
                 break;
index 7c90871..c8e2333 100644 (file)
@@ -13,12 +13,13 @@ namespace TYPO3\CMS\Core\Resource\Collection;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Resource\ResourceFactory;
 
 /**
  * A collection containing a set files belonging to certain categories.
  * This collection is persisted to the database with the accordant category identifiers.
  */
-class CategoryBasedFileCollection extends \TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection
+class CategoryBasedFileCollection extends AbstractFileCollection
 {
     /**
      * @var string
@@ -56,7 +57,7 @@ class CategoryBasedFileCollection extends \TYPO3\CMS\Core\Resource\Collection\Ab
             ' AND sys_category_record_mm.tablenames = \'sys_file_metadata\''
         );
 
-        $resourceFactory = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance();
+        $resourceFactory = ResourceFactory::getInstance();
         if ($resource) {
             while (($record = $this->getDatabaseConnection()->sql_fetch_assoc($resource)) !== false) {
                 $this->add($resourceFactory->getFileObject((int)$record['file']));
index 1de8ef3..4ca689a 100644 (file)
@@ -13,11 +13,13 @@ namespace TYPO3\CMS\Core\Resource\Collection;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\SingletonInterface;
+use TYPO3\CMS\Core\Utility\ArrayUtility;
 
 /**
  * Registry for FileCollection classes
  */
-class FileCollectionRegistry implements \TYPO3\CMS\Core\SingletonInterface
+class FileCollectionRegistry implements SingletonInterface
 {
     /**
      * Registered FileCollection types
@@ -55,7 +57,7 @@ class FileCollectionRegistry implements \TYPO3\CMS\Core\SingletonInterface
             throw new \InvalidArgumentException('Class ' . $className . ' does not exist.', 1391295613);
         }
 
-        if (!in_array(\TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection::class, class_parents($className), true)) {
+        if (!in_array(AbstractFileCollection::class, class_parents($className), true)) {
             throw new \InvalidArgumentException('FileCollection ' . $className . ' needs to extend the AbstractFileCollection.', 1391295633);
         }
 
@@ -102,7 +104,7 @@ class FileCollectionRegistry implements \TYPO3\CMS\Core\SingletonInterface
             );
         }
         if ($additionalColumns !== array()) {
-            \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['sys_file_collection']['columns'], $additionalColumns);
+            ArrayUtility::mergeRecursiveWithOverrule($GLOBALS['TCA']['sys_file_collection']['columns'], $additionalColumns);
         }
         return $GLOBALS['TCA']['sys_file_collection'];
     }
index c496918..efdbf18 100644 (file)
@@ -15,12 +15,14 @@ namespace TYPO3\CMS\Core\Resource\Collection;
  */
 
 use TYPO3\CMS\Core\Resource\Folder;
+use TYPO3\CMS\Core\Resource\StorageRepository;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * A collection containing a set of files to be represented as a (virtual) folder.
  * This collection is persisted to the database with the accordant folder reference.
  */
-class FolderBasedFileCollection extends \TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection
+class FolderBasedFileCollection extends AbstractFileCollection
 {
     /**
      * @var string
@@ -112,8 +114,8 @@ class FolderBasedFileCollection extends \TYPO3\CMS\Core\Resource\Collection\Abst
         $this->description = $array['description'];
         $this->recursive = (bool)$array['recursive'];
         if (!empty($array['folder']) && !empty($array['storage'])) {
-            /** @var $storageRepository \TYPO3\CMS\Core\Resource\StorageRepository */
-            $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class);
+            /** @var $storageRepository StorageRepository */
+            $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
             /** @var $storage \TYPO3\CMS\Core\Resource\ResourceStorage */
             $storage = $storageRepository->findByUid($array['storage']);
             if ($storage) {
index 6ffe201..1bd4186 100644 (file)
@@ -13,12 +13,14 @@ namespace TYPO3\CMS\Core\Resource\Collection;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Resource\FileRepository;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * A collection containing a static set of files. This collection is persisted
  * to the database with references to all files it contains.
  */
-class StaticFileCollection extends \TYPO3\CMS\Core\Resource\Collection\AbstractFileCollection
+class StaticFileCollection extends AbstractFileCollection
 {
     /**
      * @var string
@@ -49,8 +51,8 @@ class StaticFileCollection extends \TYPO3\CMS\Core\Resource\Collection\AbstractF
      */
     public function loadContents()
     {
-        /** @var \TYPO3\CMS\Core\Resource\FileRepository $fileRepository */
-        $fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\FileRepository::class);
+        /** @var FileRepository $fileRepository */
+        $fileRepository = GeneralUtility::makeInstance(FileRepository::class);
         $fileReferences = $fileRepository->findByRelation('sys_file_collection', 'files', $this->getIdentifier());
         foreach ($fileReferences as $file) {
             $this->add($file);
index 17f9c3e..9c76645 100644 (file)
@@ -14,6 +14,10 @@ namespace TYPO3\CMS\Core\Resource\Driver;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Resource\Exception\InvalidPathException;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
+
 /**
  * Class AbstractHierarchicalFilesystemDriver
  */
@@ -28,7 +32,7 @@ abstract class AbstractHierarchicalFilesystemDriver extends AbstractDriver
      */
     protected function isPathValid($theFile)
     {
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::validPathStr($theFile);
+        return GeneralUtility::validPathStr($theFile);
     }
 
     /**
@@ -36,16 +40,16 @@ abstract class AbstractHierarchicalFilesystemDriver extends AbstractDriver
      *
      * @param string $filePath The file path (including the file name!)
      * @return string
-     * @throws \TYPO3\CMS\Core\Resource\Exception\InvalidPathException
+     * @throws InvalidPathException
      */
     protected function canonicalizeAndCheckFilePath($filePath)
     {
-        $filePath = \TYPO3\CMS\Core\Utility\PathUtility::getCanonicalPath($filePath);
+        $filePath = PathUtility::getCanonicalPath($filePath);
 
         // filePath must be valid
         // Special case is required by vfsStream in Unit Test context
         if (!$this->isPathValid($filePath) && substr($filePath, 0, 6) !== 'vfs://') {
-            throw new \TYPO3\CMS\Core\Resource\Exception\InvalidPathException('File ' . $filePath . ' is not valid (".." and "//" is not allowed in path).', 1320286857);
+            throw new InvalidPathException('File ' . $filePath . ' is not valid (".." and "//" is not allowed in path).', 1320286857);
         }
         return $filePath;
     }
@@ -55,7 +59,7 @@ abstract class AbstractHierarchicalFilesystemDriver extends AbstractDriver
      *
      * @param string $fileIdentifier The file path (including the file name!)
      * @return string
-     * @throws \TYPO3\CMS\Core\Resource\Exception\InvalidPathException
+     * @throws InvalidPathException
      */
     protected function canonicalizeAndCheckFileIdentifier($fileIdentifier)
     {
@@ -94,6 +98,6 @@ abstract class AbstractHierarchicalFilesystemDriver extends AbstractDriver
     public function getParentFolderIdentifierOfIdentifier($fileIdentifier)
     {
         $fileIdentifier = $this->canonicalizeAndCheckFileIdentifier($fileIdentifier);
-        return \TYPO3\CMS\Core\Utility\PathUtility::dirname($fileIdentifier) . '/';
+        return PathUtility::dirname($fileIdentifier) . '/';
     }
 }
index 6679b50..4ef5661 100644 (file)
@@ -58,7 +58,7 @@ class DriverRegistry implements \TYPO3\CMS\Core\SingletonInterface
             throw new \InvalidArgumentException('Class ' . $className . ' does not exist.', 1314979197);
         }
 
-        if (!in_array(\TYPO3\CMS\Core\Resource\Driver\DriverInterface::class, class_implements($className), true)) {
+        if (!in_array(DriverInterface::class, class_implements($className), true)) {
             throw new \InvalidArgumentException('Driver ' . $className . ' needs to implement the DriverInterface.', 1387619575);
         }
         if ($shortName === '') {
index 812522f..26ab2f4 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Core\Resource\Driver;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Charset\CharsetConverter;
 use TYPO3\CMS\Core\Resource\Exception;
 use TYPO3\CMS\Core\Resource\FolderInterface;
 use TYPO3\CMS\Core\Resource\ResourceStorage;
@@ -55,7 +56,7 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver
     protected $baseUri = null;
 
     /**
-     * @var \TYPO3\CMS\Core\Charset\CharsetConverter
+     * @var CharsetConverter
      */
     protected $charsetConversion;
 
@@ -1356,12 +1357,12 @@ class LocalDriver extends AbstractHierarchicalFilesystemDriver
     /**
      * Gets the charset conversion object.
      *
-     * @return \TYPO3\CMS\Core\Charset\CharsetConverter
+     * @return CharsetConverter
      */
     protected function getCharsetConversion()
     {
         if (!isset($this->charsetConversion)) {
-            $this->charsetConversion = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Charset\CharsetConverter::class);
+            $this->charsetConversion = GeneralUtility::makeInstance(CharsetConverter::class);
         }
         return $this->charsetConversion;
     }
index 6a39228..2d6934f 100644 (file)
@@ -376,23 +376,23 @@ class File extends AbstractFile
     }
 
     /**
-     * @return \TYPO3\CMS\Core\Resource\Index\MetaDataRepository
+     * @return Index\MetaDataRepository
      */
     protected function getMetaDataRepository()
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class);
+        return GeneralUtility::makeInstance(Index\MetaDataRepository::class);
     }
 
     /**
-     * @return \TYPO3\CMS\Core\Resource\Index\FileIndexRepository
+     * @return Index\FileIndexRepository
      */
     protected function getFileIndexRepository()
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Index\FileIndexRepository::class);
+        return GeneralUtility::makeInstance(Index\FileIndexRepository::class);
     }
 
     /**
-     * @return void
+     * @param bool $indexingState
      * @internal Only for usage in Indexer
      */
     public function setIndexingInProgess($indexingState)
index 1704d75..56830a7 100644 (file)
@@ -14,12 +14,13 @@ namespace TYPO3\CMS\Core\Resource;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException;
+use TYPO3\CMS\Core\Collection\RecordCollectionRepository;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Repository for accessing the collections stored in the database
  */
-class FileCollectionRepository extends \TYPO3\CMS\Core\Collection\RecordCollectionRepository
+class FileCollectionRepository extends RecordCollectionRepository
 {
     /**
      * @var string
@@ -36,13 +37,13 @@ class FileCollectionRepository extends \TYPO3\CMS\Core\Collection\RecordCollecti
      *
      * @param int $uid The uid to be looked up
      * @return NULL|Collection\AbstractFileCollection
-     * @throws ResourceDoesNotExistException
+     * @throws Exception\ResourceDoesNotExistException
      */
     public function findByUid($uid)
     {
         $object = parent::findByUid($uid);
         if ($object === null) {
-            throw new ResourceDoesNotExistException('Could not find row with uid "' . $uid . '" in table "' . $this->table . '"', 1314354066);
+            throw new Exception\ResourceDoesNotExistException('Could not find row with uid "' . $uid . '" in table "' . $this->table . '"', 1314354066);
         }
         return $object;
     }
@@ -66,6 +67,6 @@ class FileCollectionRepository extends \TYPO3\CMS\Core\Collection\RecordCollecti
      */
     protected function getFileFactory()
     {
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\ResourceFactory::class);
+        return GeneralUtility::makeInstance(ResourceFactory::class);
     }
 }
index 252229f..75b5eec 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Resource;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use TYPO3\CMS\Core\Utility\ArrayUtility;
 
 /**
  * Representation of a specific usage of a file with possibilities to override certain
@@ -152,7 +153,7 @@ class FileReference implements FileInterface
     {
         if (empty($this->mergedProperties)) {
             $this->mergedProperties = $this->propertiesOfFileReference;
-            \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule(
+            ArrayUtility::mergeRecursiveWithOverrule(
                 $this->mergedProperties,
                 $this->originalFile->getProperties(),
                 true,
index b13f0f7..f864338 100644 (file)
@@ -14,9 +14,12 @@ namespace TYPO3\CMS\Core\Resource;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Database\RelationHandler;
 use TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException;
 use TYPO3\CMS\Core\Resource\Index\FileIndexRepository;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\MathUtility;
 
 /**
  * Repository for accessing files
@@ -31,7 +34,7 @@ class FileRepository extends AbstractRepository
      *
      * @var string
      */
-    protected $objectType = \TYPO3\CMS\Core\Resource\File::class;
+    protected $objectType = File::class;
 
     /**
      * Main File object storage table. Note that this repository also works on
@@ -65,7 +68,7 @@ class FileRepository extends AbstractRepository
     public function findByRelation($tableName, $fieldName, $uid)
     {
         $itemList = array();
-        if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($uid)) {
+        if (!MathUtility::canBeInterpretedAsInteger($uid)) {
             throw new \InvalidArgumentException('UID of related record has to be an integer. UID given: "' . $uid  . '"', 1316789798);
         }
         $referenceUids = null;
@@ -88,11 +91,11 @@ class FileRepository extends AbstractRepository
                 $referenceUids = array_keys($references);
             }
         } else {
-            /** @var $relationHandler \TYPO3\CMS\Core\Database\RelationHandler */
-            $relationHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\RelationHandler::class);
+            /** @var $relationHandler RelationHandler */
+            $relationHandler = GeneralUtility::makeInstance(RelationHandler::class);
             $relationHandler->start(
                 '', 'sys_file_reference', '', $uid, $tableName,
-                \TYPO3\CMS\Backend\Utility\BackendUtility::getTcaFieldConfiguration($tableName, $fieldName)
+                BackendUtility::getTcaFieldConfiguration($tableName, $fieldName)
             );
             if (!empty($relationHandler->tableArray['sys_file_reference'])) {
                 $referenceUids = $relationHandler->tableArray['sys_file_reference'];
@@ -122,7 +125,7 @@ class FileRepository extends AbstractRepository
      */
     public function findFileReferenceByUid($uid)
     {
-        if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($uid)) {
+        if (!MathUtility::canBeInterpretedAsInteger($uid)) {
             throw new \InvalidArgumentException('The UID of record has to be an integer. UID given: "' . $uid . '"', 1316889798);
         }
         try {
@@ -143,8 +146,8 @@ class FileRepository extends AbstractRepository
      */
     public function searchByName(Folder $folder, $fileName)
     {
-        /** @var \TYPO3\CMS\Core\Resource\ResourceFactory $fileFactory */
-        $fileFactory = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\ResourceFactory::class);
+        /** @var ResourceFactory $fileFactory */
+        $fileFactory = GeneralUtility::makeInstance(ResourceFactory::class);
 
         $folders = $folder->getStorage()->getFoldersInFolder($folder, 0, 0, true, true);
         $folders[$folder->getIdentifier()] = $folder;
@@ -159,7 +162,7 @@ class FileRepository extends AbstractRepository
 
             try {
                 $files[] = $fileFactory->getFileObject($fileRecord['uid'], $fileRecord);
-            } catch (\TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException $ignoredException) {
+            } catch (Exception\FileDoesNotExistException $ignoredException) {
                 continue;
             }
         }
index 3c863f3..5308761 100644 (file)
@@ -14,6 +14,11 @@ namespace TYPO3\CMS\Core\Resource\Filter;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\DataHandling\DataHandler;
+use TYPO3\CMS\Core\Resource\Driver\DriverInterface;
+use TYPO3\CMS\Core\Resource\ResourceFactory;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Utility methods for filtering filenames
  */
@@ -37,10 +42,10 @@ class FileExtensionFilter
      * Entry method for use as TCEMain "inline" field filter
      *
      * @param array $parameters
-     * @param \TYPO3\CMS\Core\DataHandling\DataHandler $tceMain
+     * @param DataHandler $tceMain
      * @return array
      */
-    public function filterInlineChildren(array $parameters, \TYPO3\CMS\Core\DataHandling\DataHandler $tceMain)
+    public function filterInlineChildren(array $parameters, DataHandler $tceMain)
     {
         $values = $parameters['values'];
         if ($parameters['allowedFileExtensions']) {
@@ -55,9 +60,9 @@ class FileExtensionFilter
                 if (empty($value)) {
                     continue;
                 }
-                $parts = \TYPO3\CMS\Core\Utility\GeneralUtility::revExplode('_', $value, 2);
+                $parts = GeneralUtility::revExplode('_', $value, 2);
                 $fileReferenceUid = $parts[count($parts) - 1];
-                $fileReference = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileReferenceObject($fileReferenceUid);
+                $fileReference = ResourceFactory::getInstance()->getFileReferenceObject($fileReferenceUid);
                 $file = $fileReference->getOriginalFile();
                 if ($this->isAllowed($file->getName())) {
                     $cleanValues[] = $value;
@@ -80,10 +85,10 @@ class FileExtensionFilter
      * @param string $itemIdentifier
      * @param string $parentIdentifier
      * @param array $additionalInformation Additional information about the inspected item
-     * @param \TYPO3\CMS\Core\Resource\Driver\DriverInterface $driver
+     * @param DriverInterface $driver
      * @return bool|int -1 if the file should not be included in a listing
      */
-    public function filterFileList($itemName, $itemIdentifier, $parentIdentifier, array $additionalInformation, \TYPO3\CMS\Core\Resource\Driver\DriverInterface $driver)
+    public function filterFileList($itemName, $itemIdentifier, $parentIdentifier, array $additionalInformation, DriverInterface $driver)
     {
         $returnCode = true;
         // Early return in case no file filters are set at all
@@ -102,7 +107,7 @@ class FileExtensionFilter
     /**
      * Checks whether a file is allowed according to the criteria defined in the class variables ($this->allowedFileExtensions etc.)
      *
-     * @param \TYPO3\CMS\Core\Resource\FileInterface $file
+     * @param string $fileName
      * @return bool
      */
     protected function isAllowed($fileName)
@@ -154,7 +159,7 @@ class FileExtensionFilter
         if (is_array($inputArgument)) {
             $returnValue = $inputArgument;
         } elseif ((string)$inputArgument !== '') {
-            $returnValue = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $inputArgument);
+            $returnValue = GeneralUtility::trimExplode(',', $inputArgument);
         }
 
         if (is_array($returnValue)) {
index 9bf3312..ada1f77 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Core\Resource\Filter;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Resource\Driver\DriverInterface;
+
 /**
  * Utility methods for filtering filenames
  */
@@ -36,10 +38,10 @@ class FileNameFilter
      * @param string $itemIdentifier
      * @param string $parentIdentifier
      * @param array $additionalInformation Additional information (driver dependent) about the inspected item
-     * @param \TYPO3\CMS\Core\Resource\Driver\DriverInterface $driverInstance
+     * @param DriverInterface $driverInstance
      * @return bool|int -1 if the file should not be included in a listing
      */
-    public static function filterHiddenFilesAndFolders($itemName, $itemIdentifier, $parentIdentifier, array $additionalInformation, \TYPO3\CMS\Core\Resource\Driver\DriverInterface $driverInstance)
+    public static function filterHiddenFilesAndFolders($itemName, $itemIdentifier, $parentIdentifier, array $additionalInformation, DriverInterface $driverInstance)
     {
         // Only apply the filter if you want to hide the hidden files
         if (self::$showHiddenFilesAndFolders === false && strpos($itemIdentifier, '/.') !== false) {
index 04e79f3..0d54ae0 100644 (file)
@@ -15,7 +15,11 @@ namespace TYPO3\CMS\Core\Resource\Hook;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Resource\File;
+use TYPO3\CMS\Core\Resource\ProcessedFile;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * Utility class to render TCEforms information about a sys_file record
@@ -58,13 +62,16 @@ class FileInfoHook
     /**
      * Renders a HTML Block with file information
      *
-     * @param \TYPO3\CMS\Core\Resource\File $file
+     * @param File $file
      * @return string
      */
-    protected function renderFileInformationContent(\TYPO3\CMS\Core\Resource\File $file = null)
+    protected function renderFileInformationContent(File $file = null)
     {
+        /** @var LanguageService $lang */
+        $lang = $GLOBALS['LANG'];
+
         if ($file !== null) {
-            $processedFile = $file->process(\TYPO3\CMS\Core\Resource\ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => 150, 'height' => 150));
+            $processedFile = $file->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array('width' => 150, 'height' => 150));
             $previewImage = $processedFile->getPublicUrl(true);
             $content = '';
             if ($file->isMissing()) {
@@ -78,13 +85,13 @@ class FileInfoHook
                             'alt="" class="t3-tceforms-sysfile-imagepreview" />';
             }
             $content .= '<strong>' . htmlspecialchars($file->getName()) . '</strong>';
-            $content .= ' (' . htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::formatSize($file->getSize())) . 'bytes)<br />';
+            $content .= ' (' . htmlspecialchars(GeneralUtility::formatSize($file->getSize())) . 'bytes)<br />';
             $content .= BackendUtility::getProcessedValue('sys_file', 'type', $file->getType()) . ' (' . $file->getMimeType() . ')<br />';
-            $content .= $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:fileMetaDataLocation', true) . ': ';
+            $content .= $lang->sL('LLL:EXT:lang/locallang_misc.xlf:fileMetaDataLocation', true) . ': ';
             $content .= htmlspecialchars($file->getStorage()->getName()) . ' - ' . htmlspecialchars($file->getIdentifier()) . '<br />';
             $content .= '<br />';
         } else {
-            $content = '<h2>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xlf:fileMetaErrorInvalidRecord', true) . '</h2>';
+            $content = '<h2>' . $lang->sL('LLL:EXT:lang/locallang_misc.xlf:fileMetaErrorInvalidRecord', true) . '</h2>';
         }
 
         return $content;
index 7bbcb5a..cd5b504 100644 (file)
@@ -33,7 +33,7 @@ class InaccessibleFolder extends Folder
      */
     protected function throwInaccessibleException()
     {
-        throw new \TYPO3\CMS\Core\Resource\Exception\InsufficientFolderReadPermissionsException(
+        throw new Exception\InsufficientFolderReadPermissionsException(
             'You are trying to use a method on an inaccessible folder.',
             1390290029
         );
@@ -76,7 +76,7 @@ class InaccessibleFolder extends Folder
      * @param int $numberOfItems The number of items to return
      * @param int $filterMode The filter mode to use for the filelist.
      * @param bool $recursive
-     * @return \TYPO3\CMS\Core\Resource\File[]
+     * @return File[]
      */
     public function getFiles($start = 0, $numberOfItems = 0, $filterMode = self::FILTER_MODE_USE_OWN_AND_STORAGE_FILTERS, $recursive = false)
     {
@@ -129,7 +129,7 @@ class InaccessibleFolder extends Folder
      *
      * @param string $localFilePath
      * @param string $fileName
-     * @param string $conflictMode a value of the \TYPO3\CMS\Core\Resource\DuplicationBehavior enumeration
+     * @param string $conflictMode a value of the DuplicationBehavior enumeration
      * @return File The file object
      */
     public function addFile($localFilePath, $fileName = null, $conflictMode = DuplicationBehavior::CANCEL)
@@ -141,7 +141,7 @@ class InaccessibleFolder extends Folder
      * Adds an uploaded file into the Storage.
      *
      * @param array $uploadedFileData contains information about the uploaded file given by $_FILES['file1']
-     * @param string $conflictMode a value of the \TYPO3\CMS\Core\Resource\DuplicationBehavior enumeration
+     * @param string $conflictMode a value of the DuplicationBehavior enumeration
      * @return File The file object
      */
     public function addUploadedFile(array $uploadedFileData, $conflictMode = DuplicationBehavior::CANCEL)
@@ -198,7 +198,7 @@ class InaccessibleFolder extends Folder
      *
      * @param Folder $targetFolder Target folder to copy to.
      * @param string $targetFolderName an optional destination fileName
-     * @param string $conflictMode a value of the \TYPO3\CMS\Core\Resource\DuplicationBehavior enumeration
+     * @param string $conflictMode a value of the DuplicationBehavior enumeration
      * @return Folder New (copied) folder object.
      */
     public function copyTo(Folder $targetFolder, $targetFolderName = null, $conflictMode = DuplicationBehavior::RENAME)
@@ -211,7 +211,7 @@ class InaccessibleFolder extends Folder
      *
      * @param Folder $targetFolder Target folder to move to.
      * @param string $targetFolderName an optional destination fileName
-     * @param string $conflictMode a value of the \TYPO3\CMS\Core\Resource\DuplicationBehavior enumeration
+     * @param string $conflictMode a value of the DuplicationBehavior enumeration
      * @return Folder New (copied) folder object.
      */
     public function moveTo(Folder $targetFolder, $targetFolderName = null, $conflictMode = DuplicationBehavior::RENAME)
index d37103f..e57cc67 100644 (file)
@@ -43,7 +43,7 @@ class ExtractorRegistry implements SingletonInterface
      */
     public static function getInstance()
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Index\ExtractorRegistry::class);
+        return GeneralUtility::makeInstance(ExtractorRegistry::class);
     }
 
     /**
@@ -56,7 +56,7 @@ class ExtractorRegistry implements SingletonInterface
     {
         if (!class_exists($className)) {
             throw new \InvalidArgumentException('The class "' . $className . '" you are registering is not available', 1422705270);
-        } elseif (!in_array(\TYPO3\CMS\Core\Resource\Index\ExtractorInterface::class, class_implements($className))) {
+        } elseif (!in_array(ExtractorInterface::class, class_implements($className))) {
             throw new \InvalidArgumentException('The extractor needs to implement the ExtractorInterface', 1422705271);
         } else {
             $this->extractors[] = $className;
index 3d2ad93..67c893f 100644 (file)
@@ -16,8 +16,14 @@ namespace TYPO3\CMS\Core\Resource\Index;
 
 use TYPO3\CMS\Core\Database\ReferenceIndex;
 use TYPO3\CMS\Core\Resource\File;
+use TYPO3\CMS\Core\Resource\FileInterface;
+use TYPO3\CMS\Core\Resource\Folder;
+use TYPO3\CMS\Core\Resource\ResourceFactory;
+use TYPO3\CMS\Core\Resource\ResourceStorage;
 use TYPO3\CMS\Core\SingletonInterface;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManager;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
 
 /**
  * Repository Class as an abstraction layer to sys_file
@@ -57,11 +63,11 @@ class FileIndexRepository implements SingletonInterface
     /**
      * Gets the Resource Factory
      *
-     * @return \TYPO3\CMS\Core\Resource\ResourceFactory
+     * @return ResourceFactory
      */
     protected function getResourceFactory()
     {
-        return \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance();
+        return ResourceFactory::getInstance();
     }
 
     /**
@@ -71,7 +77,7 @@ class FileIndexRepository implements SingletonInterface
      */
     public static function getInstance()
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Index\FileIndexRepository::class);
+        return GeneralUtility::makeInstance(FileIndexRepository::class);
     }
 
     /**
@@ -139,12 +145,12 @@ class FileIndexRepository implements SingletonInterface
     /**
      * Retrieves Index record for a given $fileObject
      *
-     * @param \TYPO3\CMS\Core\Resource\FileInterface $fileObject
+     * @param FileInterface $fileObject
      * @return array|bool
      *
      * @internal only for use from FileRepository
      */
-    public function findOneByFileObject(\TYPO3\CMS\Core\Resource\FileInterface $fileObject)
+    public function findOneByFileObject(FileInterface $fileObject)
     {
         $storageUid = $fileObject->getStorage()->getUid();
         $identifierHash = $fileObject->getHashedIdentifier();
@@ -174,10 +180,10 @@ class FileIndexRepository implements SingletonInterface
     /**
      * Find all records for files in a Folder
      *
-     * @param \TYPO3\CMS\Core\Resource\Folder $folder
+     * @param Folder $folder
      * @return array|NULL
      */
-    public function findByFolder(\TYPO3\CMS\Core\Resource\Folder $folder)
+    public function findByFolder(Folder $folder)
     {
         $resultRows = $this->getDatabaseConnection()->exec_SELECTgetRows(
             implode(',', $this->fields),
@@ -195,7 +201,7 @@ class FileIndexRepository implements SingletonInterface
     /**
      * Find all records for files in an array of Folders
      *
-     * @param \TYPO3\CMS\Core\Resource\Folder[] $folders
+     * @param Folder[] $folders
      * @param bool $includeMissing
      * @return array|NULL
      */
@@ -205,7 +211,7 @@ class FileIndexRepository implements SingletonInterface
         $folderIdentifiers = [];
 
         foreach ($folders as $folder) {
-            if (!$folder instanceof \TYPO3\CMS\Core\Resource\Folder) {
+            if (!$folder instanceof Folder) {
                 continue;
             }
 
@@ -312,11 +318,11 @@ class FileIndexRepository implements SingletonInterface
     /**
      * Finds the files needed for second indexer step
      *
-     * @param \TYPO3\CMS\Core\Resource\ResourceStorage $storage
+     * @param ResourceStorage $storage
      * @param int $limit
      * @return array
      */
-    public function findInStorageWithIndexOutstanding(\TYPO3\CMS\Core\Resource\ResourceStorage $storage, $limit = -1)
+    public function findInStorageWithIndexOutstanding(ResourceStorage $storage, $limit = -1)
     {
         return $this->getDatabaseConnection()->exec_SELECTgetRows(
             implode(',', $this->fields),
@@ -331,11 +337,11 @@ class FileIndexRepository implements SingletonInterface
     /**
      * Helper function for the Indexer to detect missing files
      *
-     * @param \TYPO3\CMS\Core\Resource\ResourceStorage $storage
+     * @param ResourceStorage $storage
      * @param array $uidList
      * @return array
      */
-    public function findInStorageAndNotInUidList(\TYPO3\CMS\Core\Resource\ResourceStorage $storage, array $uidList)
+    public function findInStorageAndNotInUidList(ResourceStorage $storage, array $uidList)
     {
         $where = 'storage = ' . (int)$storage->getUid();
         if (!empty($uidList)) {
@@ -417,21 +423,21 @@ class FileIndexRepository implements SingletonInterface
     /*
      * Get the SignalSlot dispatcher
      *
-     * @return \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
+     * @return Dispatcher
      */
     protected function getSignalSlotDispatcher()
     {
-        return $this->getObjectManager()->get(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
+        return $this->getObjectManager()->get(Dispatcher::class);
     }
 
     /**
      * Get the ObjectManager
      *
-     * @return \TYPO3\CMS\Extbase\Object\ObjectManager
+     * @return ObjectManager
      */
     protected function getObjectManager()
     {
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
+        return GeneralUtility::makeInstance(ObjectManager::class);
     }
 
     /**
@@ -442,7 +448,7 @@ class FileIndexRepository implements SingletonInterface
      */
     protected function emitRecordUpdatedSignal(array $data)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\Index\FileIndexRepository::class, 'recordUpdated', array($data));
+        $this->getSignalSlotDispatcher()->dispatch(FileIndexRepository::class, 'recordUpdated', array($data));
     }
 
     /**
@@ -453,7 +459,7 @@ class FileIndexRepository implements SingletonInterface
      */
     protected function emitRecordCreatedSignal(array $data)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\Index\FileIndexRepository::class, 'recordCreated', array($data));
+        $this->getSignalSlotDispatcher()->dispatch(FileIndexRepository::class, 'recordCreated', array($data));
     }
 
     /**
@@ -464,7 +470,7 @@ class FileIndexRepository implements SingletonInterface
      */
     protected function emitRecordDeletedSignal($fileUid)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\Index\FileIndexRepository::class, 'recordDeleted', array($fileUid));
+        $this->getSignalSlotDispatcher()->dispatch(FileIndexRepository::class, 'recordDeleted', array($fileUid));
     }
 
     /**
@@ -475,6 +481,6 @@ class FileIndexRepository implements SingletonInterface
      */
     protected function emitRecordMarkedAsMissingSignal($fileUid)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\Index\FileIndexRepository::class, 'recordMarkedAsMissing', array($fileUid));
+        $this->getSignalSlotDispatcher()->dispatch(FileIndexRepository::class, 'recordMarkedAsMissing', array($fileUid));
     }
 }
index eef5f8c..bfbbc97 100644 (file)
@@ -15,9 +15,11 @@ namespace TYPO3\CMS\Core\Resource\Index;
  */
 
 use TYPO3\CMS\Core\Resource\File;
+use TYPO3\CMS\Core\Resource\ResourceFactory;
 use TYPO3\CMS\Core\Resource\ResourceStorage;
 use TYPO3\CMS\Core\Type\File\ImageInfo;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
 
 /**
  * The New FAL Indexer
@@ -301,7 +303,7 @@ class Indexer
         $fileInfo = $this->transformFromDriverFileInfoArrayToFileObjectFormat($fileInfo);
         $fileInfo['type'] = $this->getFileType($fileInfo['mime_type']);
         $fileInfo['sha1'] = $this->storage->hashFileByIdentifier($identifier, 'sha1');
-        $fileInfo['extension'] = \TYPO3\CMS\Core\Utility\PathUtility::pathinfo($fileInfo['name'], PATHINFO_EXTENSION);
+        $fileInfo['extension'] = PathUtility::pathinfo($fileInfo['name'], PATHINFO_EXTENSION);
         $fileInfo['missing'] = 0;
 
         return $fileInfo;
@@ -395,11 +397,11 @@ class Indexer
     /**
      * Returns the ResourceFactory
      *
-     * @return \TYPO3\CMS\Core\Resource\ResourceFactory
+     * @return ResourceFactory
      */
     protected function getResourceFactory()
     {
-        return \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance();
+        return ResourceFactory::getInstance();
     }
 
     /**
index 977b346..efc2e25 100644 (file)
@@ -20,6 +20,8 @@ use TYPO3\CMS\Core\Resource\File;
 use TYPO3\CMS\Core\SingletonInterface;
 use TYPO3\CMS\Core\Type\File as FileType;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManager;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
 
 /**
  * Repository Class as an abstraction layer to sys_file_metadata
@@ -89,7 +91,7 @@ class MetaDataRepository implements SingletonInterface
      *
      * @param int $uid
      * @return array
-     * @throws \RuntimeException
+     * @throws InvalidUidException
      */
     public function findByFileUid($uid)
     {
@@ -187,21 +189,21 @@ class MetaDataRepository implements SingletonInterface
     /**
      * Get the SignalSlot dispatcher
      *
-     * @return \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
+     * @return Dispatcher
      */
     protected function getSignalSlotDispatcher()
     {
-        return $this->getObjectManager()->get(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
+        return $this->getObjectManager()->get(Dispatcher::class);
     }
 
     /**
      * Get the ObjectManager
      *
-     * @return \TYPO3\CMS\Extbase\Object\ObjectManager
+     * @return ObjectManager
      */
     protected function getObjectManager()
     {
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
+        return GeneralUtility::makeInstance(ObjectManager::class);
     }
 
     /**
@@ -214,7 +216,7 @@ class MetaDataRepository implements SingletonInterface
      */
     protected function emitRecordPostRetrievalSignal(\ArrayObject $data)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class, 'recordPostRetrieval', array($data));
+        $this->getSignalSlotDispatcher()->dispatch(MetaDataRepository::class, 'recordPostRetrieval', array($data));
     }
 
     /**
@@ -225,7 +227,7 @@ class MetaDataRepository implements SingletonInterface
      */
     protected function emitRecordUpdatedSignal(array $data)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class, 'recordUpdated', array($data));
+        $this->getSignalSlotDispatcher()->dispatch(MetaDataRepository::class, 'recordUpdated', array($data));
     }
 
     /**
@@ -236,7 +238,7 @@ class MetaDataRepository implements SingletonInterface
      */
     protected function emitRecordCreatedSignal(array $data)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class, 'recordCreated', array($data));
+        $this->getSignalSlotDispatcher()->dispatch(MetaDataRepository::class, 'recordCreated', array($data));
     }
 
     /**
@@ -247,14 +249,14 @@ class MetaDataRepository implements SingletonInterface
      */
     protected function emitRecordDeletedSignal($fileUid)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class, 'recordDeleted', array($fileUid));
+        $this->getSignalSlotDispatcher()->dispatch(MetaDataRepository::class, 'recordDeleted', array($fileUid));
     }
 
     /**
-     * @return \TYPO3\CMS\Core\Resource\Index\MetaDataRepository
+     * @return MetaDataRepository
      */
     public static function getInstance()
     {
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class);
+        return GeneralUtility::makeInstance(MetaDataRepository::class);
     }
 }
index d2beda0..10f4ed9 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Core\Resource;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\MathUtility;
+
 /**
  * Representation of a specific processed version of a file. These are created by the FileProcessingService,
  * which in turn uses helper classes for doing the actual file processing. See there for a detailed description.
@@ -119,7 +122,7 @@ class ProcessedFile extends AbstractFile
         if (is_array($databaseRow)) {
             $this->reconstituteFromDatabaseRecord($databaseRow);
         }
-        $this->taskTypeRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Processing\TaskTypeRegistry::class);
+        $this->taskTypeRegistry = GeneralUtility::makeInstance(Processing\TaskTypeRegistry::class);
     }
 
     /**
@@ -187,7 +190,9 @@ class ProcessedFile extends AbstractFile
         // Update some related properties
         $this->identifier = $addedFile->getIdentifier();
         $this->originalFileSha1 = $this->originalFile->getSha1();
-        $this->updateProperties($addedFile->getProperties());
+        if ($addedFile instanceof AbstractFile) {
+            $this->updateProperties($addedFile->getProperties());
+        }
         $this->deleted = false;
         $this->updated = true;
     }
@@ -324,7 +329,7 @@ class ProcessedFile extends AbstractFile
             $this->properties = array();
         }
 
-        if (array_key_exists('uid', $properties) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($properties['uid'])) {
+        if (array_key_exists('uid', $properties) && MathUtility::canBeInterpretedAsInteger($properties['uid'])) {
             $this->properties['uid'] = $properties['uid'];
         }
 
index e495eea..f74ca9a 100644 (file)
@@ -41,11 +41,6 @@ class ProcessedFileRepository extends AbstractRepository
     protected $table = 'sys_file_processedfile';
 
     /**
-     * @var ResourceFactory
-     */
-    protected $resourceFactory;
-
-    /**
      * @var \TYPO3\CMS\Core\Database\DatabaseConnection
      */
     protected $databaseConnection;
@@ -55,7 +50,7 @@ class ProcessedFileRepository extends AbstractRepository
      */
     public function __construct()
     {
-        $this->resourceFactory = GeneralUtility::makeInstance(ResourceFactory::class);
+        parent::__construct();
         $this->databaseConnection = $GLOBALS['TYPO3_DB'];
     }
 
@@ -83,8 +78,8 @@ class ProcessedFileRepository extends AbstractRepository
      */
     protected function createDomainObject(array $databaseRow)
     {
-        $originalFile = $this->resourceFactory->getFileObject((int)$databaseRow['original']);
-        $originalFile->setStorage($this->resourceFactory->getStorageObject($originalFile->getProperty('storage')));
+        $originalFile = $this->factory->getFileObject((int)$databaseRow['original']);
+        $originalFile->setStorage($this->factory->getStorageObject($originalFile->getProperty('storage')));
         $taskType = $databaseRow['task_type'];
         $configuration = unserialize($databaseRow['configuration']);
 
index 4b6cbb1..5370ef3 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Core\Resource\Processing;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Imaging\GraphicalFunctions;
+use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -31,8 +33,8 @@ class LocalImageProcessor implements ProcessorInterface
      */
     public function __construct()
     {
-        /** @var $logManager \TYPO3\CMS\Core\Log\LogManager */
-        $logManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class);
+        /** @var $logManager LogManager */
+        $logManager = GeneralUtility::makeInstance(LogManager::class);
         $this->logger = $logManager->getLogger(__CLASS__);
     }
 
@@ -143,10 +145,10 @@ class LocalImageProcessor implements ProcessorInterface
     {
         switch ($taskName) {
             case 'Preview':
-                $helper = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Processing\LocalPreviewHelper::class, $this);
+                $helper = GeneralUtility::makeInstance(LocalPreviewHelper::class, $this);
             break;
             case 'CropScaleMask':
-                $helper = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Processing\LocalCropScaleMaskHelper::class, $this);
+                $helper = GeneralUtility::makeInstance(LocalCropScaleMaskHelper::class, $this);
             break;
             default:
                 throw new \InvalidArgumentException('Cannot find helper for task name: "' . $taskName . '"', 1353401352);
@@ -156,14 +158,14 @@ class LocalImageProcessor implements ProcessorInterface
     }
 
     /**
-     * @return \TYPO3\CMS\Core\Imaging\GraphicalFunctions
+     * @return GraphicalFunctions
      */
     protected function getGraphicalFunctionsObject()
     {
         static $graphicalFunctionsObject = null;
 
         if ($graphicalFunctionsObject === null) {
-            $graphicalFunctionsObject = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\GraphicalFunctions::class);
+            $graphicalFunctionsObject = GeneralUtility::makeInstance(GraphicalFunctions::class);
         }
 
         return $graphicalFunctionsObject;
index b02c730..66785d8 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Core\Resource\Processing;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Resource\ProcessedFile;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * The registry for task types.
  */
@@ -45,20 +48,18 @@ class TaskTypeRegistry implements \TYPO3\CMS\Core\SingletonInterface
 
     /**
      * @param string $taskType
-     * @param \TYPO3\CMS\Core\Resource\ProcessedFile $processedFile
+     * @param ProcessedFile $processedFile
      * @param array $processingConfiguration
      * @return TaskInterface
      * @throws \RuntimeException
      */
-    public function getTaskForType($taskType, \TYPO3\CMS\Core\Resource\ProcessedFile $processedFile, array $processingConfiguration)
+    public function getTaskForType($taskType, ProcessedFile $processedFile, array $processingConfiguration)
     {
         $taskClass = $this->getClassForTaskType($taskType);
         if ($taskClass === null) {
             throw new \RuntimeException('Unknown processing task "' . $taskType . '"');
         }
 
-        return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($taskClass,
-            $processedFile, $processingConfiguration
-        );
+        return GeneralUtility::makeInstance($taskClass, $processedFile, $processingConfiguration);
     }
 }
index 830da15..8560b82 100644 (file)
@@ -43,7 +43,7 @@ class RendererRegistry implements \TYPO3\CMS\Core\SingletonInterface
      */
     public static function getInstance()
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Rendering\RendererRegistry::class);
+        return GeneralUtility::makeInstance(RendererRegistry::class);
     }
 
     /**
@@ -56,7 +56,7 @@ class RendererRegistry implements \TYPO3\CMS\Core\SingletonInterface
     {
         if (!class_exists($className)) {
             throw new \InvalidArgumentException('The class "' . $className . '" you are trying to register is not available', 1411840171);
-        } elseif (!in_array(\TYPO3\CMS\Core\Resource\Rendering\FileRendererInterface::class, class_implements($className), true)) {
+        } elseif (!in_array(FileRendererInterface::class, class_implements($className), true)) {
             throw new \InvalidArgumentException('The renderer needs to implement the FileRendererInterface', 1411840172);
         } else {
             $this->classNames[] = $className;
index c5e8bff..d8032cc 100644 (file)
@@ -14,11 +14,14 @@ namespace TYPO3\CMS\Core\Resource;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Resource\Index\FileIndexRepository;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\MathUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Extbase\Service\FlexFormService;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
 
 // @todo implement constructor-level caching
 /**
@@ -64,16 +67,18 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
     protected $localDriverStorageCache = null;
 
     /**
-     * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
+     * @var Dispatcher
      */
     protected $signalSlotDispatcher;
 
     /**
      * Inject signal slot dispatcher
+     *
+     * @param Dispatcher $signalSlotDispatcher an instance of the signal slot dispatcher
      */
-    public function __construct(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher = null)
+    public function __construct(Dispatcher $signalSlotDispatcher = null)
     {
-        $this->signalSlotDispatcher = $signalSlotDispatcher ?: GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
+        $this->signalSlotDispatcher = $signalSlotDispatcher ?: GeneralUtility::makeInstance(Dispatcher::class);
     }
 
     /**
@@ -87,7 +92,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
     public function getDriverObject($driverIdentificationString, array $driverConfiguration)
     {
         /** @var $driverRegistry Driver\DriverRegistry */
-        $driverRegistry = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Driver\DriverRegistry::class);
+        $driverRegistry = GeneralUtility::makeInstance(Driver\DriverRegistry::class);
         $driverClass = $driverRegistry->getDriverClass($driverIdentificationString);
         $driverObject = GeneralUtility::makeInstance($driverClass, $driverConfiguration);
         return $driverObject;
@@ -106,7 +111,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
     public function getDefaultStorage()
     {
         /** @var $storageRepository StorageRepository */
-        $storageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class);
+        $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
 
         $allStorages = $storageRepository->findAll();
         foreach ($allStorages as $storage) {
@@ -162,7 +167,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
                 );
             } elseif (count($recordData) === 0 || (int)$recordData['uid'] !== $uid) {
                 /** @var $storageRepository StorageRepository */
-                $storageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class);
+                $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
                 /** @var $storage ResourceStorage */
                 $storageObject = $storageRepository->findByUid($uid);
             }
@@ -182,7 +187,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
      */
     protected function emitPostProcessStorageSignal(ResourceStorage $storageObject)
     {
-        $this->signalSlotDispatcher->dispatch(\TYPO3\CMS\Core\Resource\ResourceFactory::class, self::SIGNAL_PostProcessStorage, array($this, $storageObject));
+        $this->signalSlotDispatcher->dispatch(ResourceFactory::class, self::SIGNAL_PostProcessStorage, array($this, $storageObject));
     }
 
     /**
@@ -226,7 +231,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
     protected function initializeLocalStorageCache()
     {
         /** @var $storageRepository StorageRepository */
-        $storageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class);
+        $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
         /** @var $storageObjects ResourceStorage[] */
         $storageObjects = $storageRepository->findByStorageType('Local');
 
@@ -272,7 +277,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
             // Get mount data if not already supplied as argument to this function
             if (empty($recordData) || $recordData['uid'] !== $uid) {
                 /** @var $GLOBALS['TYPO3_DB'] \TYPO3\CMS\Core\Database\DatabaseConnection */
-                $recordData = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_file_collection', 'uid=' . (int)$uid . ' AND deleted=0');
+                $recordData = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('*', 'sys_file_collection', 'uid=' . (int)$uid . ' AND deleted=0');
                 if (!is_array($recordData)) {
                     throw new \InvalidArgumentException('No collection found for given UID: "' . $uid . '"', 1314085992);
                 }
@@ -292,7 +297,9 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
     public function createCollectionObject(array $collectionData)
     {
         /** @var $registry Collection\FileCollectionRegistry */
-        $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Collection\FileCollectionRegistry::class);
+        $registry = GeneralUtility::makeInstance(Collection\FileCollectionRegistry::class);
+
+        /** @var \TYPO3\CMS\Core\Collection\AbstractRecordCollection $class */
         $class = $registry->getFileCollectionClass($collectionData['type']);
 
         return $class::create($collectionData);
@@ -307,13 +314,12 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
      */
     public function createStorageObject(array $storageRecord, array $storageConfiguration = null)
     {
-        $className = \TYPO3\CMS\Core\Resource\ResourceStorage::class;
         if (!$storageConfiguration) {
             $storageConfiguration = $this->convertFlexFormDataToConfigurationArray($storageRecord['configuration']);
         }
         $driverType = $storageRecord['driver'];
         $driverObject = $this->getDriverObject($driverType, $storageConfiguration);
-        return GeneralUtility::makeInstance($className, $driverObject, $storageRecord);
+        return GeneralUtility::makeInstance(ResourceStorage::class, $driverObject, $storageRecord);
     }
 
     /**
@@ -326,7 +332,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
      */
     public function createFolderObject(ResourceStorage $storage, $identifier, $name)
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Folder::class, $storage, $identifier, $name);
+        return GeneralUtility::makeInstance(Folder::class, $storage, $identifier, $name);
     }
 
     /**
@@ -337,7 +343,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
      * @param array $fileData The record row from database.
      *
      * @throws \InvalidArgumentException
-     * @throws \TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException
+     * @throws Exception\FileDoesNotExistException
      * @return File
      */
     public function getFileObject($uid, array $fileData = array())
@@ -350,7 +356,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
             if (empty($fileData)) {
                 $fileData = $this->getFileIndexRepository()->findOneByUid($uid);
                 if ($fileData === false) {
-                    throw new \TYPO3\CMS\Core\Resource\Exception\FileDoesNotExistException('No file found for given UID: ' . $uid, 1317178604);
+                    throw new Exception\FileDoesNotExistException('No file found for given UID: ' . $uid, 1317178604);
                 }
             }
             $this->fileInstances[$uid] = $this->createFileObject($fileData);
@@ -441,11 +447,11 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
         if (GeneralUtility::isFirstPartOfStr($input, 'file:')) {
             $input = substr($input, 5);
             return $this->retrieveFileOrFolderObject($input);
-        } elseif (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($input)) {
+        } elseif (MathUtility::canBeInterpretedAsInteger($input)) {
             return $this->getFileObject($input);
         } elseif (strpos($input, ':') > 0) {
-            list($prefix, $folderIdentifier) = explode(':', $input);
-            if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($prefix)) {
+            list($prefix) = explode(':', $input);
+            if (MathUtility::canBeInterpretedAsInteger($prefix)) {
                 // path or folder in a valid storageUID
                 return $this->getObjectFromCombinedIdentifier($input);
             } elseif ($prefix == 'EXT') {
@@ -462,7 +468,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
         } else {
             // this is a backwards-compatible way to access "0-storage" files or folders
             // eliminate double slashes, /./ and /../
-            $input = \TYPO3\CMS\Core\Utility\PathUtility::getCanonicalPath(ltrim($input, '/'));
+            $input = PathUtility::getCanonicalPath(ltrim($input, '/'));
             if (@is_file(PATH_site . $input)) {
                 // only the local file
                 return $this->getFileObjectFromCombinedIdentifier($input);
@@ -496,7 +502,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
             $folderIdentifier = $parts[0];
             // make sure to not use an absolute path, and remove PATH_site if it is prepended
             if (GeneralUtility::isFirstPartOfStr($folderIdentifier, PATH_site)) {
-                $folderIdentifier = \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($parts[0]);
+                $folderIdentifier = PathUtility::stripPathSitePrefix($parts[0]);
             }
         }
         return $this->getStorageObject($storageUid, array(), $folderIdentifier)->getFolder($folderIdentifier);
@@ -520,7 +526,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
      *
      * @param string $identifier
      *
-     * @throws \TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException
+     * @throws Exception\ResourceDoesNotExistException
      * @return FileInterface|Folder
      */
     public function getObjectFromCombinedIdentifier($identifier)
@@ -532,7 +538,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
         } elseif ($storage->hasFolder($objectIdentifier)) {
             return $storage->getFolder($objectIdentifier);
         } else {
-            throw new \TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException('Object with identifier "' . $identifier . '" does not exist in storage', 1329647780);
+            throw new Exception\ResourceDoesNotExistException('Object with identifier "' . $identifier . '" does not exist in storage', 1329647780);
         }
     }
 
@@ -555,7 +561,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
         } else {
             throw new \RuntimeException('A file needs to reside in a Storage', 1381570997);
         }
-        $fileObject = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\File::class, $fileData, $storageObject);
+        $fileObject = GeneralUtility::makeInstance(File::class, $fileData, $storageObject);
         return $fileObject;
     }
 
@@ -568,7 +574,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
      * @param bool $raw Whether to get raw results without performing overlays
      * @return FileReference
      * @throws \InvalidArgumentException
-     * @throws \TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException
+     * @throws Exception\ResourceDoesNotExistException
      */
     public function getFileReferenceObject($uid, array $fileReferenceData = array(), $raw = false)
     {
@@ -583,7 +589,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
             if (empty($fileReferenceData)) {
                 $fileReferenceData = $this->getFileReferenceData($uid, $raw);
                 if (!is_array($fileReferenceData)) {
-                    throw new \TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException(
+                    throw new Exception\ResourceDoesNotExistException(
                         'No file reference (sys_file_reference) was found for given UID: "' . $uid . '"',
                         1317178794
                     );
@@ -605,7 +611,7 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
     public function createFileReferenceObject(array $fileReferenceData)
     {
         /** @var FileReference $fileReferenceObject */
-        $fileReferenceObject = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\FileReference::class, $fileReferenceData);
+        $fileReferenceObject = GeneralUtility::makeInstance(FileReference::class, $fileReferenceData);
         return $fileReferenceObject;
     }
 
@@ -619,12 +625,12 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
     protected function getFileReferenceData($uid, $raw = false)
     {
         if (!$raw && TYPO3_MODE === 'BE') {
-            $fileReferenceData = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordWSOL('sys_file_reference', $uid);
+            $fileReferenceData = BackendUtility::getRecordWSOL('sys_file_reference', $uid);
         } elseif (!$raw && is_object($GLOBALS['TSFE'])) {
             $fileReferenceData = $GLOBALS['TSFE']->sys_page->checkRecord('sys_file_reference', $uid);
         } else {
             /** @var $GLOBALS['TYPO3_DB'] \TYPO3\CMS\Core\Database\DatabaseConnection */
-            $fileReferenceData = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'sys_file_reference', 'uid=' . (int)$uid . ' AND deleted=0');
+            $fileReferenceData = $this->getDatabaseConnection()->exec_SELECTgetSingleRow('*', 'sys_file_reference', 'uid=' . (int)$uid . ' AND deleted=0');
         }
         return $fileReferenceData;
     }
@@ -646,16 +652,25 @@ class ResourceFactory implements ResourceFactoryInterface, \TYPO3\CMS\Core\Singl
      */
     protected function getProcessedFileRepository()
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\ProcessedFileRepository::class);
+        return GeneralUtility::makeInstance(ProcessedFileRepository::class);
     }
 
     /**
      * Returns an instance of the Indexer
      *
-     * @return \TYPO3\CMS\Core\Resource\Index\Indexer
+     * @param ResourceStorage $storage
+     * @return Index\Indexer
      */
     protected function getIndexer(ResourceStorage $storage)
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Index\Indexer::class, $storage);
+        return GeneralUtility::makeInstance(Index\Indexer::class, $storage);
+    }
+
+    /**
+     * @return DatabaseConnection
+     */
+    protected function getDatabaseConnection()
+    {
+        return $GLOBALS['TYPO3_DB'];
     }
 }
index 4557473..dd93e69 100644 (file)
@@ -14,12 +14,16 @@ namespace TYPO3\CMS\Core\Resource;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Database\DatabaseConnection;
+use TYPO3\CMS\Core\Registry;
 use TYPO3\CMS\Core\Resource\Exception\InvalidTargetFolderException;
 use TYPO3\CMS\Core\Resource\Index\FileIndexRepository;
 use TYPO3\CMS\Core\Resource\Index\Indexer;
 use TYPO3\CMS\Core\Resource\OnlineMedia\Helpers\OnlineMediaHelperRegistry;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManager;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
 
 /**
  * A "mount point" inside the TYPO3 file handling.
@@ -115,7 +119,7 @@ class ResourceStorage implements ResourceStorageInterface
     protected $capabilities;
 
     /**
-     * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
+     * @var Dispatcher
      */
     protected $signalSlotDispatcher;
 
@@ -354,7 +358,7 @@ class ResourceStorage implements ResourceStorageInterface
                     $this->isOnline = true;
                 } else {
                     // check if the storage is disabled temporary for now
-                    $registryObject = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Registry::class);
+                    $registryObject = GeneralUtility::makeInstance(Registry::class);
                     $offlineUntil = $registryObject->get('core', 'sys_file_storage-' . $this->getUid() . '-offline-until');
                     if ($offlineUntil && $offlineUntil > time()) {
                         $this->isOnline = false;
@@ -390,7 +394,7 @@ class ResourceStorage implements ResourceStorageInterface
     {
         if ($this->getUid() > 0) {
             // @todo: move this to the storage repository
-            $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_file_storage', 'uid=' . (int)$this->getUid(), array('is_online' => 0));
+            $this->getDatabaseConnection()->exec_UPDATEquery('sys_file_storage', 'uid=' . (int)$this->getUid(), array('is_online' => 0));
         }
         $this->storageRecord['is_online'] = 0;
         $this->isOnline = false;
@@ -406,7 +410,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     public function markAsTemporaryOffline()
     {
-        $registryObject = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Registry::class);
+        $registryObject = GeneralUtility::makeInstance(Registry::class);
         $registryObject->set('core', 'sys_file_storage-' . $this->getUid() . '-offline-until', time() + 60 * 5);
         $this->storageRecord['is_online'] = 0;
         $this->isOnline = false;
@@ -497,7 +501,9 @@ class ResourceStorage implements ResourceStorageInterface
             // least one of the file mounts
             $writableFileMountAvailable = false;
             foreach ($this->fileMounts as $fileMount) {
-                if ($this->driver->isWithin($fileMount['folder']->getIdentifier(), $identifier)) {
+                /** @var Folder $folder */
+                $folder = $fileMount['folder'];
+                if ($this->driver->isWithin($folder->getIdentifier(), $identifier)) {
                     $isWithinFileMount = true;
                     if (!$checkWriteAccess) {
                         break;
@@ -1142,7 +1148,7 @@ class ResourceStorage implements ResourceStorageInterface
      * @param string $localFilePath The file on the server's hard disk to add
      * @param Folder $targetFolder The target folder where the file should be added
      * @param string $targetFileName The name of the file to be add, If not set, the local file name is used
-     * @param string $conflictMode a value of the \TYPO3\CMS\Core\Resource\DuplicationBehavior enumeration
+     * @param string $conflictMode a value of the DuplicationBehavior enumeration
      *
      * @throws \InvalidArgumentException
      * @throws Exception\ExistingTargetFileNameException
@@ -1420,7 +1426,7 @@ class ResourceStorage implements ResourceStorageInterface
     }
 
     /**
-     * @param array $filter
+     * @param callable $filter
      */
     public function addFileAndFolderNameFilter($filter)
     {
@@ -1557,7 +1563,7 @@ class ResourceStorage implements ResourceStorageInterface
             $this->processingFolders = array();
             $this->processingFolders[] = $this->getProcessingFolder();
             /** @var $storageRepository StorageRepository */
-            $storageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class);
+            $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
             $allStorages = $storageRepository->findAll();
             foreach ($allStorages as $storage) {
                 // To circumvent the permission check of the folder, we use the factory to create it "manually" instead of directly using $storage->getProcessingFolder()
@@ -1673,7 +1679,9 @@ class ResourceStorage implements ResourceStorageInterface
         $this->assureFileWritePermissions($file);
         // Call driver method to update the file and update file index entry afterwards
         $result = $this->driver->setFileContents($file->getIdentifier(), $contents);
-        $this->getIndexer()->updateIndexEntry($file);
+        if ($file instanceof File) {
+            $this->getIndexer()->updateIndexEntry($file);
+        }
         $this->emitPostFileSetContentsSignal($file, $contents);
         return $result;
     }
@@ -1736,7 +1744,7 @@ class ResourceStorage implements ResourceStorageInterface
      * @param FileInterface $file
      * @param Folder $targetFolder
      * @param string $targetFileName an optional destination fileName
-     * @param string $conflictMode a value of the \TYPO3\CMS\Core\Resource\DuplicationBehavior enumeration
+     * @param string $conflictMode a value of the DuplicationBehavior enumeration
      *
      * @throws \Exception|Exception\AbstractFileOperationException
      * @throws Exception\ExistingTargetFileNameException
@@ -1782,7 +1790,7 @@ class ResourceStorage implements ResourceStorageInterface
      * @param FileInterface $file
      * @param Folder $targetFolder
      * @param string $targetFileName an optional destination fileName
-     * @param string $conflictMode a value of the \TYPO3\CMS\Core\Resource\DuplicationBehavior enumeration
+     * @param string $conflictMode a value of the DuplicationBehavior enumeration
      *
      * @throws Exception\ExistingTargetFileNameException
      * @throws \RuntimeException
@@ -1909,7 +1917,7 @@ class ResourceStorage implements ResourceStorageInterface
      * @param array $uploadedFileData contains information about the uploaded file given by $_FILES['file1']
      * @param Folder $targetFolder the target folder
      * @param string $targetFileName the file name to be written
-     * @param string $conflictMode a value of the \TYPO3\CMS\Core\Resource\DuplicationBehavior enumeration
+     * @param string $conflictMode a value of the DuplicationBehavior enumeration
      * @return FileInterface The file object
      */
     public function addUploadedFile(array $uploadedFileData, Folder $targetFolder = null, $targetFileName = null, $conflictMode = DuplicationBehavior::CANCEL)
@@ -1968,7 +1976,7 @@ class ResourceStorage implements ResourceStorageInterface
      * @param Folder $folderToMove The folder to move.
      * @param Folder $targetParentFolder The target parent folder
      * @param string $newFolderName
-     * @param string $conflictMode a value of the \TYPO3\CMS\Core\Resource\DuplicationBehavior enumeration
+     * @param string $conflictMode a value of the DuplicationBehavior enumeration
      *
      * @throws \Exception|\TYPO3\CMS\Core\Exception
      * @throws \InvalidArgumentException
@@ -2034,7 +2042,7 @@ class ResourceStorage implements ResourceStorageInterface
      * @param FolderInterface $folderToCopy The folder to copy
      * @param FolderInterface $targetParentFolder The target folder
      * @param string $newFolderName
-     * @param string $conflictMode a value of the \TYPO3\CMS\Core\Resource\DuplicationBehavior enumeration
+     * @param string $conflictMode a value of the DuplicationBehavior enumeration
      * @return Folder The new (copied) folder object
      * @throws InvalidTargetFolderException
      */
@@ -2317,7 +2325,7 @@ class ResourceStorage implements ResourceStorageInterface
                 $parentPermissions = $this->driver->getPermissions($this->driver->getParentFolderIdentifierOfIdentifier($identifier));
                 if ($parentPermissions['r']) {
                     $folder = GeneralUtility::makeInstance(
-                        \TYPO3\CMS\Core\Resource\InaccessibleFolder::class, $this, $data['identifier'], $data['name']
+                        InaccessibleFolder::class, $this, $data['identifier'], $data['name']
                     );
                 }
             }
@@ -2407,7 +2415,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPreFileAddSignal($targetFileName, Folder $targetFolder, $sourceFilePath)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PreFileAdd, array(&$targetFileName, $targetFolder, $sourceFilePath, $this, $this->driver));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PreFileAdd, array(&$targetFileName, $targetFolder, $sourceFilePath, $this, $this->driver));
         return $targetFileName;
     }
 
@@ -2420,7 +2428,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPostFileAddSignal(FileInterface $file, Folder $targetFolder)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFileAdd, array($file, $targetFolder));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PostFileAdd, array($file, $targetFolder));
     }
 
     /**
@@ -2432,7 +2440,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPreFileCopySignal(FileInterface $file, Folder $targetFolder)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PreFileCopy, array($file, $targetFolder));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PreFileCopy, array($file, $targetFolder));
     }
 
     /**
@@ -2444,7 +2452,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPostFileCopySignal(FileInterface $file, Folder $targetFolder)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFileCopy, array($file, $targetFolder));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PostFileCopy, array($file, $targetFolder));
     }
 
     /**
@@ -2456,7 +2464,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPreFileMoveSignal(FileInterface $file, Folder $targetFolder)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PreFileMove, array($file, $targetFolder));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PreFileMove, array($file, $targetFolder));
     }
 
     /**
@@ -2464,12 +2472,12 @@ class ResourceStorage implements ResourceStorageInterface
      *
      * @param FileInterface $file
      * @param Folder $targetFolder
-     * @param Folder $originalFolder
+     * @param FolderInterface $originalFolder
      * @return void
      */
-    protected function emitPostFileMoveSignal(FileInterface $file, Folder $targetFolder, Folder $originalFolder)
+    protected function emitPostFileMoveSignal(FileInterface $file, Folder $targetFolder, FolderInterface $originalFolder)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFileMove, array($file, $targetFolder, $originalFolder));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PostFileMove, array($file, $targetFolder, $originalFolder));
     }
 
     /**
@@ -2481,7 +2489,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPreFileRenameSignal(FileInterface $file, $targetFolder)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PreFileRename, array($file, $targetFolder));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PreFileRename, array($file, $targetFolder));
     }
 
     /**
@@ -2493,7 +2501,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPostFileRenameSignal(FileInterface $file, $sanitizedTargetFileName)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFileRename, array($file, $sanitizedTargetFileName));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PostFileRename, array($file, $sanitizedTargetFileName));
     }
 
     /**
@@ -2505,7 +2513,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPreFileReplaceSignal(FileInterface $file, $localFilePath)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PreFileReplace, array($file, $localFilePath));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PreFileReplace, array($file, $localFilePath));
     }
 
     /**
@@ -2517,7 +2525,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPostFileReplaceSignal(FileInterface $file, $localFilePath)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFileReplace, array($file, $localFilePath));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PostFileReplace, array($file, $localFilePath));
     }
 
     /**
@@ -2528,7 +2536,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPostFileCreateSignal($newFileIdentifier, Folder $targetFolder)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFileCreate, array($newFileIdentifier, $targetFolder));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PostFileCreate, array($newFileIdentifier, $targetFolder));
     }
 
     /**
@@ -2539,7 +2547,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPreFileDeleteSignal(FileInterface $file)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PreFileDelete, array($file));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PreFileDelete, array($file));
     }
 
     /**
@@ -2550,7 +2558,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPostFileDeleteSignal(FileInterface $file)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFileDelete, array($file));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PostFileDelete, array($file));
     }
 
     /**
@@ -2562,7 +2570,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPostFileSetContentsSignal(FileInterface $file, $content)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFileSetContents, array($file, $content));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PostFileSetContents, array($file, $content));
     }
 
     /**
@@ -2574,7 +2582,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPreFolderAddSignal(Folder $targetFolder, $name)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PreFolderAdd, array($targetFolder, $name));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PreFolderAdd, array($targetFolder, $name));
     }
 
     /**
@@ -2585,7 +2593,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPostFolderAddSignal(Folder $folder)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFolderAdd, array($folder));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PostFolderAdd, array($folder));
     }
 
     /**
@@ -2598,7 +2606,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPreFolderCopySignal(Folder $folder, Folder $targetFolder, $newName)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PreFolderCopy, array($folder, $targetFolder, $newName));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PreFolderCopy, array($folder, $targetFolder, $newName));
     }
 
     /**
@@ -2611,7 +2619,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPostFolderCopySignal(Folder $folder, Folder $targetFolder, $newName)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFolderCopy, array($folder, $targetFolder, $newName));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PostFolderCopy, array($folder, $targetFolder, $newName));
     }
 
     /**
@@ -2624,7 +2632,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPreFolderMoveSignal(Folder $folder, Folder $targetFolder, $newName)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PreFolderMove, array($folder, $targetFolder, $newName));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PreFolderMove, array($folder, $targetFolder, $newName));
     }
 
     /**
@@ -2638,7 +2646,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPostFolderMoveSignal(Folder $folder, Folder $targetFolder, $newName, Folder $originalFolder)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFolderMove, array($folder, $targetFolder, $newName, $originalFolder));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PostFolderMove, array($folder, $targetFolder, $newName, $originalFolder));
     }
 
     /**
@@ -2650,7 +2658,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPreFolderRenameSignal(Folder $folder, $newName)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PreFolderRename, array($folder, $newName));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PreFolderRename, array($folder, $newName));
     }
 
     /**
@@ -2662,7 +2670,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPostFolderRenameSignal(Folder $folder, $newName)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFolderRename, array($folder, $newName));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PostFolderRename, array($folder, $newName));
     }
 
     /**
@@ -2673,7 +2681,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPreFolderDeleteSignal(Folder $folder)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PreFolderDelete, array($folder));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PreFolderDelete, array($folder));
     }
 
     /**
@@ -2684,7 +2692,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPostFolderDeleteSignal(Folder $folder)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFolderDelete, array($folder));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PostFolderDelete, array($folder));
     }
 
     /**
@@ -2696,7 +2704,7 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function emitPreGeneratePublicUrlSignal(ResourceInterface $resourceObject, $relativeToCurrentScript, array $urlData)
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PreGeneratePublicUrl, array($this, $this->driver, $resourceObject, $relativeToCurrentScript, $urlData));
+        $this->getSignalSlotDispatcher()->dispatch(ResourceStorage::class, self::SIGNAL_PreGeneratePublicUrl, array($this, $this->driver, $resourceObject, $relativeToCurrentScript, $urlData));
     }
 
     /**
@@ -2755,12 +2763,12 @@ class ResourceStorage implements ResourceStorageInterface
     /**
      * Get the SignalSlot dispatcher.
      *
-     * @return \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
+     * @return Dispatcher
      */
     protected function getSignalSlotDispatcher()
     {
         if (!isset($this->signalSlotDispatcher)) {
-            $this->signalSlotDispatcher = $this->getObjectManager()->get(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
+            $this->signalSlotDispatcher = $this->getObjectManager()->get(Dispatcher::class);
         }
         return $this->signalSlotDispatcher;
     }
@@ -2768,11 +2776,11 @@ class ResourceStorage implements ResourceStorageInterface
     /**
      * Gets the ObjectManager.
      *
-     * @return \TYPO3\CMS\Extbase\Object\ObjectManager
+     * @return ObjectManager
      */
     protected function getObjectManager()
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
+        return GeneralUtility::makeInstance(ObjectManager::class);
     }
 
     /**
@@ -2780,11 +2788,11 @@ class ResourceStorage implements ResourceStorageInterface
      */
     protected function getFileFactory()
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\ResourceFactory::class);
+        return GeneralUtility::makeInstance(ResourceFactory::class);
     }
 
     /**
-     * @return \TYPO3\CMS\Core\Resource\Index\FileIndexRepository
+     * @return Index\FileIndexRepository
      */
     protected function getFileIndexRepository()
     {
@@ -2797,7 +2805,7 @@ class ResourceStorage implements ResourceStorageInterface
     protected function getFileProcessingService()
     {
         if (!$this->fileProcessingService) {
-            $this->fileProcessingService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Service\FileProcessingService::class, $this, $this->driver);
+            $this->fileProcessingService = GeneralUtility::makeInstance(Service\FileProcessingService::class, $this, $this->driver);
         }
         return $this->fileProcessingService;
     }
@@ -2888,11 +2896,11 @@ class ResourceStorage implements ResourceStorageInterface
     /**
      * Gets the Indexer.
      *
-     * @return \TYPO3\CMS\Core\Resource\Index\Indexer
+     * @return Index\Indexer
      */
     protected function getIndexer()
     {
-        return GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Index\Indexer::class, $this);
+        return GeneralUtility::makeInstance(Index\Indexer::class, $this);
     }
 
     /**
@@ -2911,4 +2919,12 @@ class ResourceStorage implements ResourceStorageInterface
     {
         return $this->isDefault;
     }
+
+    /**
+     * @return DatabaseConnection
+     */
+    protected function getDatabaseConnection()
+    {
+        return $GLOBALS['TYPO3_DB'];
+    }
 }
index 97d2d31..c9d57ba 100644 (file)
@@ -14,8 +14,11 @@ namespace TYPO3\CMS\Core\Resource\Service;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Log\LogManager;
 use TYPO3\CMS\Core\Resource;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManager;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
 
 /**
  * File processing service
@@ -33,7 +36,7 @@ class FileProcessingService
     protected $driver;
 
     /**
-     * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
+     * @var Dispatcher
      */
     protected $signalSlotDispatcher;
 
@@ -56,8 +59,8 @@ class FileProcessingService
         $this->storage = $storage;
         $this->driver = $driver;
 
-        /** @var $logManager \TYPO3\CMS\Core\Log\LogManager */
-        $logManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class);
+        /** @var $logManager LogManager */
+        $logManager = GeneralUtility::makeInstance(LogManager::class);
         $this->logger = $logManager->getLogger(__CLASS__);
     }
 
@@ -75,7 +78,7 @@ class FileProcessingService
     public function processFile(Resource\FileInterface $fileObject, Resource\ResourceStorage $targetStorage, $taskType, $configuration)
     {
         /** @var $processedFileRepository Resource\ProcessedFileRepository */
-        $processedFileRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\ProcessedFileRepository::class);
+        $processedFileRepository = GeneralUtility::makeInstance(Resource\ProcessedFileRepository::class);
 
         $processedFile = $processedFileRepository->findOneByOriginalFileAndTaskTypeAndConfiguration($fileObject, $taskType, $configuration);
 
@@ -104,7 +107,6 @@ class FileProcessingService
      */
     protected function process(Resource\ProcessedFile $processedFile, Resource\ResourceStorage $targetStorage)
     {
-
         // We only have to trigger the file processing if the file either is new, does not exist or the
         // original file has changed since the last processing run (the last case has to trigger a reprocessing
         // even if the original file was used until now)
@@ -112,12 +114,12 @@ class FileProcessingService
             $processedFile->isOutdated()) {
             $task = $processedFile->getTask();
             /** @var $processor Resource\Processing\LocalImageProcessor */
-            $processor = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Processing\LocalImageProcessor::class);
+            $processor = GeneralUtility::makeInstance(Resource\Processing\LocalImageProcessor::class);
             $processor->processTask($task);
 
             if ($task->isExecuted() && $task->isSuccessful() && $processedFile->isProcessed()) {
                 /** @var $processedFileRepository Resource\ProcessedFileRepository */
-                $processedFileRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\ProcessedFileRepository::class);
+                $processedFileRepository = GeneralUtility::makeInstance(Resource\ProcessedFileRepository::class);
                 $processedFileRepository->add($processedFile);
             }
         }
@@ -126,13 +128,12 @@ class FileProcessingService
     /**
      * Get the SignalSlot dispatcher
      *
-     * @return \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
+     * @return Dispatcher
      */
     protected function getSignalSlotDispatcher()
     {
         if (!isset($this->signalSlotDispatcher)) {
-            $this->signalSlotDispatcher = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class)
-                ->get(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
+            $this->signalSlotDispatcher = GeneralUtility::makeInstance(ObjectManager::class)->get(Dispatcher::class);
         }
         return $this->signalSlotDispatcher;
     }
@@ -147,7 +148,11 @@ class FileProcessingService
      */
     protected function emitPreFileProcessSignal(Resource\ProcessedFile $processedFile, Resource\FileInterface $file, $context, array $configuration = array())
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PreFileProcess, array($this, $this->driver, $processedFile, $file, $context, $configuration));
+        $this->getSignalSlotDispatcher()->dispatch(
+            Resource\ResourceStorage::class,
+            self::SIGNAL_PreFileProcess,
+            array($this, $this->driver, $processedFile, $file, $context, $configuration)
+        );
     }
 
     /**
@@ -160,6 +165,10 @@ class FileProcessingService
      */
     protected function emitPostFileProcessSignal(Resource\ProcessedFile $processedFile, Resource\FileInterface $file, $context, array $configuration = array())
     {
-        $this->getSignalSlotDispatcher()->dispatch(\TYPO3\CMS\Core\Resource\ResourceStorage::class, self::SIGNAL_PostFileProcess, array($this, $this->driver, $processedFile, $file, $context, $configuration));
+        $this->getSignalSlotDispatcher()->dispatch(
+            Resource\ResourceStorage::class,
+            self::SIGNAL_PostFileProcess,
+            array($this, $this->driver, $processedFile, $file, $context, $configuration)
+        );
     }
 }
index bb84d83..1d62b15 100644 (file)
@@ -15,6 +15,8 @@ namespace TYPO3\CMS\Core\Resource\Service;
  */
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Resource\Exception\InvalidUidException;
+use TYPO3\CMS\Core\Resource\Index\MetaDataRepository;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
 
@@ -55,14 +57,15 @@ class UserFileInlineLabelService
                     $fullTitle = $params['row']['title'];
                 } else {
                     try {
-                        $metaDataRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Index\MetaDataRepository::class);
+                        $metaDataRepository = GeneralUtility::makeInstance(MetaDataRepository::class);
                         $metaData = $metaDataRepository->findByFileUid($fileRecord['uid']);
                         $fullTitle = $metaData['title'];
-                    } catch (\TYPO3\CMS\Core\Resource\Exception\InvalidUidException $e) {
+                    } catch (InvalidUidException $e) {
                         /**
                          * We just catch the exception here
                          * Reasoning: There is nothing an editor or even admin could do
                          */
+                        $fullTitle = '';
                     }
                 }
 
index 8c9bc3c..de048b9 100644 (file)
@@ -15,6 +15,10 @@ namespace TYPO3\CMS\Core\Resource\Service;
  */
 
 use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
+use TYPO3\CMS\Core\Resource\Exception\InsufficientFolderReadPermissionsException;
+use TYPO3\CMS\Core\Resource\Folder;
+use TYPO3\CMS\Core\Resource\StorageRepository;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -43,13 +47,13 @@ class UserFileMountService
             $storageUid = (int)$PA['row']['storage'][0];
         }
         if ($storageUid > 0) {
-            /** @var $storageRepository \TYPO3\CMS\Core\Resource\StorageRepository */
-            $storageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class);
+            /** @var $storageRepository StorageRepository */
+            $storageRepository = GeneralUtility::makeInstance(StorageRepository::class);
             /** @var $storage \TYPO3\CMS\Core\Resource\ResourceStorage */
             $storage = $storageRepository->findByUid($storageUid);
             if ($storage === null) {
-                /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
-                $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
+                /** @var FlashMessageService $flashMessageService */
+                $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
                 $queue = $flashMessageService->getMessageQueueByIdentifier();
                 $queue->enqueue(new FlashMessage('Storage #' . $storageUid . ' does not exist. No folder is currently selectable.', '', FlashMessage::ERROR));
                 if (empty($PA['items'])) {
@@ -80,8 +84,8 @@ class UserFileMountService
                     }
                 }
             } else {
-                /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */
-                $flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
+                /** @var FlashMessageService $flashMessageService */
+                $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
                 $queue = $flashMessageService->getMessageQueueByIdentifier();
                 $queue->enqueue(new FlashMessage('Storage "' . $storage->getName() . '" is not browsable. No folder is currently selectable.', '', FlashMessage::WARNING));
                 if (empty($PA['items'])) {
@@ -100,11 +104,11 @@ class UserFileMountService
      * Simple function to make a hierarchical subfolder request into
      * a "flat" option list
      *
-     * @param \TYPO3\CMS\Core\Resource\Folder $parentFolder
+     * @param Folder $parentFolder
      * @param int $level a limiter
-     * @return \TYPO3\CMS\Core\Resource\Folder[]
+     * @return Folder[]
      */
-    protected function getSubfoldersForOptionList(\TYPO3\CMS\Core\Resource\Folder $parentFolder, $level = 0)
+    protected function getSubfoldersForOptionList(Folder $parentFolder, $level = 0)
     {
         $level++;
         // hard break on recursion
@@ -116,7 +120,7 @@ class UserFileMountService
         foreach ($subFolders as $subFolder) {
             try {
                 $subFolderItems = $this->getSubfoldersForOptionList($subFolder, $level);
-            } catch (\TYPO3\CMS\Core\Resource\Exception\InsufficientFolderReadPermissionsException $e) {
+            } catch (InsufficientFolderReadPermissionsException $e) {
                 $subFolderItems  = array();
             }
             $allFolderItems = array_merge($allFolderItems, $subFolderItems);
index cb83894..f520769 100644 (file)
@@ -14,7 +14,12 @@ namespace TYPO3\CMS\Core\Resource\Service;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Messaging\FlashMessageQueue;
+use TYPO3\CMS\Core\Messaging\FlashMessageService;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Lang\LanguageService;
 
 /**
  * Utility class to render capabilities of the storage.
@@ -43,15 +48,18 @@ class UserStorageCapabilityService
 
             // Display a warning to the BE User in case settings is not inline with storage capability.
             if ($storageRecord['is_public'] && !$storage->isPublic()) {
-                $message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class,
-                    $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.message.storage_is_no_public'),
-                    $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.header.storage_is_no_public'),
-                    \TYPO3\CMS\Core\Messaging\FlashMessage::WARNING
+                /** @var LanguageService $lang */
+                $lang = $GLOBALS['LANG'];
+                $message = GeneralUtility::makeInstance(
+                    FlashMessage::class,
+                    $lang->sL('LLL:EXT:lang/locallang_core.xlf:warning.message.storage_is_no_public'),
+                    $lang->sL('LLL:EXT:lang/locallang_core.xlf:warning.header.storage_is_no_public'),
+                    FlashMessage::WARNING
                 );
 
-                /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */
-                $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
-                /** @var $defaultFlashMessageQueue \TYPO3\CMS\Core\Messaging\FlashMessageQueue */
+                /** @var $flashMessageService FlashMessageService */
+                $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
+                /** @var $defaultFlashMessageQueue FlashMessageQueue */
                 $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
                 $defaultFlashMessageQueue->enqueue($message);
             }
index eba3fe9..26eb976 100644 (file)
@@ -14,6 +14,10 @@ namespace TYPO3\CMS\Core\Resource;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools;
+use TYPO3\CMS\Core\Log\LogManager;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Repository for accessing the file mounts
  */
@@ -27,7 +31,7 @@ class StorageRepository extends AbstractRepository
     /**
      * @var string
      */
-    protected $objectType = \TYPO3\CMS\Core\Resource\ResourceStorage::class;
+    protected $objectType = ResourceStorage::class;
 
     /**
      * @var string
@@ -58,8 +62,8 @@ class StorageRepository extends AbstractRepository
     {
         parent::__construct();
 
-        /** @var $logManager \TYPO3\CMS\Core\Log\LogManager */
-        $logManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Log\LogManager::class);
+        /** @var $logManager LogManager */
+        $logManager = GeneralUtility::makeInstance(LogManager::class);
         $this->logger = $logManager->getLogger(__CLASS__);
         $this->db = $GLOBALS['TYPO3_DB'];
     }
@@ -131,7 +135,7 @@ class StorageRepository extends AbstractRepository
         $this->initializeLocalCache();
 
         /** @var $driverRegistry Driver\DriverRegistry */
-        $driverRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Driver\DriverRegistry::class);
+        $driverRegistry = GeneralUtility::makeInstance(Driver\DriverRegistry::class);
 
         $storageObjects = array();
         foreach (static::$storageRowCache as $storageRow) {
@@ -161,7 +165,7 @@ class StorageRepository extends AbstractRepository
         $this->initializeLocalCache();
 
         /** @var $driverRegistry Driver\DriverRegistry */
-        $driverRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\Driver\DriverRegistry::class);
+        $driverRegistry = GeneralUtility::makeInstance(Driver\DriverRegistry::class);
 
         $storageObjects = array();
         foreach (static::$storageRowCache as $storageRow) {
@@ -203,8 +207,8 @@ class StorageRepository extends AbstractRepository
             )
         );
 
-        /** @var $flexObj \TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools */
-        $flexObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools::class);
+        /** @var $flexObj FlexFormTools */
+        $flexObj = GeneralUtility::makeInstance(FlexFormTools::class);
         $flexFormXml = $flexObj->flexArray2Xml($flexFormData, true);
 
             // create the record
index 96eca77..c443ffd 100644 (file)
@@ -14,6 +14,11 @@ namespace TYPO3\CMS\Core\Resource\Utility;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Messaging\FlashMessage;
+use TYPO3\CMS\Core\Resource\AbstractFile;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Lang\LanguageService;
+
 /**
  * Some Backend Utility functions for working with resources
  */
@@ -22,18 +27,22 @@ class BackendUtility
     /**
      * Create a flash message for a file that is marked as missing
      *
-     * @param \TYPO3\CMS\Core\Resource\AbstractFile $file
-     * @return \TYPO3\CMS\Core\Messaging\FlashMessage
+     * @param AbstractFile $file
+     * @return FlashMessage
      */
-    public static function getFlashMessageForMissingFile(\TYPO3\CMS\Core\Resource\AbstractFile $file)
+    public static function getFlashMessageForMissingFile(AbstractFile $file)
     {
-        /** @var \TYPO3\CMS\Core\Messaging\FlashMessage $flashMessage */
-        $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class,
-            $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing_text') .
+        /** @var LanguageService $lang */
+        $lang = $GLOBALS['LANG'];
+
+        /** @var FlashMessage $flashMessage */
+        $flashMessage = GeneralUtility::makeInstance(
+            FlashMessage::class,
+            $lang->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing_text') .
             ' <abbr title="' . htmlspecialchars($file->getStorage()->getName() . ' :: ' . $file->getIdentifier()) . '">' .
             htmlspecialchars($file->getName()) . '</abbr>',
-            $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing'),
-            \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR
+            $lang->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing'),
+            FlashMessage::ERROR
         );
 
         return $flashMessage;
index d6a49a5..f328cd1 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Core\Resource\Utility;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Resource\FolderInterface;
+use TYPO3\CMS\Lang\LanguageService;
+
 /**
  * Utility function for working with resource-lists
  */
@@ -27,14 +30,17 @@ class ListUtility
      */
     public static function resolveSpecialFolderNames(array $folders)
     {
+        /** @var LanguageService $lang */
+        $lang = $GLOBALS['LANG'];
         $resolvedFolders = array();
 
         /** @var $folder \TYPO3\CMS\Core\Resource\Folder */
         foreach ($folders as $folder) {
             $name = $folder->getName();
             $role = $folder->getRole();
-            if ($role !== \TYPO3\CMS\Core\Resource\FolderInterface::ROLE_DEFAULT) {
-                $tempName = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:role_folder_' . $role, true);
+            if ($role !== FolderInterface::ROLE_DEFAULT) {
+
+                $tempName = $lang->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:role_folder_' . $role, true);
                 if (!empty($tempName) && ($tempName !== $name)) {
                     // Set new name and append original name
                     $name = $tempName . ' (' . $name . ')';