X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FProfile.php;h=794dc1de93c8857e2f23c92f30930342fb7890c2;hb=1e8d26baecad6ca1088ea7815fe2615fb520a10e;hp=0cf1397c73176f0b6321519ce660900013f647c3;hpb=816262d4884d09804a93e1a6974a6b0ecc6660f1;p=quix0rs-gnu-social.git diff --git a/classes/Profile.php b/classes/Profile.php index 0cf1397c73..794dc1de93 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -22,9 +22,9 @@ if (!defined('LACONICA')) { exit(1); } /** * Table Definition for profile */ -require_once 'DB/DataObject.php'; +require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; -class Profile extends DB_DataObject +class Profile extends Memcached_DataObject { ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */ @@ -41,25 +41,18 @@ class Profile extends DB_DataObject public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP /* Static get */ - function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Profile',$k,$v); } + function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Profile',$k,$v); } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE function getAvatar($width, $height=NULL) { - $avatar = DB_DataObject::factory('avatar'); - $avatar->profile_id = $this->id; - $avatar->width = $width; if (is_null($height)) { - $avatar->height = $width; - } else { - $avatar->height = $height; - } - if ($avatar->find(true)) { - return $avatar; - } else { - return NULL; + $height = $width; } + return Avatar::pkeyGet(array('profile_id' => $this->id, + 'width' => $width, + 'height' => $height)); } function getOriginalAvatar() { @@ -125,7 +118,7 @@ class Profile extends DB_DataObject } function delete_avatars() { - $avatar = DB_DataObject::factory('avatar'); + $avatar = new Avatar(); $avatar->profile_id = $this->id; $avatar->find(); while ($avatar->fetch()) { @@ -133,7 +126,7 @@ class Profile extends DB_DataObject } return true; } - + function getBestName() { return ($this->fullname) ? $this->fullname : $this->nickname; } @@ -145,7 +138,7 @@ class Profile extends DB_DataObject if ($dt) { $notice->whereAdd('created < "' . $dt . '"'); } - $notice->orderBy('created DESC'); + $notice->orderBy('created DESC, notice.id DESC'); $notice->limit(1); if ($notice->find(true)) { return $notice;