Skip to content
This repository was archived by the owner on Oct 29, 2020. It is now read-only.

Commit 7894b79

Browse files
committed
fixes cache
1 parent e7780f6 commit 7894b79

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

lib/modules/dosomething/dosomething_northstar/dosomething_northstar.module

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,7 @@ function dosomething_northstar_update_user($form_state) {
132132
*/
133133
function dosomething_northstar_get_northstar_user($id) {
134134
$northstar_user_info = cache_get('northstar_user_info_' . $id, 'cache_northstar_user_info');
135-
// $northstar_user_info = (string) $northstar_user_info;
136-
// die(gettype($northstar_user_info)); returns an object
137-
// die($northstar_user_info); returns error "Object of class stdClass could not be converted to string"
135+
$northstar_user_info = $northstar_user_info->data;
138136

139137
if (empty($northstar_user_info)) {
140138
$client = _dosomething_northstar_build_http_client();
@@ -144,17 +142,18 @@ function dosomething_northstar_get_northstar_user($id) {
144142
'method' => 'GET',
145143
));
146144

145+
$northstar_user_info = $northstar_user_info->data;
146+
147147
if (!empty($northstar_user_info->error)) {
148148
$error = sprintf("Error fetching Northstar user data, uid=%d: '%s'", $id, $northstar_user_info->error);
149149
watchdog_exception('northstar', new Exception($error));
150150
} else {
151+
// die($northstar_user_info);
151152
cache_set('northstar_user_info_' . $id, $northstar_user_info, 'cache_northstar_user_info', REQUEST_TIME + 60*60*24);
152153
}
153154
}
154-
// die($northstar_user_info->data); returns user object
155-
// die(gettype($northstar_user_info->data)); returns a string
156-
// die(gettype($northstar_user_info)); returns an cubrid_fetch_object(result)
157-
return $northstar_user_info->data;
155+
156+
return $northstar_user_info;
158157
}
159158

160159
/**

lib/modules/dosomething/dosomething_reportback/includes/Reportback.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,6 @@ private function build($data, $full = false) {
162162

163163
if ($full) {
164164
$northstar_user = dosomething_northstar_get_northstar_user($data->uid);
165-
// die(gettype($northstar_user)); returns an object
166-
// die(gettype($northstar_user->data)); returns a string when makes call to ns
167-
// die(gettype($northstar_user->data)); returns an object when gets info from cache_get
168-
// die(gettype($northstar_user));
169165
$northstar_user = json_decode($northstar_user, true);
170166
$northstar_user = (object) $northstar_user['data'][0];
171167

lib/modules/dosomething/dosomething_reportback/includes/ReportbackItem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ private function build($data, $full = false) {
120120

121121
if ($full) {
122122
$northstar_user = dosomething_northstar_get_northstar_user($data->uid);
123-
$northstar_user = json_decode($northstar_user->data, true);
123+
$northstar_user = json_decode($northstar_user, true);
124124
$northstar_user = (object) $northstar_user['data'][0];
125125

126126
$this->user = [

0 commit comments

Comments
 (0)