method to get the site owner

This commit is contained in:
Evan Prodromou 2010-01-29 15:15:23 -05:00
parent d437b76ed1
commit 70a4f8c0e2

View File

@ -925,4 +925,30 @@ class User extends Memcached_DataObject
return $share;
}
}
static function siteOwner()
{
$owner = self::cacheGet('user:site_owner');
if ($owner === false) { // cache miss
$pr = new Profile_role();
$pr->role = Profile_role::OWNER;
$pr->orderBy('created');
$pr->limit(0, 1);
if ($pr->fetch($true)) {
$owner = User::staticGet('id', $pr->profile_id);
} else {
$owner = null;
}
self::cacheSet('user:site_owner', $owner);
}
return $owner;
}
}