From 4a3ec65409f1b89f7f96ca0b102716735be2108e Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 2 Jun 2016 16:45:00 -0700 Subject: adjust algorithm to ensure new system apps are installed. --- Zotlabs/Lib/Apps.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 7e232af02..fd713a3f8 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -70,16 +70,25 @@ class Apps { } } + /** + * Install the system app if no system apps have been installed, or if a new system app + * is discovered, or if the version of a system app changes. + */ + static public function check_install_system_app($app) { if((! is_array(self::$installed_system_apps)) || (! count(self::$installed_system_apps))) { return true; } + $notfound = true; foreach(self::$installed_system_apps as $iapp) { - if(($iapp['app_id'] == hash('whirlpool',$app['name'])) && ($iapp['app_version'] != $app['version'])) { - return true; + if($iapp['app_id'] == hash('whirlpool',$app['name'])) { + $notfound = false; + if($iapp['app_version'] != $app['version']) { + return true; + } } } - return false; + return $notfound; } -- cgit v1.2.3