X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FYammerImport%2Fclasses%2FYammer_notice_stub.php;h=e10300c4c7186f4ba72bae1982a20333ef95e79c;hb=1fdc72f5956f00c736f7761aead4abd8da192eda;hp=98a5e2cf77365c15dd4d677d469ffeb1171ce0a7;hpb=084befc32f6ddefc8aa7743dc0ad332a985c98f5;p=quix0rs-gnu-social.git diff --git a/plugins/YammerImport/classes/Yammer_notice_stub.php b/plugins/YammerImport/classes/Yammer_notice_stub.php index 98a5e2cf77..e10300c4c7 100644 --- a/plugins/YammerImport/classes/Yammer_notice_stub.php +++ b/plugins/YammerImport/classes/Yammer_notice_stub.php @@ -48,10 +48,27 @@ class Yammer_notice_stub extends Memcached_DataObject public $json_data; // text public $created; // datetime + /** + * Get an instance by key + * + * This is a utility method to get a single instance with a given key value. + * + * @param string $k Key to use to lookup + * @param mixed $v Value to lookup + * + * @return Yammer_notice_stub object found, or null for no hits + * + */ + + function staticGet($k, $v=null) + { + return Memcached_DataObject::staticGet('Yammer_notice_stub', $k, $v); + } + /** * Return schema definition to set this table up in onCheckSchema */ - static function schemaDef($field) + static function schemaDef() { return array(new ColumnDef('id', 'bigint', null, false, 'PRI'), @@ -73,7 +90,7 @@ class Yammer_notice_stub extends Memcached_DataObject function table() { return array('id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, - 'json_data' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL, + 'json_data' => DB_DATAOBJECT_STR + DB_DATAOBJECT_NOTNULL, 'created' => DB_DATAOBJECT_STR + DB_DATAOBJECT_DATE + DB_DATAOBJECT_TIME + DB_DATAOBJECT_NOTNULL); } @@ -126,6 +143,16 @@ class Yammer_notice_stub extends Memcached_DataObject return array(false, false, false); } + /** + * Decode the stored data structure. + * + * @return mixed + */ + public function getData() + { + return json_decode($this->json_data, true); + } + /** * Save the native Yammer API representation of a message for the pending * import. Since they come in in reverse chronological order, we need to @@ -153,22 +180,4 @@ class Yammer_notice_stub extends Memcached_DataObject return $stub; } - - /** - * Save a mapping between a remote Yammer and local imported user. - * - * @param integer $user_id ID of the status in StatusNet - * - * @return Yammer_notice_stub new object for this value - */ - - static function retrieve($orig_id) - { - $stub = self::staticGet('id', $orig_id); - if ($stub) { - return json_decode($stub->json_data, true); - } else { - return false; - } - } }