Exemple #1
0
 /**
  * Process the daily routine unpublication part : unpublish page that needs to be
  *
  * @return void
  * @access private
  */
 protected function _dailyRoutineUnpublish()
 {
     $today = new CMS_date();
     $today->setNow();
     //process all pages that are to be unpublished
     $sql = "\n\t\t\tselect\n\t\t\t\tid_pag\n\t\t\tfrom\n\t\t\t\tpages,\n\t\t\t\tresources,\n\t\t\t\tresourceStatuses\n\t\t\twhere\n\t\t\t\tresource_pag=id_res\n\t\t\t\tand status_res=id_rs\n\t\t\t\tand location_rs='" . RESOURCE_LOCATION_USERSPACE . "'\n\t\t\t\tand publication_rs='" . RESOURCE_PUBLICATION_PUBLIC . "'\n\t\t\t\tand\t(publicationDateStart_rs > '" . $today->getDBValue(true) . "'\n\t\t\t\t\tor (publicationDateEnd_rs < '" . $today->getDBValue(true) . "' and publicationDateEnd_rs!='0000-00-00'))\n\t\t";
     $q = new CMS_query($sql);
     $unpublished = array();
     while ($id = $q->getValue("id_pag")) {
         $unpublished[] = $id;
     }
     $regen_pages = array();
     foreach ($unpublished as $page_id) {
         $page = CMS_tree::getPageByID($page_id);
         //calculate the pages to regenerate
         $temp_regen = CMS_linxesCatalog::getLinkers($page);
         if ($temp_regen) {
             $regen_pages = array_merge($regen_pages, $temp_regen);
         }
         $father = CMS_tree::getAncestor($page, 1);
         if ($father) {
             $temp_regen = CMS_linxesCatalog::getWatchers($father);
             if ($temp_regen) {
                 $regen_pages = array_merge($regen_pages, $temp_regen);
             }
         }
         //apply changes on the page
         $page->deleteFiles();
         CMS_linxesCatalog::deleteLinxes($page, true);
         CMS_tree::detachPageFromTree($page, true);
     }
     //regenerate the pages that needs to be, but first pull off the array the ids of the unpublished pages
     $regen_pages = array_unique(array_diff($regen_pages, $unpublished));
     CMS_tree::submitToRegenerator($regen_pages, false);
 }
Exemple #2
0
 /**
  * Regenerate alias page and all pages related to this alias
  *
  * @return string
  * @access protected
  */
 protected function _regenerate()
 {
     if (($this->_replace || $this->_needRegen) && $this->_pageID) {
         $page = CMS_tree::getPageById($this->_pageID);
         if ($page && !$page->hasError()) {
             $regen_pages = array();
             $temp_regen = CMS_linxesCatalog::getWatchers($page);
             if ($temp_regen) {
                 $regen_pages = array_merge($regen_pages, $temp_regen);
             }
             $temp_regen = CMS_linxesCatalog::getLinkers($page);
             if ($temp_regen) {
                 $regen_pages = array_merge($regen_pages, $temp_regen);
             }
             $regen_pages = array_unique($regen_pages);
             //regen page itself
             CMS_tree::submitToRegenerator($page->getID(), false, false);
             //regen all pages which link this one and lauch regeneration
             CMS_tree::submitToRegenerator($regen_pages, false, true);
         }
     }
     return true;
 }