2 namespace TYPO3\CMS\Reports\Report\Status;
29 $this->executeAdminCommand();
31 'PhpPeakMemory' => $this->getPhpPeakMemoryStatus(),
42 protected function executeAdminCommand()
44 $command = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET(
'adminCmd');
46 case 'clear_peak_memory_usage_flag':
48 $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Registry::class);
49 $registry->remove(
'core',
'reports-peakMemoryUsage');
61 protected function getPhpPeakMemoryStatus()
64 $registry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Registry::class);
65 $peakMemoryUsage =
$registry->get(
'core',
'reports-peakMemoryUsage');
66 $memoryLimit = \TYPO3\CMS\Core\Utility\GeneralUtility::getBytesFromSizeMeasurement(ini_get(
'memory_limit'));
67 $value =
$GLOBALS[
'LANG']->getLL(
'status_ok');
69 $severity = \TYPO3\CMS\Reports\Status::OK;
70 $bytesUsed = $peakMemoryUsage[
'used'];
71 $percentageUsed = $memoryLimit ? number_format($bytesUsed / $memoryLimit * 100, 1) .
'%' :
'?';
72 $dateOfPeak = date(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'ddmmyy'], $peakMemoryUsage[
'tstamp']);
73 $urlOfPeak =
'<a href="' . htmlspecialchars($peakMemoryUsage[
'url']) .
'">' . htmlspecialchars($peakMemoryUsage[
'url']) .
'</a>';
74 $clearFlagUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv(
'TYPO3_REQUEST_URL') .
'&adminCmd=clear_peak_memory_usage_flag';
75 if ($peakMemoryUsage[
'used']) {
77 $message .=
' <a href="' . $clearFlagUrl .
'">' .
$GLOBALS[
'LANG']->getLL(
'status_phpPeakMemoryClearFlag') .
'</a>.';
78 $severity = \TYPO3\CMS\Reports\Status::WARNING;
79 $value = $percentageUsed;
81 return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Reports\Status::class,
$GLOBALS[
'LANG']->getLL(
'status_phpPeakMemory'), $value, $message, $severity);
92 if (is_array(${
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/install/mod/class.tx_install.php'][
'requiredPhpModules']})) {
93 foreach (${
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
'ext/install/mod/class.tx_install.php'][
'requiredPhpModules']} as $classData) {
94 $hookObject = \TYPO3\CMS\Core\Utility\GeneralUtility::getUserObj($classData);
95 $modules = $hookObject->setRequiredPhpModules($modules, $this);
98 $missingPhpModules = array();
99 foreach ($modules as $module) {
100 if (is_array($module)) {
101 $detectedSubmodules =
false;
102 foreach ($module as $submodule) {
103 if (extension_loaded($submodule)) {
104 $detectedSubmodules =
true;
107 if ($detectedSubmodules ===
false) {
108 $missingPhpModules[] = sprintf(
$GLOBALS[
'LANG']->getLL(
'status_phpModulesGroup'),
'(' . implode(
', ', $module) .
')');
110 }
elseif (!extension_loaded($module)) {
111 $missingPhpModules[] = $module;
114 if (!empty($missingPhpModules)) {
115 $value =
$GLOBALS[
'LANG']->getLL(
'status_phpModulesMissing');
116 $message = sprintf(
$GLOBALS[
'LANG']->getLL(
'status_phpModulesList'), implode(
', ', $missingPhpModules));
117 $message .=
' ' .
$GLOBALS[
'LANG']->getLL(
'status_phpModulesInfo');
118 $severity = \TYPO3\CMS\Reports\Status::ERROR;
120 $value =
$GLOBALS[
'LANG']->getLL(
'status_phpModulesPresent');
122 $severity = \TYPO3\CMS\Reports\Status::OK;
124 return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Reports\Status::class,
$GLOBALS[
'LANG']->getLL(
'status_phpModules'), $value, $message, $severity);