Bug #93415
closedtypo3temp clearing stops at storage null
100%
Description
I use the backend tool "Remove Temporary Assets" to clear the "Typo3temp" folders.
However this ends up in an error message.
(1/1) TypeError Argument 1 passed to TYPO3\CMS\Install\Service\Typo3tempFileService::getStatsFromStorage() must be an instance of TYPO3\CMS\Core\Resource\ResourceStorage, null given, called in /path/typo3_src-10.4.10/typo3/sysext/install/Classes/Service/Typo3tempFileService.php on line 58 in /path/typo3_src-10.4.10/typo3/sysext/install/Classes/Service/Typo3tempFileService.php line 112 } return $stats; } protected function getStatsFromStorage(ResourceStorage $storage): array { $storageConfiguration = $storage->getConfiguration(); $storageBasePath = rtrim($storageConfiguration['basePath'], '/'); $processedPath = '/' . $storageBasePath . $storage->getProcessingFolder()->getIdentifier(); at TYPO3\CMS\Install\Service\Typo3tempFileService->getStatsFromStorage(null) in /path/typo3_src-10.4.10/typo3/sysext/install/Classes/Service/Typo3tempFileService.php line 58 public function getStatsFromStorageByUid(int $storageUid): array { $storage = $this->storageRepository->findByUid($storageUid); return $this->getStatsFromStorage($storage); } /** * Directory statistics for typo3temp/assets folders with some at TYPO3\CMS\Install\Service\Typo3tempFileService->getStatsFromStorageByUid(0) in /path/typo3_src-10.4.10/typo3/sysext/install/Classes/Controller/MaintenanceController.php line 184 $messageQueue->enqueue(new FlashMessage('The directory "' . $folder . '" has been cleared successfully', 'Directory cleared')); } else { $storageUid = (int)$storageUid; // We have to get the stats before deleting files, otherwise we're not able to retrieve the amount of files anymore $stats = $this->typo3tempFileService->getStatsFromStorageByUid($storageUid); $failedDeletions = $this->typo3tempFileService->clearProcessedFiles($storageUid); if ($failedDeletions) { $messageQueue->enqueue(new FlashMessage( 'Failed to delete ' . $failedDeletions . ' processed files. See TYPO3 log (by default typo3temp/var/log/typo3_*.log)', at TYPO3\CMS\Install\Controller\MaintenanceController->clearTypo3tempFilesAction(object(TYPO3\CMS\Core\Http\ServerRequest)) in /path/typo3_src-10.4.10/typo3/sysext/install/Classes/Middleware/Maintenance.php line 246 'Unknown action method ' . $action . ' in controller ' . $controllerName, 1505216027 ); } $response = $controller->$action($request); } return $response; } at TYPO3\CMS\Install\Middleware\Maintenance->process(object(TYPO3\CMS\Core\Http\ServerRequest), object(class@anonymous/path/typo3_src-10.4.10/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f5748cb941b)) in /path/typo3_src-10.4.10/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 121 } public function handle(ServerRequestInterface $request): ResponseInterface { return $this->middleware->process($request, $this->next); } }; } at class@anonymous/path/typo3_src-10.4.10/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f5748cb8d16->handle(object(TYPO3\CMS\Core\Http\ServerRequest)) in /path/typo3_src-10.4.10/typo3/sysext/core/Classes/Middleware/NormalizedParamsAttribute.php line 45 */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $request = $request->withAttribute('normalizedParams', NormalizedParams::createFromRequest($request)); return $handler->handle($request); } } at TYPO3\CMS\Core\Middleware\NormalizedParamsAttribute->process(object(TYPO3\CMS\Core\Http\ServerRequest), object(class@anonymous/path/typo3_src-10.4.10/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f5748cb8d16)) in /path/typo3_src-10.4.10/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 172 if (!$middleware instanceof MiddlewareInterface) { throw new \InvalidArgumentException(get_class($middleware) . ' does not implement ' . MiddlewareInterface::class, 1516821342); } return $middleware->process($request, $this->next); } }; } } at class@anonymous/path/typo3_src-10.4.10/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php0x7f5748cb941b->handle(object(TYPO3\CMS\Core\Http\ServerRequest)) in /path/typo3_src-10.4.10/typo3/sysext/core/Classes/Http/MiddlewareDispatcher.php line 78 * @return ResponseInterface */ public function handle(ServerRequestInterface $request): ResponseInterface { return $this->tip->handle($request); } /** * Seed the middleware stack with the inner request handler at TYPO3\CMS\Core\Http\MiddlewareDispatcher->handle(object(TYPO3\CMS\Core\Http\ServerRequest)) in /path/typo3_src-10.4.10/typo3/sysext/core/Classes/Http/AbstractApplication.php line 85 * @return ResponseInterface */ protected function handle(ServerRequestInterface $request): ResponseInterface { return $this->requestHandler->handle($request); } /** * Set up the application and shut it down afterwards at TYPO3\CMS\Core\Http\AbstractApplication->handle(object(TYPO3\CMS\Core\Http\ServerRequest)) in /path/typo3_src-10.4.10/typo3/sysext/install/Classes/Http/Application.php line 50 protected function handle(ServerRequestInterface $request): ResponseInterface { $this->initializeContext(); return parent::handle($request) ->withHeader('X-Frame-Options', 'SAMEORIGIN'); } /** at TYPO3\CMS\Install\Http\Application->handle(object(TYPO3\CMS\Core\Http\ServerRequest)) in /path/typo3_src-10.4.10/typo3/sysext/core/Classes/Http/AbstractApplication.php line 97 final public function run(callable $execute = null) { try { $response = $this->handle( ServerRequestFactory::fromGlobals() ); if ($execute !== null) { call_user_func($execute); } at TYPO3\CMS\Core\Http\AbstractApplication->run() in /path/typo3_src-10.4.10/typo3/install.php line 105 call_user_func(function () { $classLoader = require dirname(__DIR__).'/vendor/autoload.php'; \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(1, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_INSTALL); \TYPO3\CMS\Core\Core\Bootstrap::init($classLoader, true)->get(\TYPO3\CMS\Install\Http\Application::class)->run(); }); at {closure}() in /path/typo3_src-10.4.10/typo3/install.php line 106 call_user_func(function () { $classLoader = require dirname(__DIR__).'/vendor/autoload.php'; \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::run(1, \TYPO3\CMS\Core\Core\SystemEnvironmentBuilder::REQUESTTYPE_INSTALL); \TYPO3\CMS\Core\Core\Bootstrap::init($classLoader, true)->get(\TYPO3\CMS\Install\Http\Application::class)->run(); });
Updated by Maximilian Ziermaier over 3 years ago
+1 Confirm this error in TYPO3 10.4.13
"Check for broken extensions" tool can load all extensions successfully
All other "Remove Temporary Assets"-Buttons like compressed, css, js, ... work fine
Updated by Česlav Przywara over 3 years ago
- Is Regression set to Yes
I have noticed the same problem.
I did a little of digging and I think it's a regression introduced in TYPO3 10.4.4 by this commit: https://github.com/TYPO3/TYPO3.CMS/commit/70a88b752b
The \TYPO3\CMS\Install\Service\Typo3tempFileService::getStatsFromStorageByUid()
method introduced in this commit fails in the case of /typo3temp/assets/_processed_
folder. Although the folder has storage uid = 0, I assume the uid
is only meant to refer to sys_file_processedfile
records with storage = 0
. There is no sys_file_storage
record with uid = 0
, so there's no way to fetch the stats from it.
A simple fix would be to only fetch the stats for $storageUid > 0
(and adapt the notification).
In TYPO3 10.4.3 the problem is not present.
Updated by Gerrit Code Review over 3 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 https://review.typo3.org/c/Packages/TYPO3.CMS/+/68099
Updated by Gerrit Code Review over 3 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/68099
Updated by Maximilian Ziermaier over 3 years ago
I have applied PatchSet 2 and it works for me now.
Thx
Updated by Christian Kuhn over 3 years ago
- Related to Task #91461: Rephrase notifications in Admin Tools added
Updated by Gerrit Code Review over 3 years ago
Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/68319
Updated by Česlav Przywara over 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset e0b12e6f0e25dd3fc0251cc352345969b3d943b0.