예제 #1
0
파일: Deleter.php 프로젝트: jbzdak/wikidot
 public static function instance()
 {
     if (self::$instance == null) {
         self::$instance = new Deleter();
     }
     return self::$instance;
 }
예제 #2
0
 public function deletePageEvent($runData)
 {
     $pl = $runData->getParameterList();
     $pageId = $pl->getParameterValue("page_id");
     $site = $runData->getTemp("site");
     $db = Database::connection();
     $db->begin();
     $c = new Criteria();
     $c->add("page_id", $pageId);
     $c->setForUpdate(true);
     $page = DB_PagePeer::instance()->selectOne($c);
     if ($page == null || $page->getSiteId() != $site->getSiteId()) {
         throw new ProcessException(_("Error getting page information."), "no_page");
     }
     $user = $runData->getUser();
     $category = $page->getCategory();
     WDPermissionManager::instance()->hasPagePermission('delete', $user, $category, $page);
     // ok, delete... sad but true.
     $deleter = Deleter::instance();
     $deleter->deletePage($page, $site);
     $db->commit();
     if (GlobalProperties::$UI_SLEEP) {
         sleep(1);
     }
 }
예제 #3
0
 /**
  * @param int $id
  */
 protected function delete($id)
 {
     $Deleter = new Deleter($this->PDO, new Object($this->fetch($id)));
     $Deleter->setAccountID(0);
     $Deleter->delete();
 }