Skip to content

Commit

Permalink
Do not remove shipped and compatible apps
Browse files Browse the repository at this point in the history
  • Loading branch information
VicDeo committed Nov 15, 2012
1 parent bc9f4ee commit ad18824
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion updater/lib/updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ public static function prepare($version) {
$sources = Helper::getSources($version);
$destinations = Helper::getDirectories();


if (preg_match('/^\d+\.\d+/', $version, $ver)) {
$ver = $ver[0];
} else {
$ver = $version;
}
// read the list of shipped apps
$appLocation = $sources[Helper::APP_DIRNAME];
$shippedApps = array_keys(Helper::getFilteredContent($appLocation));

try {
$locations = Helper::getPreparedLocations();
foreach ($locations as $type => $dirs) {
Expand All @@ -36,8 +46,19 @@ public static function prepare($version) {
$tempBaseDir = $tempDir . '/' . $type;
Helper::mkdir($tempBaseDir, true);


// Collect old sources
foreach ($dirs as $name => $path) {
//skip compatible, not shipped apps
if (strpos($type, Helper::APP_DIRNAME) ===0
&& !in_array($name, $shippedApps)
) {
//Read compatibility info
$info = \OC_App::getAppInfo($name);
if (isset($info['require']) && version_compare($ver, $info['require'])>=0){
continue;
}
}
self::$locations[] = array (
'src' => $path,
'dst' => $tempBaseDir . '/' . $name
Expand Down Expand Up @@ -93,7 +114,7 @@ public static function update($version, $backupBase) {
throw $e;
}

$config = "/config/config.php";
$config = "/" . Helper::CORE_DIRNAME . "/config/config.php";
copy($backupBase . $config, \OC::$SERVERROOT . $config);

//TODO: disable removed apps
Expand Down

0 comments on commit ad18824

Please sign in to comment.