r82845 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82844‎ | r82845 | r82846 >
Date:12:35, 26 February 2011
Author:maxsem
Status:ok (Comments)
Tags:
Comment:
(bug 1379) Installer directory conflicts with some hosts' configuration panel.

Renamed config/ to mw-config/, however left aliases for b/c.
Modified paths:
  • /trunk/phase3/HISTORY (modified) (history)
  • /trunk/phase3/INSTALL (modified) (history)
  • /trunk/phase3/config (replaced) (history)
  • /trunk/phase3/config/OBSOLETE (added) (history)
  • /trunk/phase3/config/index.php (added) (history)
  • /trunk/phase3/config/index.php5 (added) (history)
  • /trunk/phase3/docs/distributors.txt (modified) (history)
  • /trunk/phase3/docs/scripts.txt (modified) (history)
  • /trunk/phase3/includes/WebStart.php (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)
  • /trunk/phase3/includes/installer/WebInstaller.php (modified) (history)
  • /trunk/phase3/includes/templates/NoLocalSettings.php (modified) (history)
  • /trunk/phase3/includes/templates/PHP4.php (modified) (history)
  • /trunk/phase3/mw-config (added) (history)

Diff [purge]

Index: trunk/phase3/docs/scripts.txt
@@ -61,5 +61,5 @@
6262 the web server needs a .php5 to run the file with the PHP 5 engine and runs .php
6363 scripts with PHP 4. To use these files, you have to modify $wgScriptExtension to
6464 '.php5' is LocalSettings.php but it is already done by the config script if you
65 -used config/index.php5 for installation.
 65+used mw-config/index.php5 for installation.
