Hi,
There is a huge problem with Lexicons in my modx project. I have few different contexts which points to different domains. Sometimes, users complaining about wrong text on some of these domains. For example, domain1 lexicon showing on domain2. Everythings fine after page refresh, but still, its a big problem. I use this gateway plugin (I put refreshCache everywhere I can to avoid this issue):
<?php
if ($modx->context->get('key') == 'mgr') {
return;
}
$modx->cacheManager->refresh();
switch ($_SERVER['HTTP_HOST']) {
case 'dev.domain1.com':
case 'www.domain1.com':
$modx->cacheManager->refresh();
$modx->switchContext('web');
break;
case 'dev.domain2.com':
case 'www.domain2.com':
$modx->cacheManager->refresh();
$modx->switchContext('context2');
break;
}
I use lexicons like that:
default.inc.php file:
<?php
switch ($_SERVER['HTTP_HOST']) {
case 'dev.domain1.com':
case 'www.domain1.com':
include_once 'lexicon1.php';
break;
case 'dev.domain2.com':
case 'www.domain2.com':
include_once 'lexicon2.php';
break;
}
?>
Lexicon1 and 2.php contains simple lexicon entrys. But somehow, content is messing up from time to time.
Any suggestions? Does $modx->cacheManager->refresh(); solves my problem?