/** * Checks for the existence of the ENABLE_INSTALL_TOOL file. * * @return Status An object representing whether ENABLE_INSTALL_TOOL exists */ protected function getInstallToolProtectionStatus() { $enableInstallToolFile = PATH_site . EnableFileService::INSTALL_TOOL_ENABLE_FILE_PATH; $value = $GLOBALS['LANG']->getLL('status_disabled'); $message = ''; $severity = Status::OK; if (EnableFileService::installToolEnableFileExists()) { if (EnableFileService::isInstallToolEnableFilePermanent()) { $severity = Status::WARNING; $disableInstallToolUrl = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL') . '&adminCmd=remove_ENABLE_INSTALL_TOOL'; $value = $GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_enabledPermanently'); $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_enabled'), '<span style="white-space: nowrap;">' . $enableInstallToolFile . '</span>'); $message .= ' <a href="' . htmlspecialchars($disableInstallToolUrl) . '">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_enabled_cmd') . '</a>'; } else { if (EnableFileService::installToolEnableFileLifetimeExpired()) { EnableFileService::removeInstallToolEnableFile(); } else { $severity = Status::NOTICE; $disableInstallToolUrl = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL') . '&adminCmd=remove_ENABLE_INSTALL_TOOL'; $value = $GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_enabledTemporarily'); $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_installEnabledTemporarily'), '<span style="white-space: nowrap;">' . $enableInstallToolFile . '</span>', floor((@filemtime($enableInstallToolFile) + EnableFileService::INSTALL_TOOL_ENABLE_FILE_LIFETIME - time()) / 60)); $message .= ' <a href="' . htmlspecialchars($disableInstallToolUrl) . '">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_enabled_cmd') . '</a>'; } } } return GeneralUtility::makeInstance(Status::class, $GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_installTool'), $value, $message, $severity); }
/** * Checks for the existence of the ENABLE_INSTALL_TOOL file. * * @return \TYPO3\CMS\Reports\Status An object representing whether ENABLE_INSTALL_TOOL exists */ protected function getInstallToolProtectionStatus() { $enableInstallToolFile = PATH_site . 'typo3conf/ENABLE_INSTALL_TOOL'; $value = $GLOBALS['LANG']->getLL('status_disabled'); $message = ''; $severity = \TYPO3\CMS\Reports\Status::OK; if (EnableFileService::installToolEnableFileExists()) { if (EnableFileService::isInstallToolEnableFilePermanent()) { $severity = \TYPO3\CMS\Reports\Status::WARNING; $disableInstallToolUrl = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL') . '&adminCmd=remove_ENABLE_INSTALL_TOOL'; $value = $GLOBALS['LANG']->getLL('status_enabledPermanently'); $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_enabled'), '<span style="white-space: nowrap;">' . $enableInstallToolFile . '</span>'); $message .= ' <a href="' . $disableInstallToolUrl . '">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_enabled_cmd') . '</a>'; } else { if (EnableFileService::installToolEnableFileLifetimeExpired()) { EnableFileService::removeInstallToolEnableFile(); } else { $severity = \TYPO3\CMS\Reports\Status::NOTICE; $disableInstallToolUrl = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL') . '&adminCmd=remove_ENABLE_INSTALL_TOOL'; $value = $GLOBALS['LANG']->getLL('status_enabledTemporarily'); $message = sprintf($GLOBALS['LANG']->getLL('status_installEnabledTemporarily'), '<span style="white-space: nowrap;">' . $enableInstallToolFile . '</span>', floor($enableInstallToolFileTtl / 60)); $message .= ' <a href="' . $disableInstallToolUrl . '">' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_enabled_cmd') . '</a>'; } } } return GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', $GLOBALS['LANG']->getLL('status_installTool'), $value, $message, $severity); }