[TASK] Get rid of ObjectManager in install tool 83/46883/8
authorClaus Due <claus@namelesscoder.net>
Wed, 24 Feb 2016 20:36:34 +0000 (21:36 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 1 Mar 2016 14:43:06 +0000 (15:43 +0100)
This change removes usages of ObjectManager and general
dependency injection with injection methods across the
install tool (including AJAX actions). Where necessary,
constructor dependency injection has been implemented
with automatic dependency instantiation if not passed
as constructor argument.

Change-Id: I859f07789120f538a1d735f386ff3ba3163bd00e
Resolves: #73605
Releases: master
Reviewed-on: https://review.typo3.org/46883
Reviewed-by: Frank Naegler <frank.naegler@typo3.org>
Tested-by: Frank Naegler <frank.naegler@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
38 files changed:
typo3/sysext/install/Classes/Configuration/AbstractFeature.php
typo3/sysext/install/Classes/Configuration/AbstractPreset.php
typo3/sysext/install/Classes/Configuration/FeatureManager.php
typo3/sysext/install/Classes/Controller/AbstractController.php
typo3/sysext/install/Classes/Controller/Action/AbstractAction.php
typo3/sysext/install/Classes/Controller/Action/Ajax/AbstractCoreUpdate.php
typo3/sysext/install/Classes/Controller/Action/Ajax/ClearCache.php
typo3/sysext/install/Classes/Controller/Action/Ajax/CoreUpdateIsUpdateAvailable.php
typo3/sysext/install/Classes/Controller/Action/Ajax/EnvironmentStatus.php
typo3/sysext/install/Classes/Controller/Action/Ajax/FolderStatus.php
typo3/sysext/install/Classes/Controller/Action/Common/InstallToolDisabledAction.php
typo3/sysext/install/Classes/Controller/Action/Step/DatabaseConnect.php
typo3/sysext/install/Classes/Controller/Action/Step/DatabaseData.php
typo3/sysext/install/Classes/Controller/Action/Step/DatabaseSelect.php
typo3/sysext/install/Classes/Controller/Action/Step/DefaultConfiguration.php
typo3/sysext/install/Classes/Controller/Action/Step/EnvironmentAndFolders.php
typo3/sysext/install/Classes/Controller/Action/Tool/AllConfiguration.php
typo3/sysext/install/Classes/Controller/Action/Tool/CleanUp.php
typo3/sysext/install/Classes/Controller/Action/Tool/Configuration.php
typo3/sysext/install/Classes/Controller/Action/Tool/FolderStructure.php
typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php
typo3/sysext/install/Classes/Controller/Action/Tool/SystemEnvironment.php
typo3/sysext/install/Classes/Controller/Action/Tool/TestSetup.php
typo3/sysext/install/Classes/Controller/Action/Tool/UpgradeWizard.php
typo3/sysext/install/Classes/Controller/AjaxController.php
typo3/sysext/install/Classes/Controller/BackendModuleController.php
typo3/sysext/install/Classes/Controller/StepController.php
typo3/sysext/install/Classes/Controller/ToolController.php
typo3/sysext/install/Classes/FolderStructure/DefaultFactory.php
typo3/sysext/install/Classes/Report/InstallStatusReport.php
typo3/sysext/install/Classes/Service/ClearCacheService.php
typo3/sysext/install/Classes/Service/CoreUpdateService.php
typo3/sysext/install/Classes/Service/CoreVersionService.php
typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php
typo3/sysext/install/Classes/Service/SqlExpectedSchemaService.php
typo3/sysext/install/Classes/Updates/AbstractDatabaseSchemaUpdate.php
typo3/sysext/install/Classes/Updates/AbstractDownloadExtensionUpdate.php
typo3/sysext/install/Classes/Updates/FinalDatabaseSchemaUpdate.php

index 62ad781..f44b1ca 100644 (file)
@@ -14,17 +14,14 @@ namespace TYPO3\CMS\Install\Configuration;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Abstract feature class implements common code
  */
 abstract class AbstractFeature
 {
     /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManager
-     */
-    protected $objectManager = null;
-
-    /**
      * @var string Name of feature
      */
     protected $name = '';
@@ -45,14 +42,6 @@ abstract class AbstractFeature
     protected $postValues = array();
 
     /**
-     * @param \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager
-     */
-    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManager $objectManager)
-    {
-        $this->objectManager = $objectManager;
-    }
-
-    /**
      * Initialize presets of feature
      *
      * @param array $postValues List of $POST values of this feature
@@ -72,7 +61,7 @@ abstract class AbstractFeature
         $customPresetFound = false;
         foreach ($this->presetRegistry as $presetClass) {
             /** @var PresetInterface $presetInstance */
-            $presetInstance = $this->objectManager->get($presetClass);
+            $presetInstance = GeneralUtility::makeInstance($presetClass);
             if (!($presetInstance instanceof PresetInterface)) {
                 throw new Exception(
                     'Preset ' . $presetClass . ' does not implement PresetInterface',
index ff2a0d3..e05984c 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Install\Configuration;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Configuration\ConfigurationManager;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Abstract preset class implements common preset code
  */
@@ -47,9 +50,9 @@ abstract class AbstractPreset implements PresetInterface
     /**
      * @param \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager
      */
-    public function injectConfigurationManager(\TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager)
+    public function __construct(ConfigurationManager $configurationManager = null)
     {
-        $this->configurationManager = $configurationManager;
+        $this->configurationManager = $configurationManager ?: GeneralUtility::makeInstance(ConfigurationManager::class);
     }
 
     /**
index 4b3e23f..5c41b53 100644 (file)
@@ -14,25 +14,14 @@ namespace TYPO3\CMS\Install\Configuration;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Instantiate and configure all known features and presets
  */
 class FeatureManager
 {
     /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManager
-     */
-    protected $objectManager = null;
-
-    /**
-     * @param \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager
-     */
-    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManager $objectManager)
-    {
-        $this->objectManager = $objectManager;
-    }
-
-    /**
      * @var array List of feature class names
      */
     protected $featureRegistry = array(
@@ -54,7 +43,7 @@ class FeatureManager
         $features = array();
         foreach ($this->featureRegistry as $featureClass) {
             /** @var FeatureInterface $featureInstance */
-            $featureInstance = $this->objectManager->get($featureClass);
+            $featureInstance = GeneralUtility::makeInstance($featureClass);
             if (!($featureInstance instanceof FeatureInterface)) {
                 throw new Exception(
                     'Feature ' . $featureClass . ' does not implement FeatureInterface',
index d072313..358fd77 100644 (file)
@@ -24,11 +24,6 @@ use TYPO3\CMS\Install\Service\EnableFileService;
 class AbstractController
 {
     /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManager
-     */
-    protected $objectManager = null;
-
-    /**
      * @var \TYPO3\CMS\Install\Service\SessionService
      */
     protected $session = null;
@@ -44,7 +39,7 @@ class AbstractController
     protected function isInstallToolAvailable()
     {
         /** @var \TYPO3\CMS\Install\Service\EnableFileService $installToolEnableService */
-        $installToolEnableService = $this->objectManager->get(\TYPO3\CMS\Install\Service\EnableFileService::class);
+        $installToolEnableService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\EnableFileService::class);
         if ($installToolEnableService->isFirstInstallAllowed()) {
             return true;
         }
@@ -65,11 +60,11 @@ class AbstractController
         if (!$this->isInstallToolAvailable()) {
             if (!EnableFileService::isFirstInstallAllowed() && !\TYPO3\CMS\Core\Core\Bootstrap::getInstance()->checkIfEssentialConfigurationExists()) {
                 /** @var \TYPO3\CMS\Install\Controller\Action\ActionInterface $action */
-                $action = $this->objectManager->get(\TYPO3\CMS\Install\Controller\Action\Common\FirstInstallAction::class);
+                $action = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Controller\Action\Common\FirstInstallAction::class);
                 $action->setAction('firstInstall');
             } else {
                 /** @var \TYPO3\CMS\Install\Controller\Action\ActionInterface $action */
-                $action = $this->objectManager->get(\TYPO3\CMS\Install\Controller\Action\Common\InstallToolDisabledAction::class);
+                $action = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Controller\Action\Common\InstallToolDisabledAction::class);
                 $action->setAction('installToolDisabled');
             }
             $action->setController('common');
@@ -89,7 +84,7 @@ class AbstractController
             && (empty($GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword']))
         ) {
             /** @var \TYPO3\CMS\Install\Controller\Action\ActionInterface $action */
-            $action = $this->objectManager->get(\TYPO3\CMS\Install\Controller\Action\Common\InstallToolPasswordNotSetAction::class);
+            $action = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Controller\Action\Common\InstallToolPasswordNotSetAction::class);
             $action->setController('common');
             $action->setAction('installToolPasswordNotSet');
             $this->output($action->handle());
@@ -147,7 +142,7 @@ class AbstractController
                 $this->redirect();
             } else {
                 /** @var $message \TYPO3\CMS\Install\Status\ErrorStatus */
-                $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                 $message->setTitle('Invalid form token');
                 $message->setMessage(
                     'The form protection token was invalid. You have been logged out, please log in and try again.'
@@ -185,7 +180,7 @@ class AbstractController
             $this->redirect();
         } else {
             /** @var $message \TYPO3\CMS\Install\Status\ErrorStatus */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
             $message->setTitle('Session expired');
             $message->setMessage(
                 'Your Install Tool session has expired. You have been logged out, please log in and try again.'
@@ -203,7 +198,7 @@ class AbstractController
     protected function loginForm(\TYPO3\CMS\Install\Status\StatusInterface $message = null)
     {
         /** @var \TYPO3\CMS\Install\Controller\Action\Common\LoginForm $action */
-        $action = $this->objectManager->get(\TYPO3\CMS\Install\Controller\Action\Common\LoginForm::class);
+        $action = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Controller\Action\Common\LoginForm::class);
         $action->setController('common');
         $action->setAction('login');
         $action->setToken($this->generateTokenForAction('login'));
@@ -236,7 +231,8 @@ class AbstractController
                 } elseif (md5($password) === $installToolPassword) {
                     // Update install tool password
                     $saltFactory = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance(null, 'BE');
-                    $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+                    /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
+                    $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
                     $configurationManager->setLocalConfigurationValueByPath(
                         'BE/installToolPassword',
                         $saltFactory->getHashedPassword($password)
@@ -252,7 +248,7 @@ class AbstractController
                 $saltFactory = \TYPO3\CMS\Saltedpasswords\Salt\SaltFactory::getSaltingInstance(null, 'BE');
                 $hashedPassword = $saltFactory->getHashedPassword($password);
                 /** @var $message \TYPO3\CMS\Install\Status\ErrorStatus */
-                $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                 $message->setTitle('Login failed');
                 $message->setMessage('Given password does not match the install tool login password. ' .
                     'Calculated hash: ' . $hashedPassword);
@@ -289,7 +285,7 @@ class AbstractController
         $warningEmailAddress = $GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr'];
         if ($warningEmailAddress) {
             /** @var \TYPO3\CMS\Core\Mail\MailMessage $mailMessage */
-            $mailMessage = $this->objectManager->get(\TYPO3\CMS\Core\Mail\MailMessage::class);
+            $mailMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class);
             $mailMessage
                 ->addTo($warningEmailAddress)
                 ->setSubject('Install Tool Login at \'' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . '\'')
@@ -314,7 +310,7 @@ class AbstractController
         $warningEmailAddress = $GLOBALS['TYPO3_CONF_VARS']['BE']['warning_email_addr'];
         if ($warningEmailAddress) {
             /** @var \TYPO3\CMS\Core\Mail\MailMessage $mailMessage */
-            $mailMessage = $this->objectManager->get(\TYPO3\CMS\Core\Mail\MailMessage::class);
+            $mailMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class);
             $mailMessage
                 ->addTo($warningEmailAddress)
                 ->setSubject('Install Tool Login ATTEMPT at \'' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . '\'')
@@ -363,7 +359,7 @@ class AbstractController
     protected function isInitialInstallationInProgress()
     {
         /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
-        $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
 
         $localConfigurationFileLocation = $configurationManager->getLocalConfigurationFileLocation();
         $localConfigurationFileExists = @is_file($localConfigurationFileLocation);
@@ -386,7 +382,7 @@ class AbstractController
     protected function initializeSession()
     {
         /** @var \TYPO3\CMS\Install\Service\SessionService $session */
-        $this->session = $this->objectManager->get(\TYPO3\CMS\Install\Service\SessionService::class);
+        $this->session = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\SessionService::class);
         if (!$this->session->hasSession()) {
             $this->session->startSession();
         }
@@ -406,18 +402,6 @@ class AbstractController
     }
 
     /**
-     * Initialize extbase object manager for fluid rendering
-     *
-     * @return void
-     */
-    protected function initializeObjectManager()
-    {
-        /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
-        $objectManager = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
-        $this->objectManager = $objectManager;
-    }
-
-    /**
      * Require dbal ext_localconf if extension is loaded
      * Required extbase ext_localconf
      * Set caching to NullBackend, install tool must not cache anything
@@ -529,6 +513,7 @@ class AbstractController
      *
      * @param string $controller Can be set to 'tool' to redirect from step to tool controller
      * @param string $action Set specific action for next request, used in step controller to specify next step
+     * @throws Exception\RedirectLoopException
      * @return void
      */
     protected function redirect($controller = '', $action = '')
index 44e8530..63de344 100644 (file)
@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Install\Controller\Action;
  */
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Fluid\View\StandaloneView;
 
 /**
@@ -24,36 +23,11 @@ use TYPO3\CMS\Fluid\View\StandaloneView;
 abstract class AbstractAction implements ActionInterface
 {
     /**
-     * @var ObjectManager
-     */
-    protected $objectManager = null;
-
-    /**
-     * Inject object manager
-     *
-     * @param ObjectManager $objectManager
-     */
-    public function injectObjectManager(ObjectManager $objectManager)
-    {
-        $this->objectManager = $objectManager;
-    }
-
-    /**
      * @var StandaloneView
      */
     protected $view = null;
 
     /**
-     * Inject View
-     *
-     * @param StandaloneView $view
-     */
-    public function injectView(StandaloneView $view)
-    {
-        $this->view = $view;
-    }
-
-    /**
      * @var string Name of controller. One of the strings 'step', 'tool' or 'common'
      */
     protected $controller = '';
@@ -102,11 +76,12 @@ abstract class AbstractAction implements ActionInterface
     protected function initializeHandle()
     {
         // Context service distinguishes between standalone and backend context
-        $contextService = $this->objectManager->get(\TYPO3\CMS\Install\Service\ContextService::class);
+        $contextService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\ContextService::class);
 
         $viewRootPath = GeneralUtility::getFileAbsFileName('EXT:install/Resources/Private/');
         $controllerActionDirectoryName = ucfirst($this->controller);
         $mainTemplate = ucfirst($this->action);
+        $this->view = GeneralUtility::makeInstance(StandaloneView::class);
         $this->view->setTemplatePathAndFilename($viewRootPath . 'Templates/Action/' . $controllerActionDirectoryName . '/' . $mainTemplate . '.html');
         $this->view->setLayoutRootPaths(array($viewRootPath . 'Layouts/'));
         $this->view->setPartialRootPaths(array($viewRootPath . 'Partials/'));
@@ -237,7 +212,7 @@ abstract class AbstractAction implements ActionInterface
         static $database;
         if (!is_object($database)) {
             /** @var \TYPO3\CMS\Core\Database\DatabaseConnection $database */
-            $database = $this->objectManager->get(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
+            $database = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
             $database->setDatabaseUsername($GLOBALS['TYPO3_CONF_VARS']['DB']['username']);
             $database->setDatabasePassword($GLOBALS['TYPO3_CONF_VARS']['DB']['password']);
             $database->setDatabaseHost($GLOBALS['TYPO3_CONF_VARS']['DB']['host']);
@@ -292,16 +267,16 @@ abstract class AbstractAction implements ActionInterface
         $extensionCompatibilityTesterMessages = array();
 
         /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-        $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\LoadingStatus::class);
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\LoadingStatus::class);
         $message->setTitle('Loading...');
         $extensionCompatibilityTesterMessages[] = $message;
 
-        $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
         $message->setTitle('Incompatible extension found!');
         $message->setMessage('Something went wrong and no protocol was written.');
         $extensionCompatibilityTesterMessages[] = $message;
 
-        $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
         $message->setTitle('All local extensions can be loaded!');
         $extensionCompatibilityTesterMessages[] = $message;
 
index d8cc34c..845550b 100644 (file)
@@ -14,6 +14,12 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Install\Service\CoreUpdateService;
+use TYPO3\CMS\Install\Service\CoreVersionService;
+use TYPO3\CMS\Install\Status\StatusUtility;
+use TYPO3\CMS\Install\View\JsonView;
+
 /**
  * Abstract core update class contains general core update
  * related methods
@@ -23,7 +29,7 @@ abstract class AbstractCoreUpdate extends AbstractAjaxAction
     /**
      * @var \TYPO3\CMS\Install\View\JsonView
      */
-    protected $view = null;
+    protected $view;
 
     /**
      * @var \TYPO3\CMS\Install\Service\CoreUpdateService
@@ -41,35 +47,21 @@ abstract class AbstractCoreUpdate extends AbstractAjaxAction
     protected $coreVersionService;
 
     /**
-     * @param \TYPO3\CMS\Install\View\JsonView $view
-     */
-    public function injectView(\TYPO3\CMS\Install\View\JsonView $view)
-    {
-        $this->view = $view;
-    }
-
-    /**
-     * @param \TYPO3\CMS\Install\Service\CoreUpdateService $coreUpdateService
-     */
-    public function injectCoreUpdateService(\TYPO3\CMS\Install\Service\CoreUpdateService $coreUpdateService)
-    {
-        $this->coreUpdateService = $coreUpdateService;
-    }
-
-    /**
+     * @param JsonView $view
+     * @param CoreUpdateService $coreUpdateService
      * @param \TYPO3\CMS\Install\Status\StatusUtility $statusUtility
-     */
-    public function injectStatusUtility(\TYPO3\CMS\Install\Status\StatusUtility $statusUtility)
-    {
-        $this->statusUtility = $statusUtility;
-    }
-
-    /**
      * @param \TYPO3\CMS\Install\Service\CoreVersionService $coreVersionService
      */
-    public function injectCoreVersionService(\TYPO3\CMS\Install\Service\CoreVersionService $coreVersionService)
+    public function __construct(
+        JsonView $view = null,
+        CoreUpdateService $coreUpdateService = null,
+        StatusUtility $statusUtility = null,
+        CoreVersionService $coreVersionService = null)
     {
-        $this->coreVersionService = $coreVersionService;
+        $this->view = $view ?: GeneralUtility::makeInstance(JsonView::class);
+        $this->coreUpdateService = $coreUpdateService ?: GeneralUtility::makeInstance(CoreUpdateService::class);
+        $this->statusUtility = $statusUtility ?: GeneralUtility::makeInstance(StatusUtility::class);
+        $this->coreVersionService = $coreVersionService ?: GeneralUtility::makeInstance(CoreVersionService::class);
     }
 
     /**
index bfea6ca..30b7548 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Clear Cache
  *
@@ -32,7 +34,7 @@ class ClearCache extends AbstractAjaxAction
     protected function executeAction()
     {
         /** @var \TYPO3\CMS\Install\Service\ClearCacheService $clearCacheService */
-        $clearCacheService = $this->objectManager->get(\TYPO3\CMS\Install\Service\ClearCacheService::class);
+        $clearCacheService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\ClearCacheService::class);
         $clearCacheService->clearAll();
         return 'OK';
     }
index d7d0595..7c34d8e 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Check if a younger version is available
  */
@@ -70,7 +72,7 @@ class CoreUpdateIsUpdateAvailable extends AbstractCoreUpdate
     protected function getMessage($severity, $title, $message = '')
     {
         /** @var $statusMessage \TYPO3\CMS\Install\Status\StatusInterface */
-        $statusMessage = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\' . ucfirst($severity) . 'Status');
+        $statusMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Status\\' . ucfirst($severity) . 'Status');
         $statusMessage->setTitle($title);
         $statusMessage->setMessage($message);
 
index 8c995f5..9848458 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Environment status check for errors
  */
@@ -27,14 +29,14 @@ class EnvironmentStatus extends AbstractAjaxAction
     protected function executeAction()
     {
         /** @var \TYPO3\CMS\Install\Status\StatusUtility $statusUtility */
-        $statusUtility = $this->objectManager->get(\TYPO3\CMS\Install\Status\StatusUtility::class);
+        $statusUtility = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\StatusUtility::class);
 
         // Count of failed environment checks to be displayed in the left navigation menu
-        $environmentStatus = $this->objectManager->get(\TYPO3\CMS\Install\SystemEnvironment\Check::class)->getStatus();
+        $environmentStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\SystemEnvironment\Check::class)->getStatus();
         $environmentErrors = $statusUtility->filterBySeverity($environmentStatus, 'error');
 
         // Count of failed database checks to be displayed in the left navigation menu
-        $databaseStatus = $this->objectManager->get(\TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck::class)->getStatus();
+        $databaseStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\SystemEnvironment\DatabaseCheck::class)->getStatus();
         $databaseErrors = $statusUtility->filterBySeverity($databaseStatus, 'error');
 
         return count($environmentErrors) + count($databaseErrors);
index 182665a..0ffb062 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Install\Controller\Action\Ajax;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Folder status check for errors
  */
@@ -28,16 +30,16 @@ class FolderStatus extends AbstractAjaxAction
     {
         // Count of folder structure errors are displayed in left navigation menu
         /** @var $folderStructureFacade \TYPO3\CMS\Install\FolderStructure\StructureFacade */
-        $folderStructureFacade = $this->objectManager->get(\TYPO3\CMS\Install\FolderStructure\DefaultFactory::class)->getStructure();
+        $folderStructureFacade = GeneralUtility::makeInstance(\TYPO3\CMS\Install\FolderStructure\DefaultFactory::class)->getStructure();
         $folderStatus = $folderStructureFacade->getStatus();
 
         /** @var $permissionCheck \TYPO3\CMS\Install\FolderStructure\DefaultPermissionsCheck */
-        $permissionCheck = $this->objectManager->get(\TYPO3\CMS\Install\FolderStructure\DefaultPermissionsCheck::class);
+        $permissionCheck = GeneralUtility::makeInstance(\TYPO3\CMS\Install\FolderStructure\DefaultPermissionsCheck::class);
         $folderStatus[] = $permissionCheck->getMaskStatus('fileCreateMask');
         $folderStatus[] = $permissionCheck->getMaskStatus('folderCreateMask');
 
         /** @var \TYPO3\CMS\Install\Status\StatusUtility $statusUtility */
-        $statusUtility = $this->objectManager->get(\TYPO3\CMS\Install\Status\StatusUtility::class);
+        $statusUtility = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\StatusUtility::class);
 
         $folderStructureErrors = array_merge(
             $statusUtility->filterBySeverity($folderStatus, 'error'),
index cad276c..6590b15 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Install\Controller\Action\Common;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Install\Controller\Action;
 
 /**
@@ -29,10 +30,10 @@ class InstallToolDisabledAction extends Action\AbstractAction
     protected function executeAction()
     {
         /** @var \TYPO3\CMS\Install\SystemEnvironment\Check $statusCheck */
-        $statusCheck = $this->objectManager->get(\TYPO3\CMS\Install\SystemEnvironment\Check::class);
+        $statusCheck = GeneralUtility::makeInstance(\TYPO3\CMS\Install\SystemEnvironment\Check::class);
         $statusObjects = $statusCheck->getStatus();
         /** @var \TYPO3\CMS\Install\Status\StatusUtility $statusUtility */
-        $statusUtility = $this->objectManager->get(\TYPO3\CMS\Install\Status\StatusUtility::class);
+        $statusUtility = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\StatusUtility::class);
         $alerts = $statusUtility->filterBySeverity($statusObjects, 'alert');
         $this->view->assign('alerts', $alerts);
         return $this->view->render();
index cc17c1e..d86cd33 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
  */
 
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * Database connect step:
@@ -37,7 +38,7 @@ class DatabaseConnect extends AbstractStepAction
         $result = array();
 
         /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
-        $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
 
         $postValues = $this->postValues['values'];
         if (isset($postValues['loadDbal'])) {
@@ -92,7 +93,7 @@ class DatabaseConnect extends AbstractStepAction
                     $localConfigurationPathValuePairs['DB/username'] = $value;
                 } else {
                     /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                    $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                    $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                     $errorStatus->setTitle('Database username not valid');
                     $errorStatus->setMessage('Given username must be shorter than fifty characters.');
                     $result[] = $errorStatus;
@@ -105,7 +106,7 @@ class DatabaseConnect extends AbstractStepAction
                     $localConfigurationPathValuePairs['DB/password'] = $value;
                 } else {
                     /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                    $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                    $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                     $errorStatus->setTitle('Database password not valid');
                     $errorStatus->setMessage('Given password must be shorter than fifty characters.');
                     $result[] = $errorStatus;
@@ -118,7 +119,7 @@ class DatabaseConnect extends AbstractStepAction
                     $localConfigurationPathValuePairs['DB/host'] = $value;
                 } else {
                     /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                    $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                    $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                     $errorStatus->setTitle('Database host not valid');
                     $errorStatus->setMessage('Given host is not alphanumeric (a-z, A-Z, 0-9 or _-.:) or longer than fifty characters.');
                     $result[] = $errorStatus;
@@ -131,7 +132,7 @@ class DatabaseConnect extends AbstractStepAction
                     $localConfigurationPathValuePairs['DB/port'] = (int)$value;
                 } else {
                     /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                    $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                    $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                     $errorStatus->setTitle('Database port not valid');
                     $errorStatus->setMessage('Given port is not numeric or within range 1 to 65535.');
                     $result[] = $errorStatus;
@@ -143,7 +144,7 @@ class DatabaseConnect extends AbstractStepAction
                     $localConfigurationPathValuePairs['DB/socket'] = $postValues['socket'];
                 } else {
                     /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                    $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                    $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                     $errorStatus->setTitle('Socket does not exist');
                     $errorStatus->setMessage('Given socket location does not exist on server.');
                     $result[] = $errorStatus;
@@ -156,7 +157,7 @@ class DatabaseConnect extends AbstractStepAction
                     $localConfigurationPathValuePairs['DB/database'] = $value;
                 } else {
                     /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                    $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                    $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                     $errorStatus->setTitle('Database name not valid');
                     $errorStatus->setMessage('Given database name must be shorter than fifty characters.');
                     $result[] = $errorStatus;
@@ -174,11 +175,11 @@ class DatabaseConnect extends AbstractStepAction
                     ->disableCoreCache();
                 if ($this->isDbalEnabled()) {
                     require(ExtensionManagementUtility::extPath('dbal') . 'ext_localconf.php');
-                    \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
+                    GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->setCacheConfigurations($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']);
                 }
                 if (!$this->isConnectSuccessful()) {
                     /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                    $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                    $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                     $errorStatus->setTitle('Database connect not successful');
                     $errorStatus->setMessage('Connecting to the database with given settings failed. Please check.');
                     $result[] = $errorStatus;
@@ -286,7 +287,7 @@ class DatabaseConnect extends AbstractStepAction
     protected function isConnectSuccessful()
     {
         /** @var $databaseConnection \TYPO3\CMS\Core\Database\DatabaseConnection */
-        $databaseConnection = $this->objectManager->get(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
+        $databaseConnection = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
 
         if ($this->isDbalEnabled()) {
             // Set additional connect information based on dbal driver. postgres for example needs
@@ -374,14 +375,14 @@ class DatabaseConnect extends AbstractStepAction
         // If host is "local" either by upgrading or by first install, we try a socket
         // connection first and use TCP/IP as fallback
         if ($localConfigurationPathValuePairs['DB/host'] === 'localhost'
-            || \TYPO3\CMS\Core\Utility\GeneralUtility::cmpIP($localConfigurationPathValuePairs['DB/host'], '127.*.*.*')
+            || GeneralUtility::cmpIP($localConfigurationPathValuePairs['DB/host'], '127.*.*.*')
             || (string)$localConfigurationPathValuePairs['DB/host'] === ''
         ) {
             if ($this->isConnectionWithUnixDomainSocketPossible()) {
                 $localConfigurationPathValuePairs['DB/host'] = 'localhost';
                 $localConfigurationPathValuePairs['DB/socket'] = $this->getConfiguredSocket();
             } else {
-                if (!\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($localConfigurationPathValuePairs['DB/host'], '127.')) {
+                if (!GeneralUtility::isFirstPartOfStr($localConfigurationPathValuePairs['DB/host'], '127.')) {
                     $localConfigurationPathValuePairs['DB/host'] = '127.0.0.1';
                 }
             }
@@ -399,7 +400,7 @@ class DatabaseConnect extends AbstractStepAction
         }
 
         /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
-        $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
         $configurationManager->setLocalConfigurationValuesByPathValuePairs($localConfigurationPathValuePairs);
     }
 
@@ -572,7 +573,7 @@ class DatabaseConnect extends AbstractStepAction
             ExtensionManagementUtility::loadExtension('dbal');
         }
         /** @var $errorStatus \TYPO3\CMS\Install\Status\WarningStatus */
-        $warningStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\WarningStatus::class);
+        $warningStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\WarningStatus::class);
         $warningStatus->setTitle('Loaded database abstraction layer');
         return $warningStatus;
     }
@@ -592,7 +593,7 @@ class DatabaseConnect extends AbstractStepAction
         }
         // @TODO: Remove configuration from TYPO3_CONF_VARS['EXTCONF']['dbal']
         /** @var $errorStatus \TYPO3\CMS\Install\Status\WarningStatus */
-        $warningStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\WarningStatus::class);
+        $warningStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\WarningStatus::class);
         $warningStatus->setTitle('Removed database abstraction layer');
         return $warningStatus;
     }
index 4dffbe4..7aa6332 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
  */
 
 use TYPO3\CMS\Core\Configuration\ConfigurationManager;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Install\Status\ErrorStatus;
 
 /**
@@ -32,7 +33,7 @@ class DatabaseData extends AbstractStepAction
         $result = array();
 
         /** @var ConfigurationManager $configurationManager */
-        $configurationManager = $this->objectManager->get(ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
 
         $postValues = $this->postValues['values'];
 
@@ -41,7 +42,7 @@ class DatabaseData extends AbstractStepAction
         // Check password and return early if not good enough
         $password = $postValues['password'];
         if (strlen($password) < 8) {
-            $errorStatus = $this->objectManager->get(ErrorStatus::class);
+            $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class);
             $errorStatus->setTitle('Administrator password not secure enough!');
             $errorStatus->setMessage(
                 'You are setting an important password here! It gives an attacker full control over your instance if cracked.' .
@@ -70,7 +71,7 @@ class DatabaseData extends AbstractStepAction
             'crdate' => $GLOBALS['EXEC_TIME']
         );
         if (false === $this->getDatabaseConnection()->exec_INSERTquery('be_users', $adminUserFields)) {
-            $errorStatus = $this->objectManager->get(ErrorStatus::class);
+            $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class);
             $errorStatus->setTitle('Administrator account not created!');
             $errorStatus->setMessage(
                 'The administrator account could not be created. The following error occurred:' . LF .
@@ -132,9 +133,9 @@ class DatabaseData extends AbstractStepAction
         // Import database data
         $database = $this->getDatabaseConnection();
         /** @var \TYPO3\CMS\Install\Service\SqlSchemaMigrationService $schemaMigrationService */
-        $schemaMigrationService = $this->objectManager->get(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class);
+        $schemaMigrationService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class);
         /** @var \TYPO3\CMS\Install\Service\SqlExpectedSchemaService $expectedSchemaService */
-        $expectedSchemaService = $this->objectManager->get(\TYPO3\CMS\Install\Service\SqlExpectedSchemaService::class);
+        $expectedSchemaService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\SqlExpectedSchemaService::class);
 
         // Raw concatenated ext_tables.sql and friends string
         $expectedSchemaString = $expectedSchemaService->getTablesDefinitionString(true);
@@ -168,7 +169,7 @@ class DatabaseData extends AbstractStepAction
         }
 
         foreach ($result as $statement => &$message) {
-            $errorStatus = $this->objectManager->get(ErrorStatus::class);
+            $errorStatus = GeneralUtility::makeInstance(ErrorStatus::class);
             $errorStatus->setTitle('Database query failed!');
             $errorStatus->setMessage(
                 'Query:' . LF .
@@ -187,7 +188,7 @@ class DatabaseData extends AbstractStepAction
      */
     protected function markImportDatabaseDone()
     {
-        $this->objectManager->get(ConfigurationManager::class)
+        GeneralUtility::makeInstance(ConfigurationManager::class)
             ->setLocalConfigurationValueByPath('SYS/isInitialDatabaseImportDone', true);
     }
 
@@ -198,7 +199,7 @@ class DatabaseData extends AbstractStepAction
      */
     protected function isImportDatabaseDone()
     {
-        return $this->objectManager->get(ConfigurationManager::class)
+        return GeneralUtility::makeInstance(ConfigurationManager::class)
             ->getConfigurationValueByPath('SYS/isInitialDatabaseImportDone');
     }
 }
index 43665b5..e892f0b 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Database select step.
  * This step is only rendered if database is mysql. With dbal,
@@ -38,7 +40,7 @@ class DatabaseSelect extends AbstractStepAction
         $postValues = $this->postValues['values'];
         $localConfigurationPathValuePairs = array();
         /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
-        $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
         if ($postValues['type'] === 'new') {
             $newDatabaseName = $postValues['new'];
             if ($this->isValidDatabaseName($newDatabaseName)) {
@@ -47,7 +49,7 @@ class DatabaseSelect extends AbstractStepAction
                     $localConfigurationPathValuePairs['DB/database'] = $newDatabaseName;
                 } else {
                     /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                    $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                    $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                     $errorStatus->setTitle('Unable to create database');
                     $errorStatus->setMessage(
                         'Database with name ' . $newDatabaseName . ' could not be created.' .
@@ -59,7 +61,7 @@ class DatabaseSelect extends AbstractStepAction
                 }
             } else {
                 /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-                $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                 $errorStatus->setTitle('Database name not valid');
                 $errorStatus->setMessage(
                     'Given database name must be shorter than fifty characters' .
@@ -79,7 +81,7 @@ class DatabaseSelect extends AbstractStepAction
             }
         } else {
             /** @var $errorStatus \TYPO3\CMS\Install\Status\ErrorStatus */
-            $errorStatus = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+            $errorStatus = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
             $errorStatus->setTitle('No Database selected');
             $errorStatus->setMessage('You must select a database.');
             $result[] = $errorStatus;
@@ -123,7 +125,7 @@ class DatabaseSelect extends AbstractStepAction
     protected function executeAction()
     {
         /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
-        $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
         $isInitialInstallationInProgress = $configurationManager->getConfigurationValueByPath('SYS/isInitialInstallationInProgress');
         $this->view->assign('databaseList', $this->getDatabaseList($isInitialInstallationInProgress));
         $this->view->assign('isInitialInstallationInProgress', $isInitialInstallationInProgress);
@@ -171,7 +173,7 @@ class DatabaseSelect extends AbstractStepAction
      */
     protected function initializeDatabaseConnection()
     {
-        $this->databaseConnection = $this->objectManager->get(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
+        $this->databaseConnection = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
         $this->databaseConnection->setDatabaseUsername($GLOBALS['TYPO3_CONF_VARS']['DB']['username']);
         $this->databaseConnection->setDatabasePassword($GLOBALS['TYPO3_CONF_VARS']['DB']['password']);
         $this->databaseConnection->setDatabaseHost($GLOBALS['TYPO3_CONF_VARS']['DB']['host']);
index dcb6942..b0ab00d 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Install\Service\EnableFileService;
 
 /**
@@ -29,7 +30,7 @@ class DefaultConfiguration extends AbstractStepAction
     public function execute()
     {
         /** @var \TYPO3\CMS\Install\Configuration\FeatureManager $featureManager */
-        $featureManager = $this->objectManager->get(\TYPO3\CMS\Install\Configuration\FeatureManager::class);
+        $featureManager = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Configuration\FeatureManager::class);
         // Get best matching configuration presets
         $configurationValues = $featureManager->getBestMatchingConfigurationForAllFeatures();
 
@@ -115,11 +116,11 @@ For each website you need a TypoScript template on the main page of your website
         }
 
         /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
-        $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
         $configurationManager->setLocalConfigurationValuesByPathValuePairs($configurationValues);
 
         /** @var \TYPO3\CMS\Install\Service\SessionService $session */
-        $session = $this->objectManager->get(\TYPO3\CMS\Install\Service\SessionService::class);
+        $session = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\SessionService::class);
         $session->destroySession();
 
         /** @var $formProtection \TYPO3\CMS\Core\FormProtection\InstallToolFormProtection */
index 86c4dcd..4c7daec 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Install\Controller\Action\Step;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Very first install step:
  * - Needs execution if typo3conf/LocalConfiguration.php does not exist
@@ -33,17 +35,17 @@ class EnvironmentAndFolders extends AbstractStepAction
     public function execute()
     {
         /** @var $folderStructureFactory \TYPO3\CMS\Install\FolderStructure\DefaultFactory */
-        $folderStructureFactory = $this->objectManager->get(\TYPO3\CMS\Install\FolderStructure\DefaultFactory::class);
+        $folderStructureFactory = GeneralUtility::makeInstance(\TYPO3\CMS\Install\FolderStructure\DefaultFactory::class);
         /** @var $structureFacade \TYPO3\CMS\Install\FolderStructure\StructureFacade */
         $structureFacade = $folderStructureFactory->getStructure();
         $structureFixMessages = $structureFacade->fix();
         /** @var \TYPO3\CMS\Install\Status\StatusUtility $statusUtility */
-        $statusUtility = $this->objectManager->get(\TYPO3\CMS\Install\Status\StatusUtility::class);
+        $statusUtility = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\StatusUtility::class);
         $errorsFromStructure = $statusUtility->filterBySeverity($structureFixMessages, 'error');
 
         if (@is_dir(PATH_typo3conf)) {
             /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
-            $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+            $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
             $configurationManager->createLocalConfigurationFromFactoryConfiguration();
 
             // Create a PackageStates.php with all packages activated marked as "part of factory default"
@@ -64,7 +66,7 @@ class EnvironmentAndFolders extends AbstractStepAction
 
             // Create enable install tool file after typo3conf & LocalConfiguration were created
             /** @var \TYPO3\CMS\Install\Service\EnableFileService $installToolService */
-            $installToolService = $this->objectManager->get(\TYPO3\CMS\Install\Service\EnableFileService::class);
+            $installToolService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\EnableFileService::class);
             $installToolService->removeFirstInstallFile();
             $installToolService->createInstallToolEnableFile();
         }
@@ -94,17 +96,17 @@ class EnvironmentAndFolders extends AbstractStepAction
     protected function executeAction()
     {
         /** @var \TYPO3\CMS\Install\SystemEnvironment\Check $statusCheck */
-        $statusCheck = $this->objectManager->get(\TYPO3\CMS\Install\SystemEnvironment\Check::class);
+        $statusCheck = GeneralUtility::makeInstance(\TYPO3\CMS\Install\SystemEnvironment\Check::class);
         $statusObjects = $statusCheck->getStatus();
         /** @var \TYPO3\CMS\Install\Status\StatusUtility $statusUtility */
-        $statusUtility = $this->objectManager->get(\TYPO3\CMS\Install\Status\StatusUtility::class);
+        $statusUtility = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\StatusUtility::class);
         $environmentStatus = $statusUtility->sortBySeverity($statusObjects);
         $alerts = $statusUtility->filterBySeverity($statusObjects, 'alert');
         $this->view->assign('alerts', $alerts);
         $this->view->assign('environmentStatus', $environmentStatus);
 
         /** @var $folderStructureFactory \TYPO3\CMS\Install\FolderStructure\DefaultFactory */
-        $folderStructureFactory = $this->objectManager->get(\TYPO3\CMS\Install\FolderStructure\DefaultFactory::class);
+        $folderStructureFactory = GeneralUtility::makeInstance(\TYPO3\CMS\Install\FolderStructure\DefaultFactory::class);
         /** @var $structureFacade \TYPO3\CMS\Install\FolderStructure\StructureFacade */
         $structureFacade = $folderStructureFactory->getStructure();
         $structureMessages = $structureFacade->getStatus();
index 5658e15..4966524 100644 (file)
@@ -167,7 +167,7 @@ class AllConfiguration extends Action\AbstractAction
                             if ((string)$GLOBALS['TYPO3_CONF_VARS'][$section][$valueKey] !== (string)$value) {
                                 $configurationPathValuePairs[$section . '/' . $valueKey] = $value;
                                 /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-                                $status = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+                                $status = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
                                 $status->setTitle('$GLOBALS[\'TYPO3_CONF_VARS\'][\'' . $section . '\'][\'' . $valueKey . '\']');
                                 $status->setMessage('New value = ' . $value);
                                 $statusObjects[] = $status;
@@ -178,7 +178,7 @@ class AllConfiguration extends Action\AbstractAction
             }
             if (!empty($statusObjects)) {
                 /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
-                $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+                $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
                 $configurationManager->setLocalConfigurationValuesByPathValuePairs($configurationPathValuePairs);
             }
         }
@@ -193,7 +193,7 @@ class AllConfiguration extends Action\AbstractAction
     protected function getDefaultConfigArrayComments()
     {
         /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
-        $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
         $string = GeneralUtility::getUrl($configurationManager->getDefaultConfigurationFileLocation());
 
         $commentArray = array();
index 909ddf5..815317c 100644 (file)
@@ -146,12 +146,12 @@ class CleanUp extends Action\AbstractAction
         }
         if (!empty($clearedTables)) {
             /** @var OkStatus $message */
-            $message = $this->objectManager->get(OkStatus::class);
+            $message = GeneralUtility::makeInstance(OkStatus::class);
             $message->setTitle('Cleared tables');
             $message->setMessage('List of cleared tables: ' . implode(', ', $clearedTables));
         } else {
             /** @var InfoStatus $message */
-            $message = $this->objectManager->get(InfoStatus::class);
+            $message = GeneralUtility::makeInstance(InfoStatus::class);
             $message->setTitle('No tables selected to clear');
         }
         return $message;
@@ -167,7 +167,7 @@ class CleanUp extends Action\AbstractAction
         $database = $this->getDatabaseConnection();
         $database->exec_UPDATEquery('be_users', '', array('uc' => ''));
         /** @var OkStatus $message */
-        $message = $this->objectManager->get(OkStatus::class);
+        $message = GeneralUtility::makeInstance(OkStatus::class);
         $message->setTitle('Reset all backend users preferences');
         return $message;
     }
@@ -249,7 +249,7 @@ class CleanUp extends Action\AbstractAction
         $data['numberOfDeletedFiles'] = $deleteCounter;
 
         if ($deleteCounter > 0) {
-            $message = $this->objectManager->get(OkStatus::class);
+            $message = GeneralUtility::makeInstance(OkStatus::class);
             $message->setTitle('Deleted ' . $deleteCounter . ' files from typo3temp/' . $subDirectory . '/');
             $this->actionMessages[] = $message;
         }
@@ -299,11 +299,11 @@ class CleanUp extends Action\AbstractAction
         $failedDeletions = $repository->removeAll();
         if ($failedDeletions) {
             /** @var ErrorStatus $message */
-            $message = $this->objectManager->get(ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(ErrorStatus::class);
             $message->setTitle('Failed to delete ' . $failedDeletions . ' processed files. See TYPO3 log (by default typo3temp/var/logs/typo3_*.log)');
         } else {
             /** @var OkStatus $message */
-            $message = $this->objectManager->get(OkStatus::class);
+            $message = GeneralUtility::makeInstance(OkStatus::class);
             $message->setTitle('Cleared processed files');
         }
 
index 7400271..1aa4f4a 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Install\Controller\Action\Tool;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Configuration\ConfigurationManager;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Install\Configuration\FeatureManager;
 use TYPO3\CMS\Install\Controller\Action;
 
 /**
@@ -29,22 +32,16 @@ class Configuration extends Action\AbstractAction
     /**
      * @var \TYPO3\CMS\Core\Configuration\ConfigurationManager
      */
-    protected $configurationManager = null;
+    protected $configurationManager;
 
     /**
-     * @param \TYPO3\CMS\Install\Configuration\FeatureManager $featureManager
+     * @param FeatureManager $featureManager
+     * @param ConfigurationManager $configurationManager
      */
-    public function injectFeatureManager(\TYPO3\CMS\Install\Configuration\FeatureManager $featureManager)
+    public function __construct(FeatureManager $featureManager = null, ConfigurationManager $configurationManager = null)
     {
-        $this->featureManager = $featureManager;
-    }
-
-    /**
-     * @param \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager
-     */
-    public function injectConfigurationManager(\TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager)
-    {
-        $this->configurationManager = $configurationManager;
+        $this->featureManager = $featureManager ?: GeneralUtility::makeInstance(FeatureManager::class);
+        $this->configurationManager = $configurationManager ?: GeneralUtility::makeInstance(ConfigurationManager::class);
     }
 
     /**
@@ -79,7 +76,7 @@ class Configuration extends Action\AbstractAction
         if (!empty($configurationValues)) {
             $this->configurationManager->setLocalConfigurationValuesByPathValuePairs($configurationValues);
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
             $message->setTitle('Configuration written');
             $messageBody = array();
             foreach ($configurationValues as $configurationKey => $configurationValue) {
@@ -88,7 +85,7 @@ class Configuration extends Action\AbstractAction
             $message->setMessage(implode(LF, $messageBody));
         } else {
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\InfoStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\InfoStatus::class);
             $message->setTitle('No configuration change selected');
         }
         return $message;
index 07c95c3..fd584df 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Install\Controller\Action\Tool;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Install\Controller\Action;
 
 /**
@@ -29,7 +30,7 @@ class FolderStructure extends Action\AbstractAction
     protected function executeAction()
     {
         /** @var $folderStructureFactory \TYPO3\CMS\Install\FolderStructure\DefaultFactory */
-        $folderStructureFactory = $this->objectManager->get(\TYPO3\CMS\Install\FolderStructure\DefaultFactory::class);
+        $folderStructureFactory = GeneralUtility::makeInstance(\TYPO3\CMS\Install\FolderStructure\DefaultFactory::class);
         /** @var $structureFacade \TYPO3\CMS\Install\FolderStructure\StructureFacade */
         $structureFacade = $folderStructureFactory->getStructure();
 
@@ -40,7 +41,7 @@ class FolderStructure extends Action\AbstractAction
 
         $statusObjects = $structureFacade->getStatus();
         /** @var $statusUtility \TYPO3\CMS\Install\Status\StatusUtility */
-        $statusUtility = $this->objectManager->get(\TYPO3\CMS\Install\Status\StatusUtility::class);
+        $statusUtility = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\StatusUtility::class);
 
         $errorStatus = array_merge(
             $statusUtility->filterBySeverity($statusObjects, 'error'),
@@ -53,7 +54,7 @@ class FolderStructure extends Action\AbstractAction
         );
 
         /** @var \TYPO3\CMS\Install\FolderStructure\DefaultPermissionsCheck $permissionCheck */
-        $permissionCheck = $this->objectManager->get(\TYPO3\CMS\Install\FolderStructure\DefaultPermissionsCheck::class);
+        $permissionCheck = GeneralUtility::makeInstance(\TYPO3\CMS\Install\FolderStructure\DefaultPermissionsCheck::class);
         $filePermissionStatus = $permissionCheck->getMaskStatus('fileCreateMask');
         $directoryPermissionStatus = $permissionCheck->getMaskStatus('folderCreateMask');
 
index 5214339..9078a84 100644 (file)
@@ -72,7 +72,7 @@ class ImportantActions extends Action\AbstractAction
         $opcodeCacheService = GeneralUtility::makeInstance(OpcodeCacheService::class);
 
         /** @var \TYPO3\CMS\Install\Service\CoreUpdateService $coreUpdateService */
-        $coreUpdateService = $this->objectManager->get(\TYPO3\CMS\Install\Service\CoreUpdateService::class);
+        $coreUpdateService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\CoreUpdateService::class);
         $this->view
             ->assign('enableCoreUpdate', $coreUpdateService->isCoreUpdateEnabled())
             ->assign('composerMode', Bootstrap::usesComposerClassLoading())
@@ -102,23 +102,23 @@ class ImportantActions extends Action\AbstractAction
         $values = $this->postValues['values'];
         if ($values['newInstallToolPassword'] !== $values['newInstallToolPasswordCheck']) {
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
             $message->setTitle('Install tool password not changed');
             $message->setMessage('Given passwords do not match.');
         } elseif (strlen($values['newInstallToolPassword']) < 8) {
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
             $message->setTitle('Install tool password not changed');
             $message->setMessage('Given password must be at least eight characters long.');
         } else {
             /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
-            $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+            $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
             $configurationManager->setLocalConfigurationValueByPath(
                 'BE/installToolPassword',
                 $this->getHashedPassword($values['newInstallToolPassword'])
             );
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
             $message->setTitle('Install tool password changed');
         }
         return $message;
@@ -134,15 +134,15 @@ class ImportantActions extends Action\AbstractAction
         $values = $this->postValues['values'];
         if (isset($values['newSiteName']) && $values['newSiteName'] !== '') {
             /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
-            $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+            $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
             $configurationManager->setLocalConfigurationValueByPath('SYS/sitename', $values['newSiteName']);
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
             $message->setTitle('Site name changed');
             $this->view->assign('siteName', $values['newSiteName']);
         } else {
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
             $message->setTitle('Site name not changed');
             $message->setMessage('Site name must be at least one character long.');
         }
@@ -157,9 +157,9 @@ class ImportantActions extends Action\AbstractAction
     protected function clearAllCache()
     {
         /** @var \TYPO3\CMS\Install\Service\ClearCacheService $clearCacheService */
-        $clearCacheService = $this->objectManager->get(\TYPO3\CMS\Install\Service\ClearCacheService::class);
+        $clearCacheService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\ClearCacheService::class);
         $clearCacheService->clearAll();
-        $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
         $message->setTitle('Successfully cleared all caches');
         return $message;
     }
@@ -172,7 +172,7 @@ class ImportantActions extends Action\AbstractAction
     protected function clearOpcodeCache()
     {
         GeneralUtility::makeInstance(OpcodeCacheService::class)->clearAllActive();
-        $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
         $message->setTitle('Successfully cleared all available opcode caches');
         return $message;
     }
@@ -186,7 +186,7 @@ class ImportantActions extends Action\AbstractAction
     {
         $newKey = \TYPO3\CMS\Core\Utility\GeneralUtility::getRandomHexString(96);
         /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
-        $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
         $configurationManager->setLocalConfigurationValueByPath('SYS/encryptionKey', $newKey);
         /** @var $formProtection \TYPO3\CMS\Core\FormProtection\InstallToolFormProtection */
         $formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get(
@@ -194,7 +194,7 @@ class ImportantActions extends Action\AbstractAction
         );
         $formProtection->clean();
         /** @var \TYPO3\CMS\Install\Service\SessionService $session */
-        $session = $this->objectManager->get(\TYPO3\CMS\Install\Service\SessionService::class);
+        $session = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\SessionService::class);
         $session->destroySession();
         \TYPO3\CMS\Core\Utility\HttpUtility::redirect('Install.php?install[context]=' . $this->getContext());
     }
@@ -213,17 +213,17 @@ class ImportantActions extends Action\AbstractAction
 
         if (strlen($username) < 1) {
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
             $message->setTitle('Administrator user not created');
             $message->setMessage('No valid username given.');
         } elseif ($password !== $passwordCheck) {
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
             $message->setTitle('Administrator user not created');
             $message->setMessage('Passwords do not match.');
         } elseif (strlen($password) < 8) {
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
             $message->setTitle('Administrator user not created');
             $message->setMessage('Password must be at least eight characters long.');
         } else {
@@ -235,7 +235,7 @@ class ImportantActions extends Action\AbstractAction
             );
             if ($userExists) {
                 /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-                $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                 $message->setTitle('Administrator user not created');
                 $message->setMessage('A user with username "' . $username . '" exists already.');
             } else {
@@ -249,7 +249,7 @@ class ImportantActions extends Action\AbstractAction
                 );
                 $database->exec_INSERTquery('be_users', $adminUserFields);
                 /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-                $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+                $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
                 $message->setTitle('Administrator created with username "' . $username . '".');
             }
         }
