r23505 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23504‎ | r23505 | r23506 >
Date:14:50, 28 June 2007
Author:brion
Status:old
Tags:
Comment:
* (bug 10387) Detect and handle '.php5' extension environments at install time
Patch by Edward Z. Yang.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/api.php5 (added) (history)
  • /trunk/phase3/config/index.php (modified) (history)
  • /trunk/phase3/config/index.php5 (added) (history)
  • /trunk/phase3/img_auth.php5 (added) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/Setup.php (modified) (history)
  • /trunk/phase3/index.php5 (added) (history)
  • /trunk/phase3/install-utils.inc (modified) (history)
  • /trunk/phase3/redirect.php5 (added) (history)
  • /trunk/phase3/thumb.php5 (added) (history)

Diff [purge]

Index: trunk/phase3/includes/Setup.php
@@ -28,8 +28,8 @@
2929 }
3030
3131 // Set various default paths sensibly...
32 -if( $wgScript === false ) $wgScript = "$wgScriptPath/index.php";
33 -if( $wgRedirectScript === false ) $wgRedirectScript = "$wgScriptPath/redirect.php";
 32+if( $wgScript === false ) $wgScript = "$wgScriptPath/index$wgScriptExtension";
 33+if( $wgRedirectScript === false ) $wgRedirectScript = "$wgScriptPath/redirect$wgScriptExtension";
3434
3535 if( $wgArticlePath === false ) {
3636 if( $wgUsePathInfo ) {
Index: trunk/phase3/includes/DefaultSettings.php
@@ -125,8 +125,9 @@
126126 * in LocalSettings.php. Generally you should not need to change this
127127 * unless you don't like seeing "index.php".
128128 */
129 -$wgScript = false; /// defaults to "{$wgScriptPath}/index.php"
130 -$wgRedirectScript = false; /// defaults to "{$wgScriptPath}/redirect.php"
 129+$wgScriptExtension = '.php'; /// extension to append to script names by default
 130+$wgScript = false; /// defaults to "{$wgScriptPath}/index{$wgScriptExtension}"
 131+$wgRedirectScript = false; /// defaults to "{$wgScriptPath}/redirect{$wgScriptExtension}"
131132 /**#@-*/
132133
133134
@@ -443,7 +444,7 @@
444445 * apache servers don't have read/write access to the thumbnail path.
445446 *
446447 * Example:
447 - * $wgThumbnailScriptPath = "{$wgScriptPath}/thumb.php";
 448+ * $wgThumbnailScriptPath = "{$wgScriptPath}/thumb{$wgScriptExtension}";
448449 */
449450 $wgThumbnailScriptPath = false;
450451 $wgSharedThumbnailScriptPath = false;
Index: trunk/phase3/img_auth.php5
@@ -0,0 +1 @@
 2+<?php require './img_auth.php'; ?>
Index: trunk/phase3/install-utils.inc
@@ -11,7 +11,9 @@
1212 die( -1 );
1313 }
1414 if( version_compare( phpversion(), '5.0.0' ) < 0 ) {
15 - echo "PHP 5.0.0 or higher is required. ABORTING.\n";
 15+ echo "PHP 5.0.0 or higher is required. If PHP 5 is available only when \n".
 16+ "PHP files have a .php5 extension, please navigate to <a href=\"index.php5\">index.php5</a> \n".
 17+ "to continue installation. ABORTING.\n";
1618 die( -1 );
1719 }
1820
@@ -122,4 +124,4 @@
123125 return $path;
124126 }
125127
126 -?>
\ No newline at end of file
 128+?>
Index: trunk/phase3/redirect.php5
@@ -0,0 +1 @@
 2+<?php require './redirect.php'; ?>
Index: trunk/phase3/index.php5
@@ -0,0 +1 @@
 2+<?php require './index.php'; ?>
Index: trunk/phase3/api.php5
@@ -0,0 +1,2 @@
 2+<?php require 'api.php'; ?>
 3+<?php require 'api.php'; ?>
\ No newline at end of file
Index: trunk/phase3/thumb.php5
@@ -0,0 +1 @@
 2+<?php require './thumb.php'; ?>
Index: trunk/phase3/config/index.php5
@@ -0,0 +1,6 @@
 2+<?php
 3+
 4+define('MW_INSTALL_PHP5_EXT', 1);
 5+require './index.php';
 6+
 7+?>
