From 1801380d62ab693e819f17706a9530679a1add1e Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 9 Dec 2020 10:38:06 +0100 Subject: [PATCH] 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. --- article.inc.php | 7 +++++++ 1 file changed, 7 insertions(+) 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; -- 2.30.0