@@ -269,16 +269,16 @@ class ImportantActions extends Action\AbstractAction
         // Early return in case no update was selected
         if (empty($this->postValues['values'])) {
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\WarningStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\WarningStatus::class);
             $message->setTitle('No database changes selected');
             $messages[] = $message;
             return $messages;
         }
 
         /** @var \TYPO3\CMS\Install\Service\SqlSchemaMigrationService $schemaMigrationService */
-        $schemaMigrationService = $this->objectManager->get(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class);
+        $schemaMigrationService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class);
         /** @var \TYPO3\CMS\Install\Service\SqlExpectedSchemaService $expectedSchemaService */
-        $expectedSchemaService = $this->objectManager->get(\TYPO3\CMS\Install\Service\SqlExpectedSchemaService::class);
+        $expectedSchemaService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\SqlExpectedSchemaService::class);
         $expectedSchema = $expectedSchemaService->getExpectedDatabaseSchema();
         $currentSchema = $schemaMigrationService->getFieldDefinitions_database();
 
@@ -306,7 +306,7 @@ class ImportantActions extends Action\AbstractAction
             if (is_array($resultSet)) {
                 foreach ($resultSet as $errorMessage) {
                     /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-                    $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                    $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                     $message->setTitle('Database update failed');
                     $message->setMessage('Error: ' . $errorMessage);
                     $messages[] = $message;
@@ -315,7 +315,7 @@ class ImportantActions extends Action\AbstractAction
         }
 
         /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-        $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
         $message->setTitle('Executed database updates');
         $messages[] = $message;
 
@@ -332,9 +332,9 @@ class ImportantActions extends Action\AbstractAction
     protected function databaseAnalyzerAnalyze()
     {
         /** @var \TYPO3\CMS\Install\Service\SqlSchemaMigrationService $schemaMigrationService */
-        $schemaMigrationService = $this->objectManager->get(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class);
+        $schemaMigrationService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class);
         /** @var \TYPO3\CMS\Install\Service\SqlExpectedSchemaService $expectedSchemaService */
-        $expectedSchemaService = $this->objectManager->get(\TYPO3\CMS\Install\Service\SqlExpectedSchemaService::class);
+        $expectedSchemaService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\SqlExpectedSchemaService::class);
         $expectedSchema = $expectedSchemaService->getExpectedDatabaseSchema();
 
         $currentSchema = $schemaMigrationService->getFieldDefinitions_database();
