#93415typo3temp clearing stops at storage null
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();
});