/** * Clean the cache for the structure and the page content * @param int $safinstancesId * @return Boolean */ public function clearPageCache($safinstancesId) { try { PagstructureOp::cleanCache($safinstancesId); foreach (glob($this->cachePath . '/zend_cache---internal-metadatas---publicms_*') as $filename) { unlink($filename); } foreach (glob($this->cachePath . '/zend_cache---publicms_*') as $filename) { unlink($filename); } return true; } catch (Exception $e) { return false; } }
/** * * @param $id * @return unknown_type */ public function unpublish($id) { $safeInstanceId = Zend_Registry::getInstance()->get('config')->get('db')->safinstances_id; $sql = "UPDATE pagstructure SET status = 'draft',datemodified=NOW(),who_modified = '" . Sydney_Tools::who() . "' WHERE id = " . $id; $this->_db->query($sql); // clean cache of the structure PagstructureOp::cleanCache($safeInstanceId); // clean cache of pages $cache = new Sydney_Cache_Manager(); $cache->clearPageCache($safeInstanceId); }
/** * */ public function editadvancedprocessAction() { $r = $this->getRequest(); $eid = 0; if ($r->id > 0) { $nodeDB = new Pagstructure(); $node = $nodeDB->fetchRow('id = ' . $r->id . ' AND safinstances_id = ' . $this->safinstancesId); $node->metakeywords = $r->metakeywords; $node->metadesc = $r->metadesc; $node->iscachable = $r->iscachable; $node->cachetime = $r->cachetime; $node->redirecttoid = $r->redirecttoid; $node->shortdesc = $r->shortdesc; $node->colorcode = $r->colorcode; $node->layout = $r->layout; $node->save(); $eid = $r->id; // GDE : 27/08/2010 - Add trace of current action Sydney_Db_Trace::add('trace.event.update_advanced_properties' . ' [' . $node->label . ']', 'adminpages', Sydney_Tools::getTableName($nodeDB), 'editadvancedproperties', $eid); } // update the linked menu $mns = new PagstructurePagmenus(); $mns->delete('pagstructure_id = ' . $eid); //Zend_Debug::dump($r->menus); if (is_array($r->menus)) { foreach ($r->menus as $mid) { $crow = $mns->createRow(); $crow->pagstructure_id = $eid; $crow->pagmenus_id = $mid; $crow->save(); } } PagstructureOp::cleanCache($this->safinstancesId); $this->redirect('/adminpages/pages/edit/id/' . $eid); }
/** * Updates the structure order for all posted nodes (for the current saf instance). * URL : /adminpages/services/updatestrorder/format/json * @return void */ public function updatestrorderAction() { $msg = 'error! Generic'; $status = 0; try { $data = Zend_Json::decode($this->getRequest()->jsondata); $i = 0; $sql = ''; foreach ($data as $n) { $sql .= "UPDATE pagstructure SET\n\t\t\t\t\t\t\tparent_id = '" . $n['parentid'] . "',\n\t\t\t\t\t\t\tpagorder = '" . $n['ndborder'] . "'\n\t\t\t\t\t\t\tWHERE id = '" . $n['dbid'] . "'\n\t\t\t\t\t\t\tAND safinstances_id='" . $this->safinstancesId . "'; "; $i++; } $this->_db->query($sql); $msg = 'Structure order updated. ' . $i . ' nodes affected.'; PagstructureOp::cleanCache($this->safinstancesId); $status = 1; Sydney_Db_Trace::add('trace.event.reorder_page', 'adminpages', 'pagstructure', 'updatepageorder', '', ''); // */ } catch (Exception $e) { $msg = 'error! the order could not be saved. error : ' . $e; $status = 0; } $this->view->ResultSet = array('message' => $msg, 'status' => $status, 'modal' => false); }