page: skip directory handlers in search
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 9 Dec 2020 09:38:06 +0000 (10:38 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 19 Dec 2020 02:01:43 +0000 (03:01 +0100)
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

index 3e67d6f1a457d59a9646babcbe83f2aa242821eb..2396f2be6e078e12af9d1ea2933ca25cafe6d49e 100644 (file)
@@ -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;