/** * 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; }
/** * Fix permission if they are not equal to target permission * * @throws Exception * @return \TYPO3\CMS\Install\Status\StatusInterface */ protected function fixPermission() { if ($this->isPermissionCorrect()) { throw new Exception('Permission on ' . $this->getAbsolutePath() . ' are already ok', 1366744035); } $result = @chmod($this->getAbsolutePath(), octdec($this->getTargetPermission())); if ($result === TRUE) { $status = new Status\OkStatus(); $status->setTitle('Fixed permission on ' . $this->getRelativePathBelowSiteRoot() . '.'); } else { $status = new Status\NoticeStatus(); $status->setTitle('Permission change on ' . $this->getRelativePathBelowSiteRoot() . ' not successful'); $status->setMessage('Permissions could not be changed to ' . $this->getTargetPermission() . '. This only is a problem if files and folders within this node cannot be written.'); } return $status; }
/** * 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; }
/** * 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; }
/** * Check suhosin.executor.include.whitelist contains phar * * @return Status\StatusInterface */ protected function checkSuhosinExecutorIncludeWhiteListContainsPhar() { if ($this->isSuhosinLoadedAndActive()) { $whitelist = (string) ini_get('suhosin.executor.include.whitelist'); if (strpos($whitelist, 'phar') === false) { $status = new Status\NoticeStatus(); $status->setTitle('PHP suhosin.executor.include.whitelist does not contain phar'); $status->setMessage('suhosin.executor.include.whitelist= ' . $whitelist . LF . '"phar" is currently not a hard requirement of TYPO3 CMS but is nice to have and a possible' . ' requirement in future versions. A useful setting is:' . LF . 'suhosin.executor.include.whitelist=phar,vfs'); } else { $status = new Status\OkStatus(); $status->setTitle('PHP suhosin.executor.include.whitelist contains phar'); } } else { $status = new Status\InfoStatus(); $status->setTitle('Suhosin not loaded'); $status->setMessage('If enabling suhosin, a useful setting is:' . LF . 'suhosin.executor.include.whitelist=phar,vfs'); } return $status; }