aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-03-03 21:00:42 -0800
committerfriendica <info@friendica.com>2014-03-03 21:00:42 -0800
commit3d49bf0320cd6a35e34da9694d3eb957053845a3 (patch)
tree203e3d7f773231b15252806220110bb3ce9cf985
parentcdd2e9cd953394adfd6331c946466f3165606e29 (diff)
downloadvolse-hubzilla-3d49bf0320cd6a35e34da9694d3eb957053845a3.tar.gz
volse-hubzilla-3d49bf0320cd6a35e34da9694d3eb957053845a3.tar.bz2
volse-hubzilla-3d49bf0320cd6a35e34da9694d3eb957053845a3.zip
directory sync issues
-rwxr-xr-xboot.php5
-rw-r--r--include/dir_fns.php3
-rw-r--r--include/zot.php16
-rw-r--r--install/update.php11
-rw-r--r--mod/dirsearch.php7
5 files changed, 28 insertions, 14 deletions
diff --git a/boot.php b/boot.php
index f60d7fc3d..19d79941c 100755
--- a/boot.php
+++ b/boot.php
@@ -47,7 +47,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' );
define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'ZOT_REVISION', 1 );
-define ( 'DB_UPDATE_VERSION', 1101 );
+define ( 'DB_UPDATE_VERSION', 1102 );
define ( 'EOL', '<br />' . "\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@@ -323,11 +323,10 @@ define ( 'POLL_OVERWRITE', 0x8000); // If you vote twice remove the prior
define ( 'UPDATE_FLAGS_UPDATED', 0x0001);
+define ( 'UPDATE_FLAGS_FORCED', 0x0002);
define ( 'UPDATE_FLAGS_DELETED', 0x1000);
-
-
/**
* Maximum number of "people who like (or don't like) this" that we will list by name
*/
diff --git a/include/dir_fns.php b/include/dir_fns.php
index c2e614831..aeee8492f 100644
--- a/include/dir_fns.php
+++ b/include/dir_fns.php
@@ -101,6 +101,9 @@ function sync_directories($dirmode) {
$ud_flags = 0;
if(is_array($t['flags']) && in_array('deleted',$t['flags']))
$ud_flags |= UPDATE_FLAGS_DELETED;
+ if(is_array($t['flags']) && in_array('forced',$t['flags']))
+ $ud_flags |= UPDATE_FLAGS_FORCED;
+
$z = q("insert into updates ( ud_hash, ud_guid, ud_date, ud_flags, ud_addr )
values ( '%s', '%s', '%s', %d, '%s' ) ",
dbesc($t['hash']),
diff --git a/include/zot.php b/include/zot.php
index a52abfecd..e80dabed9 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -305,7 +305,7 @@ function zot_refresh($them,$channel = null, $force = false) {
return false;
}
- $x = import_xchan($j,(($force) ? (-1) : 1));
+ $x = import_xchan($j,(($force) ? UPDATE_FLAGS_FORCED : UPDATE_FLAGS_UPDATED));
if(! $x['success'])
return false;
@@ -538,14 +538,14 @@ function zot_register_hub($arr) {
/**
- * @function import_xchan($arr,$ud_flags = 1)
+ * @function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED)
* Takes an associative array of a fetched discovery packet and updates
* all internal data structures which need to be updated as a result.
*
* @param array $arr => json_decoded discovery packet
* @param int $ud_flags
- * Determines whether to create a directory update record if any changes occur, default 1 or true
- * $ud_flags = (-1) indicates a forced refresh where we unconditionally create a directory update record
+ * Determines whether to create a directory update record if any changes occur, default is UPDATE_FLAGS_UPDATED (true)
+ * $ud_flags = UPDATE_FLAGS_FORCED indicates a forced refresh where we unconditionally create a directory update record
* this typically occurs once a month for each channel as part of a scheduled ping to notify the directory
* that the channel still exists
*
@@ -553,7 +553,7 @@ function zot_register_hub($arr) {
* 'message' (optional error string only if success is false)
*/
-function import_xchan($arr,$ud_flags = 1) {
+function import_xchan($arr,$ud_flags = UPDATE_FLAGS_UPDATED) {
call_hooks('import_xchan', $arr);
@@ -912,7 +912,7 @@ function import_xchan($arr,$ud_flags = 1) {
}
}
- if(($changed) || ($ud_flags == (-1))) {
+ if(($changed) || ($ud_flags == UPDATE_FLAGS_FORCED)) {
$guid = random_string() . '@' . get_app()->get_hostname();
update_modtime($xchan_hash,$guid,$arr['address'],$ud_flags);
logger('import_xchan: changed: ' . $what,LOGGER_DEBUG);
@@ -1644,7 +1644,7 @@ function process_profile_delivery($sender,$arr,$deliveries) {
dbesc($sender['hash'])
);
if($r)
- import_directory_profile($sender['hash'],$arr,$r[0]['xchan_addr'], 1, 0);
+ import_directory_profile($sender['hash'],$arr,$r[0]['xchan_addr'], UPDATE_FLAGS_UPDATED, 0);
}
@@ -1655,7 +1655,7 @@ function process_profile_delivery($sender,$arr,$deliveries) {
*
*/
-function import_directory_profile($hash,$profile,$addr,$ud_flags = 1, $suppress_update = 0) {
+function import_directory_profile($hash,$profile,$addr,$ud_flags = UPDATE_FLAGS_UPDATED, $suppress_update = 0) {
logger('import_directory_profile', LOGGER_DEBUG);
if(! $hash)
diff --git a/install/update.php b/install/update.php
index 9c9b6129a..175b89285 100644
--- a/install/update.php
+++ b/install/update.php
@@ -1,6 +1,6 @@
<?php
-define( 'UPDATE_VERSION' , 1101 );
+define( 'UPDATE_VERSION' , 1102 );
/**
*
@@ -1143,4 +1143,11 @@ ADD INDEX ( `xchat_edited` ) ");
return UPDATE_SUCCESS;
return UPDATE_FAILED;
}
- \ No newline at end of file
+
+
+function update_r1101() {
+ $r = q("update updates set ud_flags = 2 where ud_flags = (-1)");
+ $r = q("update updates set ud_flags = 0 where ud_flags = 4096");
+ return UPDATE_SUCCESS;
+}
+
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 59a1d448d..7b83b8a46 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -159,7 +159,12 @@ function dirsearch_content(&$a) {
);
if($r) {
foreach($r as $rr) {
- $flags = (($rr['ud_flags'] & UPDATE_FLAGS_DELETED) ? array('deleted') : array());
+ $flags = array();
+ if($rr['ud_flags'] & UPDATE_FLAGS_DELETED)
+ $flags[] = 'deleted';
+ if($rr['ud_flags'] & UPDATE_FLAGS_FORCED)
+ $flags[] = 'forced';
+
$spkt['transactions'][] = array(
'hash' => $rr['ud_hash'],
'address' => $rr['ud_addr'],