Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change include path instead of prepending #101

Merged
merged 1 commit into from
Mar 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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