Beispiel #1
0
 /**
  * Test that we can instantiate and run AllPages plugin without error.
  */
 function testAllPages()
 {
     global $request;
     $lp = new WikiPlugin_AllPages();
     $this->assertEquals("AllPages", $lp->getName());
     $args = "";
     $this->assertType('object', $request->_dbi, 'isa WikiDB');
     /*
     */
     $result = $lp->run($request->_dbi, $args, $request, "AllPages");
     $this->assertType('object', $result, 'isa PageList');
     $this->assertType('object', $request->_dbi, 'isa WikiDB');
     if (!isa($request->_dbi, "WikiDB")) {
         // very very strange bug
         $request->_dbi = WikiDB::open($GLOBALS['DBParams']);
         if (!isa($request->_dbi, "WikiDB")) {
             trigger_error("strange php bug\n", E_USER_WARNING);
             return;
         }
     }
     $xml = $result->asXml();
     $this->assertType('object', $result, 'isa XmlContent');
     //$xml->asString();
     //$this->assertType('object', $result, 'isa XmlContent');
 }
Beispiel #2
0
 * @since   2012/11/26
 * @license GPLv2
 */
define('INC_MONIWIKI', 1);
$topdir = realpath(dirname(__FILE__) . '/../');
include_once $topdir . "/wiki.php";
// Start Main
$Config = getConfig($topdir . '/config.php');
require_once $topdir . '/wikilib.php';
require_once $topdir . '/lib/win32fix.php';
require_once $topdir . '/lib/wikiconfig.php';
require_once $topdir . '/lib/cache.text.php';
require_once $topdir . '/lib/timer.php';
include_once dirname(__FILE__) . '/utils.php';
$Config = wikiConfig($Config);
$DBInfo = new WikiDB($Config);
$p = $DBInfo->getPage('FrontPage');
$formatter = new Formatter($p);
if (empty($formatter->wordrule)) {
    $formatter->set_wordrule();
}
$params = array();
if (class_exists('Timer')) {
    $timing = new Timer();
    $params['timer'] =& $timing;
    $params['timer']->Check("load");
}
$options = array();
$options[] = array('f', '', "force update redirect caches");
$options[] = array('d', '', "debug");
$short_opts = '';
Beispiel #3
0
}
require_once $topdir . '/wikilib.php';
require_once $topdir . '/lib/wikiconfig.php';
require_once $topdir . '/lib/timer.php';
require_once $topdir . '/lib/win32fix.php';
require_once $topdir . '/lib/cache.text.php';
include_once dirname(__FILE__) . '/utils.php';
// setup some variables
$Config['fetch_imagesize'] = 0;
$Config['fetch_images'] = 0;
$Config['nonexists'] = 'nolink';
$Config['fetch_action'] = 'http://fetch_action/';
$Config['pull_url'] = 'http://rigvedawiki.net/w/';
$Config['media_url_mode'] = 1;
$Config = wikiConfig($Config);
$DBInfo = new WikiDB($Config);
$params = array();
if (class_exists('Timer')) {
    $timing = new Timer();
    $params['timer'] =& $timing;
    $params['timer']->Check("load");
}
// get args
$options = array();
$options[] = array("t", "type", "render type\n\t\t\t(support 'mdict', 'html')");
$options[] = array("d", "dir", "directory of text data");
$options[] = array("n", '', "namu markup");
$options[] = array("o", "out", "output directory");
$options[] = array("w", '', "overwrite");
$short_opts = '';
// list of short options.
Beispiel #4
0
function linkSearch($linktype, $search, $pages = "*", $relation = "*", $credentials = false)
{
    global $server;
    checkCredentials($server, $credentials, 'view', _("HomePage"));
    $dbi = WikiDB::open($GLOBALS['DBParams']);
    require_once "lib/TextSearchQuery.php";
    $pagequery = new TextSearchQuery($pages);
    $linkquery = new TextSearchQuery($search);
    if ($linktype == 'relation') {
        $relquery = new TextSearchQuery($relation);
        $links = $dbi->_backend->link_search($pagequery, $linkquery, $linktype, $relquery);
    } elseif ($linktype == 'attribute') {
        // only numeric search withh attributes!
        $relquery = new TextSearchQuery($relation);
        require_once "lib/SemanticWeb.php";
        // search: "population > 1 million and area < 200 km^2" relation="*" pages="*"
        $linkquery = new SemanticAttributeSearchQuery($search, $relation);
        $links = $dbi->_backend->link_search($pagequery, $linkquery, $linktype, $relquery);
    } else {
        // we already do have forward and backlinks as SOAP
        $links = $dbi->_backend->link_search($pagequery, $linkquery, $linktype);
    }
    return $links->asArray();
}
Beispiel #5
0
function _upgrade_db_init(&$dbh)
{
    global $request, $DBParams, $DBAuthParams;
    if (!in_array($DBParams['dbtype'], array('SQL', 'ADODB', 'PDO'))) {
        return;
    }
    if (DBADMIN_USER) {
        // if need to connect as the root user, for CREATE and ALTER privileges
        $AdminParams = $DBParams;
        if ($DBParams['dbtype'] == 'SQL') {
            $dsn = DB::parseDSN($AdminParams['dsn']);
        } else {
            // ADODB or PDO
            $dsn = parseDSN($AdminParams['dsn']);
        }
        $AdminParams['dsn'] = sprintf("%s://%s:%s@%s/%s", $dsn['phptype'], DBADMIN_USER, DBADMIN_PASSWD, $dsn['hostspec'], $dsn['database']);
        if (DEBUG & _DEBUG_SQL and $DBParams['dbtype'] == 'PDO') {
            echo "<br>\nDBParams['dsn']: '", $DBParams['dsn'], "'";
            echo "<br>\ndsn: '", print_r($dsn), "'";
            echo "<br>\nAdminParams['dsn']: '", $AdminParams['dsn'], "'";
        }
        $dbh = WikiDB::open($AdminParams);
    } elseif ($dbadmin = $request->getArg('dbadmin')) {
        if (empty($dbadmin['user']) or isset($dbadmin['cancel'])) {
            $dbh =& $request->_dbi;
        } else {
            $AdminParams = $DBParams;
            if ($DBParams['dbtype'] == 'SQL') {
                $dsn = DB::parseDSN($AdminParams['dsn']);
            } else {
                $dsn = parseDSN($AdminParams['dsn']);
            }
            $AdminParams['dsn'] = sprintf("%s://%s:%s@%s/%s", $dsn['phptype'], $dbadmin['user'], $dbadmin['passwd'], $dsn['hostspec'], $dsn['database']);
            $dbh = WikiDB::open($AdminParams);
        }
    } else {
        // Check if the privileges are enough. Need CREATE and ALTER perms.
        // And on windows: SELECT FROM mysql, possibly: UPDATE mysql.
        $form = HTML::form(array("method" => "post", "action" => $request->getPostURL(), "accept-charset" => $GLOBALS['charset']), HTML::p(_("Upgrade requires database privileges to CREATE and ALTER the phpwiki database."), HTML::br(), _("And on windows at least the privilege to SELECT FROM mysql, and possibly UPDATE mysql")), HiddenInputs(array('action' => 'upgrade')), HTML::table(array("cellspacing" => 4), HTML::tr(HTML::td(array('align' => 'right'), _("DB admin user:"******"dbadmin[user]", 'size' => 12, 'maxlength' => 256, 'value' => 'root')))), HTML::tr(HTML::td(array('align' => 'right'), _("DB admin password:"******"dbadmin[passwd]", 'type' => 'password', 'size' => 12, 'maxlength' => 256)))), HTML::tr(HTML::td(array('align' => 'center', 'colspan' => 2), Button("submit:", _("Submit"), 'wikiaction'), HTML::raw('&nbsp;'), Button("submit:dbadmin[cancel]", _("Cancel"), 'button')))));
        $form->printXml();
        echo "</div><!-- content -->\n";
        echo asXML(Template("bottom"));
        echo "</body></html>\n";
        $request->finish();
        exit;
    }
}
Beispiel #6
0
/**
 * Initializes PhpWiki and calls the plugin specified in the url to
 * produce an image. Furthermore, allow the usage of Apache's
 * ErrorDocument mechanism in order to make this file only called when 
 * image could not be found in the cache.
 * (see doc/README.phpwiki-cache for further information).
 */