@@ -424,7 +424,7 @@ class ImportantActions extends Action\AbstractAction
         $this->view->assign('databaseAnalyzerSuggestion', $databaseAnalyzerSuggestion);
 
         /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-        $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
         $message->setTitle('Analyzed current database');
         return $message;
     }
index 97ba761..528af16 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Install\Controller\Action\Tool;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Install\Controller\Action;
 use TYPO3\CMS\Install\Status\StatusUtility;
 use TYPO3\CMS\Install\SystemEnvironment\Check;
@@ -32,15 +33,15 @@ class SystemEnvironment extends Action\AbstractAction
     protected function executeAction()
     {
         /** @var $statusCheck Check */
-        $statusCheck = $this->objectManager->get(Check::class);
+        $statusCheck = GeneralUtility::makeInstance(Check::class);
         $statusObjects = $statusCheck->getStatus();
 
         /** @var $statusCheck DatabaseCheck */
-        $databaseStatusCheck = $this->objectManager->get(DatabaseCheck::class);
+        $databaseStatusCheck = GeneralUtility::makeInstance(DatabaseCheck::class);
         $statusObjects = array_merge($statusObjects, $databaseStatusCheck->getStatus());
 
         /** @var $statusUtility StatusUtility */
-        $statusUtility = $this->objectManager->get(StatusUtility::class);
+        $statusUtility = GeneralUtility::makeInstance(StatusUtility::class);
         $sortedStatusObjects = $statusUtility->sortBySeverity($statusObjects);
         $this->view->assign('statusObjectsBySeverity', $sortedStatusObjects);
 
index 096012d..5d6db12 100644 (file)
@@ -109,13 +109,13 @@ class TestSetup extends Action\AbstractAction
             || !GeneralUtility::validEmail($this->postValues['values']['testEmailRecipient'])
         ) {
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
             $message->setTitle('Mail not sent');
             $message->setMessage('Given address is not a valid email address.');
         } else {
             $recipient = $this->postValues['values']['testEmailRecipient'];
             /** @var $mailMessage \TYPO3\CMS\Core\Mail\MailMessage */
-            $mailMessage = $this->objectManager->get(\TYPO3\CMS\Core\Mail\MailMessage::class);
+            $mailMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Mail\MailMessage::class);
             $mailMessage
                 ->addTo($recipient)
                 ->addFrom($this->getSenderEmailAddress(), $this->getSenderEmailName())
