Commit 70a4f8c0 authored by Evan Prodromou's avatar Evan Prodromou

method to get the site owner

parent d437b76e
......@@ -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;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment