[dokuwiki] Re: wiki farm

  • From: Guy Brand <gb@xxxxxxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Sun, 26 Aug 2007 22:36:56 +0200

On 23 August at 14:29, Andreas Gohr wrote:

>> Just to point out for those interested -- there are over 50 references to 
>> realpath in define statements throughout the DokuWiki code.  This leaves 
>> me wondering ... if instead, DokuWiki included a custom realpath that did 
>> NOT resolve symlinks, I believe this would allow DokuWiki to work in both 
>> standard (no symlink) or wiki farm (symlink) environments.
> 
> This is exactly what I was thinking about since your first mail :-) A patch 
> would be welcome.

  Attached patch is an attempt to remove realpath() calls. I'm using
  it for the farm patch since a few days, without regression. Test
  unit also ran successfully.


On 23 August at 15:45, Chris Smith wrote:

>> if(!defined('DOKU_INC')) 
>> define('DOKU_INC',realpath(dirname(__FILE__).'/../../../').'/');
>> 
> This practice should be discouraged.  The plugins included with DW now 
> commence with the following lines
> 
> // must be run within Dokuwiki
> if(!defined('DOKU_INC')) die();

  Fix pushed to Andi for the bundled revert plugin to die this way.


-- 
  bug
New patches:

[Remove realpath() use to define DOKU_INC wherever needed
Guy Brand <gb@xxxxxxxxxxxxxxxxx>**20070826202315] {
hunk ./doku.php 11
-  if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__)).'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0))).'/');
hunk ./feed.php 9
-  if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__)).'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0))).'/');
hunk ./inc/FeedParser.php 8
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/HTTPClient.php 9
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/JSON.php 61
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/actions.php 9
-  if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/auth.php 12
-  if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/cache.php 9
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/cliopts.php 23
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/common.php 9
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/confutils.php 9
-  if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/events.php 9
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/form.php 9
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/fulltext.php 9
-  if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/html.php 9
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/indexer.php 9
-  if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/infoutils.php 8
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/init.php 14
-  if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/io.php 9
-  if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/mail.php 9
-  if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/media.php 9
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/parser/handler.php 2
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-2))).'/');
hunk ./inc/parser/lexer.php 16
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-2))).'/');
hunk ./inc/parser/metadata.php 8
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-2))).'/');
hunk ./inc/parser/parser.php 3
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-2))).'/');
hunk ./inc/parser/renderer.php 8
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-2))).'/');
hunk ./inc/parser/xhtml.php 9
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-2))).'/');
hunk ./inc/parser/xhtmlsummary.php 2
-if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../../').'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-2))).'/');
hunk ./inc/parserutils.php 10
-  if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/search.php 9
-  if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/template.php 9
-  if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./inc/toolbar.php 9
-  if(!defined('DOKU_INC')) 
define('DOKU_INC',realpath(dirname(__FILE__).'/../').'/');
+  if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0,-1))).'/');
hunk ./install.php 8
-if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(__FILE__)).'/');
+if(!defined('DOKU_INC')) 
define('DOKU_INC',dirname(join('/',array_slice(explode('/',$_SERVER['SCRIPT_FILENAME']),0))).'/');
}

Context:

