diff options
author | Mario <mario@mariovavti.com> | 2018-09-24 09:57:26 +0200 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2018-09-24 09:57:26 +0200 |
commit | 317fd06357e746eed5f53050fe7af277caf78e91 (patch) | |
tree | 8d2d1d508320bdd9de63cabe79c99b00cbdaaa04 /Zotlabs | |
parent | 4a7c678213fca1ba3f98c96579368062297d425b (diff) | |
parent | 995fc63f2caa6d735044b28caf03793f7c275eb1 (diff) | |
download | volse-hubzilla-317fd06357e746eed5f53050fe7af277caf78e91.tar.gz volse-hubzilla-317fd06357e746eed5f53050fe7af277caf78e91.tar.bz2 volse-hubzilla-317fd06357e746eed5f53050fe7af277caf78e91.zip |
Merge branch 'app-installed-filters' into 'dev'
Add filters for addon/app installed checks and docs
See merge request hubzilla/core!1284
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Lib/Apps.php | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 010947467..4ee64f15e 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -532,7 +532,7 @@ class Apps { static public function app_install($uid,$app) { $app['uid'] = $uid; - if(self::app_installed($uid,$app)) + if(self::app_installed($uid,$app,true)) $x = self::app_update($app); else $x = self::app_store($app); @@ -660,33 +660,60 @@ class Apps { } } - static public function app_installed($uid,$app) { + static public function app_installed($uid,$app,$bypass_filter=false) { $r = q("select id from app where app_id = '%s' and app_channel = %d limit 1", dbesc((array_key_exists('guid',$app)) ? $app['guid'] : ''), intval($uid) ); + if (!$bypass_filter) { + $filter_arr = [ + 'uid'=>$uid, + 'app'=>$app, + 'installed'=>$r + ]; + call_hooks('app_installed_filter',$filter_arr); + $r = $filter_arr['installed']; + } return(($r) ? true : false); } - static public function addon_app_installed($uid,$app) { + static public function addon_app_installed($uid,$app,$bypass_filter=false) { $r = q("select id from app where app_plugin = '%s' and app_channel = %d limit 1", dbesc($app), intval($uid) ); + if (!$bypass_filter) { + $filter_arr = [ + 'uid'=>$uid, + 'app'=>$app, + 'installed'=>$r + ]; + call_hooks('addon_app_installed_filter',$filter_arr); + $r = $filter_arr['installed']; + } return(($r) ? true : false); } - static public function system_app_installed($uid,$app) { + static public function system_app_installed($uid,$app,$bypass_filter=false) { $r = q("select id from app where app_id = '%s' and app_channel = %d limit 1", dbesc(hash('whirlpool',$app)), intval($uid) ); + if (!$bypass_filter) { + $filter_arr = [ + 'uid'=>$uid, + 'app'=>$app, + 'installed'=>$r + ]; + call_hooks('system_app_installed_filter',$filter_arr); + $r = $filter_arr['installed']; + } return(($r) ? true : false); } |