コード例 #1
0
ファイル: AdminUser.php プロジェクト: neTpyceB/TMCms-panel
 protected function beforeDelete()
 {
     // AdminUser log
     $res = new UserLogRepository();
     $res->setWhereUserId($this->getId());
     $res->deleteObjectCollection();
     // AdminUser messages - received
     $res = new UsersMessageEntityRepository();
     $res->setWhereToUserId($this->getId());
     $res->deleteObjectCollection();
     // AdminUser messages - sent
     $res = new UsersMessageEntityRepository();
     $res->setWhereFromUserId($this->getId());
     $res->deleteObjectCollection();
     // AdminUser sessions
     $res = new UsersSessionEntityRepository();
     $res->setWhereUserId($this->getId());
     $res->deleteObjectCollection();
     // App log
     $log = new AppLogEntityRepository();
     $log->setWhereUserId($this->getId());
     $log->deleteObjectCollection();
 }
コード例 #2
0
ファイル: Users.php プロジェクト: neTpyceB/TMCms-core
 /**
  * Delete outdated sessions for users that are no longer logged-in
  * @return bool sessions are deleted
  */
 private function deleteOldSessions()
 {
     // 2% chance of kicking idle sessions
     if (mt_rand(0, 49)) {
         return false;
     }
     $sessions = new UsersSessionEntityRepository();
     $sessions->setOnlyOutdated();
     $sessions->deleteObjectCollection();
     return true;
 }