[TASK] Fetch folder and environment status through AJAX 19/28619/6
authorWouter Wolters <typo3@wouterwolters.nl>
Fri, 21 Mar 2014 18:42:31 +0000 (19:42 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 21 Mar 2014 19:53:55 +0000 (20:53 +0100)
Resolves: #57166
Releases: 6.2
Change-Id: I72aa55cff3322bbe46d271758fd04f3aba860ae7
Reviewed-on: https://review.typo3.org/28619
Reviewed-by: Ernesto Baschny
Tested-by: Ernesto Baschny
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/install/Classes/Controller/Action/AbstractAction.php
typo3/sysext/install/Classes/Controller/Action/Ajax/EnvironmentStatus.php [new file with mode: 0644]
typo3/sysext/install/Classes/Controller/Action/Ajax/FolderStatus.php [new file with mode: 0644]
typo3/sysext/install/Classes/Controller/AjaxController.php
typo3/sysext/install/Resources/Private/Partials/Action/Common/Left.html
typo3/sysext/install/Resources/Public/Javascript/Install.js

index d0763e2..45a1b03 100644 (file)
@@ -105,28 +105,6 @@ abstract class AbstractAction implements ActionInterface {
         * @return void
         */
        protected function initializeHandle() {
-               /** @var \TYPO3\CMS\Install\Status\StatusUtility $statusUtility */
-               $statusUtility = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\StatusUtility');
-
-               // Count of failed environment checks are displayed in the left navigation menu
-               $environmentStatus = $this->objectManager->get('TYPO3\\CMS\\Install\\SystemEnvironment\\Check')->getStatus();
-               $environmentErrors = $statusUtility->filterBySeverity($environmentStatus, 'error');
-
-               // 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')->getStructure();
-               $folderStatus = $folderStructureFacade->getStatus();
-
-               /** @var $permissionCheck \TYPO3\CMS\Install\FolderStructure\DefaultPermissionsCheck */
-               $permissionCheck = $this->objectManager->get('TYPO3\\CMS\\Install\\FolderStructure\\DefaultPermissionsCheck');
-               $folderStatus[] = $permissionCheck->getMaskStatus('fileCreateMask');
-               $folderStatus[] = $permissionCheck->getMaskStatus('folderCreateMask');
-
-               $folderStructureErrors = array_merge(
-                       $statusUtility->filterBySeverity($folderStatus, 'error'),
-                       $statusUtility->filterBySeverity($folderStatus, 'warning')
-               );
-
                // Context service distinguishes between standalone and backend context
                $contextService = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\ContextService');
 
@@ -147,9 +125,7 @@ abstract class AbstractAction implements ActionInterface {
                        ->assign('lastError', $this->lastError)
                        ->assign('messages', $this->messages)
                        ->assign('typo3Version', TYPO3_version)
-                       ->assign('siteName', $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'])
-                       ->assign('environmentErrors', $environmentErrors)
-                       ->assign('folderStructureErrors', $folderStructureErrors);
+                       ->assign('siteName', $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']);
        }
 
        /**
diff --git a/typo3/sysext/install/Classes/Controller/Action/Ajax/EnvironmentStatus.php b/typo3/sysext/install/Classes/Controller/Action/Ajax/EnvironmentStatus.php
new file mode 100644 (file)
index 0000000..ab73641
--- /dev/null
@@ -0,0 +1,46 @@
+<?php
+namespace TYPO3\CMS\Install\Controller\Action\Ajax;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2014 Wouter Wolters <typo3@wouterwolters.nl>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Environment status check for errors
+ */
+class EnvironmentStatus extends AbstractAjaxAction {
+
+       /**
+        * Get environment status errors
+        *
+        * @return string
+        */
+       protected function executeAction() {
+               /** @var \TYPO3\CMS\Install\Status\StatusUtility $statusUtility */
+               $statusUtility = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\StatusUtility');
+
+               // Count of failed environment checks are displayed in the left navigation menu
+               $environmentStatus = $this->objectManager->get('TYPO3\\CMS\\Install\\SystemEnvironment\\Check')->getStatus();
+               $environmentErrors = $statusUtility->filterBySeverity($environmentStatus, 'error');
+               return count($environmentErrors);
+       }
+}
\ No newline at end of file
diff --git a/typo3/sysext/install/Classes/Controller/Action/Ajax/FolderStatus.php b/typo3/sysext/install/Classes/Controller/Action/Ajax/FolderStatus.php
new file mode 100644 (file)
index 0000000..672bffe
--- /dev/null
@@ -0,0 +1,58 @@
+<?php
+namespace TYPO3\CMS\Install\Controller\Action\Ajax;
+
+/***************************************************************
+ *  Copyright notice
+ *
+ *  (c) 2014 Wouter Wolters <typo3@wouterwolters.nl>
+ *  All rights reserved
+ *
+ *  This script is part of the TYPO3 project. The TYPO3 project is
+ *  free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  The GNU General Public License can be found at
+ *  http://www.gnu.org/copyleft/gpl.html.
+ *
+ *  This script is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * Folder status check for errors
+ */
+class FolderStatus extends AbstractAjaxAction {
+
+       /**
+        * Get folder status errors
+        *
+        * @return string
+        */
+       protected function executeAction() {
+               // 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')->getStructure();
+               $folderStatus = $folderStructureFacade->getStatus();
+
+               /** @var $permissionCheck \TYPO3\CMS\Install\FolderStructure\DefaultPermissionsCheck */
+               $permissionCheck = $this->objectManager->get('TYPO3\\CMS\\Install\\FolderStructure\\DefaultPermissionsCheck');
+               $folderStatus[] = $permissionCheck->getMaskStatus('fileCreateMask');
+               $folderStatus[] = $permissionCheck->getMaskStatus('folderCreateMask');
+
+               /** @var \TYPO3\CMS\Install\Status\StatusUtility $statusUtility */
+               $statusUtility = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\StatusUtility');
+
+               $folderStructureErrors = array_merge(
+                       $statusUtility->filterBySeverity($folderStatus, 'error'),
+                       $statusUtility->filterBySeverity($folderStatus, 'warning')
+               );
+
+               return count($folderStructureErrors);
+       }
+}
\ No newline at end of file
index 74087fd..fa16abd 100644 (file)
@@ -53,6 +53,8 @@ class AjaxController extends AbstractController {
                'coreUpdateUnpack',
                'coreUpdateMove',
                'coreUpdateActivate',
+               'folderStatus',
+               'environmentStatus'
        );
 
        /**
index 3b25790..f099615 100644 (file)
                <li id="t3-install-menu-systemEnvironment" class="{f:if(condition:'{action} == \'systemEnvironment\'', then:'act')}">
                        <a href="Install.php?install[action]=systemEnvironment&install[context]={context}&install[controller]=tool">
                                System environment
-                               <f:if condition="{environmentErrors}">
-                                       <span class="t3-install-menu-errorCount"><f:count>{environmentErrors}</f:count></span>
-                               </f:if>
                        </a>
                </li>
                <li id="t3-install-menu-folderStructure" class="{f:if(condition:'{action} == \'folderStructure\'', then:'act')}">
                        <a href="Install.php?install[action]=folderStructure&install[context]={context}&install[controller]=tool">
                                Folder structure
-                               <f:if condition="{folderStructureErrors}">
-                                       <span class="t3-install-menu-errorCount"><f:count>{folderStructureErrors}</f:count></span>
-                               </f:if>
                        </a>
                </li>
                <li id="t3-install-menu-testSetup" class="{f:if(condition:'{action} == \'testSetup\'', then:'act')}">
index 64b2949..3578f82 100644 (file)
  */
 var TYPO3 = {};
 TYPO3.Install = {};
+
+TYPO3.Install.Status = {
+       getFolderStatus: function() {
+               var url = location.href + '&install[controller]=ajax&install[action]=folderStatus';
+               $.ajax({
+                       url: url,
+                       cache: false,
+                       success: function(data) {
+                               if (data > 0) {
+                                       $('#t3-install-menu-folderStructure a').append('<span class="t3-install-menu-errorCount">' + data + '</span>');
+                               }
+                       }
+               });
+       },
+       getEnvironmentStatus: function() {
+               var url = location.href + '&install[controller]=ajax&install[action]=environmentStatus';
+               $.ajax({
+                       url: url,
+                       cache: false,
+                       success: function(data) {
+                               if (data > 0) {
+                                       $('#t3-install-menu-systemEnvironment a').append('<span class="t3-install-menu-errorCount">' + data + '</span>');
+                               }
+                       }
+               });
+       }
+};
+
 TYPO3.Install.coreUpdate = {
        /**
         * The action queue defines what actions are called in which order
@@ -391,6 +419,9 @@ $(document).ready(function() {
                        $(e.target).closest('.t3-install-form-submit').remove();
                }));
        }
+
+       TYPO3.Install.Status.getFolderStatus();
+       TYPO3.Install.Status.getEnvironmentStatus();
 });
 
 function handleButtonScrolling() {