TYPO3 CMS  TYPO3_6-2
InstallStatusReport.php
Go to the documentation of this file.
1 <?php
3 
17 
24 
25  protected $reportList = 'FileSystem,RemainingUpdates';
26 
32  public function getStatus() {
33  $reports = array();
34  $reportMethods = explode(',', $this->reportList);
35  foreach ($reportMethods as $reportMethod) {
36  $reports[$reportMethod] = $this->{'get' . $reportMethod . 'Status'}();
37  }
38  return $reports;
39  }
40 
46  protected function getFileSystemStatus() {
47  $value = $GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_writable');
48  $message = '';
50  // Requirement level
51  // -1 = not required, but if it exists may be writable or not
52  // 0 = not required, if it exists the dir should be writable
53  // 1 = required, don't has to be writable
54  // 2 = required, has to be writable
55  $checkWritable = array(
56  'typo3temp/' => 2,
57  'typo3temp/pics/' => 2,
58  'typo3temp/temp/' => 2,
59  'typo3temp/llxml/' => 2,
60  'typo3temp/cs/' => 2,
61  'typo3temp/GB/' => 2,
62  'typo3temp/locks/' => 2,
63  'typo3conf/' => 2,
64  'typo3conf/ext/' => 0,
65  'typo3conf/l10n/' => 0,
66  TYPO3_mainDir . 'ext/' => -1,
67  'uploads/' => 2,
68  'uploads/pics/' => 0,
69  'uploads/media/' => 0,
70  $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] => -1,
71  $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'] . '_temp_/' => 0
72  );
73  foreach ($checkWritable as $relPath => $requirementLevel) {
74  if (!@is_dir((PATH_site . $relPath))) {
75  // If the directory is missing, try to create it
77  }
78  if (!@is_dir((PATH_site . $relPath))) {
79  if ($requirementLevel > 0) {
80  // directory is required
81  $value = $GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_missingDirectory');
82  $message .= sprintf($GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_directoryDoesNotExistCouldNotCreate'), $relPath) . '<br />';
84  } else {
85  $message .= sprintf($GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_directoryDoesNotExist'), $relPath);
86  if ($requirementLevel == 0) {
87  $message .= ' ' . $GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_directoryShouldAlsoBeWritable');
88  }
89  $message .= '<br />';
90  if ($severity < \TYPO3\CMS\Reports\Status::WARNING) {
91  $value = $GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_nonExistingDirectory');
93  }
94  }
95  } else {
96  if (!is_writable((PATH_site . $relPath))) {
97  switch ($requirementLevel) {
98  case 0:
99  $message .= sprintf($GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_directoryShouldBeWritable'), (PATH_site . $relPath)) . '<br />';
100  if ($severity < \TYPO3\CMS\Reports\Status::WARNING) {
101  $value = $GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_recommendedWritableDirectory');
103  }
104  break;
105  case 2:
106  $value = $GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_requiredWritableDirectory');
107  $message .= sprintf($GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_directoryMustBeWritable'), (PATH_site . $relPath)) . '<br />';
109  break;
110  }
111  }
112  }
113  }
114  return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', $GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_fileSystem'), $value, $message, $severity);
115  }
116 
122  protected function getRemainingUpdatesStatus() {
123  $value = $GLOBALS['LANG']->getLL('status_updateComplete');
124  $message = '';
125  $severity = \TYPO3\CMS\Reports\Status::OK;
126  if (!\TYPO3\CMS\Core\Utility\GeneralUtility::compat_version(TYPO3_branch)) {
127  $value = $GLOBALS['LANG']->getLL('status_updateIncomplete');
129  $url = BackendUtility::getModuleUrl('system_InstallInstall');
130  $message = sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:warning.install_update'), '<a href="' . htmlspecialchars($url) . '">', '</a>');
131  }
132  return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Reports\\Status', $GLOBALS['LANG']->sL('LLL:EXT:install/Resources/Private/Language/Report/locallang.xlf:status_remainingUpdates'), $value, $message, $severity);
133  }
134 
135 }
static getModuleUrl($moduleName, $urlParameters=array(), $backPathOverride=FALSE, $returnAbsoluteUrl=FALSE)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]