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:
Mikael Nordfeldth
2013-08-18 12:10:44 +02:00
parent c36608b233
commit e95f77d34c
41 changed files with 40 additions and 488 deletions

View File

@@ -59,7 +59,7 @@ class FeedDBException extends FeedSubException
* Higher-level behavior building OStatus stuff on top is handled
* under Ostatus_profile.
*/
class FeedSub extends Memcached_DataObject
class FeedSub extends Managed_DataObject
{
public $__table = 'feedsub';
@@ -78,11 +78,6 @@ class FeedSub extends Memcached_DataObject
public $created;
public $modified;
public /*static*/ function staticGet($k, $v=null)
{
return parent::staticGet(__CLASS__, $k, $v);
}
/**
* return table definition for DB_DataObject
*

View File

@@ -26,7 +26,7 @@ if (!defined('STATUSNET')) {
* @package Hub
* @author Brion Vibber <brion@status.net>
*/
class HubSub extends Memcached_DataObject
class HubSub extends Managed_DataObject
{
public $__table = 'hubsub';
@@ -40,11 +40,6 @@ class HubSub extends Memcached_DataObject
public $created;
public $modified;
public /*static*/ function staticGet($topic, $callback)
{
return parent::staticGet(__CLASS__, 'hashkey', self::hashkey($topic, $callback));
}
protected static function hashkey($topic, $callback)
{
return sha1($topic . '|' . $callback);

View File

@@ -33,7 +33,7 @@ if (!defined('STATUSNET')) {
require_once 'Crypt/RSA.php';
class Magicsig extends Memcached_DataObject
class Magicsig extends Managed_DataObject
{
const PUBLICKEYREL = 'magic-public-key';
@@ -81,32 +81,6 @@ class Magicsig extends Memcached_DataObject
$this->alg = $alg;
}
/**
* Fetch a Magicsig object from the cache or database on a field match.
*
* @param string $k
* @param mixed $v
* @return Magicsig
*/
public /*static*/ function staticGet($k, $v=null)
{
$obj = parent::staticGet(__CLASS__, $k, $v);
if (!empty($obj)) {
$obj = Magicsig::fromString($obj->keypair);
// Double check keys: Crypt_RSA did not
// consistently generate good keypairs.
// We've also moved to 1024 bit keys.
if (strlen($obj->publicKey->modulus->toBits()) != 1024) {
$obj->delete();
return false;
}
}
return $obj;
}
function table()
{
return array(

View File

@@ -25,7 +25,7 @@ if (!defined('STATUSNET')) {
* @package OStatusPlugin
* @maintainer Brion Vibber <brion@status.net>
*/
class Ostatus_source extends Memcached_DataObject
class Ostatus_source extends Managed_DataObject
{
public $__table = 'ostatus_source';
@@ -33,11 +33,6 @@ class Ostatus_source extends Memcached_DataObject
public $profile_uri; // uri of the ostatus_profile this came through -- may be a group feed
public $method; // push or salmon
public /*static*/ function staticGet($k, $v=null)
{
return parent::staticGet(__CLASS__, $k, $v);
}
/**
* return table definition for DB_DataObject
*