[BUGFIX] Skip write access check if core files exist 78/42378/3
authorFrederic Gaus <frederic.gaus@flagbit.de>
Mon, 20 Jul 2015 12:07:27 +0000 (14:07 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Fri, 7 Aug 2015 12:46:36 +0000 (14:46 +0200)
If updating a TYPO3 instance when the core files are
already present, the CoreUpdateService can skip the
write access check.

Resolves: #68386
Releases: master, 6.2
Change-Id: I7af201d98e43799f4066c74443a1815d9b65cbf0
Reviewed-on: http://review.typo3.org/42378
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/install/Classes/Controller/Action/Ajax/CoreUpdateCheckPreConditions.php
typo3/sysext/install/Classes/Service/CoreUpdateService.php

index 655b08b..c8c2326 100644 (file)
@@ -26,7 +26,7 @@ class CoreUpdateCheckPreConditions extends AbstractCoreUpdate {
         */
        protected function executeAction() {
                $this->view->assignMultiple(array(
-                               'success' => $this->coreUpdateService->checkPreConditions(),
+                               'success' => $this->coreUpdateService->checkPreConditions($this->getVersionToHandle()),
                                'status' => $this->coreUpdateService->getMessages(),
                        ));
                return $this->view->render();
index 8aac119..c0f70b4 100644 (file)
@@ -147,9 +147,11 @@ class CoreUpdateService {
        /**
         * Check if an update is possible at all
         *
-        * @return boolean TRUE on success
+        * @param string $version The target version number
+        * @return bool TRUE on success
+        * @throws \TYPO3\CMS\Install\Status\Exception
         */
-       public function checkPreConditions() {
+       public function checkPreConditions($version) {
                $success = TRUE;
                $messages = array();
 
@@ -198,21 +200,23 @@ class CoreUpdateService {
                                unlink($file);
                        }
 
-                       // Explicit write check to upper directory of current core location
-                       $coreLocation = @realPath($this->symlinkToCoreFiles . '/../');
-                       $file = $coreLocation . '/' . uniqid('install-core-update-test-', TRUE);
-                       $result = @touch($file);
-                       if (!$result) {
-                               $success = FALSE;
-                               /** @var $message StatusInterface */
-                               $message = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\ErrorStatus');
-                               $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 (!$this->checkCoreFilesAvailable($version)) {
+                               // Explicit write check to upper directory of current core location
+                               $coreLocation = @realPath($this->symlinkToCoreFiles . '/../');
+                               $file = $coreLocation . '/' . uniqid('install-core-update-test-', TRUE);
+                               $result = @touch($file);
+                               if (!$result) {
+                                       $success = FALSE;
+                                       /** @var $message StatusInterface */
+                                       $message = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\ErrorStatus');
+                                       $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);
+                               }
                        }
                }