Commit 6e791bf2 authored by Dave Lane's avatar Dave Lane

fixed data model mismatch when retrieving WEnotes registrated feed urls from Couchdb

parent 1077d0fc
......@@ -107,12 +107,14 @@ class WEnotesCouch extends WEnotesUtil {
$data = array();
$result = json_decode($couch->get('/_design/ids/_view/by_wp_id?key="'.
$user_id.'"&descending=true')->body, true);
$this->log('CouchDB number of rows returned: '. count($result['rows']));
//$this->log('CouchDB rows returned: '. print_r($result, true));
if ($result && count($result['rows'])) {
$this->log('CouchDB number of rows returned: '. count($result['total_rows']));
$this->log('CouchDB rows returned: '. print_r($result, true));
if (isset($result['rows']) && count($result['total_rows'])) {
$this->log('got result, and non-zero rows...');
foreach($result['rows'] as $row) {
$data[$row['value']['site_id']] = $row['value'];
foreach($row['value']['wp_site_ids'] as $site_id) {
$data[$site_id]['feed_url'] = $row['value']['feed_url'];
}
}
$this->log('CouchDB data array (get_reg_status_by_user): '. print_r($data, true));
return $data;
......
......@@ -111,9 +111,9 @@ class WEnotes extends WEnotesSites {
} else {
$html .= ' (no URL specified)';
}
if ($reg_status && isset($reg_status[$site_id]['url'])) {
if ($reg_status && isset($reg_status[$site_id]['feed_url'])) {
$this->log('Info for this site: '. print_r($reg_status[$site_id], true));
$msg = ($reg_status[$site_id]['url'] == '') ? '' : $reg_status[$site_id]['url'].', set ';
$msg = ($reg_status[$site_id]['feed_url'] == '') ? '' : $reg_status[$site_id]['feed_url'].', set ';
$html .= ' Registered '.$msg.' (on '.$reg_status[$site_id]['we_timestamp'].') for WEnotes scanning.';
} else {
$html .= ' Not yet registered for WEnotes scanning.';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment