示例#1
0
 /**
  * deletePage
  * @author Cornelius Hansjakob <*****@*****.**>
  * @param integer $intElementId
  * @version 1.0
  */
 public function deletePage($intElementId)
 {
     $this->core->logger->debug('cms->models->Model_Pages->deletePage(' . $intElementId . ')');
     $this->getPageTable();
     $objPageData = $this->load($intElementId);
     if (count($objPageData) > 0) {
         $objPage = $objPageData->current();
         $strIndexPath = GLOBAL_ROOT_PATH . $this->core->sysConfig->path->search_index->page;
         $strPageId = $objPage->pageId;
         if (count(scandir($strIndexPath)) > 2) {
             $this->objIndex = Zend_Search_Lucene::open($strIndexPath);
             $objTerm = new Zend_Search_Lucene_Index_Term($strPageId . '_*', 'key');
             $objQuery = new Zend_Search_Lucene_Search_Query_Wildcard($objTerm);
             $objHits = $this->objIndex->find($objQuery);
             foreach ($objHits as $objHit) {
                 $this->objIndex->delete($objHit->id);
             }
             $this->objIndex->commit();
         }
         $strWhere = $this->objPageTable->getAdapter()->quoteInto('relationId = ?', $strPageId);
         $strWhere .= $this->objPageTable->getAdapter()->quoteInto(' AND idUrlTypes = ?', $this->core->sysConfig->url_types->page);
         $this->getPageUrlTable()->delete($strWhere);
     }
     $strWhere = $this->objPageTable->getAdapter()->quoteInto('id = ?', $intElementId);
     return $this->objPageTable->delete($strWhere);
 }