From: Brion Vibber Date: Thu, 28 Jun 2007 14:50:06 +0000 (+0000) Subject: * (bug 10387) Detect and handle '.php5' extension environments at install time X-Git-Tag: 1.31.0-rc.0~52361 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/membres/fiche.php?a=commitdiff_plain;h=13b739ec461d845cd8eb719fca97df6cfd13a64a;p=lhc%2Fweb%2Fwiklou.git * (bug 10387) Detect and handle '.php5' extension environments at install time Patch by Edward Z. Yang. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 468461879e..95b5de4f05 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -110,6 +110,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 6711) Add $wgAddGroups and $wgRemoveGroups to allow finer control over usergroup assignment. * Introduce 'UserEffectiveGroups' hook; see docs/hooks.txt for more information +* (bug 10387) Detect and handle '.php5' extension environments at install time + Patch by Edward Z. Yang. + == Bugfixes since 1.10 == diff --git a/api.php5 b/api.php5 new file mode 100644 index 0000000000..5c225e2f48 --- /dev/null +++ b/api.php5 @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/config/index.php b/config/index.php index ce18bac596..3f663379d8 100644 --- a/config/index.php +++ b/config/index.php @@ -201,7 +201,8 @@ $ourdb['postgres']['rootuser'] = 'postgres'; /* Check for existing configurations and bug out! */ if( file_exists( "../LocalSettings.php" ) ) { - dieout( "

Setup has completed, your wiki is configured.

+ $script = defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php'; + dieout( "

Setup has completed, your wiki is configured.

Please delete the /config directory for extra security.

" ); } @@ -393,10 +394,11 @@ if( ini_get( "safe_mode" ) ) { $sapi = php_sapi_name(); print "
  • PHP server API is $sapi; "; +$script = defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php'; if( $wgUsePathInfo ) { - print "ok, using pretty URLs (index.php/Page_Title)"; + print "ok, using pretty URLs ($script/Page_Title)"; } else { - print "using ugly URLs (index.php?title=Page_Title)"; + print "using ugly URLs ($script?title=Page_Title)"; } print "
  • \n"; @@ -549,6 +551,18 @@ $path = ($_SERVER["PHP_SELF"] === '') $conf->ScriptPath = preg_replace( '{^(.*)/config.*$}', '$1', $path ); print "
  • Script URI path: " . htmlspecialchars( $conf->ScriptPath ) . "
  • \n"; + + +// We may be installing from *.php5 extension file, if so, print message +$conf->ScriptExtension = '.php'; +if (defined('MW_INSTALL_PHP5_EXT')) { + $conf->ScriptExtension = '.php5'; + print "
  • Installing MediaWiki with php5 file extensions
  • \n"; +} else { + print "
  • Installing MediaWiki with php file extensions
  • \n"; +} + + print "
  • Environment checked. You can install MediaWiki.
  • \n"; $conf->posted = ($_SERVER["REQUEST_METHOD"] == "POST"); @@ -631,7 +645,7 @@ $wgAuth = new AuthPlugin(); if( $conf->SysopName ) { # Check that the user can be created $u = User::newFromName( $conf->SysopName ); - if( $u instanceof User ) { + if( is_a($u, 'User') ) { // please do not use instanceof, it breaks PHP4 # Various password checks if( $conf->SysopPass != '' ) { if( $conf->SysopPass == $conf->SysopPass2 ) { @@ -1097,7 +1111,7 @@ if( count( $errs ) ) { } ?> -
    +

    Site config

    @@ -1148,7 +1162,8 @@ if( count( $errs ) ) {
  • ScriptPath}/config/index.php?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" ); + $script = defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php'; + $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/$script?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" ); $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" ); $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" ); print "choose"; @@ -1418,6 +1433,7 @@ window.onload = toggleDBarea('DBtype; ?>', /* -------------------------------------------------------------------------------------- */ function writeSuccessMessage() { + $script = defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php'; if ( ini_get( 'safe_mode' ) && !ini_get( 'open_basedir' ) ) { echo << @@ -1427,7 +1443,7 @@ function writeSuccessMessage() {
  • Download config/LocalSettings.php with your FTP client or file manager
  • Upload it to the parent directory
  • Delete config/LocalSettings.php
  • -
  • Start using your wiki! +
  • Start using your wiki!

    If you are in a shared hosting environment, do not just move LocalSettings.php remotely. LocalSettings.php is currently owned by the user your webserver is running under, @@ -1441,7 +1457,7 @@ EOT;

    Installation successful! Move the config/LocalSettings.php file to the parent directory, then follow - this link to your wiki.

    + this link to your wiki.

    You should change file permissions for LocalSettings.php as required to prevent other users on the server reading passwords and altering configuration data.

    @@ -1568,6 +1584,7 @@ if ( \$wgCommandLineMode ) { ## The URL base path to the directory containing the wiki; ## defaults for all runtime URL paths are based off of this. \$wgScriptPath = \"{$slconf['ScriptPath']}\"; +\$wgScriptExtension = \"{$slconf['ScriptExtension']}\"; ## For more information on customizing the URLs please see: ## http://www.mediawiki.org/wiki/Manual:Short_URL diff --git a/config/index.php5 b/config/index.php5 new file mode 100644 index 0000000000..1be08780e8 --- /dev/null +++ b/config/index.php5 @@ -0,0 +1,6 @@ + diff --git a/img_auth.php5 b/img_auth.php5 new file mode 100644 index 0000000000..2065de9328 --- /dev/null +++ b/img_auth.php5 @@ -0,0 +1 @@ + diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 62f08685cd..a97993b59e 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -125,8 +125,9 @@ $wgUsePathInfo = * in LocalSettings.php. Generally you should not need to change this * unless you don't like seeing "index.php". */ -$wgScript = false; /// defaults to "{$wgScriptPath}/index.php" -$wgRedirectScript = false; /// defaults to "{$wgScriptPath}/redirect.php" +$wgScriptExtension = '.php'; /// extension to append to script names by default +$wgScript = false; /// defaults to "{$wgScriptPath}/index{$wgScriptExtension}" +$wgRedirectScript = false; /// defaults to "{$wgScriptPath}/redirect{$wgScriptExtension}" /**#@-*/ @@ -443,7 +444,7 @@ $wgUploadNavigationUrl = false; * apache servers don't have read/write access to the thumbnail path. * * Example: - * $wgThumbnailScriptPath = "{$wgScriptPath}/thumb.php"; + * $wgThumbnailScriptPath = "{$wgScriptPath}/thumb{$wgScriptExtension}"; */ $wgThumbnailScriptPath = false; $wgSharedThumbnailScriptPath = false; diff --git a/includes/Setup.php b/includes/Setup.php index 21343a699a..7c1bb913ec 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -28,8 +28,8 @@ if ( !isset( $wgVersion ) ) { } // Set various default paths sensibly... -if( $wgScript === false ) $wgScript = "$wgScriptPath/index.php"; -if( $wgRedirectScript === false ) $wgRedirectScript = "$wgScriptPath/redirect.php"; +if( $wgScript === false ) $wgScript = "$wgScriptPath/index$wgScriptExtension"; +if( $wgRedirectScript === false ) $wgRedirectScript = "$wgScriptPath/redirect$wgScriptExtension"; if( $wgArticlePath === false ) { if( $wgUsePathInfo ) { diff --git a/index.php5 b/index.php5 new file mode 100644 index 0000000000..85236494a6 --- /dev/null +++ b/index.php5 @@ -0,0 +1 @@ + diff --git a/install-utils.inc b/install-utils.inc index 24480f9165..9723e8dc26 100644 --- a/install-utils.inc +++ b/install-utils.inc @@ -11,7 +11,9 @@ function install_version_checks() { die( -1 ); } if( version_compare( phpversion(), '5.0.0' ) < 0 ) { - echo "PHP 5.0.0 or higher is required. ABORTING.\n"; + echo "PHP 5.0.0 or higher is required. If PHP 5 is available only when \n". + "PHP files have a .php5 extension, please navigate to index.php5 \n". + "to continue installation. ABORTING.\n"; die( -1 ); } @@ -122,4 +124,4 @@ function mw_get_session_save_path() { return $path; } -?> \ No newline at end of file +?> diff --git a/redirect.php5 b/redirect.php5 new file mode 100644 index 0000000000..5465295dee --- /dev/null +++ b/redirect.php5 @@ -0,0 +1 @@ + diff --git a/thumb.php5 b/thumb.php5 new file mode 100644 index 0000000000..f5c4c06447 --- /dev/null +++ b/thumb.php5 @@ -0,0 +1 @@ +