picocms/Pico

Suboptimal process of process pages id

zeleznypa opened this issue ยท 4 comments

The content folder (.../content) and extension (.md) is fixed for every pages, so it is not necessary to count the string length of the extension for every page.

Pico/lib/Pico.php

Line 1739 in 09aa825

$id = substr($file, strlen($contentDir), -strlen($contentExt));

It will be better to count it once before the foreach and use the result everytime ...

$contentDirLen = strlen($contentDir);
$contentExtLen = strlen($contentExt);

foreach ($files as $i => $file) {
   // ...
   $id = substr($file, $contentDirLen, -$contentExtLen);

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! ๐Ÿ‘

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! ๐Ÿ‘

Interested in opening a PR against the pico-3.0 branch?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in two days if no further activity occurs. Thank you for your contributions! ๐Ÿ‘