Skip to content

Commit

Permalink
Merge pull request #101 from owncloud/fix-86
Browse files Browse the repository at this point in the history
Change include path instead of prepending
  • Loading branch information
VicDeo committed Mar 27, 2015
2 parents d06fc09 + c9c8afb commit fea8bb9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/location/apps.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function update($tmpDir = '') {
Helper::move($this->newBase . '/' . $appId, $path);
} else {
// The app is new and doesn't exist in the current instance
$pathData = first(\OC::$APPSROOTS);
$pathData = \OC::$APPSROOTS[0];
Helper::move($this->newBase . '/' . $appId, $pathData['path'] . '/' . $appId);
}
}
Expand Down
28 changes: 22 additions & 6 deletions lib/updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,29 @@ public static function update($version, $backupBase){
throw new \Exception("Backup directory $backupBase is not found");
}

// Switch include paths to backup
$pathsArray = explode(PATH_SEPARATOR, get_include_path());
$pathsTranslated = [];
foreach ($pathsArray as $path){
//Update all 3rdparty paths
if (preg_match('|^' . preg_quote(\OC::$THIRDPARTYROOT . '/3rdparty') . '|', $path)) {
$pathsTranslated[] = preg_replace(
'|^' . preg_quote(\OC::$THIRDPARTYROOT . '/3rdparty') .'|',
$backupBase . '/3rdparty',
$path
);
continue;
}
// Update all OC webroot paths
$pathsTranslated[] = preg_replace(
'|^' . preg_quote(\OC::$SERVERROOT) .'|',
$backupBase,
$path
);
}

set_include_path(
$backupBase . PATH_SEPARATOR .
$backupBase . '/core/lib' . PATH_SEPARATOR .
$backupBase . '/core/config' . PATH_SEPARATOR .
$backupBase . '/3rdparty' . PATH_SEPARATOR .
$backupBase . '/apps' . PATH_SEPARATOR .
get_include_path()
implode(PATH_SEPARATOR, $pathsTranslated)
);

$tempDir = self::getTempDir();
Expand Down

0 comments on commit fea8bb9

Please sign in to comment.