Last modified: 2010-05-15 15:38:44 UTC
Hi all, I wanted to install MediaWiki on NetWare platform - but surprisingly that failed because the path separator is choosen wrong. So I examined MediaWiki, and found that the path separator selection is not very well developed... here's my patch which makes MediaWiki install on NetWare: http://www.gknw.com/test/mediawiki/mydiff1 perhaps not needed, but when we are on path separators these I found also: http://www.gknw.com/test/mediawiki/mydiff2 and I think the path separator selection should be the same with all files. Hope someone can soon commit these trivial patches so that MediaWiki can install out-of- the-box on NetWare too.... greets, Guenter.
Tested now 1.47, 1.49, and 1.5rc4 - still no sign of a fix.... with 1.5rc4 version the first patch has slightly changed: --- index.php.orig Sat Aug 13 09:31:32 2005 +++ index.php Thu Sep 01 02:03:50 2005 @@ -114,7 +114,11 @@ # As a dirty hack, we'll try to set up the include path first. # $IP = dirname( dirname( __FILE__ ) ); -$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +if (PATH_SEPARATOR != "") { + $sep = PATH_SEPARATOR; +} else { + $sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +} ini_set( "include_path", ".$sep$IP$sep$IP/includes$sep$IP/languages" ); define( "MEDIAWIKI", true ); @@ -1070,7 +1074,11 @@ $slconf['RightsIcon'] = $conf->RightsIcon; } - $sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; + if (PATH_SEPARATOR != "") { + $sep = PATH_SEPARATOR; + } else { + $sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; + } $localsettings = " # This file was automatically generated by the MediaWiki installer. # If you make manual changes, please keep track in case you need to
This patch looks wrong; an undefined constant will not evaluate to "" but rather to the string of its own name. Thus on PHP versions lacking the predefined PATH_SEPARATOR constant, it will attempt to use the string "PATH_SEPARATOR" when constructing the include path. Additionally a warning or notice message may be produced, depending on error reporting settings. Use the defined() function to determine if a constant is defined.
ok, then take this one: http://www.gknw.com/test/mediawiki/mydiff1-1.5 #============================================================================ # http://sourceforge.net/projects/wikipedia/ # MediaWiki 1.5rc4 patch to provide better path separator choose # Apply this patch with: patch -p 0 -b -i mydiff1-1.5 #============================================================================ --- config/index.php.orig Sat Aug 13 09:31:32 2005 +++ config/index.php Thu Sep 01 19:41:36 2005 @@ -114,7 +114,11 @@ # As a dirty hack, we'll try to set up the include path first. # $IP = dirname( dirname( __FILE__ ) ); -$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +if (defined(PATH_SEPARATOR)) { + $sep = PATH_SEPARATOR; +} else { + $sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +} ini_set( "include_path", ".$sep$IP$sep$IP/includes$sep$IP/languages" ); define( "MEDIAWIKI", true ); @@ -1070,7 +1074,11 @@ $slconf['RightsIcon'] = $conf->RightsIcon; } - $sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; + if (defined(PATH_SEPARATOR)) { + $sep = PATH_SEPARATOR; + } else { + $sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; + } $localsettings = " # This file was automatically generated by the MediaWiki installer. # If you make manual changes, please keep track in case you need to #============================================================================ --- maintenance/importPhase2.php.orig Mon Feb 21 16:33:46 2005 +++ maintenance/importPhase2.php Thu Sep 01 19:46:29 2005 @@ -48,7 +48,11 @@ $wgDBuser = $wgDBadminuser; $wgDBpassword = $wgDBadminpassword; -$sep = ( DIRECTORY_SEPARATOR == "\\" ) ? ";" : ":"; +if (defined(PATH_SEPARATOR)) { + $sep = PATH_SEPARATOR; +} else { + $sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +} ini_set( "include_path", "$IP$sep$include_path" ); require_once( "Setup.php" ); #============================================================================ see also: http://www.gknw.com/test/mediawiki/mydiff2-1.5 thanks, Guenter.
Closer, but this will still cause a notice warning due to use of the undefined constant. You need to pass a string here, as: defined( "PATH_SEPARATOR" )
next round entered: http://www.gknw.com/test/mediawiki/mediawiki-1.4.x.diff #============================================================================ # http://sourceforge.net/projects/wikipedia/ # MediaWiki 1.4.x patch to provide better path separator choose # Apply this patch with: patch -p 1 -i mediawiki-1.4.x.diff #============================================================================ diff -ur mediawiki-1.4.12\config\index.php mediawiki-1.4.12p\config\index.php --- mediawiki-1.4.12\config\index.phpThu Jun 23 00:08:02 2005 +++ mediawiki-1.4.12p\config\index.phpSat Nov 05 15:55:28 2005 @@ -113,7 +113,11 @@ # As a dirty hack, we'll try to set up the include path first. # $IP = dirname( dirname( __FILE__ ) ); -$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +if (defined("PATH_SEPARATOR")) { +$sep = PATH_SEPARATOR; +} else { +$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +} ini_set( "include_path", ".$sep$IP$sep$IP/includes$sep$IP/languages" ); define( "MEDIAWIKI", true ); @@ -903,7 +907,11 @@ $slconf['RightsIcon'] = $conf->RightsIcon; } -$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +if (defined("PATH_SEPARATOR")) { +$sep = PATH_SEPARATOR; +} else { +$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +} $localsettings = " # This file was automatically generated by the MediaWiki installer. # If you make manual changes, please keep track in case you need to diff -ur mediawiki-1.4.12\maintenance\commandLine.inc mediawiki-1.4. 12p\maintenance\commandLine.inc --- mediawiki-1.4.12\maintenance\commandLine.incFri Jun 24 23:39:28 2005 +++ mediawiki-1.4.12p\maintenance\commandLine.incSat Nov 05 16:01:48 2005 @@ -75,7 +75,11 @@ $wgCommandLineMode = true; # Turn off output buffering if it's on @ob_end_flush(); -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; +if (defined("PATH_SEPARATOR")) { +$sep = PATH_SEPARATOR; +} else { +$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +} if (!isset( $wgUseNormalUser ) ) { $wgUseNormalUser = false; diff -ur mediawiki-1.4.12\maintenance\importPhase2.php mediawiki-1.4. 12p\maintenance\importPhase2.php --- mediawiki-1.4.12\maintenance\importPhase2.phpSun Nov 14 23:50:24 2004 +++ mediawiki-1.4.12p\maintenance\importPhase2.phpSat Nov 05 15:59:10 2005 @@ -48,7 +48,11 @@ $wgDBuser = $wgDBadminuser; $wgDBpassword = $wgDBadminpassword; -$sep = ( DIRECTORY_SEPARATOR == "\\" ) ? ";" : ":"; +if (defined("PATH_SEPARATOR")) { +$sep = PATH_SEPARATOR; +} else { +$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +} ini_set( "include_path", "$IP$sep$include_path" ); require_once( "Setup.php" ); diff -ur mediawiki-1.4.12\maintenance\liveCmdLine.inc mediawiki-1.4. 12p\maintenance\liveCmdLine.inc --- mediawiki-1.4.12\maintenance\liveCmdLine.incSat Nov 20 05:23:52 2004 +++ mediawiki-1.4.12p\maintenance\liveCmdLine.incSat Nov 05 16:01:46 2005 @@ -38,7 +38,11 @@ $wgDBadminpassword = trim(`wikiadmin_pass`); } -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; +if (defined("PATH_SEPARATOR")) { +$sep = PATH_SEPARATOR; +} else { +$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +} putenv( "wikilang=$lang"); $newpath = "/home/wikipedia/common/php-new$sep";
and here for 1.5.2: http://www.gknw.com/test/mediawiki/mediawiki-1.5.2.diff #============================================================================ # http://sourceforge.net/projects/wikipedia/ # MediaWiki 1.5.2 patch to provide better path separator choose # Apply this patch with: patch -p 1 -i mediawiki-1.5.2.diff #============================================================================ diff -ur mediawiki-1.5.2\config\index.php mediawiki-1.5.2p\config\index.php --- mediawiki-1.5.2\config\index.phpFri Oct 28 11:02:36 2005 +++ mediawiki-1.5.2p\config\index.phpSat Nov 05 16:59:10 2005 @@ -114,7 +114,11 @@ # As a dirty hack, we'll try to set up the include path first. # $IP = dirname( dirname( __FILE__ ) ); -$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +if (defined("PATH_SEPARATOR")) { +$sep = PATH_SEPARATOR; +} else { +$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +} ini_set( "include_path", ".$sep$IP$sep$IP/includes$sep$IP/languages" ); define( "MEDIAWIKI", true ); @@ -1107,7 +1111,11 @@ $slconf['RightsIcon'] = $conf->RightsIcon; } -$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +if (defined("PATH_SEPARATOR")) { +$sep = PATH_SEPARATOR; +} else { +$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +} $localsettings = " # This file was automatically generated by the MediaWiki installer. # If you make manual changes, please keep track in case you need to diff -ur mediawiki-1.5.2\maintenance\commandLine.inc mediawiki-1.5. 2p\maintenance\commandLine.inc --- mediawiki-1.5.2\maintenance\commandLine.incSat Jul 02 11:05:00 2005 +++ mediawiki-1.5.2p\maintenance\commandLine.incSat Nov 05 16:59:30 2005 @@ -76,7 +76,11 @@ $wgCommandLineMode = true; # Turn off output buffering if it's on @ob_end_flush(); -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; +if (defined("PATH_SEPARATOR")) { +$sep = PATH_SEPARATOR; +} else { +$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +} if (!isset( $wgUseNormalUser ) ) { $wgUseNormalUser = false; diff -ur mediawiki-1.5.2\maintenance\importPhase2.php mediawiki-1.5. 2p\maintenance\importPhase2.php --- mediawiki-1.5.2\maintenance\importPhase2.phpMon Feb 21 16:33:46 2005 +++ mediawiki-1.5.2p\maintenance\importPhase2.phpSat Nov 05 16:59:42 2005 @@ -48,7 +48,11 @@ $wgDBuser = $wgDBadminuser; $wgDBpassword = $wgDBadminpassword; -$sep = ( DIRECTORY_SEPARATOR == "\\" ) ? ";" : ":"; +if (defined("PATH_SEPARATOR")) { +$sep = PATH_SEPARATOR; +} else { +$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +} ini_set( "include_path", "$IP$sep$include_path" ); require_once( "Setup.php" ); diff -ur mediawiki-1.5.2\maintenance\liveCmdLine.inc mediawiki-1.5. 2p\maintenance\liveCmdLine.inc --- mediawiki-1.5.2\maintenance\liveCmdLine.incSat Nov 20 05:23:52 2004 +++ mediawiki-1.5.2p\maintenance\liveCmdLine.incSat Nov 05 16:59:36 2005 @@ -38,7 +38,11 @@ $wgDBadminpassword = trim(`wikiadmin_pass`); } -$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":"; +if (defined("PATH_SEPARATOR")) { +$sep = PATH_SEPARATOR; +} else { +$sep = (DIRECTORY_SEPARATOR == "\\") ? ";" : ":"; +} putenv( "wikilang=$lang"); $newpath = "/home/wikipedia/common/php-new$sep";
Reducing priority; NetWare is not exactly a target OS. :) Can you check if 1.6 in CVS has already fixed this? I seem to remember changing things.
Resolving as FIXED, since we use PATH_SEPARATOR and DIRECTORY_SEPARATOR exclusively now, as we no longer support older versions of PHP lacking it.