Do not update apps if it comes from git

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2017-12-14 09:50:31 +01:00
parent ce12763ab7
commit cca8744350
No known key found for this signature in database
GPG Key ID: FB5ACEED51955BF8
1 changed files with 20 additions and 0 deletions

View File

@ -399,6 +399,10 @@ class Installer {
$apps = $this->appFetcher->get();
}
if ($this->isInstalledFromGit($appId) === true) {
return false;
}
foreach($apps as $app) {
if($app['id'] === $appId) {
$currentVersion = OC_App::getAppVersion($appId);
@ -414,6 +418,22 @@ class Installer {
return false;
}
/**
* Check if app has been installed from git
* @param string $name name of the application to remove
* @return boolean
*
* The function will check if the path contains a .git folder
*/
private function isInstalledFromGit($appId) {
$app = \OC_App::findAppInDirectories($appId);
if($app === false) {
return false;
}
$basedir = $app['path'].'/'.$appId;
return file_exists($basedir.'/.git/');
}
/**
* Check if app is already downloaded
* @param string $name name of the application to remove