/** * Get all pages codenames for website * * @return array(codename => pageId) * @access public */ function getAllPagesCodenames() { $pageIds = CMS_tree::getAllSiblings($this->_root->getID(), false, true); if (!is_array($pageIds)) { $pageIds = array(); } $pageIds[] = $this->_root->getID(); //pr($pagesIds); $q = new CMS_query("\n\t\t\tselect\n\t\t\t\tpage_pbd, codename_pbd\n\t\t\tfrom\n\t\t\t\tpagesBaseData_edited\n\t\t\twhere\n\t\t\t\tpage_pbd in (" . implode(',', $pageIds) . ")\n\t\t\t\tand codename_pbd != ''\n\t\t"); $pagesCodenames = $q->getAll(); $codenames = array(); foreach ($pagesCodenames as $pageCodename) { $codenames[$pageCodename['codename_pbd']] = $pageCodename['page_pbd']; } return $codenames; }
CMS_grandFather::raiseError('User has no regeneration rights'); $view->setActionMessage($cms_language->getMessage(MESSAGE_PAGE_NO_SCRIPTS_RIGHTS)); $view->show(); } $cms_message = ''; $content = ''; switch ($action) { case 'regenerate-all': //give it more time @set_time_limit(1000); CMS_tree::regenerateAllPages(true); $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE) . ' : ' . $cms_language->getMessage(MESSAGE_ACTION_ALL_PAGES_SUBMITED); break; case 'regenerate-tree': if ($page) { $pages = CMS_tree::getAllSiblings($page, false); $pages[$page] = $page; if (sizeof($pages) > 3) { //submit pages to regenerator $validPages = CMS_tree::pagesExistsInUserSpace($pages); CMS_tree::submitToRegenerator($validPages, true); $cms_message = $cms_language->getMessage(MESSAGE_ACTION_OPERATION_DONE) . ' : ' . $cms_language->getMessage(MESSAGE_ACTION_N_PAGES_SUBMITED, array(sizeof($validPages))); } else { //regenerate pages @set_time_limit(1000); $regenok = $regenerror = 0; $validPages = CMS_tree::pagesExistsInUserSpace($pages); foreach ($validPages as $pageID) { $pg = CMS_tree::getPageByID($pageID); if (is_a($pg, 'CMS_page') && !$pg->hasError()) { if ($pg->regenerate(true)) {
/** * Returns all the siblings pages recursively. * Static function. * * @param integer $pageID The page we want he siblings of * @param boolean $publicTree Do we want to fetch the public tree or the edited one ? * @param boolean $stopAtWebsites Do we want to fetch the tree of all websites or only the current one (default : false) * @return array(id) All siblings page id * @access public */ static function getAllSiblings($pageID, $publicTree = false, $stopAtWebsites = false) { $pages = array(); if (!io::isPositiveInteger($pageID)) { return $pages; } $siblings = CMS_tree::getSiblings($pageID, $publicTree, false); if ($stopAtWebsites) { foreach ($siblings as $key => $siblingID) { if (CMS_websitesCatalog::isWebsiteRoot($siblingID)) { unset($siblings[$key]); } } } $pages = array_merge($pages, $siblings); foreach ($siblings as $siblingID) { $pages = array_merge($pages, CMS_tree::getAllSiblings($siblingID, $publicTree, $stopAtWebsites)); } return $pages; }