Closed iGeckoDev closed 9 years ago
I have been doing some more testing. When I cache an individual page it works properly. The problem occurs when caching multiple pages. The content of the first page to be cached is always replaced by the content of the last page to be cached. The bug only occurs when using 'artisan flatten:build'.
I think there are two things going on here:
First, which doesn't really seem to be a big issue, the index gets queued twice (at least in some cases). I would prefer it only get queued once, however. The reason this happens, I think, is that there are two different ways you can have the root url (e.g. relative/absolute) in your content. The root provided by --root=
Second, I think the root is being replaced with the last page cached, because of the key staying the same. I haven't ran through the code for the salt yet, but I'm assuming that if that's not set in the config, that will cause this problem. I'll have more time this evening to figure that out. By now, I'm guessing you either gave up or found a workaround, but I'm sure someone else will be equally confused as us.
From what I can tell, when using artisan flatten:build, the hash is always 'Get-/', for every page. I don't see anywhere in the BuildCommand code where the hash is actually set. I think it needs to be set to the request type and page url, for every page crawled. My flatten.json looks like this, after crawling a few pages: {"cached":["GET-\/","GET-\/","GET-\/"]
Adding a CacheHandler->setHash() method and modifying the Crawler->getPage($url) method to use that with Flatten->computeHash() works for me.
Will reopen if this is still happening on 1.0
For some reason the cache of the homepage does not display the homepage data, instead it show displays the data of another page. All other pages are cached properly. Any idea what might be causing this?