function destroyTree() { global $destroyexecuted, $form, $db; $variations = createDBCArray("variations", "VARIATION_ID", "1"); if (!$destroyexecuted) { $destroyexecuted = true; $delstart = value("del", "NUMERIC"); $parentId = getDBCell("sitemap", "PARENT_ID", "MENU_ID = $delstart"); $destroyArray = getPageTree($delstart); if (value("destroypages") == "0") { // geht nicht $meldung = "Please select also the check Destroy Tree. Only then the system will delete the tree."; $form->addToTopText($meldung); } else { if (value("destroycluster") == "0") { // nur pages löschen for ($i = 0; $i < count($destroyArray); $i++) { for ($j = 0; $j < count($variations); $j++) { expireSitepage($destroyArray[$i], 10, $variations[$j]); } $sql1 = "DELETE FROM sitepage WHERE SPID = $destroyArray[$i]"; $menuid = getDBCell("sitepage", "MENU_ID", "SPID = " . $destroyArray[$i]); $deletequery = new query($db, $sql1); if ($menuid != "0" and $menuid != 0 and $menuid != "") { $sql2 = "DELETE FROM sitemap WHERE MENU_ID = $menuid"; $sql3 = "DELETE FROM sitepage_names WHERE SPID = " . $destroyArray[$i]; $sql4 = "DELETE FROM sitepage_owner WHERE SPID = " . $destroyArray[$i]; $deletequery = new query($db, $sql3); $deletequery = new query($db, $sql4); $deletequery = new query($db, $sql2); } $deletequery->free(); } } else { // pages und cluster for ($i = 0; $i < count($destroyArray); $i++) { for ($j = 0; $j < count($variations); $j++) { expireSitepage($destroyArray[$i], 10, $variations[$j]); } $clnid = getDBCell("sitepage", "CLNID", "SPID = $destroyArray[$i]"); // only delete cluster if it is not used as channel article. if (!getDBCell("channel_articles", "CHID", "ARTICLE_ID = ".$clnid)) { $usage = 0; $usage += countRows("sitepage", "CLNID", "CLNID = $clnid AND DELETED=0"); $usage += countRows("cluster_content", "FKID", "FKID = $clnid"); $usage += countRows("cluster_template_items", "FDIK", "FKID = $clnid"); if ($usage < 2) { $sql = "UPDATE cluster_node SET DELETED = 1 WHERE CLNID = $clnid"; $query = new query($db, $sql); } } $sql1 = "DELETE FROM sitepage WHERE SPID = $destroyArray[$i]"; $menuid = getDBCell("sitepage", "MENU_ID", "SPID = " . $destroyArray[$i]); $deletequery = new query($db, $sql1); if ($menuid != "0" and $menuid != 0 and $menuid != "") { $sql2 = "DELETE FROM sitemap WHERE MENU_ID = $menuid"; $sql3 = "DELETE FROM sitepage_names WHERE SPID = " . $destroyArray[$i]; $sql4 = "DELETE FROM sitepage_owner WHERE SPID = " . $destroyArray[$i]; $deletequery = new query($db, $sql3); $deletequery = new query($db, $sql4); $deletequery = new query($db, $sql2); } $deletequery->free(); } } } sortTableRows("sitemap", "MENU_ID", "POSITION", "PARENT_ID = $parentId"); } }
/** * Expires a complete Menutree * * @param integer ID of the start-node from where to expire * @param integer ID of the Variation you want to launch */ function expireMenuTree($menuId, $variation) { global $c; ini_set("max_execution_time", $c["timeout"]); $launchArray = getPageTree($menuId); for ($i = 0; $i < count($launchArray); $i++) { expireSitepage($launchArray[$i], 10, $variation); } }
$mymenu = getDBCell("sitepage", "MENU_ID", "SPID=$spid"); relaunchMenuTree($mymenu, $variation); } elseif ($action == $lang->get('launch_tree') && $aclf->checkAccessToFunction("B_LAUNCH_TREE")) { $mymenu = getDBCell("sitepage", "MENU_ID", "SPID=$spid"); launchMenuTree($mymenu, $variation); } else if ($aclf->checkAccessToFunction("B_EXPIRE_LAUNCH")) { launchSitepage($spid, 10, $variation); } } else { $clusterPanel->addToTopText($lang->get("nosptitle")); $clusterPanel->setTopStyle("errorheader"); } } else if ($action == $lang->get("sp_expire") && $aclf->checkAccessToFunction("B_EXPIRE_LAUNCH")) { expireSitepage($oid, 10, $variation); } else if ($action == $lang->get("rb_cache")) { // rebuildCache(); } else if ($action == $lang->get('exp_tree') && $aclf->checkAccessToFunction("B_EXPIRE_TREE")) { $mymenu = getDBCell("sitepage", "MENU_ID", "SPID=$spid"); expireMenuTree($mymenu, $variation); } else if ($action == $lang->get('del_tree') && $aclf->checkAccessToFunction("B_DESTROY_TREE")) { $mymenu = getDBCell("sitepage", "MENU_ID", "SPID=$spid"); header ("Location: destroy_tree.php?sid=$sid&del=$mymenu"); exit; } } if ($clnid == "0" && ($type == 1 || ($type == 2 && ($action != "pproperties" && value("acstate") != "pproperties")))) { require_once $c["path"] . "modules/sitepages/logic_selectcluster.inc.php";