Index: trunk/phase3/config/index.php
@@ -201,7 +201,8 @@
202202 /* Check for existing configurations and bug out! */
203203
204204 if( file_exists( "../LocalSettings.php" ) ) {
205 - dieout( "<p><strong>Setup has completed, <a href='../index.php'>your wiki</a> is configured.</strong></p>
 205+ $script = defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php';
 206+ dieout( "<p><strong>Setup has completed, <a href='../$script'>your wiki</a> is configured.</strong></p>
206207
207208 <p>Please delete the /config directory for extra security.</p></div></div></div></div>" );
208209 }
@@ -393,10 +394,11 @@
394395
395396 $sapi = php_sapi_name();
396397 print "<li>PHP server API is $sapi; ";
 398+$script = defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php';
397399 if( $wgUsePathInfo ) {
398 - print "ok, using pretty URLs (<tt>index.php/Page_Title</tt>)";
 400+ print "ok, using pretty URLs (<tt>$script/Page_Title</tt>)";
399401 } else {
400 - print "using ugly URLs (<tt>index.php?title=Page_Title</tt>)";
 402+ print "using ugly URLs (<tt>$script?title=Page_Title</tt>)";
401403 }
402404 print "</li>\n";
403405
@@ -549,6 +551,18 @@
550552 $conf->ScriptPath = preg_replace( '{^(.*)/config.*$}', '$1', $path );
551553 print "<li>Script URI path: <tt>" . htmlspecialchars( $conf->ScriptPath ) . "</tt></li>\n";
552554
 555+
 556+
 557+// We may be installing from *.php5 extension file, if so, print message
 558+$conf->ScriptExtension = '.php';
 559+if (defined('MW_INSTALL_PHP5_EXT')) {
 560+ $conf->ScriptExtension = '.php5';
 561+ print "<li>Installing MediaWiki with <tt>php5</tt> file extensions</li>\n";
 562+} else {
 563+ print "<li>Installing MediaWiki with <tt>php</tt> file extensions</li>\n";
 564+}
 565+
 566+
553567 print "<li style='font-weight:bold;color:green;font-size:110%'>Environment checked. You can install MediaWiki.</li>\n";
554568 $conf->posted = ($_SERVER["REQUEST_METHOD"] == "POST");
555569
@@ -631,7 +645,7 @@
632646 if( $conf->SysopName ) {
633647 # Check that the user can be created
634648 $u = User::newFromName( $conf->SysopName );
635 - if( $u instanceof User ) {
 649+ if( is_a($u, 'User') ) { // please do not use instanceof, it breaks PHP4
636650 # Various password checks
637651 if( $conf->SysopPass != '' ) {
638652 if( $conf->SysopPass == $conf->SysopPass2 ) {
@@ -1097,7 +1111,7 @@
10981112 }
10991113 ?>
11001114
1101 -<form action="index.php" name="config" method="post">
 1115+<form action="<?php echo defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php'; ?>" name="config" method="post">
11021116
11031117
11041118 <h2>Site config</h2>
@@ -1148,7 +1162,8 @@
11491163 <li><?php
11501164 aField( $conf, "License", "A Creative Commons license - ", "radio", "cc" );
11511165 $partner = "MediaWiki";
1152 - $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/index.php?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
 1166+ $script = defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php';
 1167+ $exit = urlencode( "$wgServer{$conf->ScriptPath}/config/$script?License=cc&RightsUrl=[license_url]&RightsText=[license_name]&RightsCode=[license_code]&RightsIcon=[license_button]" );
11531168 $icon = urlencode( "$wgServer$wgUploadPath/wiki.png" );
11541169 $ccApp = htmlspecialchars( "http://creativecommons.org/license/?partner=$partner&exit_url=$exit&partner_icon_url=$icon" );
11551170 print "<a href=\"$ccApp\" target='_blank'>choose</a>";
@@ -1418,6 +1433,7 @@
14191434
14201435 /* -------------------------------------------------------------------------------------- */
14211436 function writeSuccessMessage() {
 1437+ $script = defined('MW_INSTALL_PHP5_EXT') ? 'index.php5' : 'index.php';
14221438 if ( ini_get( 'safe_mode' ) && !ini_get( 'open_basedir' ) ) {
14231439 echo <<<EOT
14241440 <div class="success-box">
@@ -1427,7 +1443,7 @@
14281444 <li>Download config/LocalSettings.php with your FTP client or file manager</li>
14291445 <li>Upload it to the parent directory</li>
14301446 <li>Delete config/LocalSettings.php</li>
1431 - <li>Start using <a href='../index.php'>your wiki</a>!
 1447+ <li>Start using <a href='../$script'>your wiki</a>!
14321448 </ol>
14331449 <p>If you are in a shared hosting environment, do <strong>not</strong> just move LocalSettings.php
14341450 remotely. LocalSettings.php is currently owned by the user your webserver is running under,
@@ -1441,7 +1457,7 @@
14421458 <p>
14431459 <span class="success-message">Installation successful!</span>
14441460 Move the <tt>config/LocalSettings.php</tt> file to the parent directory, then follow
1445 -<a href="../index.php"> this link</a> to your wiki.</p>
 1461+<a href="../$script"> this link</a> to your wiki.</p>
14461462 <p>You should change file permissions for <tt>LocalSettings.php</tt> as required to
14471463 prevent other users on the server reading passwords and altering configuration data.</p>
14481464 </div>
@@ -1568,6 +1584,7 @@
15691585 ## The URL base path to the directory containing the wiki;
15701586 ## defaults for all runtime URL paths are based off of this.
15711587 \$wgScriptPath = \"{$slconf['ScriptPath']}\";
 1588+\$wgScriptExtension = \"{$slconf['ScriptExtension']}\";
15721589
15731590 ## For more information on customizing the URLs please see:
15741591 ## http://www.mediawiki.org/wiki/Manual:Short_URL
Index: trunk/phase3/RELEASE-NOTES
@@ -110,7 +110,10 @@
111111 * (bug 6711) Add $wgAddGroups and $wgRemoveGroups to allow finer control over
112112 usergroup assignment.
113113 * Introduce 'UserEffectiveGroups' hook; see docs/hooks.txt for more information
 114+* (bug 10387) Detect and handle '.php5' extension environments at install time
 115+ Patch by Edward Z. Yang.
114116
 117+
115118 == Bugfixes since 1.10 ==
116119
117120 * (bug 9712) Use Arabic comma in date/time formats for Arabic and Farsi

Follow-up revisions

RevisionCommit summaryAuthorDate
r23581Merged revisions 23406-23580 via svnmerge from...david04:50, 30 June 2007

Status & tagging log