aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2021-10-04 13:54:45 +0200
committerMario Vavti <mario@mariovavti.com>2021-10-04 13:54:45 +0200
commit21a6dffd5f24b0468e17e9e22fb795dff1020472 (patch)
tree5f13b80bac00b3de7a493f46b28bb555b5a1acd8 /include
parent743098921220364341e5e3b194fbe0b442a4c28c (diff)
downloadvolse-hubzilla-21a6dffd5f24b0468e17e9e22fb795dff1020472.tar.gz
volse-hubzilla-21a6dffd5f24b0468e17e9e22fb795dff1020472.tar.bz2
volse-hubzilla-21a6dffd5f24b0468e17e9e22fb795dff1020472.zip
Revert "more app sync fixes"
This reverts commit 743098921220364341e5e3b194fbe0b442a4c28c.
Diffstat (limited to 'include')
-rw-r--r--include/import.php34
1 files changed, 13 insertions, 21 deletions
diff --git a/include/import.php b/include/import.php
index ab44a6012..c986eeaef 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, true);
+ $sysapps = Apps::get_system_apps(false);
foreach ($apps as $app) {
@@ -549,34 +549,32 @@ 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 (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 {
+ if ($app['app_id'] === hash('whirlpool',$sysapp['app_name'])) {
// 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) {
- continue;
+ break;
}
$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);
}
}
}
@@ -608,6 +606,7 @@ 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",
@@ -620,15 +619,6 @@ 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');
@@ -642,6 +632,8 @@ function sync_sysapps($channel, $apps) {
}
+
+
/**
* @brief Import chatrooms.
*