/** * If the backend script is in CLI mode, it will try to load a backend user named by the CLI module name (in lowercase) * * @param string $userName the name of the module registered inside $TYPO3_CONF_VARS[SC_OPTIONS][GLOBAL][cliKeys] as second parameter * @throws \RuntimeException if a non-admin Backend user could not be loaded */ protected function initializeBackendUser($userName) { $this->bootstrap->initializeBackendUser(); $GLOBALS['BE_USER']->setBeUserByName($userName); if (!$GLOBALS['BE_USER']->user['uid']) { throw new \RuntimeException('No backend user named "' . $userName . '" was found!', 3); } $this->bootstrap->initializeBackendAuthentication()->initializeLanguageObject(); }