@@ -123,7 +123,7 @@ class TestSetup extends Action\AbstractAction
                 ->setBody('<html><body>html test content</body></html>', 'text/html')
                 ->addPart('TEST CONTENT')
                 ->send();
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
             $message->setTitle('Test mail sent');
             $message->setMessage('Recipient: ' . $recipient);
         }
@@ -199,7 +199,7 @@ class TestSetup extends Action\AbstractAction
         imagegif($image, $outputFile);
 
         /** @var \TYPO3\CMS\Install\Status\StatusInterface $message */
-        $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\InfoStatus::class);
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\InfoStatus::class);
         $message->setTitle('True type font');
         $message->setMessage(
             'If the two images below do not look the same, please check your FreeType 2 module.'
@@ -234,7 +234,7 @@ class TestSetup extends Action\AbstractAction
             $result = array();
             if (!GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $formatToTest)) {
                 /** @var \TYPO3\CMS\Install\Status\StatusInterface $message */
-                $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\WarningStatus::class);
+                $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\WarningStatus::class);
                 $message->setTitle('Skipped test');
                 $message->setMessage('Handling format ' . $formatToTest . ' must be enabled in TYPO3_CONF_VARS[\'GFX\'][\'imagefile_ext\']');
                 $result['error'] = $message;
@@ -287,7 +287,7 @@ class TestSetup extends Action\AbstractAction
                 clearstatcache();
                 $compressedSize = GeneralUtility::formatSize(filesize($imResult[3]));
                 /** @var \TYPO3\CMS\Install\Status\StatusInterface $message */
