Use configuration check utility
authorstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Sat, 24 Oct 2015 21:43:26 +0000 (21:43 +0000)
committerstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Sat, 24 Oct 2015 21:43:26 +0000 (21:43 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/sr_email_subscribe/trunk@90030 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
Classes/Controller/SubscribePluginController.php

index 4fe77f8..ba0edcb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2015-10-24 Stanislas Rolland  <typo3(arobas)sjbr.ca>
+       * Use configuration check utility
+
 2015-10-23 Stanislas Rolland  <typo3(arobas)sjbr.ca>
        * Update version to 4.0.0
        * Resolves #70982: [!!!] Move default style sheets to Resources directory and add static template
index 971965f..e8324f2 100644 (file)
@@ -23,7 +23,7 @@ namespace SJBR\SrEmailSubscribe\Controller;
  *  This copyright notice MUST APPEAR in all copies of the script!
  */
 
-use SJBR\SrFeuserRegister\Utility\LocalizationUtility;
+use SJBR\SrFeuserRegister\Utility\ConfigurationCheckUtility;
 use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Frontend\Plugin\AbstractPlugin;
@@ -64,10 +64,10 @@ class SubscribePluginController extends AbstractPlugin
 
        public function main($content, $conf)
        {
-               $this->conf = $conf;
+               $this->conf = &$conf;
                $this->pi_setPiVarDefaults();
 
-               $content = $this->checkRequirements();
+               $content = ConfigurationCheckUtility::checkRequirements($this->extKey);
 
                if (!$content) {
                        $adminFieldList = 'name,hidden';
@@ -113,25 +113,4 @@ class SubscribePluginController extends AbstractPlugin
                }
                return $content;
        }
-
-       /**
-        * Checks requirements for this plugin
-        *
-        * @return string Error message, if error found, empty string otherwise
-        */
-       protected function checkRequirements()
-       {
-               $content = '';
-               if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['constraints']['depends'])) {
-                       $requiredExtensions = array_diff(array_keys($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$this->extKey]['constraints']['depends']), array('php', 'typo3'));
-                       foreach ($requiredExtensions as $requiredExtension) {
-                               if (!ExtensionManagementUtility::isLoaded($requiredExtension)) {
-                                       $message = sprintf(LocalizationUtility::translate('internal_required_extension_missing', $this->extensionName), $requiredExtension);
-                                       GeneralUtility::sysLog($message, $this->extKey, GeneralUtility::SYSLOG_SEVERITY_ERROR);
-                                       $content .= sprintf(LocalizationUtility::translate('internal_check_requirements_frontend', $this->extensionName), $message);
-                               }
-                       }
-               }
-               return $content;
-       }
 }
\ No newline at end of file