Example #1
0
 /**
  * Get status of directory - used in root and directory node
  *
  * @return array<\TYPO3\CMS\Install\Status\StatusInterface>
  */
 protected function getSelfStatus()
 {
     $result = array();
     if (!$this->isDirectory()) {
         $status = new Status\ErrorStatus();
         $status->setTitle($this->getRelativePathBelowSiteRoot() . ' is not a directory');
         $status->setMessage('Directory ' . $this->getRelativePathBelowSiteRoot() . ' should be a directory,' . ' but is of type ' . filetype($this->getAbsolutePath()));
         $result[] = $status;
     } elseif (!$this->isWritable()) {
         $status = new Status\ErrorStatus();
         $status->setTitle('Directory ' . $this->getRelativePathBelowSiteRoot() . ' is not writable');
         $status->setMessage('Path ' . $this->getAbsolutePath() . ' exists, but no file underneath it' . ' can be created.');
         $result[] = $status;
     } elseif (!$this->isPermissionCorrect()) {
         $status = new Status\NoticeStatus();
         $status->setTitle('Directory ' . $this->getRelativePathBelowSiteRoot() . ' permissions mismatch');
         $status->setMessage('Default configured permissions are ' . $this->getTargetPermission() . ' but current permissions are ' . $this->getCurrentPermission());
         $result[] = $status;
     } else {
         $status = new Status\OkStatus();
         $status->setTitle('Directory ' . $this->getRelativePathBelowSiteRoot());
         $status->setMessage('Is a directory with the configured permissions of ' . $this->getTargetPermission());
         $result[] = $status;
     }
     return $result;
 }
