/**
  * Check if an update is possible at all
  *
  * @param string $version The target version number
  * @return bool TRUE on success
  * @throws \TYPO3\CMS\Install\Status\Exception
  */
 public function checkPreConditions($version)
 {
     $success = true;
     $messages = array();
     /** @var StatusUtility $statusUtility */
     $statusUtility = $this->objectManager->get(StatusUtility::class);
     // Folder structure test: Update can be done only if folder structure returns no errors
     /** @var $folderStructureFacade \TYPO3\CMS\Install\FolderStructure\StructureFacade */
     $folderStructureFacade = $this->objectManager->get(DefaultFactory::class)->getStructure();
     $folderStructureErrors = $statusUtility->filterBySeverity($folderStructureFacade->getStatus(), 'error');
     $folderStructureWarnings = $statusUtility->filterBySeverity($folderStructureFacade->getStatus(), 'warning');
     if (!empty($folderStructureErrors) || !empty($folderStructureWarnings)) {
         $success = false;
         /** @var $message StatusInterface */
         $message = $this->objectManager->get(ErrorStatus::class);
         $message->setTitle('Automatic TYPO3 CMS core update not possible: Folder structure has errors or warnings');
         $message->setMessage('To perform an update, the folder structure of this TYPO3 CMS instance must' . ' stick to the conventions, or the update process could lead to unexpected' . ' results and may be hazardous to your system');
         $messages[] = $message;
     }
     // No core update on windows
     if (TYPO3_OS === 'WIN') {
         $success = false;
         /** @var $message StatusInterface */
         $message = $this->objectManager->get(ErrorStatus::class);
         $message->setTitle('Automatic TYPO3 CMS core update not possible: Update not supported on Windows OS');
         $messages[] = $message;
     }
     if ($success) {
         // Explicit write check to document root
         $file = PATH_site . StringUtility::getUniqueId('install-core-update-test-');
         $result = @touch($file);
         if (!$result) {
             $success = false;
             /** @var $message StatusInterface */
             $message = $this->objectManager->get(ErrorStatus::class);
             $message->setTitle('Automatic TYPO3 CMS core update not possible: No write access to document root');
             $message->setMessage('Could not write a file in path "' . PATH_site . '"!');
             $messages[] = $message;
         } else {
             unlink($file);
         }
         if (!$this->checkCoreFilesAvailable($version)) {
             // Explicit write check to upper directory of current core location
             $coreLocation = @realPath($this->symlinkToCoreFiles . '/../');
             $file = $coreLocation . '/' . StringUtility::getUniqueId('install-core-update-test-');
             $result = @touch($file);
             if (!$result) {
                 $success = false;
                 /** @var $message StatusInterface */
                 $message = $this->objectManager->get(ErrorStatus::class);
                 $message->setTitle('Automatic TYPO3 CMS core update not possible: No write access to TYPO3 CMS core location');
                 $message->setMessage('New TYPO3 CMS core should be installed in "' . $coreLocation . '", but this directory is not writable!');
                 $messages[] = $message;
             } else {
                 unlink($file);
             }
         }
     }
     if ($success && !$this->coreVersionService->isInstalledVersionAReleasedVersion()) {
         $success = false;
         /** @var $message StatusInterface */
         $message = $this->objectManager->get(ErrorStatus::class);
         $message->setTitle('Automatic TYPO3 CMS core update not possible: You are running a development version of TYPO3');
         $message->setMessage('Your current version is specified as ' . $this->coreVersionService->getInstalledVersion() . '.' . ' This is a development version and can not be updated automatically. If this is a "git"' . ' checkout, please update using git directly.');
         $messages[] = $message;
     }
     $this->messages = $messages;
     return $success;
 }