function mainImageCache()
{
    $request = new Request();
    // normalize pagename
    $request->setArg('pagename', deducePagename($request));
    $pagename = $request->getArg('pagename');
    $request->_dbi = WikiDB::open($GLOBALS['DBParams']);
    if (ENABLE_USER_NEW) {
        $request->_user = new _AnonUser();
        $request->_prefs =& $request->_user->_prefs;
    } else {
        $request->_user = new WikiUser($request);
        $request->_prefs = new UserPreferences();
    }
    // Enable the output of most of the warning messages.
    // The warnings will screw up zip files and setpref though.
    // They will also screw up my images... But I think
    // we should keep them.
    global $ErrorManager;
    $ErrorManager->setPostponedErrorMask(E_NOTICE | E_USER_NOTICE);
    $id = $request->getArg('id');
    $args = $request->getArg('args');
    $request->setArg('action', 'imagecache');
    $cache = new WikiPluginCached();
    if ($id) {
        // this indicates a direct call (script wasn't called as
        // 404 ErrorDocument)
    } else {
        // deduce image id or image args (plugincall) from
        // refering URL
        $uri = $request->get('REDIRECT_URL');
        $query = $request->get('REDIRECT_QUERY_STRING');
        $uri .= $query ? '?' . $query : '';
        if (!$uri) {
            $uri = $request->get('REQUEST_URI');
        }
        if (!$uri) {
            $cache->printError('png', 'Could not deduce image identifier or creation' . ' parameters. (Neither REQUEST nor REDIRECT' . ' obtained.)');
            return;
        }
        //$cacheparams = $GLOBALS['CacheParams'];
        if (!preg_match(':^(.*/)?' . PLUGIN_CACHED_FILENAME_PREFIX . '([^\\?/]+)\\.img(\\?args=([^\\?&]*))?$:', $uri, $matches)) {
            $cache->printError('png', "I do not understand this URL: {$uri}");
            return;
        }
        $request->setArg('id', $matches[2]);
        if ($matches[4]) {
            // md5 args?
            $request->setArg('args', rawurldecode($matches[4]));
        }
        $request->setStatus(200);
        // No, we do _not_ have an Error 404 :->
    }
    $cache->fetchImageFromCache($request->_dbi, $request, 'png');
}
Beispiel #7
0
/**
 * Title indexer by wkpark at gmail.com
 * 2012/04/22
 */
