From 16905344219a6293705b71cd526fad3ba07b04eb Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 31 Jan 2010 19:02:14 +0100 Subject: first attempt to centralize all include loading Classes are loaded throug PHP5's class autoloader, all other includes are just loaded by default. This skips a lot of require_once calls. Parser and Plugin stuff isn't handled by the class loader yet. --- inc/init.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 6fb9559ce..3cff40073 100644 --- a/inc/init.php +++ b/inc/init.php @@ -37,6 +37,9 @@ if (!defined('DOKU_E_LEVEL')) { error_reporting(DOKU_E_LEVEL); } +// load libraries +require_once(DOKU_INC.'inc/load.php'); + // init memory caches global $cache_revinfo; $cache_revinfo = array(); @@ -245,6 +248,8 @@ init_files(); scriptify(DOKU_CONF.'users.auth'); scriptify(DOKU_CONF.'acl.auth'); +// setup authentication system +auth_setup(); /** * Checks paths from config file @@ -526,7 +531,6 @@ EOT; exit; } - /** * A realpath() replacement * @@ -588,5 +592,3 @@ function fullpath($path,$exists=false){ return $finalpath; } - - -- cgit v1.2.3 From c2a6d81662045023bdf1617b6b49f71c274d55ca Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 1 Feb 2010 16:10:25 +0100 Subject: plugin related autoloading This patch moved the place where DOKU_PLUGIN is defined. It no longer can be set from a normal config (only via preload) --- inc/init.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 3cff40073..7f4792cfa 100644 --- a/inc/init.php +++ b/inc/init.php @@ -20,6 +20,9 @@ if (@file_exists($preload)) include($preload); // define the include path if(!defined('DOKU_INC')) define('DOKU_INC',fullpath(dirname(__FILE__).'/../').'/'); +// define Plugin dir +if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); + // define config path (packagers may want to change this to /etc/dokuwiki/) if(!defined('DOKU_CONF')) define('DOKU_CONF',DOKU_INC.'conf/'); @@ -158,8 +161,6 @@ if(!defined('DOKU_TAB')) define ('DOKU_TAB',"\t"); // define cookie and session id, append server port when securecookie is configured FS#1664 if (!defined('DOKU_COOKIE')) define('DOKU_COOKIE', 'DW'.md5(DOKU_REL.(($conf['securecookie'])?$_SERVER['SERVER_PORT']:''))); -// define Plugin dir -if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); // define main script if(!defined('DOKU_SCRIPT')) define('DOKU_SCRIPT','doku.php'); -- cgit v1.2.3 From c7cb395c4ee1339709918b7675e91d3d3b10050d Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Mon, 15 Mar 2010 12:16:23 +0100 Subject: Load libraries after init --- inc/init.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 7f4792cfa..ae44ad1a9 100644 --- a/inc/init.php +++ b/inc/init.php @@ -40,9 +40,6 @@ if (!defined('DOKU_E_LEVEL')) { error_reporting(DOKU_E_LEVEL); } -// load libraries -require_once(DOKU_INC.'inc/load.php'); - // init memory caches global $cache_revinfo; $cache_revinfo = array(); @@ -249,8 +246,13 @@ init_files(); scriptify(DOKU_CONF.'users.auth'); scriptify(DOKU_CONF.'acl.auth'); +// load libraries +require_once(DOKU_INC.'inc/load.php'); + // setup authentication system -auth_setup(); +if (!defined('NOSESSION')) { + auth_setup(); +} /** * Checks paths from config file -- cgit v1.2.3 From f1986589078b5e2e3aecc37d8f28b03caa3b8c17 Mon Sep 17 00:00:00 2001 From: Michael Klier Date: Fri, 26 Mar 2010 11:43:35 +0100 Subject: moved plugincontroller and event handler creation to init.php --- inc/init.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index ae44ad1a9..3a9988fcf 100644 --- a/inc/init.php +++ b/inc/init.php @@ -246,9 +246,21 @@ init_files(); scriptify(DOKU_CONF.'users.auth'); scriptify(DOKU_CONF.'acl.auth'); +// setup plugin controller class (can be overwritten in preload.php) +$plugin_types = array('admin','syntax','action','renderer', 'helper'); +global $plugin_controller_class, $plugin_controller; +if (empty($plugin_controller_class)) $plugin_controller_class = 'Doku_Plugin_Controller'; + // load libraries require_once(DOKU_INC.'inc/load.php'); +// initialize plugin controller +$plugin_controller = new $plugin_controller_class(); + +// initialize the event handler +global $EVENT_HANDLER; +$EVENT_HANDLER = new Doku_Event_Handler(); + // setup authentication system if (!defined('NOSESSION')) { auth_setup(); -- cgit v1.2.3 From a0070b52bbd24f6972b819fa8ff4bdbfe81b5bbc Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Wed, 16 Jun 2010 16:15:28 +0200 Subject: Add title index to the indexer files, improve indexer calls --- inc/init.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 3a9988fcf..20263f95a 100644 --- a/inc/init.php +++ b/inc/init.php @@ -304,7 +304,8 @@ function init_paths(){ function init_files(){ global $conf; - $files = array( $conf['indexdir'].'/page.idx'); + $files = array( $conf['indexdir'].'/page.idx', + $conf['indexdir'].'/title.idx'); foreach($files as $file){ if(!@file_exists($file)){ -- cgit v1.2.3 From 345b1674b60537d4a68bce48f7cc106b771051c7 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 26 Jun 2010 12:11:13 +0200 Subject: create title.idx with the correct length FS#1978 The title.idx file needs to have exactly the same length as the page.idx. This patch creates the file with the correct length if it doesn't exist yet. If you upgrade in between you need to delete your data/index/title.idx file --- inc/init.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 20263f95a..9a3eaf9c9 100644 --- a/inc/init.php +++ b/inc/init.php @@ -304,8 +304,7 @@ function init_paths(){ function init_files(){ global $conf; - $files = array( $conf['indexdir'].'/page.idx', - $conf['indexdir'].'/title.idx'); + $files = array($conf['indexdir'].'/page.idx'); foreach($files as $file){ if(!@file_exists($file)){ @@ -318,6 +317,22 @@ function init_files(){ } } } + + # create title index (needs to have same length as page.idx) + $file = $conf['indexdir'].'/title.idx'; + if(!@file_exists($file)){ + $pages = file($conf['indexdir'].'/page.idx'); + $pages = count($pages); + $fh = @fopen($file,'a'); + if($fh){ + for($i=0; $i<$pages; $i++){ + fwrite($fh,"\n"); + } + fclose($fh); + }else{ + nice_die("$file is not writable. Check your permissions settings!"); + } + } } /** -- cgit v1.2.3 From c8f80b4e70ee1b73ecc08cac583d021979af9359 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 27 Jun 2010 14:43:56 +0200 Subject: Use config_cascade for ACLs and plain auth users FS#1677 --- inc/init.php | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 9a3eaf9c9..21382cdb0 100644 --- a/inc/init.php +++ b/inc/init.php @@ -77,26 +77,32 @@ if (empty($config_cascade)) { 'local' => array(DOKU_CONF.'license.local.php'), ), 'mediameta' => array( - 'default' => array(DOKU_CONF.'mediameta.php'), - 'local' => array(DOKU_CONF.'mediameta.local.php'), - ), + 'default' => array(DOKU_CONF.'mediameta.php'), + 'local' => array(DOKU_CONF.'mediameta.local.php'), + ), 'mime' => array( - 'default' => array(DOKU_CONF.'mime.conf'), - 'local' => array(DOKU_CONF.'mime.local.conf'), - ), + 'default' => array(DOKU_CONF.'mime.conf'), + 'local' => array(DOKU_CONF.'mime.local.conf'), + ), 'scheme' => array( - 'default' => array(DOKU_CONF.'scheme.conf'), - 'local' => array(DOKU_CONF.'scheme.local.conf'), - ), + 'default' => array(DOKU_CONF.'scheme.conf'), + 'local' => array(DOKU_CONF.'scheme.local.conf'), + ), 'smileys' => array( - 'default' => array(DOKU_CONF.'smileys.conf'), - 'local' => array(DOKU_CONF.'smileys.local.conf'), - ), + 'default' => array(DOKU_CONF.'smileys.conf'), + 'local' => array(DOKU_CONF.'smileys.local.conf'), + ), 'wordblock' => array( - 'default' => array(DOKU_CONF.'wordblock.conf'), - 'local' => array(DOKU_CONF.'wordblock.local.conf'), - ), - ); + 'default' => array(DOKU_CONF.'wordblock.conf'), + 'local' => array(DOKU_CONF.'wordblock.local.conf'), + ), + 'acl' => array( + 'default' => DOKU_CONF.'acl.auth.php', + ), + 'plainauth.users' => array( + 'default' => DOKU_CONF.'users.auth.php', + ), + ); } //prepare config array() -- cgit v1.2.3 From e6a6dbfe6cfcfaf3fb0992350ea7769faa762116 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sun, 27 Jun 2010 14:52:47 +0200 Subject: moved default config cascade to its own file --- inc/init.php | 50 +------------------------------------------------- 1 file changed, 1 insertion(+), 49 deletions(-) (limited to 'inc/init.php') diff --git a/inc/init.php b/inc/init.php index 21382cdb0..b53167e3c 100644 --- a/inc/init.php +++ b/inc/init.php @@ -54,55 +54,7 @@ global $cache_metadata; //set the configuration cascade - but only if its not already been set in preload.php if (empty($config_cascade)) { - $config_cascade = array( - 'main' => array( - 'default' => array(DOKU_CONF.'dokuwiki.php'), - 'local' => array(DOKU_CONF.'local.php'), - 'protected' => array(DOKU_CONF.'local.protected.php'), - ), - 'acronyms' => array( - 'default' => array(DOKU_CONF.'acronyms.conf'), - 'local' => array(DOKU_CONF.'acronyms.local.conf'), - ), - 'entities' => array( - 'default' => array(DOKU_CONF.'entities.conf'), - 'local' => array(DOKU_CONF.'entities.local.conf'), - ), - 'interwiki' => array( - 'default' => array(DOKU_CONF.'interwiki.conf'), - 'local' => array(DOKU_CONF.'interwiki.local.conf'), - ), - 'license' => array( - 'default' => array(DOKU_CONF.'license.php'), - 'local' => array(DOKU_CONF.'license.local.php'), - ), - 'mediameta' => array( - 'default' => array(DOKU_CONF.'mediameta.php'), - 'local' => array(DOKU_CONF.'mediameta.local.php'), - ), - 'mime' => array( - 'default' => array(DOKU_CONF.'mime.conf'), - 'local' => array(DOKU_CONF.'mime.local.conf'), - ), - 'scheme' => array( - 'default' => array(DOKU_CONF.'scheme.conf'), - 'local' => array(DOKU_CONF.'scheme.local.conf'), - ), - 'smileys' => array( - 'default' => array(DOKU_CONF.'smileys.conf'), - 'local' => array(DOKU_CONF.'smileys.local.conf'), - ), - 'wordblock' => array( - 'default' => array(DOKU_CONF.'wordblock.conf'), - 'local' => array(DOKU_CONF.'wordblock.local.conf'), - ), - 'acl' => array( - 'default' => DOKU_CONF.'acl.auth.php', - ), - 'plainauth.users' => array( - 'default' => DOKU_CONF.'users.auth.php', - ), - ); + include(DOKU_INC.'inc/config_cascade.php'); } //prepare config array() -- cgit v1.2.3