Ejemplo n.º 1
0
 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(1);
         if ($pr->find(true)) {
             $owner = User::staticGet('id', $pr->profile_id);
         } else {
             $owner = null;
         }
         self::cacheSet('user:site_owner', $owner);
     }
     return $owner;
 }
Ejemplo n.º 2
0
 public 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(1);
         if (!$pr->find(true)) {
             throw new NoResultException($pr);
         }
         $owner = User::getKV('id', $pr->profile_id);
         self::cacheSet('user:site_owner', $owner);
     }
     if ($owner instanceof User) {
         return $owner;
     }
     throw new ServerException(_('No site owner configured.'));
 }