Author: chabotc
Date: Thu Dec 11 11:04:02 2008
New Revision: 725784
URL: http://svn.apache.org/viewvc?rev=725784&view=rev
Log:
SHINDIG-779 by Pan Jie - Fix JsonDb for app data service
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/social/sample/JsonDbOpensocialService.php
Modified:
incubator/shindig/branches/1.0.x-incubating/php/src/social/sample/JsonDbOpensocialService.php
URL:
http://svn.apache.org/viewvc/incubator/shindig/branches/1.0.x-incubating/php/src/social/sample/JsonDbOpensocialService.php?rev=725784&r1=725783&r2=725784&view=diff
==============================================================================
---
incubator/shindig/branches/1.0.x-incubating/php/src/social/sample/JsonDbOpensocialService.php
(original)
+++
incubator/shindig/branches/1.0.x-incubating/php/src/social/sample/JsonDbOpensocialService.php
Thu Dec 11 11:04:02 2008
@@ -264,6 +264,9 @@
}
public function getPersonData($userId, GroupId $groupId, $appId, $fields,
SecurityToken $token) {
+ if (! isset($fields[0])) {
+ $fields[0] = '@all';
+ }
$db = $this->getDb();
$allData = $this->getAllData();
$friendsTable = $db[self::$FRIEND_LINK_TABLE];
@@ -311,6 +314,14 @@
}
public function deletePersonData($userId, GroupId $groupId, $appId, $fields,
SecurityToken $token) {
+ $db = $this->getDb();
+ $allData = $this->getAllData();
+ if ($fields == null || $fields[0] == '*') {
+ $allData[$userId->getUserId($token)] = null;
+ $db[self::$DATA_TABLE] = $allData;
+ $this->saveDb($db);
+ return null;
+ }
foreach ($fields as $key => $present) {
if (! $this->isValidKey($key)) {
throw new SocialSpiException("The person app data key had invalid
characters", ResponseError::$BAD_REQUEST);