From c80e009cf3750f559c18c526ebac62def7c3defb Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 5 Jul 2018 21:46:34 -0700 Subject: app store fixes --- Zotlabs/Lib/Apps.php | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) (limited to 'Zotlabs/Lib') diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 81f426f4b..c2ec5c967 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -156,17 +156,20 @@ class Apps { * is discovered, or if the version of a system app changes. */ + + static public function check_install_personal_app($app) { - foreach(self::$installed_apps as $iapp) { - $install = false; + $installed = false; + foreach(self::$installed_apps as $iapp) { if($iapp['app_id'] == hash('whirlpool',$app['name'])) { + $installed = true; if(($iapp['app_version'] != $app['version']) || ($app['plugin'] && (! $iapp['app_plugin']))) { return intval($iapp['app_id']); } } } - if(in_array($app['name'],self::$base_apps)) { + if(! $installed && in_array($app['name'],self::$base_apps)) { return true; } return false; @@ -531,21 +534,13 @@ class Apps { intval(TERM_OBJ_APP), intval($x[0]['id']) ); - if($x[0]['app_system']) { - $r = q("update app set app_deleted = 1 where app_id = '%s' and app_channel = %d", - dbesc($app['guid']), - intval($uid) - ); - } - else { - $r = q("delete from app where app_id = '%s' and app_channel = %d", - dbesc($app['guid']), - intval($uid) - ); + $r = q("delete from app where app_id = '%s' and app_channel = %d", + dbesc($app['guid']), + intval($uid) + ); - // we don't sync system apps - they may be completely different on the other system - build_sync_packet($uid,array('app' => $x)); - } + // we don't sync system apps - they may be completely different on the other system + build_sync_packet($uid,array('app' => $x)); } else { self::app_undestroy($uid,$app); @@ -945,7 +940,7 @@ class Apps { // if updating an embed app, don't mess with any existing categories. - if(array_key_exists('embed',$arr) && intval($arr['embed'])) + if(array_key_exists('embed',$arr) && intval($arr['embed']) && (intval($darray['app_channel']))) return $ret; if($x) { -- cgit v1.2.3