summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--classes/User.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/classes/User.php b/classes/User.php
index 6ea975202..b70049617 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -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;
+ }
}