-                $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\InfoStatus::class);
+                $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\InfoStatus::class);
                 $message->setTitle('Compressed gif');
                 $message->setMessage(
                     'Method used by compress: ' . $methodUsed . LF
@@ -295,7 +295,7 @@ class TestSetup extends Action\AbstractAction
                 );
             } else {
                 /** @var \TYPO3\CMS\Install\Status\StatusInterface $message */
-                $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\InfoStatus::class);
+                $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\InfoStatus::class);
                 $message->setTitle('Gif compression not enabled by [GFX][gif_compress]');
             }
             $testResults['gif']['message'] = $message;
@@ -529,7 +529,7 @@ class TestSetup extends Action\AbstractAction
             $testResults['niceText']['referenceFile'] = $this->imageBasePath . 'TestReference/Gdlib-niceText.' . $gifOrPng;
             $testResults['niceText']['command'] = $imageProcessor->IM_commands;
             /** @var \TYPO3\CMS\Install\Status\StatusInterface $message */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\InfoStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\InfoStatus::class);
             $message->setTitle('Note on \'niceText\'');
             $message->setMessage(
                 '\'niceText\' is a concept that tries to improve the antialiasing of the rendered type by'
@@ -565,7 +565,7 @@ class TestSetup extends Action\AbstractAction
             $testResults['shadow']['referenceFile'] = $this->imageBasePath . 'TestReference/Gdlib-shadow.' . $gifOrPng;
             $testResults['shadow']['command'] = $imageProcessor->IM_commands;
             /** @var \TYPO3\CMS\Install\Status\StatusInterface $message */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\InfoStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\InfoStatus::class);
             $message->setTitle('Note on \'shadow\'');
             $message->setMessage(
                 'This test makes sense only if the above test had a correct output. But if so, you may not see'
@@ -590,7 +590,7 @@ class TestSetup extends Action\AbstractAction
     protected function imageTestDoneMessage($parseTime = 0)
     {
         /** @var \TYPO3\CMS\Install\Status\StatusInterface $message */
-        $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
         $message->setTitle('Executed image tests');
         $message->setMessage('Parse time: ' . $parseTime . ' ms');
         return $message;
@@ -604,7 +604,7 @@ class TestSetup extends Action\AbstractAction
     protected function imageMagickDisabledMessage()
     {
         /** @var \TYPO3\CMS\Install\Status\StatusInterface $message */
-        $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
         $message->setTitle('Tests not executed');
         $message->setMessage('ImageMagick / GraphicsMagick handling is disabled or not configured correctly.');
         return $message;
@@ -618,7 +618,7 @@ class TestSetup extends Action\AbstractAction
     protected function imageGenerationFailedMessage()
     {
         /** @var \TYPO3\CMS\Install\Status\StatusInterface $message */
-        $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
         $message->setTitle('Image generation failed');
         $message->setMessage(
             'ImageMagick / GraphicsMagick handling is enabled, but the execute'
@@ -655,7 +655,7 @@ class TestSetup extends Action\AbstractAction
     protected function initializeImageProcessor()
     {
         /** @var GraphicalFunctions $imageProcessor */
-        $imageProcessor = $this->objectManager->get(GraphicalFunctions::class);
+        $imageProcessor = GeneralUtility::makeInstance(GraphicalFunctions::class);
         $imageProcessor->init();
         $imageProcessor->tempPath = PATH_site . 'typo3temp/';
         $imageProcessor->dontCheckForExistingTempFile = 1;
@@ -701,7 +701,7 @@ class TestSetup extends Action\AbstractAction
      */
     protected function setUpDatabaseConnectionMock()
     {
-        $database = $this->objectManager->get(\TYPO3\CMS\Install\Database\DatabaseConnectionMock::class);
+        $database = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Database\DatabaseConnectionMock::class);
         $GLOBALS['TYPO3_DB'] = $database;
     }
 }
index 65b61be..5b22433 100644 (file)
@@ -91,7 +91,7 @@ class UpgradeWizard extends Action\AbstractAction
     {
         if (empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'])) {
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\WarningStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\WarningStatus::class);
             $message->setTitle('No update wizards registered');
             return $message;
         }
@@ -128,7 +128,7 @@ class UpgradeWizard extends Action\AbstractAction
         $this->view->assign('availableUpdates', $availableUpdates);
 
         /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-        $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
         $message->setTitle('Show available update wizards');
         return $message;
     }
@@ -158,7 +158,7 @@ class UpgradeWizard extends Action\AbstractAction
         $this->view->assign('updateData', $updateData);
 
         /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-        $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+        $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
         $message->setTitle('Show wizard options');
         return $message;
     }
@@ -186,7 +186,7 @@ class UpgradeWizard extends Action\AbstractAction
         $wizardInputErrorMessage = '';
         if (method_exists($updateObject, 'checkUserInput') && !$updateObject->checkUserInput($wizardInputErrorMessage)) {
             /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-            $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
             $message->setTitle('Input parameter broken');
             $message->setMessage($wizardInputErrorMessage ?: 'Something went wrong!');
             $wizardData['wizardInputBroken'] = true;
@@ -205,11 +205,11 @@ class UpgradeWizard extends Action\AbstractAction
 
             if ($performResult) {
                 /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-                $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\OkStatus::class);
+                $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\OkStatus::class);
                 $message->setTitle('Update successful');
             } else {
                 /** @var $message \TYPO3\CMS\Install\Status\StatusInterface */
-                $message = $this->objectManager->get(\TYPO3\CMS\Install\Status\ErrorStatus::class);
+                $message = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\ErrorStatus::class);
                 $message->setTitle('Update failed!');
                 if ($customOutput) {
                     $message->setMessage($customOutput);
@@ -288,10 +288,10 @@ class UpgradeWizard extends Action\AbstractAction
     protected function silentCacheFrameworkTableSchemaMigration()
     {
         /** @var $sqlHandler \TYPO3\CMS\Install\Service\SqlSchemaMigrationService */
-        $sqlHandler = $this->objectManager->get(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class);
+        $sqlHandler = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class);
 
         /** @var \TYPO3\CMS\Core\Cache\DatabaseSchemaService $cachingFrameworkDatabaseSchemaService */
-        $cachingFrameworkDatabaseSchemaService = $this->objectManager->get(\TYPO3\CMS\Core\Cache\DatabaseSchemaService::class);
+        $cachingFrameworkDatabaseSchemaService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Cache\DatabaseSchemaService::class);
         $expectedSchemaString = $cachingFrameworkDatabaseSchemaService->getCachingFrameworkRequiredDatabaseSchema();
         $cleanedExpectedSchemaString = implode(LF, $sqlHandler->getStatementArray($expectedSchemaString, true, '^CREATE TABLE '));
         $neededTableDefinition = $sqlHandler->getFieldDefinitions_fileContent($cleanedExpectedSchemaString);
index 4747bd2..60b739d 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Install\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Install tool ajax controller, handles ajax requests
  *
@@ -52,7 +54,6 @@ class AjaxController extends AbstractController
     public function execute()
     {
         $this->loadBaseExtensions();
-        $this->initializeObjectManager();
         // Warning: Order of these methods is security relevant and interferes with different access
         // conditions (new/existing installation). See the single method comments for details.
         $this->outputInstallToolNotEnabledMessageIfNeeded();
@@ -142,7 +143,7 @@ class AjaxController extends AbstractController
         $this->validateAuthenticationAction($action);
         $actionClass = ucfirst($action);
         /** @var \TYPO3\CMS\Install\Controller\Action\ActionInterface $toolAction */
-        $toolAction = $this->objectManager->get('TYPO3\\CMS\\Install\\Controller\\Action\\Ajax\\' . $actionClass);
+        $toolAction = GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Controller\\Action\\Ajax\\' . $actionClass);
         if (!($toolAction instanceof Action\ActionInterface)) {
             throw new Exception(
                 $action . ' does not implement ActionInterface',
index 8337e4f..f36453c 100644 (file)
@@ -19,7 +19,6 @@ use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Template\ModuleTemplate;
 use TYPO3\CMS\Core\FormProtection\AbstractFormProtection;
 use TYPO3\CMS\Core\FormProtection\FormProtectionFactory;
-use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
 use TYPO3\CMS\Fluid\View\StandaloneView;
index ba92216..2f44c94 100644 (file)
@@ -45,8 +45,6 @@ class StepController extends AbstractController
     public function execute()
     {
         $this->loadBaseExtensions();
-        $this->initializeObjectManager();
-
         $this->outputInstallToolNotEnabledMessageIfNeeded();
         $this->outputInstallToolPasswordNotSetMessageIfNeeded();
         $this->recreatePackageStatesFileIfNotExisting();
@@ -146,7 +144,7 @@ class StepController extends AbstractController
         $this->validateAuthenticationAction($action);
         $actionClass = ucfirst($action);
         /** @var \TYPO3\CMS\Install\Controller\Action\Step\StepInterface $stepAction */
-        $stepAction = $this->objectManager->get('TYPO3\\CMS\\Install\\Controller\\Action\\Step\\' . $actionClass);
+        $stepAction = GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Controller\\Action\\Step\\' . $actionClass);
         if (!($stepAction instanceof Action\Step\StepInterface)) {
             throw new Exception(
                 $action . ' does non implement StepInterface',
@@ -183,7 +181,7 @@ class StepController extends AbstractController
     protected function recreatePackageStatesFileIfNotExisting()
     {
         /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
-        $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
         $localConfigurationFileLocation = $configurationManager->getLocalConfigurationFileLocation();
         $localConfigurationFileExists = is_file($localConfigurationFileLocation);
         $packageStatesFilePath = PATH_typo3conf . 'PackageStates.php';
@@ -260,13 +258,13 @@ class StepController extends AbstractController
             && $postValues['action'] === 'environmentAndFolders'
         ) {
             /** @var \TYPO3\CMS\Install\Controller\Action\Step\StepInterface $action */
-            $action = $this->objectManager->get(\TYPO3\CMS\Install\Controller\Action\Step\EnvironmentAndFolders::class);
+            $action = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Controller\Action\Step\EnvironmentAndFolders::class);
             $errorMessagesFromExecute = $action->execute();
             $wasExecuted = true;
         }
 
         /** @var \TYPO3\CMS\Install\Controller\Action\Step\StepInterface $action */
-        $action = $this->objectManager->get(\TYPO3\CMS\Install\Controller\Action\Step\EnvironmentAndFolders::class);
+        $action = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Controller\Action\Step\EnvironmentAndFolders::class);
 
         $needsExecution = true;
         try {
@@ -279,7 +277,7 @@ class StepController extends AbstractController
 
         if (!@is_dir(PATH_typo3conf) || $needsExecution) {
             /** @var \TYPO3\CMS\Install\Controller\Action\Step\StepInterface $action */
-            $action = $this->objectManager->get(\TYPO3\CMS\Install\Controller\Action\Step\EnvironmentAndFolders::class);
+            $action = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Controller\Action\Step\EnvironmentAndFolders::class);
             if ($this->isInitialInstallationInProgress()) {
                 $currentStep = (array_search('environmentAndFolders', $this->authenticationActions) + 1);
                 $totalSteps = count($this->authenticationActions);
@@ -308,7 +306,7 @@ class StepController extends AbstractController
         }
 
         /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
-        $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
+        $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
         $configurationManager->setLocalConfigurationValueByPath('SYS/trustedHostsPattern', '.*');
         $this->redirect();
     }
@@ -321,7 +319,7 @@ class StepController extends AbstractController
     protected function executeSilentConfigurationUpgradesIfNeeded()
     {
         /** @var SilentConfigurationUpgradeService $upgradeService */
-        $upgradeService = $this->objectManager->get(SilentConfigurationUpgradeService::class);
+        $upgradeService = GeneralUtility::makeInstance(SilentConfigurationUpgradeService::class);
         try {
             $upgradeService->execute();
         } catch (Exception\RedirectException $e) {
index 9058e43..edceef2 100644 (file)
@@ -48,7 +48,6 @@ class ToolController extends AbstractController
     public function execute()
     {
         $this->loadBaseExtensions();
-        $this->initializeObjectManager();
 
         // Warning: Order of these methods is security relevant and interferes with different access
         // conditions (new/existing installation). See the single method comments for details.
@@ -177,7 +176,7 @@ class ToolController extends AbstractController
         $this->validateAuthenticationAction($action);
         $actionClass = ucfirst($action);
         /** @var \TYPO3\CMS\Install\Controller\Action\ActionInterface $toolAction */
-        $toolAction = $this->objectManager->get('TYPO3\\CMS\\Install\\Controller\\Action\\Tool\\' . $actionClass);
+        $toolAction = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Install\\Controller\\Action\\Tool\\' . $actionClass);
         if (!($toolAction instanceof Action\ActionInterface)) {
             throw new Exception(
                 $action . ' does not implement ActionInterface',
index 10ec7a8..9f06bde 100644 (file)
@@ -26,7 +26,6 @@ class DefaultFactory
      *
      * @throws Exception
      * @return RootNode
-     * @TODO: Use objectManager instead of new (will be injected)
      */
     public function getStructure()
     {
index 290bd09..5faa150 100644 (file)
@@ -174,10 +174,8 @@ class InstallStatusReport implements \TYPO3\CMS\Reports\StatusProviderInterface
     protected function getNewVersionStatus()
     {
         $languageService = $this->getLanguageService();
-        /** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */
-        $objectManager = GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
         /** @var \TYPO3\CMS\Install\Service\CoreVersionService $coreVersionService */
-        $coreVersionService = $objectManager->get(\TYPO3\CMS\Install\Service\CoreVersionService::class);
+        $coreVersionService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\CoreVersionService::class);
 
         // No updates for development versions
         if (!$coreVersionService->isInstalledVersionAReleasedVersion()) {
index c4ef87e..e858de6 100644 (file)
@@ -23,19 +23,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 class ClearCacheService
 {
     /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManager
-     */
-    protected $objectManager = null;
-
-    /**
-     * @param \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager
-     */
-    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManager $objectManager)
-    {
-        $this->objectManager = $objectManager;
-    }
-
-    /**
      * This clear cache implementation follows a pretty brutal approach.
      * Goal is to reliably get rid of cache entries, even if some broken
      * extension is loaded that would kill the backend 'clear cache' action.
@@ -109,7 +96,7 @@ class ClearCacheService
         static $database;
         if (!is_object($database)) {
             /** @var \TYPO3\CMS\Core\Database\DatabaseConnection $database */
-            $database = $this->objectManager->get(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
+            $database = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Database\DatabaseConnection::class);
             $database->setDatabaseUsername($GLOBALS['TYPO3_CONF_VARS']['DB']['username']);
             $database->setDatabasePassword($GLOBALS['TYPO3_CONF_VARS']['DB']['password']);
             $database->setDatabaseHost($GLOBALS['TYPO3_CONF_VARS']['DB']['host']);
index 62a48ca..cb7b949 100644 (file)
@@ -41,11 +41,6 @@ use TYPO3\CMS\Install\Status\WarningStatus;
 class CoreUpdateService
 {
     /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManager
-     */
-    protected $objectManager;
-
-    /**
      * @var \TYPO3\CMS\Install\Service\CoreVersionService
      */
     protected $coreVersionService;
@@ -77,19 +72,11 @@ class CoreUpdateService
     protected $downloadBaseUri;
 
     /**
-     * @param \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager
-     */
-    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManager $objectManager)
-    {
-        $this->objectManager = $objectManager;
-    }
-
-    /**
-     * @param \TYPO3\CMS\Install\Service\CoreVersionService $coreVersionService
+     * @param CoreVersionService $coreVersionService
      */
-    public function injectCoreVersionService(\TYPO3\CMS\Install\Service\CoreVersionService $coreVersionService)
+    public function __construct(CoreVersionService $coreVersionService = null)
     {
-        $this->coreVersionService = $coreVersionService;
+        $this->coreVersionService = $coreVersionService ?: GeneralUtility::makeInstance(CoreVersionService::class);
     }
 
     /**
@@ -160,7 +147,7 @@ class CoreUpdateService
         } catch (RemoteFetchException $e) {
             $success = false;
             /** @var $message StatusInterface */
-            $message = $this->objectManager->get(ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(ErrorStatus::class);
             $message->setTitle('Version matrix could not be fetched from get.typo3.org');
             $message->setMessage(
                 'Current version specification could not be fetched from http://get.typo3.org/json.'
@@ -184,17 +171,17 @@ class CoreUpdateService
         $messages = array();
 
         /** @var StatusUtility $statusUtility */
-        $statusUtility = $this->objectManager->get(StatusUtility::class);
+        $statusUtility = GeneralUtility::makeInstance(StatusUtility::class);
 
         // Folder structure test: Update can be done only if folder structure returns no errors
         /** @var $folderStructureFacade \TYPO3\CMS\Install\FolderStructure\StructureFacade */
-        $folderStructureFacade = $this->objectManager->get(DefaultFactory::class)->getStructure();
+        $folderStructureFacade = GeneralUtility::makeInstance(DefaultFactory::class)->getStructure();
         $folderStructureErrors = $statusUtility->filterBySeverity($folderStructureFacade->getStatus(), 'error');
         $folderStructureWarnings = $statusUtility->filterBySeverity($folderStructureFacade->getStatus(), 'warning');
         if (!empty($folderStructureErrors) || !empty($folderStructureWarnings)) {
             $success = false;
             /** @var $message StatusInterface */
-            $message = $this->objectManager->get(ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(ErrorStatus::class);
             $message->setTitle('Automatic TYPO3 CMS core update not possible: Folder structure has errors or warnings');
             $message->setMessage(
                 'To perform an update, the folder structure of this TYPO3 CMS instance must'
@@ -208,7 +195,7 @@ class CoreUpdateService
         if (TYPO3_OS === 'WIN') {
             $success = false;
             /** @var $message StatusInterface */
-            $message = $this->objectManager->get(ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(ErrorStatus::class);
             $message->setTitle('Automatic TYPO3 CMS core update not possible: Update not supported on Windows OS');
             $messages[] = $message;
         }
@@ -220,7 +207,7 @@ class CoreUpdateService
             if (!$result) {
                 $success = false;
                 /** @var $message StatusInterface */
-                $message = $this->objectManager->get(ErrorStatus::class);
+                $message = GeneralUtility::makeInstance(ErrorStatus::class);
                 $message->setTitle('Automatic TYPO3 CMS core update not possible: No write access to document root');
                 $message->setMessage('Could not write a file in path "' . PATH_site . '"!');
                 $messages[] = $message;
@@ -236,7 +223,7 @@ class CoreUpdateService
                 if (!$result) {
                     $success = false;
                     /** @var $message StatusInterface */
-                    $message = $this->objectManager->get(ErrorStatus::class);
+                    $message = GeneralUtility::makeInstance(ErrorStatus::class);
                     $message->setTitle('Automatic TYPO3 CMS core update not possible: No write access to TYPO3 CMS core location');
                     $message->setMessage(
                         'New TYPO3 CMS core should be installed in "' . $coreLocation . '", but this directory is not writable!'
@@ -251,7 +238,7 @@ class CoreUpdateService
         if ($success && !$this->coreVersionService->isInstalledVersionAReleasedVersion()) {
             $success = false;
             /** @var $message StatusInterface */
-            $message = $this->objectManager->get(ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(ErrorStatus::class);
             $message->setTitle('Automatic TYPO3 CMS core update not possible: You are running a development version of TYPO3');
             $message->setMessage(
                 'Your current version is specified as ' . $this->coreVersionService->getInstalledVersion() . '.'
@@ -278,7 +265,7 @@ class CoreUpdateService
 
         if ($this->checkCoreFilesAvailable($version)) {
             /** @var $message StatusInterface */
-            $message = $this->objectManager->get(NoticeStatus::class);
+            $message = GeneralUtility::makeInstance(NoticeStatus::class);
             $message->setTitle('Skipped download of TYPO3 CMS core. A core source directory already exists in destination path. Using this instead.');
             $messages[] = $message;
         } else {
@@ -288,7 +275,7 @@ class CoreUpdateService
             if (@file_exists($fileLocation)) {
                 $success = false;
                 /** @var $message StatusInterface */
-                $message = $this->objectManager->get(ErrorStatus::class);
+                $message = GeneralUtility::makeInstance(ErrorStatus::class);
                 $message->setTitle('TYPO3 CMS core download exists in download location: ' . PathUtility::stripPathSitePrefix($this->downloadTargetPath));
                 $messages[] = $message;
             } else {
@@ -296,7 +283,7 @@ class CoreUpdateService
                 if (!$fileContent) {
                     $success = false;
                     /** @var $message StatusInterface */
-                    $message = $this->objectManager->get(ErrorStatus::class);
+                    $message = GeneralUtility::makeInstance(ErrorStatus::class);
                     $message->setTitle('Download not successful');
                     $messages[] = $message;
                 } else {
@@ -304,11 +291,11 @@ class CoreUpdateService
                     if (!$fileStoreResult) {
                         $success = false;
                         /** @var $message StatusInterface */
-                        $message = $this->objectManager->get(ErrorStatus::class);
+                        $message = GeneralUtility::makeInstance(ErrorStatus::class);
                         $message->setTitle('Unable to store download content');
                         $messages[] = $message;
                     } else {
-                        $message = $this->objectManager->get(OkStatus::class);
+                        $message = GeneralUtility::makeInstance(OkStatus::class);
                         $message->setTitle('TYPO3 CMS core download finished');
                         $messages[] = $message;
                     }
@@ -332,7 +319,7 @@ class CoreUpdateService
 
         if ($this->checkCoreFilesAvailable($version)) {
             /** @var $message StatusInterface */
-            $message = $this->objectManager->get(WarningStatus::class);
+            $message = GeneralUtility::makeInstance(WarningStatus::class);
             $message->setTitle('Verifying existing TYPO3 CMS core checksum is not possible');
             $messages[] = $message;
         } else {
@@ -342,7 +329,7 @@ class CoreUpdateService
             if (!file_exists($fileLocation)) {
                 $success = false;
                 /** @var $message StatusInterface */
-                $message = $this->objectManager->get(ErrorStatus::class);
+                $message = GeneralUtility::makeInstance(ErrorStatus::class);
                 $message->setTitle('Downloaded TYPO3 CMS core not found');
                 $messages[] = $message;
             } else {
@@ -350,7 +337,7 @@ class CoreUpdateService
                 if ($actualChecksum !== $expectedChecksum) {
                     $success = false;
                     /** @var $message StatusInterface */
-                    $message = $this->objectManager->get(ErrorStatus::class);
+                    $message = GeneralUtility::makeInstance(ErrorStatus::class);
                     $message->setTitle('New TYPO3 CMS core checksum mismatch');
                     $message->setMessage(
                         'The official TYPO3 CMS version system on https://get.typo3.org expects a sha1 checksum of '
@@ -360,7 +347,7 @@ class CoreUpdateService
                     );
                     $messages[] = $message;
                 } else {
-                    $message = $this->objectManager->get(OkStatus::class);
+                    $message = GeneralUtility::makeInstance(OkStatus::class);
                     $message->setTitle('Checksum verified');
                     $messages[] = $message;
                 }
@@ -383,7 +370,7 @@ class CoreUpdateService
 
         if ($this->checkCoreFilesAvailable($version)) {
             /** @var $message StatusInterface */
-            $message = $this->objectManager->get(NoticeStatus::class);
+            $message = GeneralUtility::makeInstance(NoticeStatus::class);
             $message->setTitle('Unpacking TYPO3 CMS core files skipped');
             $messages[] = $message;
         } else {
@@ -392,13 +379,13 @@ class CoreUpdateService
             if (!@is_file($fileLocation)) {
                 $success = false;
                 /** @var $message StatusInterface */
-                $message = $this->objectManager->get(ErrorStatus::class);
+                $message = GeneralUtility::makeInstance(ErrorStatus::class);
                 $message->setTitle('Downloaded TYPO3 CMS core not found');
                 $messages[] = $message;
             } elseif (@file_exists($this->downloadTargetPath . 'typo3_src-' . $version)) {
                 $success = false;
                 /** @var $message StatusInterface */
-                $message = $this->objectManager->get(ErrorStatus::class);
+                $message = GeneralUtility::makeInstance(ErrorStatus::class);
                 $message->setTitle('Unpacked TYPO3 CMS core exists in download location: ' . PathUtility::stripPathSitePrefix($this->downloadTargetPath));
                 $messages[] = $message;
             } else {
@@ -407,7 +394,7 @@ class CoreUpdateService
                 if ($errorCode) {
                     $success = false;
                     /** @var $message StatusInterface */
-                    $message = $this->objectManager->get(ErrorStatus::class);
+                    $message = GeneralUtility::makeInstance(ErrorStatus::class);
                     $message->setTitle('Unpacking TYPO3 CMS core not successful');
                     $messages[] = $message;
                 } else {
@@ -415,11 +402,11 @@ class CoreUpdateService
                     if (!$removePackedFileResult) {
                         $success = false;
                         /** @var $message StatusInterface */
-                        $message = $this->objectManager->get(ErrorStatus::class);
+                        $message = GeneralUtility::makeInstance(ErrorStatus::class);
                         $message->setTitle('Removing packed TYPO3 CMS core not successful');
                         $messages[] = $message;
                     } else {
-                        $message = $this->objectManager->get(OkStatus::class);
+                        $message = GeneralUtility::makeInstance(OkStatus::class);
                         $message->setTitle('Unpacking TYPO3 CMS core successful');
                         $messages[] = $message;
                     }
@@ -443,7 +430,7 @@ class CoreUpdateService
 
         if ($this->checkCoreFilesAvailable($version)) {
             /** @var $message StatusInterface */
-            $message = $this->objectManager->get(NoticeStatus::class);
+            $message = GeneralUtility::makeInstance(NoticeStatus::class);
             $message->setTitle('Moving TYPO3 CMS core files skipped');
             $messages[] = $message;
         } else {
@@ -453,7 +440,7 @@ class CoreUpdateService
             if (!@is_dir($downloadedCoreLocation)) {
                 $success = false;
                 /** @var $message StatusInterface */
-                $message = $this->objectManager->get(ErrorStatus::class);
+                $message = GeneralUtility::makeInstance(ErrorStatus::class);
                 $message->setTitle('Unpacked TYPO3 CMS core not found');
                 $messages[] = $message;
             } else {
@@ -461,11 +448,11 @@ class CoreUpdateService
                 if (!$moveResult) {
                     $success = false;
                     /** @var $message StatusInterface */
-                    $message = $this->objectManager->get(ErrorStatus::class);
+                    $message = GeneralUtility::makeInstance(ErrorStatus::class);
                     $message->setTitle('Moving TYPO3 CMS core to ' . $newCoreLocation . ' failed');
                     $messages[] = $message;
                 } else {
-                    $message = $this->objectManager->get(OkStatus::class);
+                    $message = GeneralUtility::makeInstance(OkStatus::class);
                     $message->setTitle('Moved TYPO3 CMS core to final location');
                     $messages[] = $message;
                 }
@@ -492,13 +479,13 @@ class CoreUpdateService
         if (!is_dir($newCoreLocation)) {
             $success = false;
             /** @var $message StatusInterface */
-            $message = $this->objectManager->get(ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(ErrorStatus::class);
             $message->setTitle('New TYPO3 CMS core not found');
             $messages[] = $message;
         } elseif (!is_link($this->symlinkToCoreFiles)) {
             $success = false;
             /** @var $message StatusInterface */
-            $message = $this->objectManager->get(ErrorStatus::class);
+            $message = GeneralUtility::makeInstance(ErrorStatus::class);
             $message->setTitle('TYPO3 CMS core source directory (typo3_src) is not a link');
             $messages[] = $message;
         } else {
@@ -507,7 +494,7 @@ class CoreUpdateService
             if (!$unlinkResult) {
                 $success = false;
                 /** @var $message StatusInterface */
-                $message = $this->objectManager->get(ErrorStatus::class);
+                $message = GeneralUtility::makeInstance(ErrorStatus::class);
                 $message->setTitle('Removing old symlink failed');
                 $messages[] = $message;
             } else {
@@ -520,7 +507,7 @@ class CoreUpdateService
                 } else {
                     $success = false;
                     /** @var $message StatusInterface */
-                    $message = $this->objectManager->get(ErrorStatus::class);
+                    $message = GeneralUtility::makeInstance(ErrorStatus::class);
                     $message->setTitle('Linking new TYPO3 CMS core failed');
                     $messages[] = $message;
                 }
index c1e86ea..5106f29 100644 (file)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Install\Service;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Registry;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\VersionNumberUtility;
 
@@ -23,11 +24,6 @@ use TYPO3\CMS\Core\Utility\VersionNumberUtility;
 class CoreVersionService
 {
     /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManager
-     */
-    protected $objectManager;
-
-    /**
      * @var \TYPO3\CMS\Core\Registry
      */
     protected $registry;
@@ -40,19 +36,14 @@ class CoreVersionService
     protected $downloadBaseUri;
 
     /**
-     * @param \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager
-     */
-    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManager $objectManager)
-    {
-        $this->objectManager = $objectManager;
-    }
-
-    /**
-     * @param \TYPO3\CMS\Core\Registry $registry
+     * Initialize update URI
+     *
+     * @param Registry $registry
      */
-    public function injectRegistry(\TYPO3\CMS\Core\Registry $registry)
+    public function __construct(Registry $registry = null)
     {
-        $this->registry = $registry;
+        $this->downloadBaseUri = 'https://get.typo3.org/';
+        $this->registry = $registry ?: GeneralUtility::makeInstance(Registry::class);
     }
 
     /**
@@ -64,14 +55,6 @@ class CoreVersionService
     }
 
     /**
-     * Initialize update URI
-     */
-    public function __construct()
-    {
-        $this->downloadBaseUri = 'https://get.typo3.org/';
-    }
-
-    /**
      * Update version matrix from remote and store in registry
      *
      * @return void
index 37ad9d3..c508e5c 100755 (executable)
@@ -14,6 +14,7 @@ namespace TYPO3\CMS\Install\Service;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Configuration\ConfigurationManager;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Install\Controller\Exception\RedirectException;
@@ -32,14 +33,9 @@ use TYPO3\CMS\Install\Controller\Exception\RedirectException;
 class SilentConfigurationUpgradeService
 {
     /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManager
-     */
-    protected $objectManager = null;
-
-    /**
      * @var \TYPO3\CMS\Core\Configuration\ConfigurationManager
      */
-    protected $configurationManager = null;
+    protected $configurationManager;
 
     /**
      * List of obsolete configuration options in LocalConfiguration to be removed
@@ -92,20 +88,9 @@ class SilentConfigurationUpgradeService
         'GFX/image_processing',
     );
 
-    /**
-     * @param \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager
-     */
-    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManager $objectManager)
-    {
-        $this->objectManager = $objectManager;
-    }
-
-    /**
-     * @param \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager
-     */
-    public function injectConfigurationManager(\TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager)
+    public function __construct(ConfigurationManager $configurationManager = null)
     {
-        $this->configurationManager = $configurationManager;
+        $this->configurationManager = $configurationManager ?: GeneralUtility::makeInstance(ConfigurationManager::class);
     }
 
     /**
index 5ed4554..9dc4592 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Install\Service;
  */
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
 
 /**
  * Expected schema service
@@ -24,29 +25,16 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 class SqlExpectedSchemaService
 {
     /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManager
-     */
-    protected $objectManager = null;
-
-    /**
      * @var \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
      */
     protected $signalSlotDispatcher;
 
     /**
-     * @param \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager
-     */
-    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManager $objectManager)
-    {
-        $this->objectManager = $objectManager;
-    }
-
-    /**
-     * @param \TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher
+     * @param Dispatcher $signalSlotDispatcher
      */
-    public function injectSignalSlotDispatcher(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher $signalSlotDispatcher)
+    public function __construct(Dispatcher $signalSlotDispatcher = null)
     {
-        $this->signalSlotDispatcher = $signalSlotDispatcher;
+        $this->signalSlotDispatcher = $signalSlotDispatcher ?: GeneralUtility::makeInstance(Dispatcher::class);
     }
 
     /**
@@ -57,7 +45,7 @@ class SqlExpectedSchemaService
     public function getExpectedDatabaseSchema()
     {
         /** @var \TYPO3\CMS\Install\Service\SqlSchemaMigrationService $schemaMigrationService */
-        $schemaMigrationService = $this->objectManager->get(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class);
+        $schemaMigrationService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class);
         // Raw concatenated ext_tables.sql and friends string
         $expectedSchemaString = $this->getTablesDefinitionString();
         // Remove comments
index e55a20b..c47a98c 100644 (file)
@@ -14,6 +14,10 @@ namespace TYPO3\CMS\Install\Updates;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Install\Service\SqlExpectedSchemaService;
+use TYPO3\CMS\Install\Service\SqlSchemaMigrationService;
+
 /**
  * Contains the update class to create and alter tables, fields and keys to comply to the database schema
  */
@@ -35,18 +39,12 @@ abstract class AbstractDatabaseSchemaUpdate extends AbstractUpdate
     protected $expectedSchemaService;
 
     /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManager
-     */
-    protected $objectManager;
-
-    /**
      * Constructor function.
      */
-    public function __construct()
+    public function __construct(SqlSchemaMigrationService $schemaMigrationService = null, SqlExpectedSchemaService $expectedSchemaService = null)
     {
-        $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class);
-        $this->schemaMigrationService = $this->objectManager->get(\TYPO3\CMS\Install\Service\SqlSchemaMigrationService::class);
-        $this->expectedSchemaService = $this->objectManager->get(\TYPO3\CMS\Install\Service\SqlExpectedSchemaService::class);
+        $this->schemaMigrationService = $schemaMigrationService ?: GeneralUtility::makeInstance(SqlSchemaMigrationService::class);
+        $this->expectedSchemaService = $expectedSchemaService ?: GeneralUtility::makeInstance(SqlExpectedSchemaService::class);
     }
 
     /**
index 57c2bc5..75cd002 100644 (file)
@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Install\Updates;
  */
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility;
 use TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility;
 use TYPO3\CMS\Extensionmanager\Utility\InstallUtility;
@@ -53,11 +52,8 @@ abstract class AbstractDownloadExtensionUpdate extends AbstractUpdate
     protected function installExtension($extensionKey, &$customMessages)
     {
         $updateSuccessful = true;
-        /** @var $objectManager ObjectManager */
-        $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
-
         /** @var $extensionListUtility ListUtility */
-        $extensionListUtility = $objectManager->get(ListUtility::class);
+        $extensionListUtility = GeneralUtility::makeInstance(ListUtility::class);
 
         $availableExtensions = $extensionListUtility->getAvailableExtensions();
         $availableAndInstalledExtensions = $extensionListUtility->getAvailableAndInstalledExtensions($availableExtensions);
@@ -65,7 +61,7 @@ abstract class AbstractDownloadExtensionUpdate extends AbstractUpdate
         // Extension is not downloaded yet.
         if (!is_array($availableAndInstalledExtensions[$extensionKey])) {
             /** @var $extensionTerUtility TerUtility */
-            $extensionTerUtility = $objectManager->get(TerUtility::class);
+            $extensionTerUtility = GeneralUtility::makeInstance(TerUtility::class);
             $extensionDetails = $this->getExtensionDetails($extensionKey);
             if (empty($extensionDetails)) {
                 $updateSuccessful = false;
@@ -83,7 +79,7 @@ abstract class AbstractDownloadExtensionUpdate extends AbstractUpdate
             }
 
             /** @var $extensionFileHandlingUtility FileHandlingUtility */
-            $extensionFileHandlingUtility = $objectManager->get(FileHandlingUtility::class);
+            $extensionFileHandlingUtility = GeneralUtility::makeInstance(FileHandlingUtility::class);
             $extensionFileHandlingUtility->unpackExtensionFromExtensionDataArray($t3xExtracted);
 
             // The listUtility now needs to have the regenerated list of packages
@@ -92,7 +88,7 @@ abstract class AbstractDownloadExtensionUpdate extends AbstractUpdate
 
         if ($updateSuccessful !== false) {
             /** @var $extensionInstallUtility InstallUtility */
-            $extensionInstallUtility = $objectManager->get(InstallUtility::class);
+            $extensionInstallUtility = GeneralUtility::makeInstance(InstallUtility::class);
             $extensionInstallUtility->install($extensionKey);
         }
         return $updateSuccessful;
index 6cef965..3844a75 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Install\Updates;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
 /**
  * Contains the update class to create and alter tables, fields and keys to comply to the database schema
  */
@@ -36,7 +38,7 @@ class FinalDatabaseSchemaUpdate extends AbstractDatabaseSchemaUpdate
      */
     public function checkForUpdate(&$description)
     {
-        $contextService = $this->objectManager->get(\TYPO3\CMS\Install\Service\ContextService::class);
+        $contextService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\ContextService::class);
         $description = 'There are tables or fields in the database which need to be changed.<br /><br />' .
         'This update wizard can be run only when there are no other update wizards left to make sure they have all needed fields unchanged.<br /><br />' .
         'If you want to apply changes selectively, <a href="Install.php?install[action]=importantActions&amp;install[context]=' . $contextService->getContextString() . '&amp;install[controller]=tool">go to Database Analyzer</a>.';