summaryrefslogtreecommitdiff
path: root/www/wiki/mw-config
diff options
context:
space:
mode:
authorYaco <franco@reevo.org>2020-06-04 11:01:00 -0300
committerYaco <franco@reevo.org>2020-06-04 11:01:00 -0300
commitfc7369835258467bf97eb64f184b93691f9a9fd5 (patch)
treedaabd60089d2dd76d9f5fb416b005fbe159c799d /www/wiki/mw-config
first commit
Diffstat (limited to 'www/wiki/mw-config')
-rw-r--r--www/wiki/mw-config/config-cc.css60
-rw-r--r--www/wiki/mw-config/config.css209
-rw-r--r--www/wiki/mw-config/config.js151
-rw-r--r--www/wiki/mw-config/images/ajax-loader.gifbin0 -> 1788 bytes
-rw-r--r--www/wiki/mw-config/images/bullet.gifbin0 -> 50 bytes
-rw-r--r--www/wiki/mw-config/images/critical-32.pngbin0 -> 1736 bytes
-rw-r--r--www/wiki/mw-config/images/download-32.pngbin0 -> 1717 bytes
-rw-r--r--www/wiki/mw-config/images/help-question-hover.gifbin0 -> 1246 bytes
-rw-r--r--www/wiki/mw-config/images/help-question.gifbin0 -> 126 bytes
-rw-r--r--www/wiki/mw-config/images/info-32.pngbin0 -> 1832 bytes
-rw-r--r--www/wiki/mw-config/images/installer-logo.pngbin0 -> 15448 bytes
-rw-r--r--www/wiki/mw-config/images/tick-32.pngbin0 -> 1069 bytes
-rw-r--r--www/wiki/mw-config/images/warning-32.pngbin0 -> 1268 bytes
-rw-r--r--www/wiki/mw-config/index.php82
-rw-r--r--www/wiki/mw-config/overrides/README22
15 files changed, 524 insertions, 0 deletions
diff --git a/www/wiki/mw-config/config-cc.css b/www/wiki/mw-config/config-cc.css
new file mode 100644
index 00000000..3b2798fc
--- /dev/null
+++ b/www/wiki/mw-config/config-cc.css
@@ -0,0 +1,60 @@
+/**
+ * Copy of CC standard stylesheet, plus tweaks for iframe usage
+ */
+
+body {
+ margin: 0;
+ background: #eee;
+ font-family: 'Verdana';
+ color: #333;
+}
+
+#main {
+ border: 1px solid #d0d0d0;
+ background: #fff;
+ margin: 0.5em;
+}
+
+/**
+ * Looks like you have to specify the width of #menu
+ * or IE5 Mac stretches it all the way across the div, and
+ * Opera streches it half way.
+ */
+
+#main #menu {
+ border-left: 1px dotted #ccc;
+ float: right;
+ width: 230px;
+ background: #fff;
+ margin: 0 0 10px 10px;
+}
+
+h1,
+h3,
+p,
+pre,
+td {
+ margin: 0 20px 20px 20px;
+ font-size: 11px;
+ line-height: 140%;
+}
+
+.header {
+ padding-left: 10px;
+ padding-top: 10px;
+}
+
+.nav {
+ padding-left: 10px;
+ padding-bottom: 10px;
+ font-size: 11px;
+ margin-bottom: 16px;
+}
+
+#menu p {
+ font-size: 11px;
+}
+
+.dent {
+ margin-left: 64px;
+}
diff --git a/www/wiki/mw-config/config.css b/www/wiki/mw-config/config.css
new file mode 100644
index 00000000..2468c715
--- /dev/null
+++ b/www/wiki/mw-config/config.css
@@ -0,0 +1,209 @@
+.env-check {
+ font-size: 90%;
+ margin: 1em 0 1em 2.5em;
+}
+
+.config-section {
+ margin-top: 2em;
+}
+
+.config-block {
+ margin-top: 2em;
+ display: block;
+
+}
+
+.config-block-label {
+ display: block;
+ margin-bottom: 0.2em;
+}
+
+.config-block-label label,
+.config-label {
+ font-weight: bold;
+ padding-right: 0.5em;
+ padding-top: 0.2em;
+}
+
+.config-block-elements {
+ margin-left: 2em;
+}
+
+.config-block-elements li {
+ list-style: none;
+}
+
+.config-input {
+ clear: left;
+ zoom: 100%; /* IE hack */
+}
+
+.config-page-wrapper {
+ padding: 0.5em;
+}
+
+.config-page-list {
+ float: right;
+ width: 12em;
+ border: 1px solid #aaa;
+ background: #fff;
+ padding: 0.5em;
+ /* 3em left margin to leave space between the list and the page-content */
+ margin: 0.5em 0.5em 0.5em 3.5em;
+}
+
+.config-page {
+ padding: 0.5em 0.5em 0.5em 2em;
+ margin: 0.5em 0.5em 0.5em 0.5em;
+ background: #eee;
+}
+
+.config-submit {
+ clear: left;
+ text-align: center;
+ padding: 1em;
+}
+
+.config-submit input {
+ margin-left: 0.5em;
+ margin-right: 0.5em;
+}
+
+.config-page-disabled {
+ color: #aaa;
+}
+
+.config-error-box {
+ border: 2px solid #f00;
+}
+
+.config-page-current {
+ font-weight: bold;
+}
+
+.config-message {
+ display: list-item;
+ line-height: 1.5em;
+ /* @embed */
+ list-style-image: url( images/bullet.gif );
+ list-style-type: square;
+}
+
+.config-input-text {
+ width: 20em;
+ margin-right: 1em;
+}
+
+.config-input-check {
+ margin-left: 10em;
+}
+
+.config-skins-item {
+ /* Clearfix */
+ clear: left;
+ overflow: hidden;
+}
+
+.config-skins-item .config-input-check {
+ margin-left: 10em;
+ width: 20em;
+ float: left;
+}
+
+.config-skins-item .config-skins-use-as-default {
+ float: left;
+}
+
+.error {
+ color: #f00;
+ background-color: #fff;
+ font-weight: bold;
+ left: 1em;
+ font-size: 100%;
+}
+
+.config-settings-block {
+ list-style-type: none;
+ list-style-image: none;
+ margin: 0;
+ padding: 0;
+}
+
+.btn-install {
+ font-weight: bold;
+ font-size: 110%;
+ padding: 0.2em 0.3em;
+}
+
+.success-message {
+ font-weight: bold;
+ font-size: 110%;
+ color: #008000;
+}
+
+.success-box {
+ font-size: 130%;
+}
+
+.config-cc-wrapper {
+ clear: left;
+ /* If you change this height, also change it in WebInstallerOptions::submitCC() */
+ height: 54em;
+}
+
+.config-plainlink a {
+ background: none !important; /* stylelint-disable-line declaration-no-important */
+ padding: 0 !important; /* stylelint-disable-line declaration-no-important */
+}
+
+.config-download-link {
+ font-size: 1.8em;
+ margin-left: 2em;
+}
+
+.config-download-link a {
+ background: url( images/download-32.png ) no-repeat center left;
+ padding-left: 40px; /* 32 px for the image (above), plus some breathing room */
+ height: 32px; /* provide enough vertical room for the image */
+ display: inline-block; /* allow the height property (above) to work */
+ line-height: 32px; /* center the text vertically */
+}
+
+#config-live-log {
+ overflow: hidden;
+ min-width: 20em;
+}
+
+/* Hide empty live-log textarea */
+#config-live-log textarea:empty {
+ display: none;
+}
+
+/* tooltip styles */
+.config-help-field-hint {
+ display: none;
+ margin-left: 2px;
+ margin-bottom: -8px;
+ padding: 0 0 0 15px;
+ /* @embed */
+ background-image: url( images/help-question.gif );
+ background-position: left center;
+ background-repeat: no-repeat;
+ cursor: pointer;
+ font-size: 0.8em;
+ text-decoration: underline;
+ color: #0645ad;
+}
+
+.config-help-field-hint:hover {
+ /* @embed */
+ background-image: url( images/help-question-hover.gif );
+}
+
+.config-help-field-data {
+ display: block;
+ background-color: #d6f3ff;
+ padding: 5px 8px 4px 8px;
+ border: 1px solid #5dc9f4;
+ margin-left: 20px;
+}
diff --git a/www/wiki/mw-config/config.js b/www/wiki/mw-config/config.js
new file mode 100644
index 00000000..99290f44
--- /dev/null
+++ b/www/wiki/mw-config/config.js
@@ -0,0 +1,151 @@
+/* global extDependencyMap */
+( function ( $ ) {
+ $( function () {
+ var $label, labelText;
+
+ function syncText() {
+ var value = $( this ).val()
+ .replace( /[\[\]{}|#<>%+? ]/g, '_' ) // eslint-disable-line no-useless-escape
+ .replace( /&/, '&amp;' )
+ .replace( /__+/g, '_' )
+ .replace( /^_+/, '' )
+ .replace( /_+$/, '' );
+ value = value.charAt( 0 ).toUpperCase() + value.slice( 1 );
+ $label.text( labelText.replace( '$1', value ) );
+ }
+
+ // Set up the help system
+ $( '.config-help-field-data' ).hide()
+ .closest( '.config-help-field-container' ).find( '.config-help-field-hint' )
+ .show()
+ .click( function () {
+ $( this ).closest( '.config-help-field-container' ).find( '.config-help-field-data' )
+ .slideToggle( 'fast' );
+ } );
+
+ // Show/hide code for DB-specific options
+ // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here?
+ $( '.dbRadio' ).each( function () {
+ $( document.getElementById( $( this ).attr( 'rel' ) ) ).hide();
+ } );
+ $( document.getElementById( $( '.dbRadio:checked' ).attr( 'rel' ) ) ).show();
+ $( '.dbRadio' ).click( function () {
+ var $checked = $( '.dbRadio:checked' ),
+ $wrapper = $( document.getElementById( $checked.attr( 'rel' ) ) );
+ if ( $wrapper.is( ':hidden' ) ) {
+ $( '.dbWrapper' ).hide( 'slow' );
+ $wrapper.show( 'slow' );
+ }
+ } );
+
+ // Scroll to the bottom of upgrade log
+ $( '#config-live-log' ).children( 'textarea' ).each( function () {
+ this.scrollTop = this.scrollHeight;
+ } );
+
+ // Show/hide Creative Commons thingy
+ $( '.licenseRadio' ).click( function () {
+ var $wrapper = $( '#config-cc-wrapper' );
+ if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) {
+ $wrapper.show( 'slow' );
+ } else {
+ $wrapper.hide( 'slow' );
+ }
+ } );
+
+ // Show/hide random stuff (email, upload)
+ $( '.showHideRadio' ).click( function () {
+ var $wrapper = $( '#' + $( this ).attr( 'rel' ) );
+ if ( $( this ).is( ':checked' ) ) {
+ $wrapper.show( 'slow' );
+ } else {
+ $wrapper.hide( 'slow' );
+ }
+ } );
+ $( '.hideShowRadio' ).click( function () {
+ var $wrapper = $( '#' + $( this ).attr( 'rel' ) );
+ if ( $( this ).is( ':checked' ) ) {
+ $wrapper.hide( 'slow' );
+ } else {
+ $wrapper.show( 'slow' );
+ }
+ } );
+
+ // Hide "other" textboxes by default
+ // Should not be done in CSS for javascript disabled compatibility
+ if ( !$( '#config__NamespaceType_other' ).is( ':checked' ) ) {
+ $( '.enabledByOther' ).closest( '.config-block' ).hide();
+ }
+
+ // Enable/disable "other" textboxes
+ $( '.enableForOther' ).click( function () {
+ var $textbox = $( document.getElementById( $( this ).attr( 'rel' ) ) );
+ // FIXME: Ugh, this is ugly
+ if ( $( this ).val() === 'other' ) {
+ $textbox.prop( 'readonly', false ).closest( '.config-block' ).slideDown( 'fast' );
+ } else {
+ $textbox.prop( 'readonly', true ).closest( '.config-block' ).slideUp( 'fast' );
+ }
+ } );
+
+ // Synchronize radio button label for sitename with textbox
+ $label = $( 'label[for="config__NamespaceType_site-name"]' );
+ labelText = $label.text();
+ $label.text( labelText.replace( '$1', '' ) );
+ $( '#config_wgSitename' ).on( 'keyup change', syncText ).each( syncText );
+
+ // Show/Hide memcached servers when needed
+ $( 'input[name$="config__MainCacheType"]' ).change( function () {
+ var $memc = $( '#config-memcachewrapper' );
+ if ( $( 'input[name$="config__MainCacheType"]:checked' ).val() === 'memcached' ) {
+ $memc.show( 'slow' );
+ } else {
+ $memc.hide( 'slow' );
+ }
+ } );
+
+ function areReqsSatisfied( name ) {
+ var i, ext, skin, node;
+ if ( !extDependencyMap[ name ] ) {
+ return true;
+ }
+
+ if ( extDependencyMap[ name ].extensions ) {
+ for ( i in extDependencyMap[ name ].extensions ) {
+ ext = extDependencyMap[ name ].extensions[ i ];
+ node = document.getElementById( 'config_ext-' + ext );
+ if ( !node || !node.checked ) {
+ return false;
+ }
+ }
+ }
+ if ( extDependencyMap[ name ].skins ) {
+ for ( i in extDependencyMap[ name ].skins ) {
+ skin = extDependencyMap[ name ].skins[ i ];
+ node = document.getElementById( 'config_skin-' + skin );
+ if ( !node || !node.checked ) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ // Disable checkboxes if the extension has dependencies
+ $( '.mw-ext-with-dependencies input' ).prop( 'disabled', true );
+ $( '.config-ext-input[data-name]' ).on( 'change', function () {
+ $( '.mw-ext-with-dependencies input' ).each( function () {
+ var name = this.getAttribute( 'data-name' );
+ if ( areReqsSatisfied( name ) ) {
+ // Re-enable it!
+ this.disabled = false;
+ } else {
+ // Uncheck and disable the checkbox
+ this.checked = false;
+ this.disabled = true;
+ }
+ } );
+ } );
+ } );
+}( jQuery ) );
diff --git a/www/wiki/mw-config/images/ajax-loader.gif b/www/wiki/mw-config/images/ajax-loader.gif
new file mode 100644
index 00000000..72203fdd
--- /dev/null
+++ b/www/wiki/mw-config/images/ajax-loader.gif
Binary files differ
diff --git a/www/wiki/mw-config/images/bullet.gif b/www/wiki/mw-config/images/bullet.gif
new file mode 100644
index 00000000..b43de48a
--- /dev/null
+++ b/www/wiki/mw-config/images/bullet.gif
Binary files differ
diff --git a/www/wiki/mw-config/images/critical-32.png b/www/wiki/mw-config/images/critical-32.png
new file mode 100644
index 00000000..9870bab9
--- /dev/null
+++ b/www/wiki/mw-config/images/critical-32.png
Binary files differ
diff --git a/www/wiki/mw-config/images/download-32.png b/www/wiki/mw-config/images/download-32.png
new file mode 100644
index 00000000..6a29cc0b
--- /dev/null
+++ b/www/wiki/mw-config/images/download-32.png
Binary files differ
diff --git a/www/wiki/mw-config/images/help-question-hover.gif b/www/wiki/mw-config/images/help-question-hover.gif
new file mode 100644
index 00000000..515138db
--- /dev/null
+++ b/www/wiki/mw-config/images/help-question-hover.gif
Binary files differ
diff --git a/www/wiki/mw-config/images/help-question.gif b/www/wiki/mw-config/images/help-question.gif
new file mode 100644
index 00000000..b4fc9c5b
--- /dev/null
+++ b/www/wiki/mw-config/images/help-question.gif
Binary files differ
diff --git a/www/wiki/mw-config/images/info-32.png b/www/wiki/mw-config/images/info-32.png
new file mode 100644
index 00000000..2f6d505d
--- /dev/null
+++ b/www/wiki/mw-config/images/info-32.png
Binary files differ
diff --git a/www/wiki/mw-config/images/installer-logo.png b/www/wiki/mw-config/images/installer-logo.png
new file mode 100644
index 00000000..43b0e8a8
--- /dev/null
+++ b/www/wiki/mw-config/images/installer-logo.png
Binary files differ
diff --git a/www/wiki/mw-config/images/tick-32.png b/www/wiki/mw-config/images/tick-32.png
new file mode 100644
index 00000000..72673445
--- /dev/null
+++ b/www/wiki/mw-config/images/tick-32.png
Binary files differ
diff --git a/www/wiki/mw-config/images/warning-32.png b/www/wiki/mw-config/images/warning-32.png
new file mode 100644
index 00000000..f2db86f2
--- /dev/null
+++ b/www/wiki/mw-config/images/warning-32.png
Binary files differ
diff --git a/www/wiki/mw-config/index.php b/www/wiki/mw-config/index.php
new file mode 100644
index 00000000..a47822bb
--- /dev/null
+++ b/www/wiki/mw-config/index.php
@@ -0,0 +1,82 @@
+<?php
+// phpcs:disable Generic.Arrays.DisallowLongArraySyntax
+/**
+ * New version of MediaWiki web-based config/installation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+// Bail on old versions of PHP, or if composer has not been run yet to install
+// dependencies. Using dirname( __FILE__ ) here because __DIR__ is PHP5.3+.
+// phpcs:ignore MediaWiki.Usage.DirUsage.FunctionFound
+require_once dirname( __FILE__ ) . '/../includes/PHPVersionCheck.php';
+wfEntryPointCheck( 'mw-config/index.php' );
+
+define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' );
+define( 'MEDIAWIKI_INSTALL', true );
+
+// Resolve relative to regular MediaWiki root
+// instead of mw-config subdirectory.
+chdir( dirname( __DIR__ ) );
+require dirname( __DIR__ ) . '/includes/WebStart.php';
+
+wfInstallerMain();
+
+function wfInstallerMain() {
+ global $wgRequest, $wgLang, $wgMetaNamespace, $wgCanonicalNamespaceNames;
+
+ $installer = InstallerOverrides::getWebInstaller( $wgRequest );
+
+ if ( !$installer->startSession() ) {
+ if ( $installer->request->getVal( "css" ) ) {
+ // Do not display errors on css pages
+ $installer->outputCss();
+ exit;
+ }
+
+ $errors = $installer->getPhpErrors();
+ $installer->showError( 'config-session-error', $errors[0] );
+ $installer->finish();
+ exit;
+ }
+
+ $fingerprint = $installer->getFingerprint();
+ if ( isset( $_SESSION['installData'][$fingerprint] ) ) {
+ $session = $_SESSION['installData'][$fingerprint];
+ } else {
+ $session = array();
+ }
+
+ if ( !is_null( $wgRequest->getVal( 'uselang' ) ) ) {
+ $langCode = $wgRequest->getVal( 'uselang' );
+ } elseif ( isset( $session['settings']['_UserLang'] ) ) {
+ $langCode = $session['settings']['_UserLang'];
+ } else {
+ $langCode = 'en';
+ }
+ $wgLang = Language::factory( $langCode );
+ RequestContext::getMain()->setLanguage( $wgLang );
+
+ $installer->setParserLanguage( $wgLang );
+
+ $wgMetaNamespace = $wgCanonicalNamespaceNames[NS_PROJECT];
+
+ $session = $installer->execute( $session );
+
+ $_SESSION['installData'][$fingerprint] = $session;
+}
diff --git a/www/wiki/mw-config/overrides/README b/www/wiki/mw-config/overrides/README
new file mode 100644
index 00000000..9a9d84db
--- /dev/null
+++ b/www/wiki/mw-config/overrides/README
@@ -0,0 +1,22 @@
+Don't modify the installer if you want to alter its behavior, including
+the contents of generated LocalSettings.php in your package. Instead,
+you can override classes used by the installer.
+
+You can override 3 classes:
+* LocalSettingsGenerator - generates LocalSettings.php
+* WebInstaller - web installer UI
+* CliInstaller - command-line installer
+
+Example override:
+
+$overrides['LocalSettingsGenerator'] = 'MyLocalSettingsGenerator';
+
+class MyLocalSettingsGenerator extends LocalSettingsGenerator {
+ function getText() {
+ // Modify an existing setting
+ $this->values['wgDefaultSkin'] = 'vector';
+ // add a new setting
+ $ls = parent::getText();
+ return $ls . "\n\$wgMiserMode = true;\n";
+ }
+}