aboutsummaryrefslogtreecommitdiffstats
path: root/include/import.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-10-04 18:21:08 +0000
committerMario <mario@mariovavti.com>2021-10-04 18:21:08 +0000
commit8e212d30d0e28cad8017d425fe6c2c1ed45ca78b (patch)
treedfb5bb3551f8512942de31179007f813112ea7fc /include/import.php
parentb9ae396e74b93e089f1ce36d817025955a493cf8 (diff)
parent3a38946f8a9e08fec5406fedac2577a890c8773d (diff)
downloadvolse-hubzilla-8e212d30d0e28cad8017d425fe6c2c1ed45ca78b.tar.gz
volse-hubzilla-8e212d30d0e28cad8017d425fe6c2c1ed45ca78b.tar.bz2
volse-hubzilla-8e212d30d0e28cad8017d425fe6c2c1ed45ca78b.zip
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
Diffstat (limited to 'include/import.php')
-rw-r--r--include/import.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/include/import.php b/include/import.php
index b11d01511..6186fd6ed 100644
--- a/include/import.php
+++ b/include/import.php
@@ -609,10 +609,29 @@ function sync_sysapps($channel, $apps) {
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",
- dbesc($app['app_id']),
- intval($channel['channel_id'])
- );
+ if(Apps::can_delete($channel['channel_id'], ['guid' => $app['app_id']])) {
+ $local_app = q("select id from app where app_id = '%s' and app_channel = %d limit 1",
+ dbesc($app['app_id']),
+ intval($channel['channel_id'])
+ );
+ if ($local_app) {
+ q("delete from term where otype = %d and oid = %d",
+ intval(TERM_OBJ_APP),
+ intval($local_app[0]['id'])
+ );
+
+ q("delete from app where app_id = '%s' and app_channel = %d",
+ dbesc($app['app_id']),
+ intval($channel['channel_id'])
+ );
+ }
+ }
+ else {
+ 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