Example #2
0
 /**
  * Get own status
  * Returns information status if running on Windows
  * Returns OK status if is link and possible target is correct
  * Else returns error (not fixable)
  *
  * @return array<\TYPO3\CMS\Install\Status\StatusInterface>
  */
 public function getStatus()
 {
     if ($this->isWindowsOs()) {
         $status = new Status\InfoStatus();
         $status->setTitle($this->getRelativePathBelowSiteRoot() . ' should be a link, but this support is incomplete for Windows.');
         $status->setMessage('This node is not handled for Windows OS and should be checked manually.');
         return [$status];
     }
     if (!$this->exists()) {
         $status = new Status\ErrorStatus();
         $status->setTitle($this->getRelativePathBelowSiteRoot() . ' should be a link, but it does not exist');
         $status->setMessage('Links cannot be fixed by this system');
         return [$status];
     }
     if (!$this->isLink()) {
         $status = new Status\WarningStatus();
         $status->setTitle('Path ' . $this->getRelativePathBelowSiteRoot() . ' is not a link');
         $type = @filetype($this->getAbsolutePath());
         if ($type) {
             $status->setMessage('The target ' . $this->getRelativePathBelowSiteRoot() . ' should be a link,' . ' but is of type ' . $type . '. This cannot be fixed automatically. Please investigate.');
         } else {
             $status->setMessage('The target ' . $this->getRelativePathBelowSiteRoot() . ' should be a file,' . ' but is of unknown type, probably because an upper level directory does not exist. Please investigate.');
         }
         return [$status];
     }
     if (!$this->isTargetCorrect()) {
         $status = new Status\ErrorStatus();
         $status->setTitle($this->getRelativePathBelowSiteRoot() . ' is a link, but link target is not as specified');
         $status->setMessage('Link target should be ' . $this->getTarget() . ' but is ' . $this->getCurrentTarget());
         return [$status];
     }
     $status = new Status\OkStatus();
     $message = 'Is a link';
     if ($this->getTarget() !== '') {
         $message .= ' and correctly points to target ' . $this->getTarget();
     }
     $status->setTitle($this->getRelativePathBelowSiteRoot());
     $status->setMessage($message);
     return [$status];
 }
 /**
  * Checks a BE/*mask setting for it's security
  *
  * If it permits world writing: Error
  * If it permits world reading: Warning
  * If it permits group writing: Notice
  * If it permits group reading: Notice
  * If it permits only user read/write: Ok
  *
  * @param string $which fileCreateMask or folderCreateMask
  * @return \TYPO3\CMS\Install\Status\StatusInterface
  */
 public function getMaskStatus($which)
 {
     $octal = '0' . $GLOBALS['TYPO3_CONF_VARS']['BE'][$which];
     $dec = octdec($octal);
     $perms = array('ox' => ($dec & 01) == 01, 'ow' => ($dec & 02) == 02, 'or' => ($dec & 04) == 04, 'gx' => ($dec & 010) == 010, 'gw' => ($dec & 020) == 020, 'gr' => ($dec & 040) == 040, 'ux' => ($dec & 0100) == 0100, 'uw' => ($dec & 0200) == 0200, 'ur' => ($dec & 0400) == 0400, 'setgid' => ($dec & 02000) == 02000);
     $extraMessage = '';
     $groupPermissions = FALSE;
     if (!$perms['uw'] || !$perms['ur']) {
         $permissionStatus = new Status\ErrorStatus();
         $extraMessage = ' (not read or writable by the user)';
     } elseif ($perms['ow']) {
         if (TYPO3_OS === 'WIN') {
             $permissionStatus = new Status\InfoStatus();
             $extraMessage = ' (writable by anyone on the server). This is the default behavior on a Windows system';
         } else {
             $permissionStatus = new Status\ErrorStatus();
             $extraMessage = ' (writable by anyone on the server)';
         }
     } elseif ($perms['or']) {
         $permissionStatus = new Status\NoticeStatus();
         $extraMessage = ' (readable by anyone on the server). This is the default set by TYPO3 CMS to be as much compatible as possible but if your system allows, please consider to change rights';
     } elseif ($perms['gw']) {
         $permissionStatus = new Status\OkStatus();
         $extraMessage = ' (group writable)';
         $groupPermissions = TRUE;
     } elseif ($perms['gr']) {
         $permissionStatus = new Status\OkStatus();
         $extraMessage = ' (group readable)';
         $groupPermissions = TRUE;
     } else {
         $permissionStatus = new Status\OkStatus();
     }
     $permissionStatus->setTitle($this->names[$which] . ' (BE/' . $which . ')');
     $message = 'Recommended: ' . $this->recommended[$which] . '.';
     $message .= ' Currently configured as ';
     if ($GLOBALS['TYPO3_CONF_VARS']['BE'][$which] === $this->recommended[$which]) {
         $message .= 'recommended';
     } else {
         $message .= $GLOBALS['TYPO3_CONF_VARS']['BE'][$which];
     }
     $message .= $extraMessage . '.';
     if ($groupPermissions) {
         $message .= ' This is fine as long as the web server\'s group only comprises trusted users.';
         if (!empty($GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup'])) {
             $message .= ' Your site is configured (BE/createGroup) to write as group \'' . $GLOBALS['TYPO3_CONF_VARS']['BE']['createGroup'] . '\'.';
         }
     }
     $permissionStatus->setMessage($message);
     return $permissionStatus;
 }
Example #4
0
 /**
  * Create true type font test image
  *
  * @return Status\StatusInterface
  */
 protected function isTrueTypeFontDpiStandard()
 {
     if (function_exists('imageftbbox')) {
         // 20 Pixels at 96 DPI - the DefaultConfiguration
         $fontSize = 20 / 96 * 72;
         $textDimensions = @imageftbbox($fontSize, 0, __DIR__ . '/../../Resources/Private/Font/vera.ttf', 'Testing true type support');
         $fontBoxWidth = $textDimensions[2] - $textDimensions[0];
         if ($fontBoxWidth < 300 && $fontBoxWidth > 200) {
             $status = new Status\OkStatus();
             $status->setTitle('FreeType True Type Font DPI');
             $status->setMessage('Fonts are rendered by FreeType library. ' . 'We need to ensure that the final dimensions are as expected. ' . 'This server renderes fonts based on 96 DPI correctly');
         } else {
             $status = new Status\NoticeStatus();
             $status->setTitle('FreeType True Type Font DPI');
             $status->setMessage('Fonts are rendered by FreeType library. ' . 'This server does not render fonts as expected. ' . 'Please configure FreeType or TYPO3_CONF_VARS[GFX][TTFdpi]');
         }
     } else {
         $status = new Status\ErrorStatus();
         $status->setTitle('PHP GD library freetype2 support missing');
         $status->setMessage('The core relies on GD library compiled into PHP with freetype2' . ' support. This is missing on your system. Please install it.');
     }
     return $status;
 }
Example #5
0
 /**
  * Get status of file
  *
  * @return array<\TYPO3\CMS\Install\Status\StatusInterface>
  */
 protected function getSelfStatus()
 {
     $result = array();
     if (!$this->isFile()) {
         $status = new Status\ErrorStatus();
         $status->setTitle($this->getRelativePathBelowSiteRoot() . ' is not a file');
         $status->setMessage('Path ' . $this->getAbsolutePath() . ' should be a file,' . ' but is of type ' . filetype($this->getAbsolutePath()));
         $result[] = $status;
     } elseif (!$this->isWritable()) {
         $status = new Status\NoticeStatus();
         $status->setTitle('File ' . $this->getRelativePathBelowSiteRoot() . ' is not writable');
         $status->setMessage('File ' . $this->getRelativePathBelowSiteRoot() . ' exists, but is not writable.');
         $result[] = $status;
     } elseif (!$this->isPermissionCorrect()) {
         $status = new Status\NoticeStatus();
         $status->setTitle('File ' . $this->getRelativePathBelowSiteRoot() . ' permissions mismatch');
         $status->setMessage('Default configured permissions are ' . $this->getTargetPermission() . ' but file permissions are ' . $this->getCurrentPermission());
         $result[] = $status;
     }
     if ($this->isFile() && !$this->isContentCorrect()) {
         $status = new Status\NoticeStatus();
         $status->setTitle('File ' . $this->getRelativePathBelowSiteRoot() . ' content differs');
         $status->setMessage('File content is not identical to default content. This file may have been changed manually.' . ' The Install Tool will not overwrite the current version!');
         $result[] = $status;
     } else {
         $status = new Status\OkStatus();
         $status->setTitle('File ' . $this->getRelativePathBelowSiteRoot());
         $status->setMessage('Is a file with the default content and configured permissions of ' . $this->getTargetPermission());
         $result[] = $status;
     }
     return $result;
 }
Example #6
0
 /**
  * Check gdlib supports freetype
  *
  * @return Status\StatusInterface
  */
 protected function checkGdLibFreeTypeSupport()
 {
     if (function_exists('imagettftext')) {
         $status = new Status\OkStatus();
         $status->setTitle('PHP GD library has freetype font support');
         $status->setMessage('There is a difference between the font size setting which the GD' . ' library should be supplied  with. If installation is completed' . ' a test in the install tool helps to find out the value you need.');
     } else {
         $status = new Status\ErrorStatus();
         $status->setTitle('PHP GD library freetype support missing');
         $status->setMessage('Some core functionality and extension rely on the GD' . ' to render fonts on images. This support is missing' . ' in your environment. Install it.');
     }
     return $status;
 }