public function unmap() { Section::unregisterPage($this->page); $r = new PageEditResponse(); $r->setPage($this->page); $r->setMessage(t('Page unmapped.')); $r->outputJSON(); }
public function delete() { $cID = $this->getCollectionID(); if ($this->isAlias() && !$this->isExternalLink()) { $this->removeThisAlias(); return; } if ($cID <= 1) { return false; } $db = Database::get(); // run any internal event we have for page deletion $pe = new DeletePageEvent($this); Events::dispatch('on_page_delete', $pe); if (!$pe->proceed()) { return false; } Log::addEntry(t('Page "%s" at path "%s" deleted', $this->getCollectionName(), $this->getCollectionPath()), t('Page Action')); parent::delete(); $cID = $this->getCollectionID(); // Now that all versions are gone, we can delete the collection information $q = "delete from PagePaths where cID = '{$cID}'"; $r = $db->query($q); // remove all pages where the pointer is this cID $r = $db->query('select cID from Pages where cPointerID = ?', array($cID)); while ($row = $r->fetchRow()) { PageStatistics::decrementParents($row['cID']); $db->Execute('DELETE FROM PagePaths WHERE cID=?', array($row['cID'])); } // Update cChildren for cParentID PageStatistics::decrementParents($cID); $q = "delete from PagePermissionAssignments where cID = '{$cID}'"; $r = $db->query($q); $q = "delete from Pages where cID = '{$cID}'"; $r = $db->query($q); $q = "delete from Pages where cPointerID = '{$cID}'"; $r = $db->query($q); $q = "delete from Areas WHERE cID = '{$cID}'"; $r = $db->query($q); $db->query('delete from PageSearchIndex where cID = ?', array($cID)); $q = "select cID from Pages where cParentID = '{$cID}'"; $r = $db->query($q); if ($r) { while ($row = $r->fetchRow()) { if ($row['cID'] > 0) { $nc = Page::getByID($row['cID']); $nc->delete(); } } } if (\Core::make('multilingual/detector')->isEnabled()) { Section::unregisterPage($this); } $cache = PageCache::getLibrary(); $cache->purge($this); }
public function setPageDraftTargetParentPageID($cParentID) { if ($cParentID != $this->getPageDraftTargetParentPageID()) { Section::unregisterPage($this); } $db = Database::connection(); $cParentID = intval($cParentID); $db->executeQuery('update Pages set cDraftTargetParentPageID = ? where cID = ?', [$cParentID, $this->cID]); $this->cDraftTargetParentPageID = $cParentID; Section::registerPage($this); }