[removed unused file from french translation
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070821174710] 
[german update
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070821174336] 
[alter p_get_first_heading() default $render value to true
Chris Smith <chris@xxxxxxxxxxxxx>**20070821021008
 Calls to p_get_first_heading() are most likely to expect to get the first 
heading even if it needs to be 
 generated, that is a $render value of true.  Only the metadata renderer itself 
needs a value of false in 
 order to prevent mutual dependency probelms.
 
 This fix should finally complete FS#1010 & problems breadcrumbs have with 
use_first_headings when metadata 
 doesn't exist.  Also see, 
//www.freelists.org/archives/dokuwiki/08-2007/msg00018.html & 
 //www.freelists.org/archives/dokuwiki/08-2007/msg00132.html
] 
[Fix $conf['compression'] setting values (was using 'bzip' instead of 'bz2'); 
FS#1185
Chris Smith <chris@xxxxxxxxxxxxx>**20070821120916] 
[french update
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070821173805] 
[typo fix in action plugin prototype class
Michael Klier <chi@xxxxxxxxxxx>**20070820175842] 
[fix for magic quote fixing inside array keys
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070819211952] 
[quote fix in auth_nameencode
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070819211829] 
[typo fix FS#1229
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070818222239] 
[esperanto update
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070818222029] 
[finish language update
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070816182508] 
[greek language update
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070813220053] 
[added nothing found message to backlinks output
Michael Klier <chi@xxxxxxxxxxx>**20070813160452] 
[span added to breadcrumbs label
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070813190912] 
[correctly URL encode idx parameter in index view
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070810082232] 
[Optimize loading the index with AJAX
Ben Coburn <btcoburn@xxxxxxxxxxxxx>**20070810040430
 Improves the perceptual latency of the AJAX based index view.
 
 - Only show the throbber for AJAX calls that are slow.
   Currently this applies to calls that take more than 500 ms.
 
 - Reuse the results of AJAX calls.
   This makes a namespace open, close, open, cycle much faster.
   Also reduces the number of AJAX calls to the server.
   (To reload the index, just reload the page as usual.)
] 
[Fix for not working iconv call in SimplePie
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070809234320
 See http://simplepie.org/support/viewtopic.php?pid=3819#p3819
 
 Patch sent to upstream
] 
[typo fix for plugin manager which caused blank error message FS#1216
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070809221830] 
[show correct megabyte size for image details FS#1217
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070809213753] 
[don't allow export formats in Google index FS#1219
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070809212728] 
[spelling fix FS#1220
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070809212154] 
[stripped comments from el lang file
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070809212044] 
[dutch language update
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070808214818] 
[Portuguese language update
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070808180825] 
[german language update
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070807221400] 
[TOC fixed
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070807171844
 This fixes some small bugs which were introduced with recent TOC changes
] 
[Protect auth_ismanager() from auth modules that don't always provide group 
data in array (FS#1196)
Chris Smith <chris@xxxxxxxxxxxxx>**20070805203312] 
[fixed function check in install.php FS#1215
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070806185341] 
[Add checks for supported attic compression methods to config plugin (FSâ#1185)
Chris Smith <chris@xxxxxxxxxxxxx>**20070805193638] 
[minor fixes for recent tpl_toc() patch
chris@xxxxxxxxxxxxx**20070805163833] 
[separated TOC from page
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070805132405
 This patch introduces a tpl_toc() function which can be used to freely place
 the Table of Contents in a template. When used, tpl_content should be called
 with a parameter of false to supress the automatic TOC placement.
 
 Note: if tpl_toc() us run *before* tpl_content(), TOCs will not work in the
 preview. A work around is to run tpl_content() in a output buffer first.
 
 This patch also adds a getTOC() function for admin plugins which allows plugin
 authors to put create their own TOC which will be placed correctly in the
 template. A convenience function html_mktocitem() is available.
 
 The config manager was adjusted to make ue of this new feature, but some bugs
 might remain.
] 
[generic search engines result highlighting
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070804125124] 
[test case adjustments for recent spacing fix in forms
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070804081605] 
[fulltext search fixes FS#1191 FS#1192
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070804081226] 
[Support for $inner param in tpl_actionlink
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070804071934
 This allows template authors to use their own HTML content as link body. Eg. to
 use images. Defaults to the appropriate language string.
] 
[Space between label and input element for new form handler
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070804071840] 
[Skip only empty strings not 0 in buildAttributes
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070804071749] 
[New structured forms and action events
Tom N Harris <tnharris@xxxxxxxxxxxxx>**20070730215007
 Replaces a number of *FORM_INJECTION events with a more flexible way of
 modifying forms. Forms are created with a Doku_Form class (inc/form.php)
 that can be manipulated by plugins prior to output. Plugins register a
 HTML_{$name}FORM_OUTPUT event which can modify the form object prior to
 output. Available forms are:
   LOGIN DRAFT CONFLICT REGISTER UPDATEPROFILE EDIT RESENDPWD
 Documentation for the Doku_Form class is in inc/form.php.
] 
[update breadcrumbs to generate metadata when necessary for use_first_heading
Chris Smith <chris@xxxxxxxxxxxxx>**20070802174401] 
[TAG develsnap 2007-08-01
Andreas Gohr <andi@xxxxxxxxxxxxxx>**20070731230001] 
Patch bundle hash:
d7e971e18285d701823e53942d568e552e6dbdca

Other related posts: