Description
I’ve been having a strange issue with the Archivist extra on Revo 2.5.8, specifically, the Archivist snippet that generates the Month/Year links to filter resources by.
In this particular installation, I have a multi context setup;
The generated links work for about 15 minutes, after this time they generate a page not found message when clicked, unless I clear the site cache, where they work again.
There are errors in my site log related to this issue…
Error 1
2017-08-22 14:53:54] (ERROR @ /paas/cXXXX/www/core/cache/includes/elements/modplugin/31.include.cache.php : 50) PHP warning: array_search() expects parameter 2 to be array, null given
Inside 31.include.cache.php / the block of code that contains line 50. Line 50 relates to this:
$alias = array_search($archiveId,$modx->aliasMap);
/* get resource to redirect to */
$resourceId = false;
$prefix = 'arc_';
foreach ($archiveIds as $archive) {
$archive = explode(':',$archive);
$archiveId = $archive[0];
$alias = array_search($archiveId,$modx->aliasMap);
if ($alias && strpos($search,$alias) !== false) {
$search = str_replace($alias,'',$search);
$resourceId = $archiveId;
if (isset($archive[1])) $prefix = $archive[1];
}
}
Error 2
[2017-08-22 14:53:55] (ERROR @ /paas/cXXXX/www/core/model/modx/modx.class.php : 1006) PHP warning: array_key_exists() expects parameter 2 to be array, null given
Inside modx.class.php / the block of code that contains line 1006 is:
if ($useAliasMap) {
if (isset($this->context) && $this->context->get('key') === $context && array_key_exists($uri, $this->aliasMap)) {
$resourceId = (integer) $this->aliasMap[$uri];
} elseif ($ctx = $this->getContext($context)) {
$useAliasMap = $ctx->getOption('cache_alias_map', false) && array_key_exists($uri, $ctx->aliasMap);
if ($useAliasMap && array_key_exists($uri, $ctx->aliasMap)) {
$resourceId = (integer) $ctx->aliasMap[$uri];
}
}
}
When I clear the site cache (which makes Archivist work again), when I view the contents of context.cache.php I can see the aliasMap array with URL's and ID's. When it stops working, the aliasMap is no longer present in context.cache.php.
Any help in troubleshooting would be much appreciated.