about summary refs log tree commit diff stats
path: root/wiki/bin/indexer.php
diff options
context:
space:
mode:
authorahriman <ahriman@falte.red>2019-01-02 04:57:35 +0000
committerahriman <ahriman@falte.red>2019-01-02 04:57:35 +0000
commit2bd7f83a6495011ada78ca8a9f2af417caf01760 (patch)
treef9acdb7f09e011c65330ab993d4db3620787dbfb /wiki/bin/indexer.php
parentbcb215c3a7e914d05f166846a33860e48bba64fb (diff)
downloadsite-2bd7f83a6495011ada78ca8a9f2af417caf01760.tar.gz
removed dokuwiki
Diffstat (limited to 'wiki/bin/indexer.php')
-rwxr-xr-xwiki/bin/indexer.php107
1 files changed, 0 insertions, 107 deletions
diff --git a/wiki/bin/indexer.php b/wiki/bin/indexer.php
deleted file mode 100755
index 4d19a95..0000000
--- a/wiki/bin/indexer.php
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/usr/bin/php
-<?php
-
-use splitbrain\phpcli\CLI;
-use splitbrain\phpcli\Options;
-
-if(!defined('DOKU_INC')) define('DOKU_INC', realpath(dirname(__FILE__) . '/../') . '/');
-define('NOSESSION', 1);
-require_once(DOKU_INC . 'inc/init.php');
-
-/**
- * Update the Search Index from command line
- */
-class IndexerCLI extends CLI {
-
-    private $quiet = false;
-    private $clear = false;
-
-    /**
-     * Register options and arguments on the given $options object
-     *
-     * @param Options $options
-     * @return void
-     */
-    protected function setup(Options $options) {
-        $options->setHelp(
-            'Updates the searchindex by indexing all new or changed pages. When the -c option is ' .
-            'given the index is cleared first.'
-        );
-
-        $options->registerOption(
-            'clear',
-            'clear the index before updating',
-            'c'
-        );
-        $options->registerOption(
-            'quiet',
-            'don\'t produce any output',
-            'q'
-        );
-    }
-
-    /**
-     * Your main program
-     *
-     * Arguments and options have been parsed when this is run
-     *
-     * @param Options $options
-     * @return void
-     */
-    protected function main(Options $options) {
-        $this->clear = $options->getOpt('clear');
-        $this->quiet = $options->getOpt('quiet');
-
-        if($this->clear) $this->clearindex();
-
-        $this->update();
-    }
-
-    /**
-     * Update the index
-     */
-    function update() {
-        global $conf;
-        $data = array();
-        $this->quietecho("Searching pages... ");
-        search($data, $conf['datadir'], 'search_allpages', array('skipacl' => true));
-        $this->quietecho(count($data) . " pages found.\n");
-
-        foreach($data as $val) {
-            $this->index($val['id']);
-        }
-    }
-
-    /**
-     * Index the given page
-     *
-     * @param string $id
-     */
-    function index($id) {
-        $this->quietecho("$id... ");
-        idx_addPage($id, !$this->quiet, $this->clear);
-        $this->quietecho("done.\n");
-    }
-
-    /**
-     * Clear all index files
-     */
-    function clearindex() {
-        $this->quietecho("Clearing index... ");
-        idx_get_indexer()->clear();
-        $this->quietecho("done.\n");
-    }
-
-    /**
-     * Print message if not supressed
-     *
-     * @param string $msg
-     */
-    function quietecho($msg) {
-        if(!$this->quiet) echo $msg;
-    }
-}
-
-// Main
-$cli = new IndexerCLI();
-$cli->run();