예제 #1
0
 public function delete()
 {
     $success = parent::delete();
     if ($success) {
         $path = $this->getPath(null, true);
         $this->logger->log("deleting " . $path);
         unlink($path);
         if ($this->isImage()) {
             unlink($this->getPath('small', true));
             unlink($this->getPath('med', true));
         }
     }
 }
예제 #2
0
 public function delete()
 {
     $rtn = parent::delete();
     // delete extra relationship for wechat_account_user if existed
     if ($rtn) {
         $user = MySiteUser::getCurrentUser();
         $wechat_account_user = WechatAccountUser::findbyCombo($this->getAccountId(), $user->getId());
         if ($wechat_account_user) {
             $wechat_account_user->delete();
         }
     }
     // check if there is any other users subscribing this wechat_account, if no, we delete it
     if ($rtn) {
         $wechat_account_users = WechatAccountUser::findByAccountId($this->getAccountId());
         if (sizeof($wechat_account_users) == 0) {
             $wechat_account = WechatAccount::findById($this->getAccountId());
             $wechat_account->delete();
         }
     }
     return $rtn;
 }