diff options
author | Mario Vavti <mario@mariovavti.com> | 2021-10-04 13:41:54 +0200 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2021-10-04 13:41:54 +0200 |
commit | 743098921220364341e5e3b194fbe0b442a4c28c (patch) | |
tree | b390f3bc7f19559964eabffbe98ba5948a762b27 /include/import.php | |
parent | 2e26a13f810791e909b5c35db82ffe33aaee8e57 (diff) | |
download | volse-hubzilla-743098921220364341e5e3b194fbe0b442a4c28c.tar.gz volse-hubzilla-743098921220364341e5e3b194fbe0b442a4c28c.tar.bz2 volse-hubzilla-743098921220364341e5e3b194fbe0b442a4c28c.zip |
more app sync fixes
Diffstat (limited to 'include/import.php')
-rw-r--r-- | include/import.php | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/include/import.php b/include/import.php index c986eeaef..ab44a6012 100644 --- a/include/import.php +++ b/include/import.php @@ -541,7 +541,7 @@ function import_sysapps($channel, $apps) { if ($channel && $apps) { - $sysapps = Apps::get_system_apps(false); + $sysapps = Apps::get_system_apps(false, true); foreach ($apps as $app) { @@ -549,32 +549,34 @@ function import_sysapps($channel, $apps) { continue; } - if (array_key_exists('app_deleted',$app) && (intval($app['app_deleted']))) { - continue; - } - $term = ((array_key_exists('term',$app) && is_array($app['term'])) ? $app['term'] : null); foreach ($sysapps as $sysapp) { - if ($app['app_id'] === hash('whirlpool',$sysapp['app_name'])) { + if (array_key_exists('app_deleted',$app) && $app['app_deleted'] && $app['app_id']) { + q("update app set app_deleted = 1 where app_id = '%s' and app_channel = %d", + dbesc($app['app_id']), + intval($channel['channel_id']) + ); + } + else { // install this app on this server $newapp = $sysapp; $newapp['uid'] = $channel['channel_id']; - $newapp['guid'] = hash('whirlpool',$newapp['name']); + $newapp['guid'] = hash('whirlpool', $newapp['name']); $installed = q("select id from app where app_id = '%s' and app_channel = %d limit 1", dbesc($newapp['guid']), intval($channel['channel_id']) ); if ($installed) { - break; + continue; } $newapp['system'] = 1; if ($term) { - $newapp['categories'] = array_elm_to_str($term,'term'); + $newapp['categories'] = array_elm_to_str($term, 'term'); } - Apps::app_install($channel['channel_id'],$newapp); + Apps::app_install($channel['channel_id'], $newapp); } } } @@ -606,7 +608,6 @@ function sync_sysapps($channel, $apps) { } foreach ($sysapps as $sysapp) { - if ($app['app_id'] === hash('whirlpool', $sysapp['name'])) { if (array_key_exists('app_deleted',$app) && $app['app_deleted'] && $app['app_id']) { q("update app set app_deleted = 1 where app_id = '%s' and app_channel = %d", @@ -619,6 +620,15 @@ function sync_sysapps($channel, $apps) { $newapp = $sysapp; $newapp['uid'] = $channel['channel_id']; $newapp['guid'] = hash('whirlpool', $newapp['name']); + + $installed = q("select id from app where app_id = '%s' and app_channel = %d limit 1", + dbesc($newapp['guid']), + intval($channel['channel_id']) + ); + if ($installed) { + continue; + } + $newapp['system'] = 1; if ($term) { $newapp['categories'] = array_elm_to_str($term, 'term'); @@ -632,8 +642,6 @@ function sync_sysapps($channel, $apps) { } - - /** * @brief Import chatrooms. * |