Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Month archives only show a few posts #1

Open
cdevroe opened this issue Jan 5, 2012 · 4 comments
Open

Month archives only show a few posts #1

cdevroe opened this issue Jan 5, 2012 · 4 comments

Comments

@cdevroe
Copy link

cdevroe commented Jan 5, 2012

These are taken from Marco's own Readme. I figured I'd put them as issues that can be discussed, resolved.

"The month archives sometimes only contain a few posts."

Further information welcome.

@pocketWashburn
Copy link
Contributor

More specifically, the updater says its updating the month archive but doesn't actually. A wipe of the cache and a full rebuild has fixed it every time for me. The first potential culprit is, I think, engine/update.sh I just haven't had a chance to dig into it yet.

@pocketWashburn
Copy link
Contributor

ok, so update.sh is a wrapper for calling update.php, update.php wraps a call to Updater::update(), since its not useful to post the entirety of the architecture I'll stop there.

I'm looking at Updater::post_filenames_in_year_month and how its different from Updater::most_recent_post_filenames because the issue seems to be (at least in my specific test case) that the most recent post isn't making it into the posts array thats passed to the Post::write_index for the archives, when it does for the frontpage.

@pocketWashburn
Copy link
Contributor

the difference is post_filenames_in_year_month calls posts_in_year_month which reads from cache/posts-[year]-[month]-[md5 of require_tag . " " . require_type]

and most_recent_post_filenames reads from cache/dir-[md5 of source_path . /posts]

for some reason the post doesn't make its way into the posts in year month cache, although it does in the dir- cache, so thats the next place I'll look into, how/when those caches are created.

@pocketWashburn
Copy link
Contributor

Its entirely possible that I'm missing something, but it seems like once the cache file is created for the month archive it never gets updated unless its manually deleted because of the following lines:

engine/Updater.php 48 - 50

if (file_exists($cache_fname)) {
        $files = unserialize(file_get_contents($cache_fname));
    }

since the $cache_fname value is set to:

$cache_fname = self::$cache_path . "/posts-$year-$month-" . md5($require_tag . ' ' . $require_type);

and that filename won't change for the month's archive, it will only reach the else statement and update the archive cache file when it has been deleted.

By eliminating that if statement, it correctly updates the archive for me, but I feel like I'm missing something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants