[TASK] CGL Cleanup of ResourceStorage 59/23559/3
authorHelmut Hummel <helmut.hummel@typo3.org>
Tue, 3 Sep 2013 13:14:13 +0000 (15:14 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Tue, 3 Sep 2013 14:37:12 +0000 (16:37 +0200)
To ease further backporting this change
backports some non functional CGL cleanup
to 6.0 branch

Releases: 6.1

Change-Id: Idf9d728a9143ab5cec311401fb6f56220c1f58a4
Reviewed-on: https://review.typo3.org/23556
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-on: https://review.typo3.org/23559

typo3/sysext/core/Classes/Resource/ResourceStorage.php

index d5311d5..763f6a0 100644 (file)
@@ -27,6 +27,7 @@ namespace TYPO3\CMS\Core\Resource;
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
  *  This copyright notice MUST APPEAR in all copies of the script!
  ***************************************************************/
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
 
 /**
 use TYPO3\CMS\Core\Utility\PathUtility;
 
 /**
@@ -345,7 +346,7 @@ class ResourceStorage {
        /**
         * Returns TRUE if this storage has the given capability.
         *
        /**
         * Returns TRUE if this storage has the given capability.
         *
-        * @param int $capability A capability, as defined in a CAPABILITY_* constant
+        * @param integer $capability A capability, as defined in a CAPABILITY_* constant
         * @return boolean
         */
        protected function hasCapability($capability) {
         * @return boolean
         */
        protected function hasCapability($capability) {
@@ -403,7 +404,7 @@ class ResourceStorage {
                                        $this->isOnline = TRUE;
                                } else {
                                        // check if the storage is disabled temporary for now
                                        $this->isOnline = TRUE;
                                } else {
                                        // check if the storage is disabled temporary for now
-                                       $registryObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
+                                       $registryObject = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
                                        $offlineUntil = $registryObject->get('core', 'sys_file_storage-' . $this->getUid() . '-offline-until');
                                        if ($offlineUntil && $offlineUntil > time()) {
                                                $this->isOnline = FALSE;
                                        $offlineUntil = $registryObject->get('core', 'sys_file_storage-' . $this->getUid() . '-offline-until');
                                        if ($offlineUntil && $offlineUntil > time()) {
                                                $this->isOnline = FALSE;
@@ -440,7 +441,7 @@ class ResourceStorage {
         * @return void
         */
        public function markAsTemporaryOffline() {
         * @return void
         */
        public function markAsTemporaryOffline() {
-               $registryObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
+               $registryObject = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Registry');
                $registryObject->set('core', 'sys_file_storage-' . $this->getUid() . '-offline-until', time() + 60 * 5);
                $this->storageRecord['is_online'] = 0;
                $this->isOnline = FALSE;
                $registryObject->set('core', 'sys_file_storage-' . $this->getUid() . '-offline-until', time() + 60 * 5);
                $this->storageRecord['is_online'] = 0;
                $this->isOnline = FALSE;
@@ -658,21 +659,21 @@ class ResourceStorage {
         * @return boolean TRUE if extension/filename is allowed
         */
        protected function checkFileExtensionPermission($fileName) {
         * @return boolean TRUE if extension/filename is allowed
         */
        protected function checkFileExtensionPermission($fileName) {
-               $isAllowed = \TYPO3\CMS\Core\Utility\GeneralUtility::verifyFilenameAgainstDenyPattern($fileName);
+               $isAllowed = GeneralUtility::verifyFilenameAgainstDenyPattern($fileName);
                if ($isAllowed) {
                if ($isAllowed) {
-                       $fileInfo = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($fileName);
+                       $fileInfo = GeneralUtility::split_fileref($fileName);
                        // Set up the permissions for the file extension
                        $fileExtensionPermissions = $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace'];
                        // Set up the permissions for the file extension
                        $fileExtensionPermissions = $GLOBALS['TYPO3_CONF_VARS']['BE']['fileExtensions']['webspace'];
-                       $fileExtensionPermissions['allow'] = \TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList(strtolower($fileExtensionPermissions['allow']));
-                       $fileExtensionPermissions['deny'] = \TYPO3\CMS\Core\Utility\GeneralUtility::uniqueList(strtolower($fileExtensionPermissions['deny']));
+                       $fileExtensionPermissions['allow'] = GeneralUtility::uniqueList(strtolower($fileExtensionPermissions['allow']));
+                       $fileExtensionPermissions['deny'] = GeneralUtility::uniqueList(strtolower($fileExtensionPermissions['deny']));
                        $fileExtension = strtolower($fileInfo['fileext']);
                        if ($fileExtension !== '') {
                                // If the extension is found amongst the allowed types, we return TRUE immediately
                        $fileExtension = strtolower($fileInfo['fileext']);
                        if ($fileExtension !== '') {
                                // If the extension is found amongst the allowed types, we return TRUE immediately
-                               if ($fileExtensionPermissions['allow'] === '*' || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($fileExtensionPermissions['allow'], $fileExtension)) {
+                               if ($fileExtensionPermissions['allow'] === '*' || GeneralUtility::inList($fileExtensionPermissions['allow'], $fileExtension)) {
                                        return TRUE;
                                }
                                // If the extension is found amongst the denied types, we return FALSE immediately
                                        return TRUE;
                                }
                                // If the extension is found amongst the denied types, we return FALSE immediately
-                               if ($fileExtensionPermissions['deny'] === '*' || \TYPO3\CMS\Core\Utility\GeneralUtility::inList($fileExtensionPermissions['deny'], $fileExtension)) {
+                               if ($fileExtensionPermissions['deny'] === '*' || GeneralUtility::inList($fileExtensionPermissions['deny'], $fileExtension)) {
                                        return FALSE;
                                }
                                // If no match we return TRUE
                                        return FALSE;
                                }
                                // If no match we return TRUE
@@ -1002,10 +1003,9 @@ class ResourceStorage {
         * Previously in \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::deleteFile()
         *
         * @param $fileObject FileInterface
         * Previously in \TYPO3\CMS\Core\Utility\File\ExtendedFileUtility::deleteFile()
         *
         * @param $fileObject FileInterface
-        *
         * @throws Exception\InsufficientFileAccessPermissionsException
         * @throws Exception\FileOperationErrorException
         * @throws Exception\InsufficientFileAccessPermissionsException
         * @throws Exception\FileOperationErrorException
-        * @return bool TRUE if deletion succeeded
+        * @return boolean TRUE if deletion succeeded
         */
        public function deleteFile($fileObject) {
                if (!$this->checkFileActionPermission('remove', $fileObject)) {
         */
        public function deleteFile($fileObject) {
                if (!$this->checkFileActionPermission('remove', $fileObject)) {
@@ -1074,7 +1074,7 @@ class ResourceStorage {
         * @param string $localFilePath the temporary file name from $_FILES['file1']['tmp_name']
         * @param Folder $targetFolder
         * @param string $targetFileName the destination file name $_FILES['file1']['name']
         * @param string $localFilePath the temporary file name from $_FILES['file1']['tmp_name']
         * @param Folder $targetFolder
         * @param string $targetFileName the destination file name $_FILES['file1']['name']
-        * @param int $uploadedFileSize
+        * @param integer $uploadedFileSize
         *
         * @throws Exception\InsufficientFolderWritePermissionsException
         * @throws Exception\UploadException
         *
         * @throws Exception\InsufficientFolderWritePermissionsException
         * @throws Exception\UploadException
@@ -1093,7 +1093,7 @@ class ResourceStorage {
                        throw new Exception\UploadException('The upload has failed, no uploaded file found!', 1322110455);
                }
                // Max upload size (kb) for files.
                        throw new Exception\UploadException('The upload has failed, no uploaded file found!', 1322110455);
                }
                // Max upload size (kb) for files.
-               $maxUploadFileSize = \TYPO3\CMS\Core\Utility\GeneralUtility::getMaxUploadFileSize() * 1024;
+               $maxUploadFileSize = GeneralUtility::getMaxUploadFileSize() * 1024;
                if ($uploadedFileSize >= $maxUploadFileSize) {
                        throw new Exception\UploadSizeException('The uploaded file exceeds the size-limit of ' . $maxUploadFileSize . ' bytes', 1322110041);
                }
                if ($uploadedFileSize >= $maxUploadFileSize) {
                        throw new Exception\UploadSizeException('The uploaded file exceeds the size-limit of ' . $maxUploadFileSize . ' bytes', 1322110041);
                }
@@ -1556,8 +1556,8 @@ class ResourceStorage {
 
        /**
         * @param $path
 
        /**
         * @param $path
-        * @param int $start
-        * @param int $numberOfItems
+        * @param integer $start
+        * @param integer $numberOfItems
         * @param array $folderFilterCallbacks
         * @param boolean $recursive
         * @return array
         * @param array $folderFilterCallbacks
         * @param boolean $recursive
         * @return array
@@ -1626,7 +1626,7 @@ class ResourceStorage {
                if (!$this->checkFolderActionPermission('add', $parentFolder)) {
                        throw new Exception\InsufficientFolderWritePermissionsException('You are not allowed to create directories in the folder "' . $parentFolder->getIdentifier() . '"', 1323059807);
                }
                if (!$this->checkFolderActionPermission('add', $parentFolder)) {
                        throw new Exception\InsufficientFolderWritePermissionsException('You are not allowed to create directories in the folder "' . $parentFolder->getIdentifier() . '"', 1323059807);
                }
-               $folderParts = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('/', $folderName, TRUE);
+               $folderParts = GeneralUtility::trimExplode('/', $folderName, TRUE);
                foreach ($folderParts as $folder) {
                        // TODO check if folder creation succeeded
                        if ($this->hasFolderInFolder($folder, $parentFolder)) {
                foreach ($folderParts as $folder) {
                        // TODO check if folder creation succeeded
                        if ($this->hasFolderInFolder($folder, $parentFolder)) {
@@ -1925,7 +1925,7 @@ class ResourceStorage {
        protected function getUniqueName(Folder $folder, $theFile, $dontCheckForUnique = FALSE) {
                static $maxNumber = 99, $uniqueNamePrefix = '';
                // Fetches info about path, name, extention of $theFile
        protected function getUniqueName(Folder $folder, $theFile, $dontCheckForUnique = FALSE) {
                static $maxNumber = 99, $uniqueNamePrefix = '';
                // Fetches info about path, name, extention of $theFile
-               $origFileInfo = \TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($theFile);
+               $origFileInfo = GeneralUtility::split_fileref($theFile);
                // Adds prefix
                if ($uniqueNamePrefix) {
                        $origFileInfo['file'] = $uniqueNamePrefix . $origFileInfo['file'];
                // Adds prefix
                if ($uniqueNamePrefix) {
                        $origFileInfo['file'] = $uniqueNamePrefix . $origFileInfo['file'];
@@ -1981,21 +1981,21 @@ class ResourceStorage {
         * @return \TYPO3\CMS\Extbase\Object\ObjectManager
         */
        protected function getObjectManager() {
         * @return \TYPO3\CMS\Extbase\Object\ObjectManager
         */
        protected function getObjectManager() {
-               return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
+               return GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
        }
 
        /**
         * @return ResourceFactory
         */
        protected function getFileFactory() {
        }
 
        /**
         * @return ResourceFactory
         */
        protected function getFileFactory() {
-               return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ResourceFactory');
+               return GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ResourceFactory');
        }
 
        /**
         * @return \TYPO3\CMS\Core\Resource\FileRepository
         */
        protected function getFileRepository() {
        }
 
        /**
         * @return \TYPO3\CMS\Core\Resource\FileRepository
         */
        protected function getFileRepository() {
-               return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
+               return GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
        }
 
        /**
        }
 
        /**
@@ -2003,7 +2003,7 @@ class ResourceStorage {
         */
        protected function getFileProcessingService() {
                if (!$this->fileProcessingService) {
         */
        protected function getFileProcessingService() {
                if (!$this->fileProcessingService) {
-                       $this->fileProcessingService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Service\\FileProcessingService', $this, $this->driver);
+                       $this->fileProcessingService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Service\\FileProcessingService', $this, $this->driver);
                }
                return $this->fileProcessingService;
        }
                }
                return $this->fileProcessingService;
        }