6666
Index: trunk/phase3/docs/distributors.txt
@@ -61,7 +61,7 @@
6262 * api.php, img_auth.php, index.php,opensearch_desc.php, profileinfo.php,
6363 redirect.php, thumb.php, trackback.php. These are the entry points for
6464 normal usage. This list may be incomplete and is subject to change.
65 - * config/index.php: Used for web-based installation (sets up the database,
 65+ * mw-config/index.php: Used for web-based installation (sets up the database,
6666 prompts for the name of the wiki, etc.). No command-line installation is
6767 currently available.
6868 * images/: Used for uploaded files. This could be somewhere else if
@@ -83,13 +83,13 @@
8484 == Configuration ==
8585
8686 MediaWiki is configured using LocalSettings.php. This is a PHP file that's
87 -generated when the user visits config/index.php to install the software, and
 87+generated when the user visits mw-config/index.php to install the software, and
8888 which the user can edit by hand thereafter. It's just a plain old PHP file,
8989 and can contain any PHP statements. It usually sets global variables that are
9090 used for configuration, and includes files used by any extensions.
9191
9292 Distributors cannot easily add extra statements to the autogenerated
93 -LocalSettings.php at the present time -- although hacking config/index.php
 93+LocalSettings.php at the present time -- although hacking mw-config/index.php
9494 would work. It would be nice if this situation could be improved.
9595
9696 Some configuration options that distributors might be in a position to set
Index: trunk/phase3/HISTORY
@@ -451,6 +451,7 @@
452452 * (bug 18372) $wgFileExtensions will now override $wgFileBlacklist
453453 * (bug 25512) Subcategory list should not include category prefix for members.
454454 * (bug 20244) Installer does not validate SQLite database directory for stable path
 455+* (bug 1379) Installer directory conflicts with some hosts' configuration panel.
455456
456457 === API changes in 1.17 ===
457458 * (bug 22738) Allow filtering by action type on query=logevent.
Index: trunk/phase3/INSTALL
@@ -65,7 +65,7 @@
6666 way (yet) to get it after you exit the installer. Place it in the main wiki
6767 directory, and the wiki should now be working.
6868
69 -Once the wiki is set up, you should remove the config directory (though it will
 69+Once the wiki is set up, you should remove the mw-config directory (though it will
7070 refuse to config again if the wiki is set up).
7171
7272 ----
Index: trunk/phase3/includes/installer/WebInstaller.php
@@ -316,7 +316,7 @@
317317 /**
318318 * Get a hash of data identifying this MW installation.
319319 *
320 - * This is used by config/index.php to prevent multiple installations of MW
 320+ * This is used by mw-config/index.php to prevent multiple installations of MW
321321 * on the same cookie domain from interfering with each other.
322322 */
323323 public function getFingerprint() {
Index: trunk/phase3/includes/installer/Installer.php
@@ -485,7 +485,7 @@
486486 * On POSIX systems return the primary group of the webserver we're running under.
487487 * On other systems just returns null.
488488 *
489 - * This is used to advice the user that he should chgrp his config/data/images directory as the
 489+ * This is used to advice the user that he should chgrp his mw-config/data/images directory as the
490490 * webserver user before he can install.
491491 *
492492 * Public because SqliteInstaller needs it, and doesn't subclass Installer.
Index: trunk/phase3/includes/WebStart.php
@@ -104,7 +104,7 @@
105105
106106 # LocalSettings.php is the per site customization file. If it does not exist
107107 # the wiki installer needs to be launched or the generated file moved from
108 - # ./config/ to ./
 108+ # ./mw-config/ to ./
109109 if( !file_exists( MW_CONFIG_FILE ) ) {
110110 require_once( "$IP/includes/templates/NoLocalSettings.php" );
111111 die();
Index: trunk/phase3/includes/templates/PHP4.php
@@ -19,7 +19,7 @@
2020 } else {
2121 $scriptUrl = '';
2222 }
23 -if ( preg_match( '!^(.*)/config/[^/]*.php$!', $scriptUrl, $m ) ) {
 23+if ( preg_match( '!^(.*)/(mw-)?config/[^/]*.php$!', $scriptUrl, $m ) ) {
2424 $baseUrl = $m[1];
2525 } elseif ( preg_match( '!^(.*)/[^/]*.php$!', $scriptUrl, $m ) ) {
2626 $baseUrl = $m[1];
Index: trunk/phase3/includes/templates/NoLocalSettings.php
@@ -52,9 +52,9 @@
5353 <p>
5454 <?php
5555 if ( $installerStarted ) {
56 - echo( "Please <a href=\"" . htmlspecialchars( $path ) . "config/index." . htmlspecialchars( $ext ) . "\"> complete the installation</a> and download LocalSettings.php." );
 56+ echo( "Please <a href=\"" . htmlspecialchars( $path ) . "mw-config/index." . htmlspecialchars( $ext ) . "\"> complete the installation</a> and download LocalSettings.php." );
5757 } else {
58 - echo( "Please <a href=\"" . htmlspecialchars( $path ) . "config/index." . htmlspecialchars( $ext ) . "\"> set up the wiki</a> first." );
 58+ echo( "Please <a href=\"" . htmlspecialchars( $path ) . "mw-config/index." . htmlspecialchars( $ext ) . "\"> set up the wiki</a> first." );
5959 }
6060 ?>
6161 </p>
Index: trunk/phase3/mw-config/index.php5
@@ -0,0 +1,4 @@
 2+<?php
 3+
 4+define('MW_INSTALL_PHP5_EXT', 1);
 5+require './index.php';
Property changes on: trunk/phase3/mw-config/index.php5
___________________________________________________________________
Added: svn:eol-style
16 + native
Index: trunk/phase3/mw-config/index.php
@@ -0,0 +1,50 @@
 2+<?php
 3+/**
 4+ * New version of MediaWiki web-based config/installation
 5+ *
 6+ * @file
 7+ */
 8+
 9+define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' );
 10+define( 'MEDIAWIKI_INSTALL', true );
 11+
 12+chdir( dirname( dirname( __FILE__ ) ) );
 13+require( dirname( dirname( __FILE__ ) ) . '/includes/WebStart.php' );
 14+
 15+wfInstallerMain();
 16+
 17+function wfInstallerMain() {
 18+ global $wgRequest, $wgLang, $wgMetaNamespace, $wgCanonicalNamespaceNames;
 19+
 20+ $installer = new WebInstaller( $wgRequest );
 21+
 22+ if ( !$installer->startSession() ) {
 23+ $installer->finish();
 24+ exit;
 25+ }
 26+
 27+ $fingerprint = $installer->getFingerprint();
 28+ if ( isset( $_SESSION['installData'][$fingerprint] ) ) {
 29+ $session = $_SESSION['installData'][$fingerprint];
 30+ } else {
 31+ $session = array();
 32+ }
 33+
 34+ if ( isset( $session['settings']['_UserLang'] ) ) {
 35+ $langCode = $session['settings']['_UserLang'];
 36+ } elseif ( !is_null( $wgRequest->getVal( 'UserLang' ) ) ) {
 37+ $langCode = $wgRequest->getVal( 'UserLang' );
 38+ } else {
 39+ $langCode = 'en';
 40+ }
 41+ $wgLang = Language::factory( $langCode );
 42+
 43+ $installer->setParserLanguage( $wgLang );
 44+
 45+ $wgMetaNamespace = $wgCanonicalNamespaceNames[NS_PROJECT];
 46+
 47+ $session = $installer->execute( $session );
 48+
 49+ $_SESSION['installData'][$fingerprint] = $session;
 50+
 51+}
Property changes on: trunk/phase3/mw-config/index.php
___________________________________________________________________
Added: svn:eol-style
152 + native
Property changes on: trunk/phase3/mw-config
___________________________________________________________________
Added: svn:ignore
253 + LocalSettings.php
Index: trunk/phase3/config/index.php5
@@ -1,4 +1 @@
2 -<?php
3 -
4 -define('MW_INSTALL_PHP5_EXT', 1);
5 -require './index.php';
 2+<?php require( dirname( dirname( __FILE__ ) ) . '/mw-config/index.php5' );
\ No newline at end of file
Property changes on: trunk/phase3/config/index.php5
___________________________________________________________________
Deleted: svn:eol-style
63 - native
Index: trunk/phase3/config/OBSOLETE
@@ -0,0 +1,2 @@
 2+This is a back-compat directory for installer, which resides in mw-config/ now.
 3+It will probably be remved in 1.19.
\ No newline at end of file
Index: trunk/phase3/config/index.php
@@ -1,50 +1 @@
2 -<?php
3 -/**
4 - * New version of MediaWiki web-based config/installation
5 - *
6 - * @file
7 - */
8 -
9 -define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' );
10 -define( 'MEDIAWIKI_INSTALL', true );
11 -
12 -chdir( dirname( dirname( __FILE__ ) ) );
13 -require( dirname( dirname( __FILE__ ) ) . '/includes/WebStart.php' );
14 -
15 -wfInstallerMain();
16 -
17 -function wfInstallerMain() {
18 - global $wgRequest, $wgLang, $wgMetaNamespace, $wgCanonicalNamespaceNames;
19 -
20 - $installer = new WebInstaller( $wgRequest );
21 -
22 - if ( !$installer->startSession() ) {
23 - $installer->finish();
24 - exit;
25 - }
26 -
27 - $fingerprint = $installer->getFingerprint();
28 - if ( isset( $_SESSION['installData'][$fingerprint] ) ) {
29 - $session = $_SESSION['installData'][$fingerprint];
30 - } else {
31 - $session = array();
32 - }
33 -
34 - if ( isset( $session['settings']['_UserLang'] ) ) {
35 - $langCode = $session['settings']['_UserLang'];
36 - } elseif ( !is_null( $wgRequest->getVal( 'UserLang' ) ) ) {
37 - $langCode = $wgRequest->getVal( 'UserLang' );
38 - } else {
39 - $langCode = 'en';
40 - }
41 - $wgLang = Language::factory( $langCode );
42 -
43 - $installer->setParserLanguage( $wgLang );
44 -
45 - $wgMetaNamespace = $wgCanonicalNamespaceNames[NS_PROJECT];
46 -
47 - $session = $installer->execute( $session );
48 -
49 - $_SESSION['installData'][$fingerprint] = $session;
50 -
51 -}
 2+<?php require( dirname( dirname( __FILE__ ) ) . '/mw-config/index.php' );
\ No newline at end of file
Property changes on: trunk/phase3/config
___________________________________________________________________
Deleted: svn:ignore
523 - LocalSettings.php

Follow-up revisions

RevisionCommit summaryAuthorDate
r82847Follow-up r82845: fix $wgScriptPath detection.maxsem12:51, 26 February 2011
r82849More prominent mention of r82845maxsem13:07, 26 February 2011
r828501.17 MFT r82845, r82847, r82848 and r82849 (config/ --> mw-config/)maxsem13:15, 26 February 2011

Comments

#Comment by Platonides (talk | contribs)   22:04, 26 February 2011

Great. It first conflicts removing config because it wasn't entry (eg. an old LocalSettings), then conflicts again because there is a config/ folder and it cannot create it.

Should probably have been a move of all the files inside.

#Comment by Hashar (talk | contribs)   11:54, 28 February 2011

Can we please make sure online documentation is up to date?

Status & tagging log