Seb35 has uploaded a new change for review. https://gerrit.wikimedia.org/r/304045
Change subject: Renamed entry points and make them inactive when directly called from their normal directory ...................................................................... Renamed entry points and make them inactive when directly called from their normal directory These entry points are only useful in the case of a multiversion installation; so as a classical MediaWiki extension, they must be disabled to avoid any security issue. Updated doc installation accordingly The directory /www is still git-ignored but the entry points inside are forced to be version-controled. This allows to version-control independently the directory /www, e.g. for 404 error pages. Change-Id: I7d712efa2b1bfc5ae61a342b61aeb66ccda797db --- M .gitignore M docs/installation.rst R www/api.php R www/img_auth.php R www/index.php R www/load.php R www/opensearch_desc.php 7 files changed, 44 insertions(+), 32 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MediaWikiFarm refs/changes/45/304045/1 diff --git a/.gitignore b/.gitignore index f3b03ea..c7edd77 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,8 @@ /node_modules /vendor -# Installation +# Web access for multiversion farms +# You can put e.g. dedicated 404 error pages in addition of entry points +# If you want to version-control this subdirectory with git, you can – in this case +# add /index.php and others in its .gitignore to avoid double version-control.) /www diff --git a/docs/installation.rst b/docs/installation.rst index cc01dab..3571208 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -13,14 +13,14 @@ Preparation =========== -It is out of scope to explain out to install and configure the full HTTP stack, neither how to make it compatible with a MediaWiki farm and evolve with the time. For a raw overview, you must configure in a multisite fashion: the DNS servers, the HTTP servers, and possibly the associated security versions DNSSEC and HTTPS, and possibly the domain names depending of your specific configuration. It is also out of scope the installation and configuration of other services and backends: database servers, memcached servers, other caching or performance services, MediaWiki external services as Parsoid, Mathoid, Citoid, etc. You should also be comfortable with command line on a *nix system. +It is out of scope to explain out to install and configure the full HTTP stack, neither how to make it compatible with a MediaWiki farm and evolve with the time. For a raw overview, you must configure in a multisite fashion: the DNS servers, the HTTP servers, and possibly the associated security versions DNSSEC and HTTPS, and possibly the domain names depending of your specific configuration. It is also out of scope the installation and configuration of other services and backends: database servers, memcached servers, other caching or performance services, MediaWiki external services as Parsoid, Mathoid, Citoid, etc. You should also be comfortable with command line on a \*nix system. It is assumed you have an existing MediaWiki (standalone) installation. A new installation is theoretically possible, but it has not been tested. Before installing the files, you must prepare these informations: * regular expression(s) for your farm(s) with named patterns; * *configuration directory* where will be placed MediaWiki configurations, the default is :path:`/etc/mediawiki`; -* *cache directory*, a directory where config files will be cached; the default is :path:`/tmp/mw-cache`; it can speed up MediaWikiFarm from 9ms to 2ms. +* *cache directory*, a directory where config files will be cached; the default is :path:`/tmp/mw-cache`; it can speed up MediaWikiFarm from 9ms to 2ms (without OpCache). For your initial configuration, you can choose the regular expression of your farm simply as the name of your existing wiki, e.g. "mywiki\.example\.org". If you do that, the suffix and wikiID can be fixed without variables, but you should quickly think how you want to organise your wikis and farms to change these to significant values before you have too much things in your config files. @@ -40,27 +40,26 @@ 1. Copy the extension MediaWikiFarm and install it in the subdirectory :path:`$IP/extensions/MediaWikiFarm`; 2. If you downloaded it from Git and want the YAML syntax, go inside the directory and run :command:`composer install --no-dev` (see Composer_ if needed); 3. Copy your existing :path:`LocalSettings.php` file in your configuration directory; -4. Verify there is no absolute path inside: ``__FILE__`` and ``__DIR__`` must be replaced by their original value to avoid any missing file require (it’s fine to use the MediaWiki installation variable :path:`$IP`); +4. Verify there is no absolute path inside: ``__FILE__`` and ``__DIR__`` should probably be replaced by their original value to avoid any missing file require (it’s fine to use the MediaWiki installation variable :path:`$IP`); 5. Copy the MediaWikiFarm file :path:`docs/config/LocalSettings.php` next to your existing :path:`$IP/LocalSettings.php`, e.g. in :path:`$IP/LocalSettings.new.php`; 6. Check or customise the directory paths inside; -5. /!\ Make MediaWikiFarm live by moving this file in place of your existing :path:`$IP/LocalSettings.php`. +7. /!\ Make MediaWikiFarm live by moving this file in place of your existing :path:`$IP/LocalSettings.php`. Multiversion mode ================= Decide on the path where will be MediaWiki versions, this will be called the *code directory*. It is recalled each MediaWiki version (version + flavour more exactly) will be in a subdirectory of this code directory, and the names of these subdirectories will be the names of the versions. This code directory is independent from the configuration directory. -It is assumed here all the directories are not use on the live website; if it is not the case, you must be more careful. +It is assumed here all the directories are not used on the live website; if it is not the case, you must be more careful. 1. Create this directory, copy your existing MediaWiki installation in a subdirectory, and rename this subdirectory to an understandable name, for instance the name of the MediaWiki version (e.g. "1.25.5"). 2. Copy the extension MediaWikiFarm in a subdirectory of this code directory. You can name this subdirectory as you want. 3. Go inside this directory; if there is no Composer :path:`vendor` directory and you want the YAML syntax, run :command:`composer install --no-dev` (see Composer_ if needed); -4. Always in the MediaWikiFarm directory, create a directory :path:`www`, and copy inside the entry points: :command:`cp src/index.php.txt www/index.php` and the same for the four other entry points. -5. Always in the MediaWikiFarm directory, create a directory :path:`config`, copy inside the file :path:`docs/config/MediaWikiFarmDirectories.php`, and check or customise the directory paths inside. -6. Go inside your MediaWiki installation and copy your existing :path:`LocalSettings.php` file in your configuration directory. -7. Verify there is no absolute path inside: ``__FILE__`` and ``__DIR__`` must be replaced by their corresponding value in the MediaWiki installation directory to avoid any missing file require (it’s fine to use the MediaWiki installation variable :path:`$IP`). -8. Go inside your MediaWiki installation and replace the existing :path:`$IP/LocalSettings.php` by the MediaWikiFarm file :path:`docs/config/LocalSettings.multiversion.php` (and renaming it with the classical name :path:`$IP/LocalSettings.php`). -9. /!\ Make MediaWikiFarm live by changing your Web server configuration to make entry points index.php and others point to the files :path:`www/index.php` and others in the MediaWikiFarm directory. +4. Always in the MediaWikiFarm directory, create a directory :path:`config`, copy inside the file :path:`docs/config/MediaWikiFarmDirectories.php`, and check or customise the directory paths inside. +5. Go inside your MediaWiki installation and copy your existing :path:`LocalSettings.php` file in your configuration directory. +6. Verify there is no absolute path inside: ``__FILE__`` and ``__DIR__`` should probably be replaced by their corresponding value in the MediaWiki installation directory to avoid any missing file require (it’s fine to use the MediaWiki installation variable :path:`$IP`). +7. Go inside your MediaWiki installation and replace the existing :path:`$IP/LocalSettings.php` by the MediaWikiFarm file :path:`docs/config/LocalSettings.multiversion.php` (and renaming it with the classical name :path:`$IP/LocalSettings.php`). +8. /!\ Make MediaWikiFarm live by changing your Web server configuration to make entry points index.php and others point to the files :path:`www/index.php` and others in the MediaWikiFarm directory. Transition from monoversion to multiversion mode ================================================ diff --git a/src/api.php.txt b/www/api.php similarity index 75% rename from src/api.php.txt rename to www/api.php index 1f3c288..250256a 100644 --- a/src/api.php.txt +++ b/www/api.php @@ -7,13 +7,15 @@ * @license AGPL-3.0+ GNU Affero General Public License v3.0 ou version ultérieure */ -# Check the entry point is installed in a multiversion MediaWiki farm -if( basename( dirname( __FILE__ ) ) != 'www' ) exit; - -# Configuration of the MediaWiki Farm +# Default MediaWikiFarm configuration $wgMediaWikiFarmCodeDir = dirname( dirname( dirname( __FILE__ ) ) ); $wgMediaWikiFarmConfigDir = '/etc/mediawiki'; $wgMediaWikiFarmCacheDir = '/tmp/mw-cache'; + +# Check the entry point is installed in a multiversion MediaWiki farm or in the classical MediaWiki extensions directory +if( is_file( $wgMediaWikiFarmCodeDir . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'DefaultSettings.php' ) ) exit; + +# Override default MediaWikiFarm configuration @include_once dirname( dirname( __FILE__ ) ) . '/config/MediaWikiFarmDirectories.php'; # Include library diff --git a/src/img_auth.php.txt b/www/img_auth.php similarity index 76% rename from src/img_auth.php.txt rename to www/img_auth.php index b0c19fa..72488b9 100644 --- a/src/img_auth.php.txt +++ b/www/img_auth.php @@ -7,13 +7,15 @@ * @license AGPL-3.0+ GNU Affero General Public License v3.0 ou version ultérieure */ -# Check the entry point is installed in a multiversion MediaWiki farm -if( basename( dirname( __FILE__ ) ) != 'www' ) exit; - -# Configuration of the MediaWiki Farm +# Default MediaWikiFarm configuration $wgMediaWikiFarmCodeDir = dirname( dirname( dirname( __FILE__ ) ) ); $wgMediaWikiFarmConfigDir = '/etc/mediawiki'; $wgMediaWikiFarmCacheDir = '/tmp/mw-cache'; + +# Check the entry point is installed in a multiversion MediaWiki farm or in the classical MediaWiki extensions directory +if( is_file( $wgMediaWikiFarmCodeDir . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'DefaultSettings.php' ) ) exit; + +# Override default MediaWikiFarm configuration @include_once dirname( dirname( __FILE__ ) ) . '/config/MediaWikiFarmDirectories.php'; # Include library diff --git a/src/index.php.txt b/www/index.php similarity index 75% rename from src/index.php.txt rename to www/index.php index c074921..2c7d025 100644 --- a/src/index.php.txt +++ b/www/index.php @@ -7,13 +7,15 @@ * @license AGPL-3.0+ GNU Affero General Public License v3.0 ou version ultérieure */ -# Check the entry point is installed in a multiversion MediaWiki farm -if( basename( dirname( __FILE__ ) ) != 'www' ) exit; - -# Configuration of the MediaWiki Farm +# Default MediaWikiFarm configuration $wgMediaWikiFarmCodeDir = dirname( dirname( dirname( __FILE__ ) ) ); $wgMediaWikiFarmConfigDir = '/etc/mediawiki'; $wgMediaWikiFarmCacheDir = '/tmp/mw-cache'; + +# Check the entry point is installed in a multiversion MediaWiki farm or in the classical MediaWiki extensions directory +if( is_file( $wgMediaWikiFarmCodeDir . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'DefaultSettings.php' ) ) exit; + +# Override default MediaWikiFarm configuration @include_once dirname( dirname( __FILE__ ) ) . '/config/MediaWikiFarmDirectories.php'; # Include library diff --git a/src/load.php.txt b/www/load.php similarity index 75% rename from src/load.php.txt rename to www/load.php index 951b6e6..03e496b 100644 --- a/src/load.php.txt +++ b/www/load.php @@ -7,13 +7,15 @@ * @license AGPL-3.0+ GNU Affero General Public License v3.0 ou version ultérieure */ -# Check the entry point is installed in a multiversion MediaWiki farm -if( basename( dirname( __FILE__ ) ) != 'www' ) exit; - -# Configuration of the MediaWiki Farm +# Default MediaWikiFarm configuration $wgMediaWikiFarmCodeDir = dirname( dirname( dirname( __FILE__ ) ) ); $wgMediaWikiFarmConfigDir = '/etc/mediawiki'; $wgMediaWikiFarmCacheDir = '/tmp/mw-cache'; + +# Check the entry point is installed in a multiversion MediaWiki farm or in the classical MediaWiki extensions directory +if( is_file( $wgMediaWikiFarmCodeDir . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'DefaultSettings.php' ) ) exit; + +# Override default MediaWikiFarm configuration @include_once dirname( dirname( __FILE__ ) ) . '/config/MediaWikiFarmDirectories.php'; # Include library diff --git a/src/opensearch_desc.php.txt b/www/opensearch_desc.php similarity index 76% rename from src/opensearch_desc.php.txt rename to www/opensearch_desc.php index b00cb2d..07da0d1 100644 --- a/src/opensearch_desc.php.txt +++ b/www/opensearch_desc.php @@ -7,13 +7,15 @@ * @license AGPL-3.0+ GNU Affero General Public License v3.0 ou version ultérieure */ -# Check the entry point is installed in a multiversion MediaWiki farm -if( basename( dirname( __FILE__ ) ) != 'www' ) exit; - -# Configuration of the MediaWiki Farm +# Default MediaWikiFarm configuration $wgMediaWikiFarmCodeDir = dirname( dirname( dirname( __FILE__ ) ) ); $wgMediaWikiFarmConfigDir = '/etc/mediawiki'; $wgMediaWikiFarmCacheDir = '/tmp/mw-cache'; + +# Check the entry point is installed in a multiversion MediaWiki farm or in the classical MediaWiki extensions directory +if( is_file( $wgMediaWikiFarmCodeDir . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'DefaultSettings.php' ) ) exit; + +# Override default MediaWikiFarm configuration @include_once dirname( dirname( __FILE__ ) ) . '/config/MediaWikiFarmDirectories.php'; # Include library -- To view, visit https://gerrit.wikimedia.org/r/304045 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I7d712efa2b1bfc5ae61a342b61aeb66ccda797db Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MediaWikiFarm Gerrit-Branch: master Gerrit-Owner: Seb35 <seb35wikipe...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits