forked from GNUsocial/gnu-social
Updating all Memcached_DataObject extended classes to Managed_DataObject
In some brief tests, this causes no problems. In this state however, you would need to modify DB_DataObject to have a static declaration of staticget (and probably pkeyGet). The next commit will change the staticGet overload to a unique function name (like getKV for getKeyValue), which means we can properly call the function by PHP Strict Standards.
This commit is contained in:
@@ -35,12 +35,12 @@ if (!defined('STATUSNET')) {
|
||||
* Common base class for the Yammer import mappings for users, groups, and notices.
|
||||
*
|
||||
* Child classes must override these static methods, since we need to run
|
||||
* on PHP 5.2.x which has no late static binding:
|
||||
* on PHP 5.2.x which has no late static binding: (not really anymore)
|
||||
* - staticGet (as our other classes)
|
||||
* - schemaDef (call self::doSchemaDef)
|
||||
* - record (call self::doRecord)
|
||||
*/
|
||||
class Yammer_common extends Memcached_DataObject
|
||||
class Yammer_common extends Managed_DataObject
|
||||
{
|
||||
public $__table = 'yammer_XXXX'; // table name
|
||||
public $__field = 'XXXX_id'; // field name to save into
|
||||
@@ -133,13 +133,13 @@ class Yammer_common extends Memcached_DataObject
|
||||
*/
|
||||
protected static function doRecord($class, $field, $orig_id, $local_id)
|
||||
{
|
||||
$map = parent::staticGet($class, 'id', $orig_id);
|
||||
$map = Memcached_DataObject::staticGet($class, 'id', $orig_id);
|
||||
|
||||
if (!empty($map)) {
|
||||
return $map;
|
||||
}
|
||||
|
||||
$map = parent::staticGet($class, $field, $local_id);
|
||||
$map = Memcached_DataObject::staticGet($class, $field, $local_id);
|
||||
|
||||
if (!empty($map)) {
|
||||
return $map;
|
||||
|
||||
@@ -37,22 +37,6 @@ class Yammer_group extends Yammer_common
|
||||
public $__field = 'group_id'; // field to map to
|
||||
public $group_id; // int
|
||||
|
||||
/**
|
||||
* 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_group object found, or null for no hits
|
||||
*
|
||||
*/
|
||||
function staticGet($k, $v=null)
|
||||
{
|
||||
return Memcached_DataObject::staticGet('Yammer_group', $k, $v);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return schema definition to set this table up in onCheckSchema
|
||||
*/
|
||||
|
||||
@@ -37,22 +37,6 @@ class Yammer_notice extends Yammer_common
|
||||
public $__field = 'notice_id'; // field to map to
|
||||
public $notice_id; // int
|
||||
|
||||
/**
|
||||
* 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 object found, or null for no hits
|
||||
*
|
||||
*/
|
||||
function staticGet($k, $v=null)
|
||||
{
|
||||
return Memcached_DataObject::staticGet('Yammer_notice', $k, $v);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return schema definition to set this table up in onCheckSchema
|
||||
*/
|
||||
|
||||
@@ -40,28 +40,13 @@ if (!defined('STATUSNET')) {
|
||||
* down in reverse chronological order, then go back over them from oldest to
|
||||
* newest and actually save them into our notice table.
|
||||
*/
|
||||
class Yammer_notice_stub extends Memcached_DataObject
|
||||
class Yammer_notice_stub extends Managed_DataObject
|
||||
{
|
||||
public $__table = 'yammer_notice_stub'; // table name
|
||||
public $id; // int primary_key not_null
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -31,7 +31,7 @@ if (!defined('STATUSNET')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
class Yammer_state extends Memcached_DataObject
|
||||
class Yammer_state extends Managed_DataObject
|
||||
{
|
||||
public $__table = 'yammer_state'; // table name
|
||||
public $id; // int primary_key not_null
|
||||
@@ -46,21 +46,6 @@ class Yammer_state extends Memcached_DataObject
|
||||
public $created; // datetime
|
||||
public $modified; // 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_state object found, or null for no hits
|
||||
*/
|
||||
function staticGet($k, $v=null)
|
||||
{
|
||||
return Memcached_DataObject::staticGet('Yammer_state', $k, $v);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return schema definition to set this table up in onCheckSchema
|
||||
*/
|
||||
|
||||
@@ -37,22 +37,6 @@ class Yammer_user extends Yammer_common
|
||||
public $__field = 'user_id'; // field to map to
|
||||
public $user_id; // int
|
||||
|
||||
/**
|
||||
* 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_user object found, or null for no hits
|
||||
*
|
||||
*/
|
||||
function staticGet($k, $v=null)
|
||||
{
|
||||
return Memcached_DataObject::staticGet('Yammer_user', $k, $v);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return schema definition to set this table up in onCheckSchema
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user