define('INC_MONIWIKI', 1);
include_once "wiki.php";
# Start Main
$Config = getConfig("config.php");
require_once "wikilib.php";
require_once "lib/win32fix.php";
require_once "lib/wikiconfig.php";
require_once "lib/cache.text.php";
require_once "lib/timer.php";
require_once "lib/indexer.DBA.php";
$Config = wikiConfig($Config);
$DBInfo = new WikiDB($Config);
$options = array();
if (class_exists('Timer')) {
    $timing = new Timer();
    $options['timer'] =& $timing;
    $options['timer']->Check("load");
}
$indexer = new Indexer_DBA('titlesearch', 'w', $DBInfo->dba_type, 'new');
#$indexer->test();
#exit;
$handle = opendir($DBInfo->text_dir);
if (!is_resource($handle)) {
    echo "Can't open {$DBInfo->text_dir}\n";
    exit;
}
$ii = 1;
Beispiel #8
0
 *
 * @author wkpark at kldp.org
 * @since 2015/05/17
 * @license GPLv2
 */
define('INC_MONIWIKI', 1);
$topdir = realpath(dirname(__FILE__) . '/../');
include_once $topdir . '/wiki.php';
// Start Main
$Config = getConfig($topdir . '/config.php');
require_once $topdir . '/wikilib.php';
require_once $topdir . '/lib/wikiconfig.php';
require_once $topdir . '/lib/timer.php';
include_once dirname(__FILE__) . '/utils.php';
$Config = wikiConfig($Config);
$DBInfo = new WikiDB($Config);
$tablename = 'documents';
$params = array();
if (class_exists('Timer')) {
    $timing = new Timer();
    $params['timer'] =& $timing;
    $params['timer']->Check("load");
}
if ($DBInfo->text_dir[0] != '/') {
    $text_dir = $topdir . '/' . $DBInfo->text_dir;
} else {
    $text_dir = $DBInfo->text_dir;
}
// get args
$options = array();
$options[] = array("t", "type", "sql type\n\t\t\t(support 'mysql', 'sqlite')");
Beispiel #9
0
// Start Main
// check a local config file config.local.php
if (file_exists($topdir . '/config.local.php')) {
    $Config = getConfig($topdir . '/config.local.php');
} else {
    $Config = getConfig($topdir . '/config.php');
}
require_once $topdir . '/wikilib.php';
require_once $topdir . '/lib/wikiconfig.php';
require_once $topdir . '/lib/timer.php';
require_once $topdir . '/lib/win32fix.php';
require_once $topdir . '/lib/cache.text.php';
include_once dirname(__FILE__) . '/utils.php';
// setup some variables
$Config = wikiConfig($Config);
$DBInfo = new WikiDB($Config);
$params = array();
if (class_exists('Timer')) {
    $timing = new Timer();
    $params['timer'] =& $timing;
    $params['timer']->Check("load");
}
// get args
$options = array();
$options[] = array("i", "interwiki", "interwiki name");
$options[] = array('t', 'type', "metadb type (compat)");
$options[] = array('d', 'dbname', "metadb file name");
$options[] = array("w", '', "overwrite");
$short_opts = '';
// list of short options.
foreach ($options as $item) {
/**
 * ElasticSearch indexer by wkpark at gmail.com
 * 2012/05/25
 */
define('INC_MONIWIKI', 1);
include_once "wiki.php";
# Start Main
$Config = getConfig("config.php");
require_once "wikilib.php";
require_once "lib/win32fix.php";
require_once "lib/wikiconfig.php";
require_once "lib/cache.text.php";
require_once "lib/timer.php";
require_once "lib/JSON.php";
$Config = wikiConfig($Config);
$DBInfo = new WikiDB($Config);
$JSON = new Services_JSON();
$options = array();
if (class_exists('Timer')) {
    $timing = new Timer();
    $options['timer'] =& $timing;
    $options['timer']->Check("load");
}
$handle = opendir($DBInfo->text_dir);
if (!is_resource($handle)) {
    echo "Can't open {$DBInfo->text_dir}\n";
    exit;
}
// make elastic search query string
$url = !empty($Config['elasticsearch_host_url']) ? $Config['elasticsearch_host_url'] : 'http://localhost:9200';
$url = rtrim($url, '/') . '/';
Beispiel #11
0
 *
 * @author wkpark at kldp.org
 * @since 2015/06/01
 * @license GPLv2
 */
define('INC_MONIWIKI', 1);
$topdir = realpath(dirname(__FILE__) . '/../');
include_once $topdir . '/wiki.php';
// Start Main
$Config = getConfig($topdir . '/config.php');
require_once $topdir . '/wikilib.php';
require_once $topdir . '/lib/wikiconfig.php';
require_once $topdir . '/lib/timer.php';
include_once dirname(__FILE__) . '/utils.php';
$Config = wikiConfig($Config);
$DBInfo = new WikiDB($Config);
$tablename = 'editlog';
$params = array();
if (class_exists('Timer')) {
    $timing = new Timer();
    $params['timer'] =& $timing;
    $params['timer']->Check("load");
}
if ($DBInfo->data_dir[0] != '/') {
    $editlog = $topdir . '/' . $DBInfo->data_dir . '/editlog';
} else {
    $editlog = $DBInfo->data_dir . '/editlog';
}
// get args
$options = array();
$options[] = array('t', 'type', "sql type\n\t\t\t(support 'mysql', 'sqlite')");
Beispiel #12
0
            } else {
                if ($line[$pos] == "'") {
                    $out[] = $buff;
                    $buff = '';
                    $flag = -1;
                } else {
                    $buff .= $ch;
                }
            }
        }
        $pos++;
    }
    return $out;
}
$Config = wikiConfig($Config);
$DBInfo = new WikiDB($Config);
$params = array();
if (class_exists('Timer')) {
    $timing = new Timer();
    $params['timer'] =& $timing;
    $params['timer']->Check("load");
}
// get args
$options = array();
$options[] = array("t", "type", "sql type\n\t\t\t(support 'mysql', 'sqlite')");
$options[] = array("d", "dir", "dest dir");
$short_opts = '';
// list of short options.
foreach ($options as $item) {
    $opt = $item[0];
    if ($item[1]) {
Beispiel #13
0
function doFullTextSearch($s, $credentials = false)
{
    global $server;
    checkCredentials($server, $credentials, 'view', _("FullTextSearch"));
    $dbi = WikiDB::open($GLOBALS['DBParams']);
    $query = new TextSearchQuery($s);
    $page_iter = $dbi->fullSearch($query);
    $pages = array();
    while ($page = $page_iter->next()) {
        $pages[] = array('pagename' => $page->getName());
    }
    return $pages;
}
Beispiel #14
0
 function _try_dbadmin_user($user, $passwd)
 {
     global $DBParams, $DBAuthParams;
     $AdminParams = $DBParams;
     if (DATABASE_TYPE == 'SQL') {
         $dsn = DB::parseDSN($AdminParams['dsn']);
     } else {
         $dsn = parseDSN($AdminParams['dsn']);
     }
     $AdminParams['dsn'] = sprintf("%s://%s:%s@%s/%s", $dsn['phptype'], $user, $passwd, $dsn['hostspec'], $dsn['database']);
     $AdminParams['_tryroot_from_upgrade'] = 1;
     // add error handler to warn about missing permissions for DBADMIN_USER
     global $ErrorManager;
     $ErrorManager->pushErrorHandler(new WikiMethodCb($this, '_dbpermission_filter'));
     $this->error_caught = 0;
     $this->dbi = WikiDB::open($AdminParams);
     if (!$this->error_caught) {
         return true;
     }
     // FAILED: redo our connection with the wikiuser
     $this->dbi = WikiDB::open($DBParams);
     $ErrorManager->flushPostponedErrors();
     $ErrorManager->popErrorHandler();
     return false;
 }
Beispiel #15
0
 function WikiRequest()
 {
     $this->_dbi = WikiDB::open($GLOBALS['DBParams']);
     // first mysql request costs [958ms]! [670ms] is mysql_connect()
     if (in_array('File', $this->_dbi->getAuthParam('USER_AUTH_ORDER'))) {
         // force our local copy, until the pear version is fixed.
         include_once dirname(__FILE__) . "/pear/File_Passwd.php";
     }
     if (ENABLE_USER_NEW) {
         // Preload all necessary userclasses. Otherwise session => __PHP_Incomplete_Class_Name
         // There's no way to demand-load it later. This way it's much slower, but needs slightly
         // less memory than loading all.
         if (ALLOW_BOGO_LOGIN) {
             include_once "lib/WikiUser/BogoLogin.php";
         }
         // UserPreferences POST Update doesn't reach this.
         foreach ($GLOBALS['USER_AUTH_ORDER'] as $method) {
             include_once "lib/WikiUser/{$method}.php";
             if ($method == 'Db') {
                 switch (DATABASE_TYPE) {
                     case 'SQL':
                         include_once "lib/WikiUser/PearDb.php";
                         break;
                     case 'ADODB':
                         include_once "lib/WikiUser/AdoDb.php";
                         break;
                     case 'PDO':
                         include_once "lib/WikiUser/PdoDb.php";
                         break;
                 }
             }
         }
         unset($method);
     }
     if (USE_DB_SESSION) {
         include_once 'lib/DbSession.php';
         $dbi =& $this->_dbi;
         $this->_dbsession = new DbSession($dbi, $dbi->getParam('prefix') . $dbi->getParam('db_session_table'));
     }
     // Fixme: Does pear reset the error mask to 1? We have to find the culprit
     //$x = error_reporting();
     $this->version = phpwiki_version();
     $this->Request();
     // [90ms]
     // Normalize args...
     $this->setArg('pagename', $this->_deducePagename());
     $this->setArg('action', $this->_deduceAction());
     if (DEBUG & _DEBUG_SQL or DATABASE_OPTIMISE_FREQUENCY > 0 and time() % DATABASE_OPTIMISE_FREQUENCY == 0) {
         if ($this->_dbi->_backend->optimize()) {
             trigger_error(_("Optimizing database"), E_USER_NOTICE);
         }
     }
     // Restore auth state. This doesn't check for proper authorization!
     $userid = $this->_deduceUsername();
     if (ENABLE_USER_NEW) {
         if (isset($this->_user) and !empty($this->_user->_authhow) and $this->_user->_authhow == 'session') {
             // users might switch in a session between the two objects.
             // restore old auth level here or in updateAuthAndPrefs?
             //$user = $this->getSessionVar('wiki_user');
             // revive db handle, because these don't survive sessions
             if (isset($this->_user) and (!isa($this->_user, WikiUserClassname()) or strtolower(get_class($this->_user)) == '_passuser')) {
                 $this->_user = WikiUser($userid, $this->_user->_prefs);
             }
             // revive other db handle
             if (isset($this->_user->_prefs->_method) and ($this->_user->_prefs->_method == 'SQL' or $this->_user->_prefs->_method == 'ADODB' or $this->_user->_prefs->_method == 'PDO' or $this->_user->_prefs->_method == 'HomePage')) {
                 $this->_user->_HomePagehandle = $this->getPage($userid);
             }
             // need to update the lockfile filehandle
             if (isa($this->_user, '_FilePassUser') and $this->_user->_file->lockfile and !$this->_user->_file->fplock) {
                 //$level = $this->_user->_level;
                 $this->_user = UpgradeUser($this->_user, new _FilePassUser($userid, $this->_user->_prefs, $this->_user->_file->filename));
                 //$this->_user->_level = $level;
             }
             $this->_prefs =& $this->_user->_prefs;
         } else {
             $user = WikiUser($userid);
             $this->_user =& $user;
             $this->_prefs =& $this->_user->_prefs;
         }
     } else {
         $this->_user = new WikiUser($this, $userid);
         $this->_prefs = $this->_user->getPreferences();
     }
 }
Beispiel #16
0
 * @since 2015/05/14
 * @license GPLv2
 */
define('INC_MONIWIKI', 1);
$topdir = realpath(dirname(__FILE__) . '/../');
include_once $topdir . "/wiki.php";
# Start Main
$Config = getConfig($topdir . "/config.php");
require_once $topdir . "/wikilib.php";
require_once $topdir . "/lib/win32fix.php";
require_once $topdir . "/lib/wikiconfig.php";
require_once $topdir . "/lib/cache.text.php";
require_once $topdir . "/lib/timer.php";
include_once dirname(__FILE__) . '/utils.php';
$Config = wikiConfig($Config);
$DBInfo = new WikiDB($Config);
$p = $DBInfo->getPage('FrontPage');
$formatter = new Formatter($p);
if (empty($formatter->wordrule)) {
    $formatter->set_wordrule();
}
$options = array();
if (class_exists('Timer')) {
    $timing = new Timer();
    $options['timer'] =& $timing;
    $options['timer']->Check("load");
}
$supported = array('compat', 'utf8fs', 'base64url', 'utf8', 'base64');
$alias = array('utf8' => 'utf8fs', 'base64' => 'base64url');
$program = $argv[0];
function usage()
Beispiel #17
0
 function getAuthDbh()
 {
     global $request;
     //, $DBParams, $DBAuthParams;
     $dbh = $request->getDbh();
     // session restauration doesn't re-connect to the database automatically,
     // so dirty it here, to force a reconnect.
     if (isset($this->_auth_dbi)) {
         if ($dbh->getParam('dbtype') == 'SQL' and empty($this->_auth_dbi->connection)) {
             unset($this->_auth_dbi);
         }
         if ($dbh->getParam('dbtype') == 'ADODB' and empty($this->_auth_dbi->_connectionID)) {
             unset($this->_auth_dbi);
         }
     }
     if (empty($this->_auth_dbi)) {
         if ($dbh->getParam('dbtype') != 'SQL' and $dbh->getParam('dbtype') != 'ADODB' and $dbh->getParam('dbtype') != 'PDO') {
             return false;
         }
         if (empty($GLOBALS['DBAuthParams'])) {
             return false;
         }
         if (!$dbh->getAuthParam('auth_dsn')) {
             $dbh = $request->getDbh();
             // use phpwiki database
         } elseif ($dbh->getAuthParam('auth_dsn') == $dbh->getParam('dsn')) {
             $dbh = $request->getDbh();
             // same phpwiki database
         } else {
             // use another external database handle. needs PHP >= 4.1
             $local_params = array_merge($GLOBALS['DBParams'], $GLOBALS['DBAuthParams']);
             $local_params['dsn'] = $local_params['auth_dsn'];
             $dbh = WikiDB::open($local_params);
         }
         $this->_auth_dbi =& $dbh->_backend->_dbh;
     }
     return $this->_auth_dbi;
 }
Beispiel #18
0
<?php

define('INC_MONIWIKI', 1);
include_once "wiki.php";
# Start Main
$Config = getConfig("config.php");
require_once "wikilib.php";
require_once "lib/win32fix.php";
require_once "lib/wikiconfig.php";
require_once "lib/cache.text.php";
require_once "lib/timer.php";
require_once "lib/indexer.DBA.php";
$Config = wikiConfig($Config);
$DBInfo = new WikiDB($Config);
$options = array();
if (class_exists('Timer')) {
    $timing = new Timer();
    $options['timer'] =& $timing;
    $options['timer']->Check("load");
}
$indexer = new Indexer_DBA('fullsearch', 'w', $DBInfo->dba_type, 'new');
#$indexer->test();
#exit;
$handle = opendir($DBInfo->text_dir);
if (!is_resource($handle)) {
    echo "Can't open {$DBInfo->text_dir}\n";
    exit;
}
$ii = 1;
while (($file = readdir($handle)) !== false) {
    if (is_dir($DBInfo->text_dir . "/" . $file)) {