Revert "Include short descriptions for extensions bundled in the release"
authorMaxSem <maxsem.wiki@gmail.com>
Sun, 12 Jan 2014 23:59:44 +0000 (23:59 +0000)
committerMaxSem <maxsem.wiki@gmail.com>
Sun, 12 Jan 2014 23:59:44 +0000 (23:59 +0000)
Contains var_dump(), self-merged non-trivial code.

This reverts commit 96b2c66e242954d8591e7b8ca7b9d6a2a4e1074a.

Change-Id: Ie630466ef50e6bcdabf01daff28c283c764aae35

includes/cache/LinkCache.php
includes/cache/LocalisationCache.php
includes/installer/Installer.php
includes/installer/LocalSettingsGenerator.php
includes/installer/WebInstaller.php
includes/installer/WebInstallerPage.php
includes/parser/LinkHolderArray.php
skins/common/config.css

index 169816b..de2a728 100644 (file)
@@ -35,7 +35,6 @@ class LinkCache {
        private $mGoodLinkFields = array();
        private $mBadLinks = array();
        private $mForUpdate = false;
-       private $useDatabase = true;
 
        /**
         * @var LinkCache
@@ -210,19 +209,6 @@ class LinkCache {
                }
        }
 
-       /**
-        * Enable or disable database use.
-        * @since 1.22
-        * @param $value Boolean
-        * @return Boolean
-        */
-       public function useDatabase( $value = null ) {
-               if ( $value !== null ) {
-                       $this->useDatabase = (bool)$value;
-               }
-               return $this->useDatabase;
-       }
-
        /**
         * Add a title to the link cache, return the page_id or zero if non-existent
         *
@@ -253,10 +239,6 @@ class LinkCache {
                        return 0;
                }
 
-               if( !$this->useDatabase ) {
-                       return 0;
-               }
-
                # Some fields heavily used for linking...
                if ( $this->mForUpdate ) {
                        $db = wfGetDB( DB_MASTER );
index 321d476..cba2ba7 100644 (file)
@@ -1027,25 +1027,6 @@ class LocalisationCache {
                $this->store = new LCStoreNull;
                $this->manualRecache = false;
        }
-
-       /**
-        * Return an array with initialised languages.
-        *
-        * @return array
-        */
-       public function getInitialisedLanguages() {
-               return $this->initialisedLangs;
-       }
-
-       /**
-        * Set initialised languages.
-        *
-        * @param array $languages Optional array of initialised languages.
-        */
-       public function setInitialisedLanguages( $languages = array() ) {
-               $this->initialisedLangs = $languages;
-       }
-
 }
 
 /**
index e7ef537..765838b 100644 (file)
@@ -1407,24 +1407,6 @@ abstract class Installer {
                return "{$_SERVER['PHP_SELF']}?page=" . urlencode( $page );
        }
 
-       /**
-        * Load the extension credits for i18n strings.  Very hacky for
-        * now, but I expect it only be used for 1.22.0 at the most.
-        */
-       public function getExtensionInfo( $file ) {
-               global $wgExtensionCredits, $wgVersion, $wgResourceModules;
-
-               $wgVersion = "1.22";
-               $wgResourceModules = array();
-               require_once $file ;
-               $e = array_values( $wgExtensionCredits );
-               if( $e ) {
-                       $ext = array_values( $e[0] );
-                       $wgExtensionCredits = array();
-                       return $ext[0];
-               }
-       }
-
        /**
         * Finds extensions that follow the format /extensions/Name/Name.php,
         * and returns an array containing the value for 'Name' for each found extension.
@@ -1447,22 +1429,13 @@ abstract class Installer {
                        if ( !is_dir( "$extDir/$file" ) ) {
                                continue;
                        }
-
-                       $extFile = "$extDir/$file/$file.php";
-                       $extI18NFile = "$extDir/$file/$file.i18n.php";
-                       if ( file_exists( $extFile ) ) {
-                               if ( $info = $this->getExtensionInfo( $extFile ) ) {
-                                       $exts[$info['name']] = $info;
-
-                                       if ( file_exists( $extI18NFile ) ) {
-                                               global $wgExtensionMessagesFiles;
-                                               $wgExtensionMessagesFiles[$file] = $extI18NFile;
-                                       }
-                               }
+                       if ( file_exists( "$extDir/$file/$file.php" ) ) {
+                               $exts[] = $file;
                        }
                }
                closedir( $dh );
-               uksort( $exts, 'strnatcasecmp' );
+               natcasesort( $exts );
+
                return $exts;
        }
 
@@ -1489,9 +1462,8 @@ abstract class Installer {
 
                require "$IP/includes/DefaultSettings.php";
 
-               $extensions = $this->findExtensions();
                foreach ( $exts as $e ) {
-                       require_once $extensions[$e]['path'];
+                       require_once "$IP/extensions/$e/$e.php";
                }
 
                $hooksWeWant = isset( $wgHooks['LoadExtensionSchemaUpdates'] ) ?
index 6b72047..68664c9 100644 (file)
@@ -137,21 +137,14 @@ class LocalSettingsGenerator {
                $localSettings = $this->getDefaultText();
 
                if ( count( $this->extensions ) ) {
-                       $extensions = $this->installer->findExtensions();
                        $localSettings .= "
 # Enabled Extensions. Most extensions are enabled by including the base extension file here
 # but check specific extension documentation for more details
 # The following extensions were automatically enabled:\n";
 
-                       $ip = $this->installer->getVar( 'IP' );
-                       foreach ( $this->extensions as $ext) {
-                               $path = str_replace( $ip, '', $extensions[$ext]['path'] );
-                               $prefix = '';
-                               if ( $path !== $extensions[$ext]['path'] ) {
-                                       $prefix = '$IP';
-                               }
-                               $path = $prefix . self::escapePhpString( $path );
-                               $localSettings .= "require_once \"$path\";\n";
+                       foreach ( $this->extensions as $extName ) {
+                               $encExtName = self::escapePhpString( $extName );
+                               $localSettings .= "require_once \"\$IP/extensions/$encExtName/$encExtName.php\";\n";
                        }
                }
 
index 2547020..79fdc99 100644 (file)
@@ -923,10 +923,8 @@ class WebInstaller extends Installer {
                }
                if ( isset( $params['rawtext'] ) ) {
                        $labelText = $params['rawtext'];
-               } elseif ( isset( $params['label'] ) ) {
-                       $labelText = $this->parse( wfMessage( $params['label'] )->text() );
                } else {
-                       $labelText = "";
+                       $labelText = $this->parse( wfMessage( $params['label'] )->text() );
                }
 
                return "<div class=\"config-input-check\">\n" .
index b12b686..d4b3d65 100644 (file)
@@ -948,20 +948,11 @@ class WebInstaller_Options extends WebInstallerPage {
                if ( $extensions ) {
                        $extHtml = $this->getFieldSetStart( 'config-extensions' );
 
-                       /* Force a recache, so we load extensions descriptions */
-                       global $wgLang;
-                       $lc = Language::getLocalisationCache();
-                       $lc->setInitialisedLanguages( array() );
-                       $lc->getItem( $wgLang->mCode, '' );
-                       LinkCache::singleton()->useDatabase( false );
-
                        foreach ( $extensions as $ext ) {
                                $extHtml .= $this->parent->getCheckBox( array(
-                                               'var' => "ext-{$ext['name']}",
-                                               'rawtext' => "<b>{$ext['name']}</b>: " .
-                                               wfMessage( $ext['descriptionmsg'] )->useDatabase( false )->parse(),
-                                       ) );
-
+                                       'var' => "ext-$ext",
+                                       'rawtext' => $ext,
+                               ) );
                        }
 
                        $extHtml .= $this->parent->getHelpBox( 'config-extensions-help' ) .
