We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 39501
    • 163 Posts
    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 setup, Archivist is running behind a protected resource.

    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 7 below is line 50 in my error message):
    /* 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];
            }
        }
    }
    


    I can’t work out what is causing the problem. Can anybody help trouble shoot? [ed. note: jonleverrier last edited this post 8 years, 11 months ago.]
      • 39501
      • 163 Posts
      [UPDATE 2] 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 !
      [ed. note: jonleverrier last edited this post 8 years, 11 months ago.]