Project

General

Profile

Actions

Bug #59017

closed

Exception while trying to edit disabled file storage

Added by Rico Sonntag over 10 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
File Abstraction Layer (FAL)
Target version:
Start date:
2014-05-22
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
no-brainer
Is Regression:
Yes
Sprint Focus:

Description

Clicking on a disabled file storage in list view to edit it, results in:

#1314085990: Desired storage is not in the list of available storages.

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #56730: Outside storages can never be displayed as publicClosedFabien Udriot2014-03-10

Actions
Actions #1

Updated by Philipp Gampe over 10 years ago

  • Status changed from New to Accepted
  • Complexity set to medium
  • Is Regression changed from No to Yes

I am not sure which commit introduced this, but it worked before.

#1314085990: Desired storage is not in the list of available storages. (More information)

InvalidArgumentException thrown in file
/home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php in line 128.

15 TYPO3\CMS\Core\Resource\Driver\DriverRegistry::getDriverClass(NULL)

/home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/ResourceFactory.php:
00100:   /** @var $driverRegistry Driver\DriverRegistry */
00101:   $driverRegistry = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Driver\\DriverRegistry');
00102:   $driverClass = $driverRegistry->getDriverClass($driverIdentificationString);
00103:   $driverObject = GeneralUtility::makeInstance($driverClass, $driverConfiguration);
00104:   return $driverObject;

14 TYPO3\CMS\Core\Resource\ResourceFactory::getDriverObject(NULL, array)

/home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/ResourceFactory.php:
00313:   }
00314:   $driverType = $storageRecord['driver'];
00315:   $driverObject = $this->getDriverObject($driverType, $storageConfiguration);
00316:   /** @var $storage ResourceStorage */
00317:   $storage = GeneralUtility::makeInstance($className, $driverObject, $storageRecord);

13 TYPO3\CMS\Core\Resource\ResourceFactory::createStorageObject(array, NULL)

/home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/ResourceFactory.php:
00178:    }
00179:    if (!$storageObject instanceof ResourceStorage) {
00180:     $storageObject = $this->createStorageObject($recordData, $storageConfiguration);
00181:    }
00182:    $this->signalSlotDispatcher->dispatch('TYPO3\\CMS\\Core\\Resource\\ResourceFactory', self::SIGNAL_PostProcessStorage, array($this, $storageObject));

12 TYPO3\CMS\Core\Resource\ResourceFactory::getStorageObject("6")

/home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/Service/UserStorageCapabilityService.php:
00052:   // Makes sure the storage object can be retrieved which is not the case when new storage.
00053:   if ((int)$propertyArray['row']['uid'] > 0) {
00054:    $storage = ResourceFactory::getInstance()->getStorageObject($fileRecord['uid']);
00055:    $storageRecord = $storage->getStorageRecord();
00056:    $isPublic = $storage->isPublic();

11 TYPO3\CMS\Core\Resource\Service\UserStorageCapabilityService::renderIsPublic(array, TYPO3\CMS\Backend\Form\FormEngine)
10 call_user_func_array(array, array)

/home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Utility/GeneralUtility.php:
04241:      }
04242:      // Call method:
04243:      $content = call_user_func_array(array(&$classObj, $parts[1]), array(&$params, &$ref));
04244:     } else {
04245:      $errorMsg = 'No method name \'' . $parts[1] . '\' in class ' . $parts[0];

9 TYPO3\CMS\Core\Utility\GeneralUtility::callUserFunction("typo3/sysext/core/Classes/Resource/Service/UserSto…rvice\UserStorageCapabilityService->renderIsPublic", array, TYPO3\CMS\Backend\Form\FormEngine)

/home/phil/t3-playground/t3-git/typo3/sysext/backend/Classes/Form/FormEngine.php:
03231:   $PA['parameters'] = isset($PA['fieldConf']['config']['parameters']) ? $PA['fieldConf']['config']['parameters'] : array();
03232:   $PA['pObj'] = &$this;
03233:   return GeneralUtility::callUserFunction($PA['fieldConf']['config']['userFunc'], $PA, $this);
03234:  }
03235: 

