picocms / Pico

Pico is a stupidly simple, blazing fast, flat file CMS.
http://picocms.org/
MIT License
3.85k stars 615 forks source link

Duplicit loading same content #375

Closed zeleznypa closed 7 years ago

zeleznypa commented 7 years ago

I'm trying to understand the flow of the PicoCMS and i found the strange thing.

In the run method, there is loading of the "current page" content here: https://github.com/picocms/Pico/blob/pico-1.1/lib/Pico.php#L319

After a while in the same method "all known pages" are loaded https://github.com/picocms/Pico/blob/pico-1.1/lib/Pico.php#L354

After a while in the same method is called discoverCurrentPage method https://github.com/picocms/Pico/blob/pico-1.1/lib/Pico.php#L356

My question is, why to load rawContent and content of the "current page" twice?

PhrozenByte commented 7 years ago

The contents of the "current page" aren't loaded twice, there's a check in Pico::readPages() that ensures this. The goal of Pico::discoverCurrentPage() is primarily to determine the next and previous pages (something we can't do until we've sorted the pages).

zeleznypa commented 7 years ago

But there is also double implementation of the parsing meta headers etc. Why not to move the first part into the "readPages" part?

zeleznypa commented 7 years ago

Sorry, I looked into the v1.0.0 version :)

PhrozenByte commented 7 years ago

btw: v1.0.0 behaves exactly the same, only versions prior to v1.0.0-beta.1 (e.g. v0.8 or v0.9) behave different.