Skip to content

Commit

Permalink
Change include path instead of prepending it
Browse files Browse the repository at this point in the history
  • Loading branch information
VicDeo committed Mar 24, 2015
1 parent adf7446 commit b1e9a04
Showing 1 changed file with 22 additions and 6 deletions.
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 b1e9a04

Please sign in to comment.