Пример #1
0
 /**
  * Executes the tool
  *
  * @return string Rendered content
  */
 protected function executeAction()
 {
     if (isset($this->postValues['set']['changeEncryptionKey'])) {
         $this->setNewEncryptionKeyAndLogOut();
     }
     $actionMessages = array();
     if (isset($this->postValues['set']['changeInstallToolPassword'])) {
         $actionMessages[] = $this->changeInstallToolPassword();
     }
     if (isset($this->postValues['set']['changeSiteName'])) {
         $actionMessages[] = $this->changeSiteName();
     }
     if (isset($this->postValues['set']['createAdministrator'])) {
         $actionMessages[] = $this->createAdministrator();
     }
     if (isset($this->postValues['set']['clearAllCache'])) {
         $actionMessages[] = $this->clearAllCache();
     }
     if (isset($this->postValues['set']['clearOpcodeCache'])) {
         $actionMessages[] = $this->clearOpcodeCache();
     }
     // Database analyzer handling
     if (isset($this->postValues['set']['databaseAnalyzerExecute']) || isset($this->postValues['set']['databaseAnalyzerAnalyze'])) {
         $this->loadExtLocalconfDatabaseAndExtTables();
     }
     if (isset($this->postValues['set']['databaseAnalyzerExecute'])) {
         $actionMessages = array_merge($actionMessages, $this->databaseAnalyzerExecute());
     }
     if (isset($this->postValues['set']['databaseAnalyzerAnalyze'])) {
         $actionMessages[] = $this->databaseAnalyzerAnalyze();
     }
     $this->view->assign('actionMessages', $actionMessages);
     $operatingSystem = TYPO3_OS === 'WIN' ? 'Windows' : 'Unix';
     /** @var \TYPO3\CMS\Install\Service\CoreUpdateService $coreUpdateService */
     $coreUpdateService = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\CoreUpdateService');
     $this->view->assign('enableCoreUpdate', $coreUpdateService->isCoreUpdateEnabled())->assign('operatingSystem', $operatingSystem)->assign('cgiDetected', GeneralUtility::isRunningOnCgiServerApi())->assign('databaseName', $GLOBALS['TYPO3_CONF_VARS']['DB']['database'])->assign('databaseUsername', $GLOBALS['TYPO3_CONF_VARS']['DB']['username'])->assign('databaseHost', $GLOBALS['TYPO3_CONF_VARS']['DB']['host'])->assign('databasePort', $GLOBALS['TYPO3_CONF_VARS']['DB']['port'])->assign('databaseSocket', $GLOBALS['TYPO3_CONF_VARS']['DB']['socket'])->assign('databaseNumberOfTables', count($this->getDatabaseConnection()->admin_get_tables()))->assign('extensionCompatibilityTesterProtocolFile', GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3temp/ExtensionCompatibilityTester.txt')->assign('extensionCompatibilityTesterErrorProtocolFile', GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3temp/ExtensionCompatibilityTesterErrors.json')->assign('listOfOpcodeCaches', OpcodeCacheUtility::getAllActive());
     return $this->view->render();
 }
Пример #2
0
 /**
  * Check if some opcode cache is loaded
  *
  * @return Status\StatusInterface
  */
 protected function checkSomePhpOpcodeCacheIsLoaded()
 {
     // Link to our wiki page, so we can update opcode cache issue information independent of TYPO3 CMS releases.
     $wikiLink = 'For more information take a look in our wiki ' . TYPO3_URL_WIKI_OPCODECACHE . '.';
     $opcodeCaches = \TYPO3\CMS\Core\Utility\OpcodeCacheUtility::getAllActive();
     if (count($opcodeCaches) === 0) {
         // Set status to notice. It needs to be notice so email won't be triggered.
         $status = new Status\NoticeStatus();
         $status->setTitle('No PHP opcode cache loaded');
         $status->setMessage('PHP opcode caches hold a compiled version of executed PHP scripts in' . ' memory and do not require to recompile a script each time it is accessed.' . ' This can be a massive performance improvement and can reduce the load on a' . ' server in general. A parse time reduction by factor three for fully cached' . ' pages can be achieved easily if using an opcode cache.' . LF . $wikiLink);
     } else {
         $status = new Status\OkStatus();
         $message = '';
         foreach ($opcodeCaches as $opcodeCache => $properties) {
             $message .= 'Name: ' . $opcodeCache . ' Version: ' . $properties['version'];
             $message .= LF;
             if ($properties['error']) {
                 // Set status to error if not already set
                 if ($status->getSeverity() !== 'error') {
                     $status = new Status\ErrorStatus();
                 }
                 $message .= ' This opcode cache is marked as malfunctioning by the TYPO3 CMS Team.';
             } elseif ($properties['canInvalidate']) {
                 $message .= ' This opcode cache should work correctly and has good performance.';
             } else {
                 // Set status to notice if not already error set. It needs to be notice so email won't be triggered.
                 if ($status->getSeverity() !== 'error' || $status->getSeverity() !== 'warning') {
                     $status = new Status\NoticeStatus();
                 }
                 $message .= ' This opcode cache may work correctly but has medium performance.';
             }
             $message .= LF;
         }
         $message .= $wikiLink;
         // Set title of status depending on serverity
         switch ($status->getSeverity()) {
             case 'error':
                 $status->setTitle('A possibly malfunctioning PHP opcode cache is loaded');
                 break;
             case 'warning':
                 $status->setTitle('A PHP opcode cache is loaded which may cause problems');
                 break;
             case 'ok':
             default:
                 $status->setTitle('A PHP opcode cache is loaded');
                 break;
         }
         $status->setMessage($message);
     }
     return $status;
 }