8 TYPO3\CMS\Backend\Form\FormEngine::getSingleField_typeUser("sys_file_storage", "is_public", array, array)

/home/phil/t3-playground/t3-git/typo3/sysext/backend/Classes/Form/FormEngine.php:
01264:     break;
01265:    case 'user':
01266:     $item = $this->getSingleField_typeUser($table, $field, $row, $PA);
01267:     break;
01268:    case 'flex':

7 TYPO3\CMS\Backend\Form\FormEngine::getSingleField_SW("sys_file_storage", "is_public", array, array)

/home/phil/t3-playground/t3-git/typo3/sysext/backend/Classes/Form/FormEngine.php:
01128:      }
01129:      // Based on the type of the item, call a render function:
01130:      $item = $this->getSingleField_SW($table, $field, $row, $PA);
01131:      // Add language + diff
01132:      if ($PA['fieldConf']['l10n_display'] && (GeneralUtility::inList($PA['fieldConf']['l10n_display'], 'hideDiff') || GeneralUtility::inList($PA['fieldConf']['l10n_display'], 'defaultAsReadonly'))) {

6 TYPO3\CMS\Backend\Form\FormEngine::getSingleField("sys_file_storage", "is_public", array, NULL, 1, "", NULL)

/home/phil/t3-playground/t3-git/typo3/sysext/backend/Classes/Form/FormEngine.php:
03641:      } elseif (!in_array($theField, $this->excludeElements) && $GLOBALS['TCA'][$table]['columns'][$theField]) {
03642:       $this->palFieldArr[$palette][] = $theField;
03643:       $elem = $this->getSingleField($table, $theField, $row, $fieldParts[1], 1, '', $fieldParts[2]);
03644:       if (is_array($elem)) {
03645:        $parts[] = $elem;

5 TYPO3\CMS\Backend\Form\FormEngine::loadPaletteElements("sys_file_storage", array, "capabilities", "")

/home/phil/t3-playground/t3-git/typo3/sysext/backend/Classes/Form/FormEngine.php:
00971:   }
00972:   $out = '';
00973:   $parts = $this->loadPaletteElements($table, $row, $palette, $itemList);
00974:   // Put palette together if there are fields in it:
00975:   if (count($parts)) {

4 TYPO3\CMS\Backend\Form\FormEngine::getPaletteFields("sys_file_storage", array, "capabilities", "Capabilities")

/home/phil/t3-playground/t3-git/typo3/sysext/backend/Classes/Form/FormEngine.php:
00831:          // Render a 'header' if not collapsed
00832:          if ($GLOBALS['TCA'][$table]['palettes'][$parts[2]]['canNotCollapse'] && $parts[1]) {
00833:           $out_array[$out_sheet][$out_pointer] .= $this->getPaletteFields($table, $row, $parts[2], $this->sL($parts[1]));
00834:          } else {
00835:           $out_array[$out_sheet][$out_pointer] .= $this->getPaletteFields($table, $row, $parts[2], '', '', $this->sL($parts[1]));

3 TYPO3\CMS\Backend\Form\FormEngine::getMainFields("sys_file_storage", array)

/home/phil/t3-playground/t3-git/typo3/sysext/backend/Classes/Controller/EditDocumentController.php:
00904:           }
00905:          } else {
00906:           $panel .= $this->tceforms->getMainFields($table, $rec);
00907:          }
00908:          $panel = $this->tceforms->wrapTotal($panel, $rec, $table);

2 TYPO3\CMS\Backend\Controller\EditDocumentController::makeEditForm()

/home/phil/t3-playground/t3-git/typo3/sysext/backend/Classes/Controller/EditDocumentController.php:
00700:    }
00701:    // Creating the editing form, wrap it with buttons, document selector etc.
00702:    $editForm = $this->makeEditForm();
00703:    if ($editForm) {
00704:     $this->firstEl = reset($this->elementsData);

1 TYPO3\CMS\Backend\Controller\EditDocumentController::main()

/home/phil/t3-playground/t3-git/typo3/alt_doc.php:
00051: 
00052: $editDocumentController->init();
00053: $editDocumentController->main();
00054: $editDocumentController->printContent();

Actions #2

Updated by Markus Klein over 10 years ago

Which version exactly?

Actions #3

Updated by Rico Sonntag over 10 years ago

6.2.1

Actions #4

Updated by Alexander Opitz over 10 years ago

Verified with trunk

Actions #5

Updated by Rafal Brzeski over 10 years ago

Any progress with this issue or is there a solution for quick fix?

Actions #6

Updated by Markus Klein over 10 years ago

Still present in current master.
This is actually a tough thing.

The UserStorageCapabilityService is used to render the "ispublic" checkbox for the backend form.
The services tries to get the storage object by using the ResourceFactory, which again uses the StorageRepository.

The StorageRepository maintains an internal cache for the storages, which is loaded only once, but only contains the "enabled" storages.
Therefore the ResourceFactory fails to retrieve the storage object and tries to create a new one, which fails too and leads to the exception.

I see only one way to fix this: We need to modify the StorageRepository again to allow fetching of hidden records.

Actions #7

Updated by Markus Klein over 10 years ago

  • Assignee set to Frans Saris

The culprit seems to be #56730.

Actions #8

Updated by Markus Klein over 10 years ago

Comment from me: I don't see the point, why a findByUid() call should consider enable-fields at all. IMO this is a bug in the AbstractRepository/StorageRepository.

Actions #9

Updated by Frans Saris about 10 years ago

Hi Rafal,

a probably quick fix could be to remove hidden from the sys_file_storage enablecolumns. But it disables the hide option for filestorages. This will probably also be part of the real fix.

Add following to you ext_tables.php

  $GLOBALS['TCA']['sys_file_storage']['ctrl']['enablecolumns'] = array();
Actions #10

Updated by Frans Saris almost 10 years ago

  • Status changed from Accepted to New
  • Complexity changed from medium to no-brainer
  • Sprint Focus set to On Location Sprint
Actions #11

Updated by Frans Saris almost 10 years ago

Fix should be to disable to possibility to hide a filestorage. See last comment

Actions #12

Updated by Gerrit Code Review almost 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36461

Actions #13

Updated by Gerrit Code Review almost 10 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36461

Actions #14

Updated by Gerrit Code Review almost 10 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36461

Actions #15

Updated by Gerrit Code Review almost 10 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36461

Actions #16

Updated by Ruud Silvrants almost 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #17

Updated by Gerrit Code Review almost 10 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36474

Actions #18

Updated by Helmut Hummel almost 10 years ago

  • Status changed from Under Review to Resolved
Actions #19

Updated by Viktor Livakivskyi over 9 years ago

Will this fix be backported to 6.2 branch?
Under 6.2.12 still reproduced.

Actions #20

Updated by Helmut Hummel over 9 years ago

Viktor Livakivskyi wrote:

Will this fix be backported to 6.2 branch?
Under 6.2.12 still reproduced.

File storages are admin only data records.
The fix is to remove the possibility to disable a file storage.
For 6.2, you may educate your admins to just not disable a file storage record and you will be fine.

If you ask me, there is no need to backport this to 6.2

Actions #21

Updated by Viktor Livakivskyi over 9 years ago

Yes, sure - I can even override TCA to exclude possibility to hide the storage.

Actions #22

Updated by Anja Leichsenring almost 9 years ago

  • Sprint Focus deleted (On Location Sprint)
Actions #23

Updated by Benni Mack about 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF