Delete shipped apps from both old and new version
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
parent
50bdca3197
commit
1ed9c8ee07
15
index.php
15
index.php
|
@ -903,13 +903,22 @@ EOF;
|
||||||
public function deleteOldFiles() {
|
public function deleteOldFiles() {
|
||||||
$this->silentLog('[info] deleteOldFiles()');
|
$this->silentLog('[info] deleteOldFiles()');
|
||||||
|
|
||||||
$shippedAppsFile = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid') . '/downloads/nextcloud/core/shipped.json';
|
$shippedAppsFile = $this->baseDir . '/../core/shipped.json';
|
||||||
if(!file_exists($shippedAppsFile)) {
|
if(!file_exists($shippedAppsFile)) {
|
||||||
|
throw new \Exception('core/shipped.json is not available');
|
||||||
|
}
|
||||||
|
|
||||||
|
$newShippedAppsFile = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid') . '/downloads/nextcloud/core/shipped.json';
|
||||||
|
if(!file_exists($newShippedAppsFile)) {
|
||||||
throw new \Exception('core/shipped.json is not available in the new release');
|
throw new \Exception('core/shipped.json is not available in the new release');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete shipped apps
|
// Delete shipped apps
|
||||||
$shippedApps = json_decode(file_get_contents($shippedAppsFile), true);
|
$shippedApps = array_merge(
|
||||||
foreach($shippedApps['shippedApps'] as $app) {
|
json_decode(file_get_contents($shippedAppsFile), true)['shippedApps'],
|
||||||
|
json_decode(file_get_contents($newShippedAppsFile), true)['shippedApps']
|
||||||
|
);
|
||||||
|
foreach($shippedApps as $app) {
|
||||||
$this->recursiveDelete($this->baseDir . '/../apps/' . $app);
|
$this->recursiveDelete($this->baseDir . '/../apps/' . $app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -786,13 +786,22 @@ EOF;
|
||||||
public function deleteOldFiles() {
|
public function deleteOldFiles() {
|
||||||
$this->silentLog('[info] deleteOldFiles()');
|
$this->silentLog('[info] deleteOldFiles()');
|
||||||
|
|
||||||
$shippedAppsFile = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid') . '/downloads/nextcloud/core/shipped.json';
|
$shippedAppsFile = $this->baseDir . '/../core/shipped.json';
|
||||||
if(!file_exists($shippedAppsFile)) {
|
if(!file_exists($shippedAppsFile)) {
|
||||||
|
throw new \Exception('core/shipped.json is not available');
|
||||||
|
}
|
||||||
|
|
||||||
|
$newShippedAppsFile = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid') . '/downloads/nextcloud/core/shipped.json';
|
||||||
|
if(!file_exists($newShippedAppsFile)) {
|
||||||
throw new \Exception('core/shipped.json is not available in the new release');
|
throw new \Exception('core/shipped.json is not available in the new release');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete shipped apps
|
// Delete shipped apps
|
||||||
$shippedApps = json_decode(file_get_contents($shippedAppsFile), true);
|
$shippedApps = array_merge(
|
||||||
foreach($shippedApps['shippedApps'] as $app) {
|
json_decode(file_get_contents($shippedAppsFile), true)['shippedApps'],
|
||||||
|
json_decode(file_get_contents($newShippedAppsFile), true)['shippedApps']
|
||||||
|
);
|
||||||
|
foreach($shippedApps as $app) {
|
||||||
$this->recursiveDelete($this->baseDir . '/../apps/' . $app);
|
$this->recursiveDelete($this->baseDir . '/../apps/' . $app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue