[TASK] Unify handling of TYPO3_PROCEED_IF_NO_USER
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / CliRequestHandler.php
index fe6f883..3a05300 100644 (file)
@@ -50,14 +50,7 @@ class CliRequestHandler implements RequestHandlerInterface {
                $commandLineKey = $this->getCommandLineKeyOrDie();
                $commandLineScript = $this->getIncludeScriptByCommandLineKey($commandLineKey);
 
-               $this->bootstrap
-                       ->loadExtensionTables(TRUE)
-                       ->initializeBackendUser()
-                       ->initializeBackendAuthentication()
-                       ->initializeLanguageObject();
-
-               // Make sure output is not buffered, so command-line output and interaction can take place
-               GeneralUtility::flushOutputBuffers();
+               $this->boot();
 
                try {
                        include($commandLineScript);
@@ -68,6 +61,27 @@ class CliRequestHandler implements RequestHandlerInterface {
        }
 
        /**
+        * Execute TYPO3 bootstrap
+        */
+       protected function boot() {
+               // Evaluate the constant for skipping the BE user check for the bootstrap
+               if (defined('TYPO3_PROCEED_IF_NO_USER') && TYPO3_PROCEED_IF_NO_USER) {
+                       $proceedIfNoUserIsLoggedIn = TRUE;
+               } else {
+                       $proceedIfNoUserIsLoggedIn = FALSE;
+               }
+
+               $this->bootstrap
+                       ->loadExtensionTables(TRUE)
+                       ->initializeBackendUser()
+                       ->initializeBackendAuthentication($proceedIfNoUserIsLoggedIn)
+                       ->initializeLanguageObject();
+
+               // Make sure output is not buffered, so command-line output and interaction can take place
+               GeneralUtility::flushOutputBuffers();
+       }
+
+       /**
         * Check CLI parameters.
         * First argument is a key that points to the script configuration.
         * If it is not set or not valid, the script exits with an error message.