Skip to content
Permalink
Browse files

Merged revision 29733 from trunk to branch contrexx_3_1 - Core/Cache:…

… Added file system caching driver, enhanced the admin view and fixed some issues related with user caching, added memcache settings and caching stats for each caching engine

git-svn-id: http://svn.contrexxlabs.com/contrexx/branches/contrexx_3_1@29734 5ce06e5d-2b28-0410-aa6a-b3cd9cf52d8a
  • Loading branch information...
Ueli Kramer
Ueli Kramer committed Feb 28, 2014
1 parent 5f55500 commit b637c81f6257b4725df26016cc391bd9f56c8b88
@@ -1106,6 +1106,18 @@ table tr.reset td {
background-position: 21px 0px;
}

.cx-expand{
padding: 0 0 0 13px;
}

.cx-expand.cx-expandUp{
background: url("../../../images/icons/advancedsearch-up.png") no-repeat left 3px;
}

.cx-expand.cx-expandDown{
background: url("../../../images/icons/advancedsearch-down.png") no-repeat left 3px;
}


/* Text alignment -- Shop */
.a_left {
@@ -217,15 +217,6 @@ public function addPage(\Cx\Core\ContentManager\Model\Entity\Page $page)
*/
public function getPages($inactive_langs = false, $aliases = false)
{
// used if the node has been loaded from cache without page objects
// only used for PageTree
if (!$this->pages) {
$q = \Env::em()->createQuery("SELECT p FROM Cx\Core\ContentManager\Model\Entity\Page p JOIN p.node n WHERE n = ?1")->useResultCache(true);
$q->setParameter(1, $this);
$this->pages = $q->getResult();
}
if ($inactive_langs) {
return $this->pages;
}
@@ -403,25 +394,42 @@ public function copy($recursive = false, Node $newParent = null, $persist = true
public function serialize() {
$parent = $this->getParent();
$childrenArray = array();
foreach ($this->getChildren() as $child) {
$childrenArray[] = $child->getId();
}
$pagesArray = array();
foreach ($this->getPages() as $page) {
$pagesArray[] = $page->getId();
}
return serialize(
array(
$this->id,
$this->lft,
$this->rgt,
$this->lvl,
$parent ? $parent : null,
$parent ? $parent->getId() : null,
$childrenArray,
$pagesArray,
)
);
}
public function unserialize($data) {
$em = \Env::em();
$unserialized = unserialize($data);
$this->id = $unserialized[0];
$this->lft = $unserialized[1];
$this->rgt = $unserialized[2];
$this->lvl = $unserialized[3];
if ($unserialized[4]) {
$this->parent = $unserialized[4];
$this->parent = $em->getReference('Cx\Core\ContentManager\Model\Entity\Node', $unserialized[4]);
}
foreach ($unserialized[5] as $childId) {
$this->children[] = $em->getReference('Cx\Core\ContentManager\Model\Entity\Node', $childId);
}
foreach ($unserialized[6] as $pageId) {
$this->pages[] = $em->getReference('Cx\Core\ContentManager\Model\Entity\Page', $pageId);
}
// don't load pages and children here, due to lazy loading
}
}
@@ -45,7 +45,7 @@ public function __construct($message, $userMessage = '', $code = 0, \Exception $
* @package contrexx
* @subpackage model_contentmanager
*/
class Page extends \Cx\Model\Base\EntityBase
class Page extends \Cx\Model\Base\EntityBase implements \Serializable
{
const TYPE_CONTENT = 'content';
const TYPE_APPLICATION = 'application';
@@ -1869,4 +1869,82 @@ public function getVersion() {
public function isDraft() {
return $this->getEditingStatus() != '';
}
public function serialize() {
return serialize(
array(
$this->id,
$this->active,
$this->backendAccessId,
$this->caching,
$this->cmd,
$this->content,
$this->contentTitle,
$this->cssName,
$this->cssNavName,
$this->customContent,
$this->display,
$this->editingStatus,
$this->end,
$this->frontendAccessId,
$this->isVirtual,
$this->lang,
$this->linkTarget,
$this->metarobots,
$this->metatitle,
$this->module,
$this->node->getId(),
$this->nodeIdShadowed,
$this->protection,
$this->skin,
$this->slug,
$this->slugBase,
$this->slugSuffix,
$this->sourceMode,
$this->start,
$this->target,
$this->title,
$this->type,
$this->updatedAt,
$this->updatedBy,
)
);
}
public function unserialize($data) {
$unserialized = unserialize($data);
$this->id = $unserialized[0];
$this->active = $unserialized[1];
$this->backendAccessId = $unserialized[2];
$this->caching = $unserialized[3];
$this->cmd = $unserialized[4];
$this->content = $unserialized[5];
$this->contentTitle = $unserialized[6];
$this->cssName = $unserialized[7];
$this->cssNavName = $unserialized[8];
$this->customContent = $unserialized[9];
$this->display = $unserialized[10];
$this->editingStatus = $unserialized[11];
$this->end = $unserialized[12];
$this->frontendAccessId = $unserialized[13];
$this->isVirtual = $unserialized[14];
$this->lang = $unserialized[15];
$this->linkTarget = $unserialized[16];
$this->metarobots = $unserialized[17];
$this->metatitle = $unserialized[18];
$this->module = $unserialized[19];
$this->node = \Env::em()->getReference('Cx\Core\ContentManager\Model\Entity\Node', $unserialized[20]);
$this->nodeIdShadowed = $unserialized[21];
$this->protection = $unserialized[22];
$this->skin = $unserialized[23];
$this->slug = $unserialized[24];
$this->slugBase = $unserialized[25];
$this->slugSuffix = $unserialized[26];
$this->sourceMode = $unserialized[27];
$this->start = $unserialized[28];
$this->target = $unserialized[29];
$this->title = $unserialized[30];
$this->type = $unserialized[31];
$this->updatedAt = $unserialized[32];
$this->updatedBy = $unserialized[33];
}
}
@@ -124,7 +124,7 @@ public function onFlush($eventArgs) {
$pageRepo = $em->getRepository('Cx\Core\ContentManager\Model\Entity\Page');
global $objCache;
$objCache->clearUserCache();
$objCache->clearCache();
foreach ($uow->getScheduledEntityUpdates() AS $entity) {
\cacheLib::deleteCacheFileByPageId($entity->getId());
@@ -193,13 +193,26 @@ public function getEntityManager() {
switch ($objCache->getUserCacheEngine()) {
case \Cache::CACHE_ENGINE_APC:
$cache = new \Doctrine\Common\Cache\ApcCache();
$cache->setNamespace($_DBCONFIG['database'] . '.' . DBPREFIX);
break;
case \Cache::CACHE_ENGINE_MEMCACHE:
$cache = new \Doctrine\Common\Cache\MemcacheCache();
$cache->setMemcache($objCache->getMemcache());
$memcache = $objCache->getMemcache();
if ($memcache instanceof \Memcache) {
$cache = new \Doctrine\Common\Cache\MemcacheCache();
$cache->setMemcache($memcache);
} elseif ($memcache instanceof \Memcached) {
$cache = new \Cx\Core_Modules\Cache\lib\Doctrine\CacheDriver\MemcachedCache();
$cache->setMemcache($memcache);
}
$cache->setNamespace($_DBCONFIG['database'] . '.' . DBPREFIX);
break;
case \Cache::CACHE_ENGINE_XCACHE:
$cache = new \Doctrine\Common\Cache\XcacheCache();
$cache->setNamespace($_DBCONFIG['database'] . '.' . DBPREFIX);
break;
case \Cache::CACHE_ENGINE_FILESYSTEM:
$cache = new \Cx\Core_Modules\Cache\lib\Doctrine\CacheDriver\FileSystemCache();
$cache->setPath(ASCMS_CACHE_PATH);
break;
default:
$cache = new \Doctrine\Common\Cache\ArrayCache();
@@ -130,7 +130,7 @@ function getPage()
case 'cache_empty':
$boolShowStatus = false;
$objCache = new CacheManager();
$objCache->deleteAllFiles();
$objCache->forceClearCache(isset($_GET['cache']) ? contrexx_input2raw($_GET['cache']) : null);
$objCache->showSettings();
break;

0 comments on commit b637c81

Please sign in to comment.
You can’t perform that action at this time.