aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-09-15 19:04:11 -0700
committerfriendica <info@friendica.com>2013-09-15 19:04:11 -0700
commitb3575484c7c8577f1ea648364fd979d7c551d4b9 (patch)
tree8c625e2df16df98cdbfa33a166358e69124b18d3 /include
parent033a9f67e7310e7ec1185b9a673abd9452600476 (diff)
downloadvolse-hubzilla-b3575484c7c8577f1ea648364fd979d7c551d4b9.tar.gz
volse-hubzilla-b3575484c7c8577f1ea648364fd979d7c551d4b9.tar.bz2
volse-hubzilla-b3575484c7c8577f1ea648364fd979d7c551d4b9.zip
don't create a directory sync notification (entry in the updates table) if the site record was updated - without checking first to see if anything changed. This is causing lots of sync entries when nothing changed to warrant it.
Diffstat (limited to 'include')
-rw-r--r--include/zot.php47
1 files changed, 30 insertions, 17 deletions
diff --git a/include/zot.php b/include/zot.php
index c461486f0..df3b79f80 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1516,12 +1516,15 @@ function import_site($arr,$pubkey) {
}
$update = false;
+ $exists = false;
$r = q("select * from site where site_url = '%s' limit 1",
dbesc($arr['url'])
);
- if($r)
- $update = true;
+ if($r) {
+ $exists = true;
+ $siterecord = $r[0];
+ }
$site_directory = 0;
if($arr['directory_mode'] == 'normal')
@@ -1552,29 +1555,39 @@ function import_site($arr,$pubkey) {
$access_policy = ACCESS_FREE;
}
-
- if($update) {
- $r = q("update site set site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s'
- where site_url = '%s' limit 1",
- intval($site_directory),
- intval($access_policy),
- dbesc(htmlentities($arr['directory_url'],ENT_COMPAT,'UTF-8',false)),
- intval($register_policy),
- dbesc(datetime_convert()),
- dbesc(htmlentities($arr['url'],ENT_COMPAT,'UTF-8',false))
- );
- if(! $r) {
- logger('import_site: update failed. ' . print_r($arr,true));
+ $directory_url = htmlentities($arr['directory_url'],ENT_COMPAT,'UTF-8',false);
+ $url = htmlentities($arr['url'],ENT_COMPAT,'UTF-8',false);
+
+ if($exists) {
+ if(($siterecord['site_flags'] != $site_directory)
+ || ($siterecord['site_access'] != $access_policy)
+ || ($siterecord['site_directory'] != $directory_url)
+ || ($siterecord['site_register'] != $register_policy)) {
+ $update = true;
+
+ $r = q("update site set site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s'
+ where site_url = '%s' limit 1",
+ intval($site_directory),
+ intval($access_policy),
+ dbesc($directory_url),
+ intval($register_policy),
+ dbesc(datetime_convert()),
+ dbesc($url)
+ );
+ if(! $r) {
+ logger('import_site: update failed. ' . print_r($arr,true));
+ }
}
}
else {
+ $update = true;
$r = q("insert into site ( site_url, site_access, site_flags, site_update, site_directory, site_register )
values ( '%s', %d, %d, '%s', '%s', %d )",
- dbesc(htmlentities($arr['url'],ENT_COMPAT,'UTF-8',false)),
+ dbesc($url),
intval($site_directory),
intval($access_policy),
dbesc(datetime_convert()),
- dbesc(htmlentities($arr['directory_url'],ENT_COMPAT,'UTF-8',false)),
+ dbesc($directory_url),
intval($register_policy)
);
if(! $r) {