From: Mischa POSLAWSKY Date: Wed, 9 Dec 2020 09:38:06 +0000 (+0100) Subject: page: skip directory handlers in search X-Git-Tag: v5.0~16 X-Git-Url: http://git.shiar.nl/minimedit.git/commitdiff_plain/1801380d62ab693e819f17706a9530679a1add1e page: skip directory handlers in search Code can alter file behaviour, so should be omitted from sitemap results (to be replaced by custom index in following commit). Removes wanted nieuws articles, but also random foto descriptions and some accidental html files. --- diff --git a/article.inc.php b/article.inc.php index 3e67d6f..2396f2b 100644 --- a/article.inc.php +++ b/article.inc.php @@ -231,6 +231,8 @@ class ArchiveArticle class PageSearch { + public $handlers = []; + function __construct($path = '.') { $this->iterator = new RecursiveCallbackFilterIterator( @@ -240,6 +242,11 @@ class PageSearch # skip hidden files and directories return FALSE; } + if (file_exists($current->getFilename() . '/index.php')) { + # contents better provided by handler code + $this->handlers[ $current->getPathname() ] = $current; + return FALSE; + } if ($current->isLink()) { # ignore symlinks, original contents only return FALSE;