From cca874435027be607f0ec76bc31e8bb80463779c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Thu, 14 Dec 2017 09:50:31 +0100 Subject: [PATCH] Do not update apps if it comes from git MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- lib/private/Installer.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/private/Installer.php b/lib/private/Installer.php index 48bd57f4c1..3ddef99c64 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -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