@@ -1184,17 +1175,11 @@ class WebInstaller_Options extends WebInstallerPage {
                        $this->setVar( 'wgRightsIcon', '' );
                }
 
-               $extsAvailable = array_map(
-                       function($e) {
-                               if( isset($e['name']) ) {
-                                       return $e['name'];
-                               }
-                       }, $this->parent->findExtensions() );
+               $extsAvailable = $this->parent->findExtensions();
                $extsToInstall = array();
-               foreach ( $extsAvailable as $key => $ext ) {
-                               var_dump("config_ext-$ext");
+               foreach ( $extsAvailable as $ext ) {
                        if ( $this->parent->request->getCheck( 'config_ext-' . $ext ) ) {
-                               $extsToInstall[] = $extsAvailable[ $key ];
+                               $extsToInstall[] = $ext;
                        }
                }
                $this->parent->setVar( '_Extensions', $extsToInstall );
index 46a0760..40c0a89 100644 (file)
@@ -280,87 +280,85 @@ class LinkHolderArray {
                $linkCache = LinkCache::singleton();
                $output = $this->parent->getOutput();
 
-               if( $linkCache->useDatabase() ) {
-                       wfProfileIn( __METHOD__ . '-check' );
-                       $dbr = wfGetDB( DB_SLAVE );
-                       $threshold = $this->parent->getOptions()->getStubThreshold();
-
-                       # Sort by namespace
-                       ksort( $this->internals );
+               wfProfileIn( __METHOD__ . '-check' );
+               $dbr = wfGetDB( DB_SLAVE );
+               $threshold = $this->parent->getOptions()->getStubThreshold();
 
-                       $linkcolour_ids = array();
+               # Sort by namespace
+               ksort( $this->internals );
 
-                       # Generate query
-                       $queries = array();
-                       foreach ( $this->internals as $ns => $entries ) {
-                               foreach ( $entries as $entry ) {
-                                       $title = $entry['title'];
-                                       $pdbk = $entry['pdbk'];
+               $linkcolour_ids = array();
 
-                                       # Skip invalid entries.
-                                       # Result will be ugly, but prevents crash.
-                                       if ( is_null( $title ) ) {
-                                               continue;
-                                       }
+               # Generate query
+               $queries = array();
+               foreach ( $this->internals as $ns => $entries ) {
+                       foreach ( $entries as $entry ) {
+                               $title = $entry['title'];
+                               $pdbk = $entry['pdbk'];
 
-                                       # Check if it's a static known link, e.g. interwiki
-                                       if ( $title->isAlwaysKnown() ) {
-                                               $colours[$pdbk] = '';
-                                       } elseif ( $ns == NS_SPECIAL ) {
-                                               $colours[$pdbk] = 'new';
-                                       } elseif ( ( $id = $linkCache->getGoodLinkID( $pdbk ) ) != 0 ) {
-                                               $colours[$pdbk] = Linker::getLinkColour( $title, $threshold );
-                                               $output->addLink( $title, $id );
-                                               $linkcolour_ids[$id] = $pdbk;
-                                       } elseif ( $linkCache->isBadLink( $pdbk ) ) {
-                                               $colours[$pdbk] = 'new';
-                                       } else {
-                                               # Not in the link cache, add it to the query
-                                               $queries[$ns][] = $title->getDBkey();
-                                       }
-                               }
-                       }
-                       if ( $queries ) {
-                               $where = array();
-                               foreach ( $queries as $ns => $pages ) {
-                                       $where[] = $dbr->makeList(
-                                               array(
-                                                       'page_namespace' => $ns,
-                                                       'page_title' => $pages,
-                                               ),
-                                               LIST_AND
-                                       );
+                               # Skip invalid entries.
+                               # Result will be ugly, but prevents crash.
+                               if ( is_null( $title ) ) {
+                                       continue;
                                }
 
-                               $res = $dbr->select(
-                                       'page',
-                                       array( 'page_id', 'page_namespace', 'page_title', 'page_is_redirect', 'page_len', 'page_latest' ),
-                                       $dbr->makeList( $where, LIST_OR ),
-                                       __METHOD__
-                               );
-
-                               # Fetch data and form into an associative array
-                               # non-existent = broken
-                               foreach ( $res as $s ) {
-                                       $title = Title::makeTitle( $s->page_namespace, $s->page_title );
-                                       $pdbk = $title->getPrefixedDBkey();
-                                       $linkCache->addGoodLinkObjFromRow( $title, $s );
-                                       $output->addLink( $title, $s->page_id );
-                                       # @todo FIXME: Convoluted data flow
-                                       # The redirect status and length is passed to getLinkColour via the LinkCache
-                                       # Use formal parameters instead
+                               # Check if it's a static known link, e.g. interwiki
+                               if ( $title->isAlwaysKnown() ) {
+                                       $colours[$pdbk] = '';
+                               } elseif ( $ns == NS_SPECIAL ) {
+                                       $colours[$pdbk] = 'new';
+                               } elseif ( ( $id = $linkCache->getGoodLinkID( $pdbk ) ) != 0 ) {
                                        $colours[$pdbk] = Linker::getLinkColour( $title, $threshold );
-                                       //add id to the extension todolist
-                                       $linkcolour_ids[$s->page_id] = $pdbk;
+                                       $output->addLink( $title, $id );
+                                       $linkcolour_ids[$id] = $pdbk;
+                               } elseif ( $linkCache->isBadLink( $pdbk ) ) {
+                                       $colours[$pdbk] = 'new';
+                               } else {
+                                       # Not in the link cache, add it to the query
+                                       $queries[$ns][] = $title->getDBkey();
                                }
-                               unset( $res );
                        }
-                       if ( count( $linkcolour_ids ) ) {
-                               //pass an array of page_ids to an extension
-                               wfRunHooks( 'GetLinkColours', array( $linkcolour_ids, &$colours ) );
+               }
+               if ( $queries ) {
+                       $where = array();
+                       foreach ( $queries as $ns => $pages ) {
+                               $where[] = $dbr->makeList(
+                                       array(
+                                               'page_namespace' => $ns,
+                                               'page_title' => $pages,
+                                       ),
+                                       LIST_AND
+                               );
                        }
-                       wfProfileOut( __METHOD__ . '-check' );
+
+                       $res = $dbr->select(
+                               'page',
+                               array( 'page_id', 'page_namespace', 'page_title', 'page_is_redirect', 'page_len', 'page_latest' ),
+                               $dbr->makeList( $where, LIST_OR ),
+                               __METHOD__
+                       );
+
+                       # Fetch data and form into an associative array
+                       # non-existent = broken
+                       foreach ( $res as $s ) {
+                               $title = Title::makeTitle( $s->page_namespace, $s->page_title );
+                               $pdbk = $title->getPrefixedDBkey();
+                               $linkCache->addGoodLinkObjFromRow( $title, $s );
+                               $output->addLink( $title, $s->page_id );
+                               # @todo FIXME: Convoluted data flow
+                               # The redirect status and length is passed to getLinkColour via the LinkCache
+                               # Use formal parameters instead
+                               $colours[$pdbk] = Linker::getLinkColour( $title, $threshold );
+                               //add id to the extension todolist
+                               $linkcolour_ids[$s->page_id] = $pdbk;
+                       }
+                       unset( $res );
+               }
+               if ( count( $linkcolour_ids ) ) {
+                       //pass an array of page_ids to an extension
+                       wfRunHooks( 'GetLinkColours', array( $linkcolour_ids, &$colours ) );
                }
+               wfProfileOut( __METHOD__ . '-check' );
 
                # Do a second query for different language variants of links and categories
                if ( $wgContLang->hasVariants() ) {
index 79780da..39206c3 100644 (file)
 }
 
 .config-input-check {
-       margin-left: 3.7em;
-       margin-right: 2em;
-       margin-bottom: 0.25em;
-}
-
-.config-input-check input {
-       margin-left: -1em;
+       margin-left: 10em;
 }
 
 .error {