Merge "Localisation updates from http://translatewiki.net."
authorTranslation updater bot <l10n-bot@translatewiki.net>
Fri, 15 Nov 2013 20:28:44 +0000 (20:28 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 15 Nov 2013 20:28:44 +0000 (20:28 +0000)
104 files changed:
RELEASE-NOTES-1.23
docs/database.txt
docs/hooks.txt
includes/Article.php
includes/AutoLoader.php
includes/Hooks.php
includes/Sanitizer.php
includes/UserMailer.php
includes/actions/CreditsAction.php
includes/actions/HistoryAction.php
includes/actions/InfoAction.php
includes/actions/RawAction.php
includes/actions/RevertAction.php
includes/api/ApiPageSet.php
includes/api/ApiParamInfo.php
includes/api/ApiParse.php
includes/api/ApiProtect.php
includes/api/ApiPurge.php
includes/api/ApiQuery.php
includes/api/ApiQueryAllCategories.php
includes/api/ApiQueryAllImages.php
includes/api/ApiQueryAllLinks.php
includes/api/ApiQueryAllPages.php
includes/api/ApiQueryAllUsers.php
includes/api/ApiQueryBacklinks.php
includes/api/ApiQueryBase.php
includes/api/ApiQueryBlocks.php
includes/api/ApiQueryCategories.php
includes/api/ApiQueryCategoryInfo.php
includes/api/ApiQueryCategoryMembers.php
includes/api/ApiQueryDeletedrevs.php
includes/api/ApiQueryDuplicateFiles.php
includes/api/ApiQueryExtLinksUsage.php
includes/api/ApiQueryExternalLinks.php
includes/api/ApiQueryFileRepoInfo.php
includes/api/ApiQueryFilearchive.php
includes/api/ApiQueryIWBacklinks.php
includes/api/ApiQueryIWLinks.php
includes/api/ApiQueryImageInfo.php
includes/api/ApiQueryImages.php
includes/api/ApiQueryInfo.php
includes/api/ApiQueryLangBacklinks.php
includes/api/ApiQueryLangLinks.php
includes/api/ApiQueryLinks.php
includes/api/ApiQueryLogEvents.php
includes/api/ApiQueryPagePropNames.php
includes/api/ApiQueryPageProps.php
includes/api/ApiQueryPagesWithProp.php
includes/api/ApiQueryProtectedTitles.php
includes/api/ApiQueryQueryPage.php
includes/api/ApiQueryRandom.php
includes/api/ApiQueryRecentChanges.php
includes/api/ApiQueryRevisions.php
includes/api/ApiQuerySearch.php
includes/api/ApiQuerySiteinfo.php
includes/api/ApiQueryStashImageInfo.php
includes/api/ApiQueryUserContributions.php
includes/api/ApiQueryUserInfo.php
includes/api/ApiQueryUsers.php
includes/api/ApiQueryWatchlist.php
includes/api/ApiQueryWatchlistRaw.php
includes/api/ApiResult.php
includes/api/ApiRollback.php
includes/api/ApiSetNotificationTimestamp.php
includes/api/ApiUnblock.php
includes/api/ApiUndelete.php
includes/api/ApiUpload.php
includes/api/ApiWatch.php
includes/clientpool/RedisConnectionPool.php
includes/db/Database.php
includes/db/DatabaseMssql.php [deleted file]
includes/db/DatabaseMysqlBase.php
includes/db/DatabasePostgres.php
includes/installer/WebInstaller.php
includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderFileModule.php
includes/search/SearchMssql.php [deleted file]
includes/specials/SpecialUploadStash.php
languages/messages/MessagesAr.php
languages/messages/MessagesAz.php
languages/messages/MessagesBcl.php
languages/messages/MessagesCs.php
languages/messages/MessagesDe.php
languages/messages/MessagesEn.php
languages/messages/MessagesFr.php
languages/messages/MessagesHy.php
languages/messages/MessagesIt.php
languages/messages/MessagesJa.php
languages/messages/MessagesKo.php
languages/messages/MessagesLb.php
languages/messages/MessagesPms.php
languages/messages/MessagesQqq.php
languages/messages/MessagesRu.php
languages/messages/MessagesSr_ec.php
languages/messages/MessagesTl.php
languages/messages/MessagesUk.php
languages/messages/MessagesVi.php
languages/messages/MessagesYi.php
languages/messages/MessagesZh_hans.php
languages/messages/MessagesZh_hant.php
maintenance/dictionary/mediawiki.dic
maintenance/moveBatch.php
maintenance/mssql/tables.sql [deleted file]
tests/parser/parserTests.txt

index f7b6507..dbdc453 100644 (file)
@@ -35,6 +35,8 @@ production.
 * Add "wgRelevantUserName" to mw.config containing the current
   Skin::getRelevantUser value.
 * (bug 56033) Add content model to the page information.
+* Added Article::MissingArticleConditions hook to give extensions a chance to
+  hide their (unrelated) log entries.
 
 === Bug fixes in 1.23 ===
 * (bug 41759) The "updated since last visit" markers (on history pages, recent
@@ -71,6 +73,7 @@ changes to languages because of Bugzilla reports.
 ** The rc_type field of recentchanges will be deprecated in a future point
    release.
 * The global variable $wgArticle has been removed after a lengthy deprecation.
+* Experimental and unsupported Mssql support has been removed
 
 == Compatibility ==
 
index 65a597b..c33b5f1 100644 (file)
@@ -180,7 +180,6 @@ MediaWiki does support the following other DBMSs to varying degrees.
 * PostgreSQL
 * SQLite
 * Oracle
-* MSSQL
 
 More information can be found about each of these databases (known issues,
 level of support, extra configuration) in the "databases" subdirectory in
index 1cd112b..d56886c 100644 (file)
@@ -461,6 +461,13 @@ types.
 &$tokenTypes: supported token types in format 'type' => callback function
 used to retrieve this type of tokens.
 
+'Article::MissingArticleConditions': Before fetching deletion & move log entries
+to display a message of a non-existing page being deleted/moved, give extensions
+a chance to hide their (unrelated) log entries.
+&$conds: Array of query conditions (all of which have to be met; conditions will
+AND in the final query)
+$logTypes: Array of log types being queried
+
 'ArticleAfterFetchContent': After fetching content of an article from the
 database. DEPRECATED, use ArticleAfterFetchContentObject instead.
 $article: the article (object) being loaded from the database
index 1619e09..854f7f1 100644 (file)
@@ -1201,10 +1201,15 @@ class Article implements Page {
 
                wfRunHooks( 'ShowMissingArticle', array( $this ) );
 
+               // Give extensions a chance to hide their (unrelated) log entries
+               $logTypes = array( 'delete', 'move' );
+               $conds = array( "log_action != 'revision'" );
+               wfRunHooks( 'Article::MissingArticleConditions', array( &$conds, $logTypes ) );
+
                # Show delete and move logs
-               LogEventsList::showLogExtract( $outputPage, array( 'delete', 'move' ), $this->getTitle(), '',
+               LogEventsList::showLogExtract( $outputPage, $logTypes, $this->getTitle(), '',
                        array( 'lim' => 10,
-                               'conds' => array( "log_action != 'revision'" ),
+                               'conds' => $conds,
                                'showIfEmpty' => false,
                                'msgKey' => array( 'moveddeleted-notice' ) )
                );
index c94c46b..2c8f05f 100644 (file)
@@ -438,7 +438,6 @@ $wgAutoloadLocalClasses = array(
        'ChronologyProtector' => 'includes/db/ChronologyProtector.php',
        'CloneDatabase' => 'includes/db/CloneDatabase.php',
        'DatabaseBase' => 'includes/db/Database.php',
-       'DatabaseMssql' => 'includes/db/DatabaseMssql.php',
        'DatabaseMysql' => 'includes/db/DatabaseMysql.php',
        'DatabaseMysqlBase' => 'includes/db/DatabaseMysqlBase.php',
        'DatabaseMysqli' => 'includes/db/DatabaseMysqli.php',
@@ -471,8 +470,6 @@ $wgAutoloadLocalClasses = array(
        'LoadMonitor' => 'includes/db/LoadMonitor.php',
        'LoadMonitor_MySQL' => 'includes/db/LoadMonitor.php',
        'LoadMonitor_Null' => 'includes/db/LoadMonitor.php',
-       'MssqlField' => 'includes/db/DatabaseMssql.php',
-       'MssqlResult' => 'includes/db/DatabaseMssql.php',
        'MySQLField' => 'includes/db/DatabaseMysqlBase.php',
        'MySQLMasterPos' => 'includes/db/DatabaseMysqlBase.php',
        'ORAField' => 'includes/db/DatabaseOracle.php',
@@ -871,14 +868,12 @@ $wgAutoloadLocalClasses = array(
        'RevisionDeleteUser' => 'includes/revisiondelete/RevisionDeleteUser.php',
 
        # includes/search
-       'MssqlSearchResultSet' => 'includes/search/SearchMssql.php',
        'MySQLSearchResultSet' => 'includes/search/SearchMySQL.php',
        'PostgresSearchResult' => 'includes/search/SearchPostgres.php',
        'PostgresSearchResultSet' => 'includes/search/SearchPostgres.php',
        'SearchEngine' => 'includes/search/SearchEngine.php',
        'SearchEngineDummy' => 'includes/search/SearchEngine.php',
        'SearchHighlighter' => 'includes/search/SearchEngine.php',
-       'SearchMssql' => 'includes/search/SearchMssql.php',
        'SearchMySQL' => 'includes/search/SearchMySQL.php',
        'SearchNearMatchResultSet' => 'includes/search/SearchEngine.php',
        'SearchOracle' => 'includes/search/SearchOracle.php',
index 396e360..db47d31 100644 (file)
@@ -199,6 +199,9 @@ class Hooks {
                                $retval = call_user_func_array( $callback, $hook_args );
                        } catch ( MWHookException $e ) {
                                $badhookmsg = $e->getMessage();
+                       } catch ( Exception $e ) {
+                               restore_error_handler();
+                               throw $e;
                        }
                        restore_error_handler();
                        wfProfileOut( $func );
index 4dbc9dd..3384af0 100644 (file)
@@ -865,6 +865,27 @@ class Sanitizer {
                $value = preg_replace_callback( $decodeRegex,
                        array( __CLASS__, 'cssDecodeCallback' ), $value );
 
+               // Normalize Halfwidth and Fullwidth Unicode block that IE6 might treat as ascii
+               $value = preg_replace_callback(
+                       '/[!-z]/u', // U+FF01 to U+FF5A
+                       function ( $matches ) {
+                               $cp = utf8ToCodepoint( $matches[0] );
+                               if ( $cp === false ) {
+                                       return '';
+                               }
+                               return chr( $cp - 65248 ); // ASCII range \x21-\x7A
+                       },
+                       $value
+               );
+
+               // Convert more characters IE6 might treat as ascii
+               // U+0280, U+0274, U+207F, U+029F, U+026A, U+207D, U+208D
+               $value = str_replace(
+                       array( 'ʀ', 'ɴ', 'ⁿ', 'ʟ', 'ɪ', '⁽', '₍' ),
+                       array( 'r', 'n', 'n', 'l', 'i', '(', '(' ),
+                       $value
+               );
+
                // Let the value through if it's nothing but a single comment, to
                // allow other functions which may reject it to pass some error
                // message through.
@@ -885,8 +906,24 @@ class Sanitizer {
                        }
                }
 
+               // S followed by repeat, iteration, or prolonged sound marks,
+               // which IE will treat as "ss"
+               $value = preg_replace(
+                       '/s(?:
+                               \xE3\x80\xB1 | # U+3031
+                               \xE3\x82\x9D | # U+309D
+                               \xE3\x83\xBC | # U+30FC
+                               \xE3\x83\xBD | # U+30FD
+                               \xEF\xB9\xBC | # U+FE7C
+                               \xEF\xB9\xBD | # U+FE7D
+                               \xEF\xBD\xB0   # U+FF70
+                       )/ix',
+                       'ss',
+                       $value
+               );
+
                // Reject problematic keywords and control characters
-               if ( preg_match( '/[\000-\010\016-\037\177]/', $value ) ) {
+               if ( preg_match( '/[\000-\010\013\016-\037\177]/', $value ) ) {
                        return '/* invalid control char */';
                } elseif ( preg_match( '! expression | filter\s*: | accelerator\s*: | url\s*\( | image\s*\( | image-set\s*\( !ix', $value ) ) {
                        return '/* insecure input */';
index 8ab10b2..6157f78 100644 (file)
@@ -352,14 +352,19 @@ class UserMailer {
                        ini_set( 'html_errors', '0' );
                        set_error_handler( 'UserMailer::errorHandler' );
 
-                       $safeMode = wfIniGetBool( 'safe_mode' );
-
-                       foreach ( $to as $recip ) {
-                               if ( $safeMode ) {
-                                       $sent = mail( $recip, self::quotedPrintable( $subject ), $body, $headers );
-                               } else {
-                                       $sent = mail( $recip, self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
+                       try {
+                               $safeMode = wfIniGetBool( 'safe_mode' );
+
+                               foreach ( $to as $recip ) {
+                                       if ( $safeMode ) {
+                                               $sent = mail( $recip, self::quotedPrintable( $subject ), $body, $headers );
+                                       } else {
+                                               $sent = mail( $recip, self::quotedPrintable( $subject ), $body, $headers, $wgAdditionalMailParams );
+                                       }
                                }
+                       } catch ( Exception $e ) {
+                               restore_error_handler();
+                               throw $e;
                        }
 
                        restore_error_handler();
index cd7eb45..97c1605 100644 (file)
@@ -127,6 +127,7 @@ class CreditsAction extends FormlessAction {
                $anon_ips = array();
 
                # Sift for real versus user names
+               /** @var $user User */
                foreach ( $contributors as $user ) {
                        $cnt--;
                        if ( $user->isLoggedIn() ) {
index 687a460..e492bd4 100644 (file)
@@ -37,6 +37,9 @@ class HistoryAction extends FormlessAction {
        const DIR_PREV = 0;
        const DIR_NEXT = 1;
 
+       /** @var array Array of message keys and strings */
+       public $message;
+
        public function getName() {
                return 'history';
        }
@@ -341,14 +344,28 @@ class HistoryAction extends FormlessAction {
  * @ingroup Actions
  */
 class HistoryPager extends ReverseChronologicalPager {
-       public $lastRow = false, $counter, $historyPage, $buttons, $conds;
+       /**
+        * @var bool|stdClass
+        */
+       public $lastRow = false;
+
+       public $counter, $historyPage, $buttons, $conds;
+
        protected $oldIdChecked;
+
        protected $preventClickjacking = false;
        /**
         * @var array
         */
        protected $parentLens;
 
+       /**
+        * @param HistoryAction $historyPage
+        * @param string $year
+        * @param string $month
+        * @param string $tagFilter
+        * @param array $conds
+        */
        function __construct( $historyPage, $year = '', $month = '', $tagFilter = '', $conds = array() ) {
                parent::__construct( $historyPage->getContext() );
                $this->historyPage = $historyPage;
@@ -397,6 +414,10 @@ class HistoryPager extends ReverseChronologicalPager {
                return 'rev_timestamp';
        }
 
+       /**
+        * @param stdClass $row
+        * @return string
+        */
        function formatRow( $row ) {
                if ( $this->lastRow ) {
                        $latest = ( $this->counter == 1 && $this->mIsFirst );
@@ -537,14 +558,14 @@ class HistoryPager extends ReverseChronologicalPager {
         *
         * @todo document some more, and maybe clean up the code (some params redundant?)
         *
-        * @param $row Object: the database row corresponding to the previous line.
-        * @param $next Mixed: the database row corresponding to the next line
+        * @param stdObject $row The database row corresponding to the previous line.
+        * @param mixed $next The database row corresponding to the next line
         *   (chronologically previous)
-        * @param $notificationtimestamp
-        * @param $latest Boolean: whether this row corresponds to the page's latest revision.
-        * @param $firstInList Boolean: whether this row corresponds to the first
+        * @param bool|string $notificationtimestamp
+        * @param bool $latest Whether this row corresponds to the page's latest revision.
+        * @param bool $firstInList Whether this row corresponds to the first
         *   displayed on this history page.
-        * @return String: HTML output for the row
+        * @return string HTML output for the row
         */
        function historyLine( $row, $next, $notificationtimestamp = false,
                $latest = false, $firstInList = false ) {
@@ -862,9 +883,11 @@ class HistoryPager extends ReverseChronologicalPager {
  * Backwards-compatibility alias
  */
 class HistoryPage extends HistoryAction {
-       public function __construct( Page $article ) { # Just to make it public
+       // @codingStandardsIgnoreStart Needed "useless" override to make it public.
+       public function __construct( Page $article ) {
                parent::__construct( $article );
        }
+       // @codingStandardsIgnoreEnd
 
        public function history() {
                $this->onView();
index c97267b..811e35d 100644 (file)
@@ -763,6 +763,7 @@ class InfoAction extends FormlessAction {
                $anon_ips = array();
 
                # Sift for real versus user names
+               /** @var $user User */
                foreach ( $contributors as $user ) {
                        $page = $user->isAnon()
                                ? SpecialPage::getTitleFor( 'Contributions', $user->getName() )
index 1a451b7..a0116fb 100644 (file)
@@ -94,6 +94,9 @@ class RawAction extends FormlessAction {
                # Output may contain user-specific data;
                # vary generated content for open sessions on private wikis
                $privateCache = !User::isEveryoneAllowed( 'read' ) && ( $smaxage == 0 || session_id() != '' );
+               // Bug 53032 - make this private if user is logged in,
+               // so we don't accidentally cache cookies
+               $privateCache = $privateCache ?: $this->getUser()->isLoggedIn();
                # allow the client to cache this for 24 hours
                $mode = $privateCache ? 'private' : 'public';
                $response->header(
index e5f1929..cdd139e 100644 (file)
@@ -48,6 +48,9 @@ class RevertAction extends Action {
  * @ingroup Actions
  */
 class RevertFileAction extends FormAction {
+       /**
+        * @var OldLocalFile
+        */
        protected $oldFile;
 
        public function getName() {
index cfbc095..6c4bb08 100644 (file)
@@ -112,7 +112,8 @@ class ApiPageSet extends ApiBase {
 
        /**
         * Populate the PageSet from the request parameters.
-        * @param bool $isDryRun If true, instantiates generator, but only to mark relevant parameters as used
+        * @param bool $isDryRun If true, instantiates generator, but only to mark
+        *    relevant parameters as used
         */
        private function executeInternal( $isDryRun ) {
                $this->profileIn();
@@ -200,8 +201,9 @@ class ApiPageSet extends ApiBase {
                                                break;
                                        case 'revids':
                                                if ( $this->mResolveRedirects ) {
-                                                       $this->setWarning( 'Redirect resolution cannot be used together with the revids= parameter. ' .
-                                                               'Any redirects the revids= point to have not been resolved.' );
+                                                       $this->setWarning( 'Redirect resolution cannot be used ' .
+                                                               'together with the revids= parameter. Any redirects ' .
+                                                               'the revids= point to have not been resolved.' );
                                                }
                                                $this->mResolveRedirects = false;
                                                $this->initFromRevIDs( $this->mParams['revids'] );
@@ -870,7 +872,12 @@ class ApiPageSet extends ApiBase {
                foreach ( $res as $row ) {
                        $rdfrom = intval( $row->rd_from );
                        $from = $this->mPendingRedirectIDs[$rdfrom]->getPrefixedText();
-                       $to = Title::makeTitle( $row->rd_namespace, $row->rd_title, $row->rd_fragment, $row->rd_interwiki );
+                       $to = Title::makeTitle(
+                               $row->rd_namespace,
+                               $row->rd_title,
+                               $row->rd_fragment,
+                               $row->rd_interwiki
+                       );
                        unset( $this->mPendingRedirectIDs[$rdfrom] );
                        if ( !$to->isExternal() && !isset( $this->mAllPages[$row->rd_namespace][$row->rd_title] ) ) {
                                $lb->add( $row->rd_namespace, $row->rd_title );
@@ -1086,19 +1093,34 @@ class ApiPageSet extends ApiBase {
                        'titles' => 'A list of titles to work on',
                        'pageids' => 'A list of page IDs to work on',
                        'revids' => 'A list of revision IDs to work on',
-                       'generator' => array( 'Get the list of pages to work on by executing the specified query module.',
-                               'NOTE: generator parameter names must be prefixed with a \'g\', see examples' ),
+                       'generator' => array(
+                               'Get the list of pages to work on by executing the specified query module.',
+                               'NOTE: generator parameter names must be prefixed with a \'g\', see examples'
+                       ),
                        'redirects' => 'Automatically resolve redirects',
-                       'converttitles' => array( 'Convert titles to other variants if necessary. Only works if the wiki\'s content language supports variant conversion.',
-                               'Languages that support variant conversion include ' . implode( ', ', LanguageConverter::$languagesWithVariants ) ),
+                       'converttitles' => array(
+                               'Convert titles to other variants if necessary. Only works if ' .
+                                       'the wiki\'s content language supports variant conversion.',
+                               'Languages that support variant conversion include ' .
+                                       implode( ', ', LanguageConverter::$languagesWithVariants )
+                       ),
                );
        }
 
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'multisource', 'info' => "Cannot use 'pageids' at the same time as 'dataSource'" ),
-                       array( 'code' => 'multisource', 'info' => "Cannot use 'revids' at the same time as 'dataSource'" ),
-                       array( 'code' => 'badgenerator', 'info' => 'Module $generatorName cannot be used as a generator' ),
+                       array(
+                               'code' => 'multisource',
+                               'info' => "Cannot use 'pageids' at the same time as 'dataSource'"
+                       ),
+                       array(
+                               'code' => 'multisource',
+                               'info' => "Cannot use 'revids' at the same time as 'dataSource'"
+                       ),
+                       array(
+                               'code' => 'badgenerator',
+                               'info' => 'Module $generatorName cannot be used as a generator'
+                       ),
                ) );
        }
 }
index 7ecf71f..2b4710a 100644 (file)
@@ -226,7 +226,8 @@ class ApiParamInfo extends ApiBase {
                        if ( isset( $p[ApiBase::PARAM_TYPE] ) ) {
                                $a['type'] = $p[ApiBase::PARAM_TYPE];
                                if ( is_array( $a['type'] ) ) {
-                                       $a['type'] = array_values( $a['type'] ); // to prevent sparse arrays from being serialized to JSON as objects
+                                       // To prevent sparse arrays from being serialized to JSON as objects
+                                       $a['type'] = array_values( $a['type'] );
                                        $result->setIndexedTagName( $a['type'], 't' );
                                }
                        }
@@ -341,7 +342,8 @@ class ApiParamInfo extends ApiBase {
                        'modules' => 'List of module names (value of the action= parameter)',
                        'querymodules' => 'List of query module names (value of prop=, meta= or list= parameter)',
                        'mainmodule' => 'Get information about the main (top-level) module as well',
-                       'pagesetmodule' => 'Get information about the pageset module (providing titles= and friends) as well',
+                       'pagesetmodule' => 'Get information about the pageset module ' .
+                               '(providing titles= and friends) as well',
                        'formatmodules' => 'List of format module names (value of format= parameter)',
                );
        }
index 91a3a99..3e2e5a8 100644 (file)
@@ -60,7 +60,10 @@ class ApiParse extends ApiBase {
                $format = $params['contentformat'];
 
                if ( !is_null( $page ) && ( !is_null( $text ) || $titleProvided ) ) {
-                       $this->dieUsage( 'The page parameter cannot be used together with the text and title parameters', 'params' );
+                       $this->dieUsage(
+                               'The page parameter cannot be used together with the text and title parameters',
+                               'params'
+                       );
                }
 
                $prop = array_flip( $params['prop'] );
@@ -76,9 +79,12 @@ class ApiParse extends ApiBase {
                // TODO: Does this still need $wgTitle?
                global $wgParser, $wgTitle;
 
-               // Currently unnecessary, code to act as a safeguard against any change in current behavior of uselang
+               // Currently unnecessary, code to act as a safeguard against any change
+               // in current behavior of uselang
                $oldLang = null;
-               if ( isset( $params['uselang'] ) && $params['uselang'] != $this->getContext()->getLanguage()->getCode() ) {
+               if ( isset( $params['uselang'] )
+                       && $params['uselang'] != $this->getContext()->getLanguage()->getCode()
+               ) {
                        $oldLang = $this->getContext()->getLanguage(); // Backup language
                        $this->getContext()->setLanguage( Language::factory( $params['uselang'] ) );
                }
@@ -250,7 +256,10 @@ class ApiParse extends ApiBase {
 
                if ( !is_null( $params['summary'] ) ) {
                        $result_array['parsedsummary'] = array();
-                       ApiResult::setContent( $result_array['parsedsummary'], Linker::formatComment( $params['summary'], $titleObj ) );
+                       ApiResult::setContent(
+                               $result_array['parsedsummary'],
+                               Linker::formatComment( $params['summary'], $titleObj )
+                       );
                }
 
                if ( isset( $prop['langlinks'] ) || isset( $prop['languageshtml'] ) ) {
@@ -322,7 +331,10 @@ class ApiParse extends ApiBase {
 
                        if ( isset( $prop['headhtml'] ) ) {
                                $result_array['headhtml'] = array();
-                               ApiResult::setContent( $result_array['headhtml'], $context->getOutput()->headElement( $context->getSkin() ) );
+                               ApiResult::setContent(
+                                       $result_array['headhtml'],
+                                       $context->getOutput()->headElement( $context->getSkin() )
+                               );
                        }
                }
 
@@ -512,7 +524,8 @@ class ApiParse extends ApiBase {
        }
 
        /**
-        * @deprecated since 1.18 No modern skin generates language links this way, please use language links
+        * @deprecated since 1.18 No modern skin generates language links this way,
+        * please use language links
         *                        data to generate your own HTML.
         * @param $languages array
         * @return string
@@ -526,7 +539,8 @@ class ApiParse extends ApiBase {
                        return '';
                }
 
-               $s = htmlspecialchars( wfMessage( 'otherlanguages' )->text() . wfMessage( 'colon-separator' )->text() );
+               $s = htmlspecialchars( wfMessage( 'otherlanguages' )->text() .
+                       wfMessage( 'colon-separator' )->text() );
 
                $langs = array();
                foreach ( $languages as $l ) {
@@ -642,7 +656,8 @@ class ApiParse extends ApiBase {
                                ApiBase::PARAM_TYPE => 'integer',
                        ),
                        'prop' => array(
-                               ApiBase::PARAM_DFLT => 'text|langlinks|categories|links|templates|images|externallinks|sections|revid|displaytitle|iwlinks|properties',
+                               ApiBase::PARAM_DFLT => 'text|langlinks|categories|links|templates|' .
+                                       'images|externallinks|sections|revid|displaytitle|iwlinks|properties',
                                ApiBase::PARAM_ISMULTI => true,
                                ApiBase::PARAM_TYPE => array(
                                        'text',
@@ -751,7 +766,8 @@ class ApiParse extends ApiBase {
 
                return array(
                        'Parses content and returns parser output',
-                       'See the various prop-Modules of action=query to get information from the current version of a page',
+                       'See the various prop-Modules of action=query to get information from the current' .
+                               'version of a page',
                        'There are several ways to specify the text to parse:',
                        "1) Specify a page or revision, using {$p}page, {$p}pageid, or {$p}oldid.",
                        "2) Specify content explicitly, using {$p}text, {$p}title, and {$p}contentmodel.",
@@ -761,15 +777,24 @@ class ApiParse extends ApiBase {
 
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'params', 'info' => 'The page parameter cannot be used together with the text and title parameters' ),
+                       array(
+                               'code' => 'params',
+                               'info' => 'The page parameter cannot be used together with the text and title parameters'
+                       ),
                        array( 'code' => 'missingrev', 'info' => 'There is no revision ID oldid' ),
-                       array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted revisions' ),
+                       array(
+                               'code' => 'permissiondenied',
+                               'info' => 'You don\'t have permission to view deleted revisions'
+                       ),
                        array( 'code' => 'missingtitle', 'info' => 'The page you specified doesn\'t exist' ),
                        array( 'code' => 'nosuchsection', 'info' => 'There is no section sectionnumber in page' ),
                        array( 'nosuchpageid' ),
                        array( 'invalidtitle', 'title' ),
                        array( 'code' => 'parseerror', 'info' => 'Failed to parse the given text.' ),
-                       array( 'code' => 'notwikitext', 'info' => 'The requested operation is only supported on wikitext content.' ),
+                       array(
+                               'code' => 'notwikitext',
+                               'info' => 'The requested operation is only supported on wikitext content.'
+                       ),
                        array( 'code' => 'pagecannotexist', 'info' => "Namespace doesn't allow actual pages" ),
                ) );
        }
@@ -778,7 +803,8 @@ class ApiParse extends ApiBase {
                return array(
                        'api.php?action=parse&page=Project:Sandbox' => 'Parse a page',
                        'api.php?action=parse&text={{Project:Sandbox}}' => 'Parse wikitext',
-                       'api.php?action=parse&text={{PAGENAME}}&title=Test' => 'Parse wikitext, specifying the page title',
+                       'api.php?action=parse&text={{PAGENAME}}&title=Test'
+                               => 'Parse wikitext, specifying the page title',
                        'api.php?action=parse&summary=Some+[[link]]&prop=' => 'Parse a summary',
                );
        }
index 25727d0..80c76b3 100644 (file)
@@ -28,7 +28,6 @@
  * @ingroup API
  */
 class ApiProtect extends ApiBase {
-
        public function execute() {
                global $wgRestrictionLevels;
                $params = $this->extractRequestParams();
@@ -47,7 +46,11 @@ class ApiProtect extends ApiBase {
                        if ( count( $expiry ) == 1 ) {
                                $expiry = array_fill( 0, count( $params['protections'] ), $expiry[0] );
                        } else {
-                               $this->dieUsageMsg( array( 'toofewexpiries', count( $expiry ), count( $params['protections'] ) ) );
+                               $this->dieUsageMsg( array(
+                                       'toofewexpiries',
+                                       count( $expiry ),
+                                       count( $params['protections'] )
+                               ) );
                        }
                }
 
@@ -100,7 +103,13 @@ class ApiProtect extends ApiBase {
                $watch = $params['watch'] ? 'watch' : $params['watchlist'];
                $this->setWatch( $watch, $titleObj, 'watchdefault' );
 
-               $status = $pageObj->doUpdateRestrictions( $protections, $expiryarray, $cascade, $params['reason'], $this->getUser() );
+               $status = $pageObj->doUpdateRestrictions(
+                       $protections,
+                       $expiryarray,
+                       $cascade,
+                       $params['reason'],
+                       $this->getUser()
+               );
 
                if ( !$status->isOK() ) {
                        $this->dieStatus( $status );
@@ -173,13 +182,19 @@ class ApiProtect extends ApiBase {
                        'pageid' => "ID of the page you want to (un)protect. Cannot be used together with {$p}title",
                        'token' => 'A protect token previously retrieved through prop=info',
                        'protections' => 'List of protection levels, formatted action=group (e.g. edit=sysop)',
-                       'expiry' => array( 'Expiry timestamps. If only one timestamp is set, it\'ll be used for all protections.',
-                               'Use \'infinite\', \'indefinite\' or \'never\', for a never-expiring protection.' ),
+                       'expiry' => array(
+                               'Expiry timestamps. If only one timestamp is ' .
+                                       'set, it\'ll be used for all protections.',
+                               'Use \'infinite\', \'indefinite\' or \'never\', for a never-expiring protection.'
+                       ),
                        'reason' => 'Reason for (un)protecting',
-                       'cascade' => array( 'Enable cascading protection (i.e. protect pages included in this page)',
-                               'Ignored if not all protection levels are \'sysop\' or \'protect\'' ),
+                       'cascade' => array(
+                               'Enable cascading protection (i.e. protect pages included in this page)',
+                               'Ignored if not all protection levels are \'sysop\' or \'protect\''
+                       ),
                        'watch' => 'If set, add the page being (un)protected to your watchlist',
-                       'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
+                       'watchlist' => 'Unconditionally add or remove the page from your ' .
+                               'watchlist, use preferences or do not change watch',
                );
        }
 
@@ -222,8 +237,10 @@ class ApiProtect extends ApiBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=protect&title=Main%20Page&token=123ABC&protections=edit=sysop|move=sysop&cascade=&expiry=20070901163000|never',
-                       'api.php?action=protect&title=Main%20Page&token=123ABC&protections=edit=all|move=all&reason=Lifting%20restrictions'
+                       'api.php?action=protect&title=Main%20Page&token=123ABC&' .
+                               'protections=edit=sysop|move=sysop&cascade=&expiry=20070901163000|never',
+                       'api.php?action=protect&title=Main%20Page&token=123ABC&' .
+                               'protections=edit=all|move=all&reason=Lifting%20restrictions'
                );
        }
 
index 4c7981e..c0dd808 100644 (file)
@@ -30,7 +30,6 @@
  * @ingroup API
  */
 class ApiPurge extends ApiBase {
-
        private $mPageSet;
 
        /**
@@ -91,7 +90,12 @@ class ApiPurge extends ApiBase {
 
                                        # Parse content; note that HTML generation is only needed if we want to cache the result.
                                        $content = $page->getContent( Revision::RAW );
-                                       $p_result = $content->getParserOutput( $title, $page->getLatest(), $popts, $wgEnableParserCache );
+                                       $p_result = $content->getParserOutput(
+                                               $title,
+                                               $page->getLatest(),
+                                               $popts,
+                                               $wgEnableParserCache
+                                       );
 
                                        # Update the links tables
                                        $updates = $content->getSecondaryDataUpdates(
index ea57196..79a3b05 100644 (file)
@@ -708,25 +708,32 @@ class ApiQuery extends ApiBase {
 
        public function getParamDescription() {
                return $this->getPageSet()->getFinalParamDescription() + array(
-                       'prop' => 'Which properties to get for the titles/revisions/pageids. Module help is available below',
+                       'prop' => 'Which properties to get for the titles/revisions/pageids. ' .
+                               'Module help is available below',
                        'list' => 'Which lists to get. Module help is available below',
                        'meta' => 'Which metadata to get about the site. Module help is available below',
                        'indexpageids' => 'Include an additional pageids section listing all returned page IDs',
                        'export' => 'Export the current revisions of all given or generated pages',
-                       'exportnowrap' => 'Return the export XML without wrapping it in an XML result (same format as Special:Export). Can only be used with export',
+                       'exportnowrap' => 'Return the export XML without wrapping it in an '.
+                               'XML result (same format as Special:Export). Can only be used with export',
                        'iwurl' => 'Whether to get the full URL if the title is an interwiki link',
                        'continue' => array(
-                               'When present, formats query-continue as key-value pairs that should simply be merged into the original request.',
+                               'When present, formats query-continue as key-value pairs that ' .
+                                       'should simply be merged into the original request.',
                                'This parameter must be set to an empty string in the initial query.',
-                               'This parameter is recommended for all new development, and will be made default in the next API version.' ),
+                               'This parameter is recommended for all new development, and ' .
+                                       'will be made default in the next API version.'
+                       ),
                );
        }
 
        public function getDescription() {
                return array(
-                       'Query API module allows applications to get needed pieces of data from the MediaWiki databases,',
+                       'Query API module allows applications to get needed pieces of data ' .
+                               'from the MediaWiki databases,',
                        'and is loosely based on the old query.php interface.',
-                       'All data modifications will first have to use query to acquire a token to prevent abuse from malicious sites'
+                       'All data modifications will first have to use query to acquire a ' .
+                               'token to prevent abuse from malicious sites'
                );
        }
 
@@ -739,7 +746,8 @@ class ApiQuery extends ApiBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=query&prop=revisions&meta=siteinfo&titles=Main%20Page&rvprop=user|comment&continue=',
+                       'api.php?action=query&prop=revisions&meta=siteinfo&' .
+                               'titles=Main%20Page&rvprop=user|comment&continue=',
                        'api.php?action=query&generator=allpages&gapprefix=API/&prop=revisions&continue=',
                );
        }
index 5ef71f0..d0ab59e 100644 (file)
@@ -80,7 +80,8 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                }
 
                if ( isset( $params['prefix'] ) ) {
-                       $this->addWhere( 'cat_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
+                       $this->addWhere( 'cat_title' .
+                               $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
                }
 
                $this->addOption( 'LIMIT', $params['limit'] + 1 );
@@ -110,7 +111,8 @@ class ApiQueryAllCategories extends ApiQueryGeneratorBase {
                $count = 0;
                foreach ( $res as $row ) {
                        if ( ++$count > $params['limit'] ) {
-                               // We've reached the one extra which shows that there are additional cats to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional cats to be had. Stop here...
                                $this->setContinueEnumParameter( 'continue', $row->cat_title );
                                break;
                        }
index 5baee8d..9f97cac 100644 (file)
@@ -32,7 +32,6 @@
  * @ingroup API
  */
 class ApiQueryAllImages extends ApiQueryGeneratorBase {
-
        protected $mRepo;
 
        public function __construct( $query, $moduleName ) {
@@ -65,7 +64,11 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
         */
        public function executeGenerator( $resultPageSet ) {
                if ( $resultPageSet->isResolvingRedirects() ) {
-                       $this->dieUsage( 'Use "gaifilterredir=nonredirects" option instead of "redirects" when using allimages as a generator', 'params' );
+                       $this->dieUsage(
+                               'Use "gaifilterredir=nonredirects" option instead of "redirects" ' .
+                                       'when using allimages as a generator',
+                               'params'
+                       );
                }
 
                $this->run( $resultPageSet );
@@ -78,7 +81,10 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
        private function run( $resultPageSet = null ) {
                $repo = $this->mRepo;
                if ( !$repo instanceof LocalRepo ) {
-                       $this->dieUsage( 'Local file repository does not support querying all images', 'unsupportedrepo' );
+                       $this->dieUsage(
+                               'Local file repository does not support querying all images',
+                               'unsupportedrepo'
+                       );
                }
 
                $prefix = $this->getModulePrefix();
@@ -103,11 +109,17 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
                        $disallowed = array( 'start', 'end', 'user' );
                        foreach ( $disallowed as $pname ) {
                                if ( isset( $params[$pname] ) ) {
-                                       $this->dieUsage( "Parameter '{$prefix}{$pname}' can only be used with {$prefix}sort=timestamp", 'badparams' );
+                                       $this->dieUsage(
+                                               "Parameter '{$prefix}{$pname}' can only be used with {$prefix}sort=timestamp",
+                                               'badparams'
+                                       );
                                }
                        }
                        if ( $params['filterbots'] != 'all' ) {
-                               $this->dieUsage( "Parameter '{$prefix}filterbots' can only be used with {$prefix}sort=timestamp", 'badparams' );
+                               $this->dieUsage(
+                                       "Parameter '{$prefix}filterbots' can only be used with {$prefix}sort=timestamp",
+                                       'badparams'
+                               );
                        }
 
                        // Pagination
@@ -125,23 +137,36 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
                        $this->addWhereRange( 'img_name', ( $ascendingOrder ? 'newer' : 'older' ), $from, $to );
 
                        if ( isset( $params['prefix'] ) ) {
-                               $this->addWhere( 'img_name' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
+                               $this->addWhere( 'img_name' .
+                                       $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
                        }
                } else {
                        // Check mutually exclusive params
                        $disallowed = array( 'from', 'to', 'prefix' );
                        foreach ( $disallowed as $pname ) {
                                if ( isset( $params[$pname] ) ) {
-                                       $this->dieUsage( "Parameter '{$prefix}{$pname}' can only be used with {$prefix}sort=name", 'badparams' );
+                                       $this->dieUsage(
+                                               "Parameter '{$prefix}{$pname}' can only be used with {$prefix}sort=name",
+                                               'badparams'
+                                       );
                                }
                        }
                        if ( !is_null( $params['user'] ) && $params['filterbots'] != 'all' ) {
-                               // Since filterbots checks if each user has the bot right, it doesn't make sense to use it with user
-                               $this->dieUsage( "Parameters '{$prefix}user' and '{$prefix}filterbots' cannot be used together", 'badparams' );
+                               // Since filterbots checks if each user has the bot right, it
+                               // doesn't make sense to use it with user
+                               $this->dieUsage(
+                                       "Parameters '{$prefix}user' and '{$prefix}filterbots' cannot be used together",
+                                       'badparams'
+                               );
                        }
 
                        // Pagination
-                       $this->addTimestampWhereRange( 'img_timestamp', ( $ascendingOrder ? 'newer' : 'older' ), $params['start'], $params['end'] );
+                       $this->addTimestampWhereRange(
+                               'img_timestamp',
+                               $ascendingOrder ? 'newer' : 'older',
+                               $params['start'],
+                               $params['end']
+                       );
 
                        // Image filters
                        if ( !is_null( $params['user'] ) ) {
@@ -223,7 +248,8 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
                $result = $this->getResult();
                foreach ( $res as $row ) {
                        if ( ++$count > $limit ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                if ( $params['sort'] == 'name' ) {
                                        $this->setContinueEnumParameter( 'continue', $row->img_name );
                                } else {
@@ -336,13 +362,16 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
                        'start' => "The timestamp to start enumerating from. Can only be used with {$p}sort=timestamp",
                        'end' => "The timestamp to end enumerating. Can only be used with {$p}sort=timestamp",
                        'prop' => ApiQueryImageInfo::getPropertyDescriptions( $this->propertyFilter ),
-                       'prefix' => "Search for all image titles that begin with this value. Can only be used with {$p}sort=name",
+                       'prefix' => "Search for all image titles that begin with this " .
+                               "value. Can only be used with {$p}sort=name",
                        'minsize' => 'Limit to images with at least this many bytes',
                        'maxsize' => 'Limit to images with at most this many bytes',
                        'sha1' => "SHA1 hash of image. Overrides {$p}sha1base36",
                        'sha1base36' => 'SHA1 hash of image in base 36 (used in MediaWiki)',
-                       'user' => "Only return files uploaded by this user. Can only be used with {$p}sort=timestamp. Cannot be used together with {$p}filterbots",
-                       'filterbots' => "How to filter files uploaded by bots. Can only be used with {$p}sort=timestamp. Cannot be used together with {$p}user",
+                       'user' => "Only return files uploaded by this user. Can only be used " .
+                               "with {$p}sort=timestamp. Cannot be used together with {$p}filterbots",
+                       'filterbots' => "How to filter files uploaded by bots. Can only be " .
+                               "used with {$p}sort=timestamp. Cannot be used together with {$p}user",
                        'mime' => 'What MIME type to search for. e.g. image/jpeg. Disabled in Miser Mode',
                        'limit' => 'How many images in total to return',
                );
@@ -371,19 +400,52 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
                $p = $this->getModulePrefix();
 
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'params', 'info' => 'Use "gaifilterredir=nonredirects" option instead of "redirects" when using allimages as a generator' ),
-                       array( 'code' => 'badparams', 'info' => "Parameter'{$p}start' can only be used with {$p}sort=timestamp" ),
-                       array( 'code' => 'badparams', 'info' => "Parameter'{$p}end' can only be used with {$p}sort=timestamp" ),
-                       array( 'code' => 'badparams', 'info' => "Parameter'{$p}user' can only be used with {$p}sort=timestamp" ),
-                       array( 'code' => 'badparams', 'info' => "Parameter'{$p}filterbots' can only be used with {$p}sort=timestamp" ),
-                       array( 'code' => 'badparams', 'info' => "Parameter'{$p}from' can only be used with {$p}sort=name" ),
-                       array( 'code' => 'badparams', 'info' => "Parameter'{$p}to' can only be used with {$p}sort=name" ),
-                       array( 'code' => 'badparams', 'info' => "Parameter'{$p}prefix' can only be used with {$p}sort=name" ),
-                       array( 'code' => 'badparams', 'info' => "Parameters '{$p}user' and '{$p}filterbots' cannot be used together" ),
-                       array( 'code' => 'unsupportedrepo', 'info' => 'Local file repository does not support querying all images' ),
+                       array(
+                               'code' => 'params',
+                               'info' => 'Use "gaifilterredir=nonredirects" option instead ' .
+                                       'of "redirects" when using allimages as a generator'
+                       ),
+                       array(
+                               'code' => 'badparams',
+                               'info' => "Parameter'{$p}start' can only be used with {$p}sort=timestamp"
+                       ),
+                       array(
+                               'code' => 'badparams',
+                               'info' => "Parameter'{$p}end' can only be used with {$p}sort=timestamp"
+                       ),
+                       array(
+                               'code' => 'badparams',
+                               'info' => "Parameter'{$p}user' can only be used with {$p}sort=timestamp"
+                       ),
+                       array(
+                               'code' => 'badparams',
+                               'info' => "Parameter'{$p}filterbots' can only be used with {$p}sort=timestamp"
+                       ),
+                       array(
+                               'code' => 'badparams',
+                               'info' => "Parameter'{$p}from' can only be used with {$p}sort=name"
+                       ),
+                       array(
+                               'code' => 'badparams',
+                               'info' => "Parameter'{$p}to' can only be used with {$p}sort=name"
+                       ),
+                       array(
+                               'code' => 'badparams',
+                               'info' => "Parameter'{$p}prefix' can only be used with {$p}sort=name"
+                       ),
+                       array(
+                               'code' => 'badparams',
+                               'info' => "Parameters '{$p}user' and '{$p}filterbots' cannot be used together"
+                       ),
+                       array(
+                               'code' => 'unsupportedrepo',
+                               'info' => 'Local file repository does not support querying all images' ),
                        array( 'code' => 'mimesearchdisabled', 'info' => 'MIME search disabled in Miser Mode' ),
                        array( 'code' => 'invalidsha1hash', 'info' => 'The SHA1 hash provided is not valid' ),
-                       array( 'code' => 'invalidsha1base36hash', 'info' => 'The SHA1Base36 hash provided is not valid' ),
+                       array(
+                               'code' => 'invalidsha1base36hash',
+                               'info' => 'The SHA1Base36 hash provided is not valid'
+                       ),
                ) );
        }
 
@@ -393,11 +455,13 @@ class ApiQueryAllImages extends ApiQueryGeneratorBase {
                                'Simple Use',
                                'Show a list of files starting at the letter "B"',
                        ),
-                       'api.php?action=query&list=allimages&aiprop=user|timestamp|url&aisort=timestamp&aidir=older' => array(
+                       'api.php?action=query&list=allimages&aiprop=user|timestamp|url&' .
+                               'aisort=timestamp&aidir=older' => array(
                                'Simple Use',
                                'Show a list of recently uploaded files similar to Special:NewFiles',
                        ),
-                       'api.php?action=query&generator=allimages&gailimit=4&gaifrom=T&prop=imageinfo' => array(
+                       'api.php?action=query&generator=allimages&gailimit=4&' .
+                               'gaifrom=T&prop=imageinfo' => array(
                                'Using as Generator',
                                'Show info about 4 files starting at the letter "T"',
                        ),
index 47f4505..ff53d0f 100644 (file)
@@ -54,7 +54,8 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                                $this->dfltNamespace = NS_TEMPLATE;
                                $this->hasNamespace = true;
                                $this->indexTag = 't';
-                               $this->description = 'List all transclusions (pages embedded using {{x}}), including non-existing';
+                               $this->description =
+                                       'List all transclusions (pages embedded using {{x}}), including non-existing';
                                $this->descriptionWhat = 'transclusion';
                                $this->descriptionTargets = 'transcluded titles';
                                $this->descriptionLinking = 'transcluding';
@@ -113,8 +114,10 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                if ( $params['unique'] ) {
                        if ( $fld_ids ) {
                                $this->dieUsage(
-                                       "{$this->getModuleName()} cannot return corresponding page ids in unique {$this->descriptionWhat}s mode",
-                                       'params' );
+                                       "{$this->getModuleName()} cannot return corresponding page " .
+                                               "ids in unique {$this->descriptionWhat}s mode",
+                                       'params'
+                               );
                        }
                        $this->addOption( 'DISTINCT' );
                }
@@ -145,12 +148,15 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                }
 
                // 'continue' always overrides 'from'
-               $from = ( $continue || is_null( $params['from'] ) ? null : $this->titlePartToKey( $params['from'] ) );
+               $from = $continue || is_null( $params['from'] )
+                       ? null
+                       : $this->titlePartToKey( $params['from'] );
                $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) );
                $this->addWhereRange( $pfx . $fieldTitle, 'newer', $from, $to );
 
                if ( isset( $params['prefix'] ) ) {
-                       $this->addWhere( $pfx . $fieldTitle . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
+                       $this->addWhere( $pfx . $fieldTitle .
+                               $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
                }
 
                $this->addFields( array( 'pl_title' => $pfx . $fieldTitle ) );
@@ -178,7 +184,8 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                $result = $this->getResult();
                foreach ( $res as $row ) {
                        if ( ++$count > $limit ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                if ( $params['unique'] ) {
                                        $this->setContinueEnumParameter( 'continue', $row->pl_title );
                                } else {
@@ -313,7 +320,10 @@ class ApiQueryAllLinks extends ApiQueryGeneratorBase {
                $what = $this->descriptionWhat;
 
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'params', 'info' => "{$m} cannot return corresponding page ids in unique {$what}s mode" ),
+                       array(
+                               'code' => 'params',
+                               'info' => "{$m} cannot return corresponding page ids in unique {$what}s mode"
+                       ),
                ) );
        }
 
index 3c24405..363d657 100644 (file)
@@ -49,7 +49,11 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
         */
        public function executeGenerator( $resultPageSet ) {
                if ( $resultPageSet->isResolvingRedirects() ) {
-                       $this->dieUsage( 'Use "gapfilterredir=nonredirects" option instead of "redirects" when using allpages as a generator', 'params' );
+                       $this->dieUsage(
+                               'Use "gapfilterredir=nonredirects" option instead of "redirects" ' .
+                                       'when using allpages as a generator',
+                               'params'
+                       );
                }
 
                $this->run( $resultPageSet );
@@ -88,7 +92,8 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                $this->addWhereRange( 'page_title', $dir, $from, $to );
 
                if ( isset( $params['prefix'] ) ) {
-                       $this->addWhere( 'page_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
+                       $this->addWhere( 'page_title' .
+                               $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
                }
 
                if ( is_null( $resultPageSet ) ) {
@@ -186,7 +191,8 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                $result = $this->getResult();
                foreach ( $res as $row ) {
                        if ( ++$count > $limit ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'continue', $row->page_title );
                                break;
                        }
@@ -303,7 +309,8 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                        'maxsize' => 'Limit to pages with at most this many bytes',
                        'prtype' => 'Limit to protected pages only',
                        'prlevel' => "The protection level (must be used with {$p}prtype= parameter)",
-                       'prfiltercascade' => "Filter protections based on cascadingness (ignored when {$p}prtype isn't set)",
+                       'prfiltercascade'
+                               => "Filter protections based on cascadingness (ignored when {$p}prtype isn't set)",
                        'filterlanglinks' => array(
                                'Filter based on whether a page has langlinks',
                                'Note that this may not consider langlinks added by extensions.',
@@ -334,7 +341,11 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
 
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'params', 'info' => 'Use "gapfilterredir=nonredirects" option instead of "redirects" when using allpages as a generator' ),
+                       array(
+                               'code' => 'params',
+                               'info' => 'Use "gapfilterredir=nonredirects" option instead of ' .
+                                       '"redirects" when using allpages as a generator'
+                       ),
                        array( 'code' => 'params', 'info' => 'prlevel may not be used without prtype' ),
                ) );
        }
@@ -349,9 +360,9 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                                'Using as Generator',
                                'Show info about 4 pages starting at the letter "T"',
                        ),
-                       'api.php?action=query&generator=allpages&gaplimit=2&gapfilterredir=nonredirects&gapfrom=Re&prop=revisions&rvprop=content' => array(
-                               'Show content of first 2 non-redirect pages beginning at "Re"',
-                       )
+                       'api.php?action=query&generator=allpages&gaplimit=2&' .
+                               'gapfilterredir=nonredirects&gapfrom=Re&prop=revisions&rvprop=content'
+                               => array( 'Show content of first 2 non-redirect pages beginning at "Re"' )
                );
        }
 
index 68f2487..748dbaf 100644 (file)
@@ -58,7 +58,8 @@ class ApiQueryAllUsers extends ApiQueryBase {
                        $fld_registration = isset( $prop['registration'] );
                        $fld_implicitgroups = isset( $prop['implicitgroups'] );
                } else {
-                       $fld_blockinfo = $fld_editcount = $fld_groups = $fld_registration = $fld_rights = $fld_implicitgroups = false;
+                       $fld_blockinfo = $fld_editcount = $fld_groups = $fld_registration =
+                               $fld_rights = $fld_implicitgroups = false;
                }
 
                $limit = $params['limit'];
@@ -123,7 +124,10 @@ class ApiQueryAllUsers extends ApiQueryBase {
                        if ( count( $params['excludegroup'] ) == 1 ) {
                                $exclude = array( 'ug1.ug_group' => $params['excludegroup'][0] );
                        } else {
-                               $exclude = array( $db->makeList( array( 'ug1.ug_group' => $params['excludegroup'] ), LIST_OR ) );
+                               $exclude = array( $db->makeList(
+                                       array( 'ug1.ug_group' => $params['excludegroup'] ),
+                                       LIST_OR
+                               ) );
                        }
                        $this->addJoinConds( array( 'ug1' => array( 'LEFT OUTER JOIN',
                                array_merge( array( 'ug1.ug_user=user_id' ), $exclude )
@@ -187,12 +191,12 @@ class ApiQueryAllUsers extends ApiQueryBase {
                $lastUser = false;
                $result = $this->getResult();
 
-               //
-               // This loop keeps track of the last entry.
-               // For each new row, if the new row is for different user then the last, the last entry is added to results.
-               // Otherwise, the group of the new row is appended to the last entry.
-               // The setContinue... is more complex because of this, and takes into account the higher sql limit
-               // to make sure all rows that belong to the same user are received.
+               // This loop keeps track of the last entry. For each new row, if the
+               // new row is for different user then the last, the last entry is added
+               // to results. Otherwise, the group of the new row is appended to the
+               // last entry. The setContinue... is more complex because of this, and
+               // takes into account the higher sql limit to make sure all rows that
+               // belong to the same user are received.
 
                foreach ( $res as $row ) {
                        $count++;
@@ -212,7 +216,8 @@ class ApiQueryAllUsers extends ApiQueryBase {
                                }
 
                                if ( $count > $limit ) {
-                                       // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                                       // We've reached the one extra which shows that there are
+                                       // additional pages to be had. Stop here...
                                        $this->setContinueEnumParameter( 'from', $row->user_name );
                                        break;
                                }
@@ -246,10 +251,13 @@ class ApiQueryAllUsers extends ApiQueryBase {
                        }
 
                        if ( $sqlLimit == $count ) {
-                               // BUG!  database contains group name that User::getAllGroups() does not return
-                               // TODO: should handle this more gracefully
-                               ApiBase::dieDebug( __METHOD__,
-                                       'MediaWiki configuration error: the database contains more user groups than known to User::getAllGroups() function' );
+                               // @todo BUG!  database contains group name that User::getAllGroups() does not return
+                               // Should handle this more gracefully
+                               ApiBase::dieDebug(
+                                       __METHOD__,
+                                       'MediaWiki configuration error: The database contains more ' .
+                                               'user groups than known to User::getAllGroups() function'
+                               );
                        }
 
                        $lastUserObj = User::newFromId( $row->user_id );
@@ -369,11 +377,13 @@ class ApiQueryAllUsers extends ApiQueryBase {
                        'dir' => 'Direction to sort in',
                        'group' => 'Limit users to given group name(s)',
                        'excludegroup' => 'Exclude users in given group name(s)',
-                       'rights' => 'Limit users to given right(s) (does not include rights granted by implicit or auto-promoted groups like *, user, or autoconfirmed)',
+                       'rights' => 'Limit users to given right(s) (does not include rights ' .
+                               'granted by implicit or auto-promoted groups like *, user, or autoconfirmed)',
                        'prop' => array(
                                'What pieces of information to include.',
                                ' blockinfo      - Adds the information about a current block on the user',
-                               ' groups         - Lists groups that the user is in. This uses more server resources and may return fewer results than the limit',
+                               ' groups         - Lists groups that the user is in. This uses ' .
+                                       'more server resources and may return fewer results than the limit',
                                ' implicitgroups - Lists all the groups the user is automatically in',
                                ' rights         - Lists rights that the user has',
                                ' editcount      - Adds the edit count of the user',
@@ -433,7 +443,10 @@ class ApiQueryAllUsers extends ApiQueryBase {
 
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'group-excludegroup', 'info' => 'group and excludegroup cannot be used together' ),
+                       array(
+                               'code' => 'group-excludegroup',
+                               'info' => 'group and excludegroup cannot be used together'
+                       ),
                ) );
        }
 
index 238c8e8..bda1e03 100644 (file)
@@ -149,7 +149,8 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                if ( $this->params['filterredir'] == 'redirects' ) {
                        $this->addWhereFld( 'page_is_redirect', 1 );
                } elseif ( $this->params['filterredir'] == 'nonredirects' && !$this->redirect ) {
-                       // bug 22245 - Check for !redirect, as filtering nonredirects, when getting what links to them is contradictory
+                       // bug 22245 - Check for !redirect, as filtering nonredirects, when
+                       // getting what links to them is contradictory
                        $this->addWhereFld( 'page_is_redirect', 0 );
                }
 
@@ -269,7 +270,8 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
 
                foreach ( $res as $row ) {
                        if ( ++$count > $this->params['limit'] ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                // Continue string preserved in case the redirect query doesn't pass the limit
                                $this->continueStr = $this->getContinueStr( $row->page_id );
                                break;
@@ -294,7 +296,8 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                        $count = 0;
                        foreach ( $res as $row ) {
                                if ( ++$count > $this->params['limit'] ) {
-                                       // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                                       // We've reached the one extra which shows that there are
+                                       // additional pages to be had. Stop here...
                                        // We need to keep the parent page of this redir in
                                        if ( $this->hasNS ) {
                                                $parentID = $this->pageMap[$row->{$this->bl_ns}][$row->{$this->bl_title}];
@@ -384,7 +387,10 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                $parentID = $this->pageMap[$ns][$row->{$this->bl_title}];
                // Put all the results in an array first
                $this->resultArr[$parentID]['redirlinks'][] = $a;
-               $this->getResult()->setIndexedTagName( $this->resultArr[$parentID]['redirlinks'], $this->bl_code );
+               $this->getResult()->setIndexedTagName(
+                       $this->resultArr[$parentID]['redirlinks'],
+                       $this->bl_code
+               );
        }
 
        protected function processContinue() {
@@ -396,7 +402,10 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
 
                // only image titles are allowed for the root in imageinfo mode
                if ( !$this->hasNS && $this->rootTitle->getNamespace() !== NS_FILE ) {
-                       $this->dieUsage( "The title for {$this->getModuleName()} query must be an image", 'bad_image_title' );
+                       $this->dieUsage(
+                               "The title for {$this->getModuleName()} query must be an image",
+                               'bad_image_title'
+                       );
                }
        }
 
@@ -494,9 +503,14 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                );
                if ( $this->getModuleName() != 'embeddedin' ) {
                        return array_merge( $retval, array(
-                               'redirect' => 'If linking page is a redirect, find all pages that link to that redirect as well. Maximum limit is halved.',
-                               'filterredir' => "How to filter for redirects. If set to nonredirects when {$this->bl_code}redirect is enabled, this is only applied to the second level",
-                               'limit' => "How many total pages to return. If {$this->bl_code}redirect is enabled, limit applies to each level separately (which means you may get up to 2 * limit results)."
+                               'redirect' => 'If linking page is a redirect, find all pages ' .
+                                       'that link to that redirect as well. Maximum limit is halved.',
+                               'filterredir' => 'How to filter for redirects. If set to ' .
+                                       "nonredirects when {$this->bl_code}redirect is enabled, " .
+                                       'this is only applied to the second level',
+                               'limit' => 'How many total pages to return. If ' .
+                                       "{$this->bl_code}redirect is enabled, limit applies to each " .
+                                       'level separately (which means you may get up to 2 * limit results).'
                        ) );
                }
 
@@ -534,7 +548,10 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase {
                return array_merge( parent::getPossibleErrors(),
                        $this->getTitleOrPageIdErrorMessage(),
                        array(
-                               array( 'code' => 'bad_image_title', 'info' => "The title for {$this->getModuleName()} query must be an image" ),
+                               array(
+                                       'code' => 'bad_image_title',
+                                       'info' => "The title for {$this->getModuleName()} query must be an image"
+                               ),
                        )
                );
        }
index c620a8f..cfc2244 100644 (file)
@@ -219,7 +219,9 @@ abstract class ApiQueryBase extends ApiBase {
                if ( $sort ) {
                        $order = $field . ( $isDirNewer ? '' : ' DESC' );
                        // Append ORDER BY
-                       $optionOrderBy = isset( $this->options['ORDER BY'] ) ? (array)$this->options['ORDER BY'] : array();
+                       $optionOrderBy = isset( $this->options['ORDER BY'] )
+                               ? (array)$this->options['ORDER BY']
+                               : array();
                        $optionOrderBy[] = $order;
                        $this->addOption( 'ORDER BY', $optionOrderBy );
                }
@@ -260,16 +262,37 @@ abstract class ApiQueryBase extends ApiBase {
         * @param string $method Function the query should be attributed to.
         *  You should usually use __METHOD__ here
         * @param array $extraQuery Query data to add but not store in the object
-        *  Format is array( 'tables' => ..., 'fields' => ..., 'where' => ..., 'options' => ..., 'join_conds' => ... )
+        *  Format is array(
+        *    'tables' => ...,
+        *    'fields' => ...,
+        *    'where' => ...,
+        *    'options' => ...,
+        *    'join_conds' => ...
+        *  )
         * @return ResultWrapper
         */
        protected function select( $method, $extraQuery = array() ) {
 
-               $tables = array_merge( $this->tables, isset( $extraQuery['tables'] ) ? (array)$extraQuery['tables'] : array() );
-               $fields = array_merge( $this->fields, isset( $extraQuery['fields'] ) ? (array)$extraQuery['fields'] : array() );
-               $where = array_merge( $this->where, isset( $extraQuery['where'] ) ? (array)$extraQuery['where'] : array() );
-               $options = array_merge( $this->options, isset( $extraQuery['options'] ) ? (array)$extraQuery['options'] : array() );
-               $join_conds = array_merge( $this->join_conds, isset( $extraQuery['join_conds'] ) ? (array)$extraQuery['join_conds'] : array() );
+               $tables = array_merge(
+                       $this->tables,
+                       isset( $extraQuery['tables'] ) ? (array)$extraQuery['tables'] : array()
+               );
+               $fields = array_merge(
+                       $this->fields,
+                       isset( $extraQuery['fields'] ) ? (array)$extraQuery['fields'] : array()
+               );
+               $where = array_merge(
+                       $this->where,
+                       isset( $extraQuery['where'] ) ? (array)$extraQuery['where'] : array()
+               );
+               $options = array_merge(
+                       $this->options,
+                       isset( $extraQuery['options'] ) ? (array)$extraQuery['options'] : array()
+               );
+               $join_conds = array_merge(
+                       $this->join_conds,
+                       isset( $extraQuery['join_conds'] ) ? (array)$extraQuery['join_conds'] : array()
+               );
 
                // getDB has its own profileDBIn/Out calls
                $db = $this->getDB();
@@ -289,7 +312,13 @@ abstract class ApiQueryBase extends ApiBase {
        protected function checkRowCount() {
                $db = $this->getDB();
                $this->profileDBIn();
-               $rowcount = $db->estimateRowCount( $this->tables, $this->fields, $this->where, __METHOD__, $this->options );
+               $rowcount = $db->estimateRowCount(
+                       $this->tables,
+                       $this->fields,
+                       $this->where,
+                       __METHOD__,
+                       $this->options
+               );
                $this->profileDBOut();
 
                global $wgAPIMaxDBRows;
index 8dad635..57f76bc 100644 (file)
@@ -76,7 +76,12 @@ class ApiQueryBlocks extends ApiQueryBase {
                        $fld_flags );
 
                $this->addOption( 'LIMIT', $params['limit'] + 1 );
-               $this->addTimestampWhereRange( 'ipb_timestamp', $params['dir'], $params['start'], $params['end'] );
+               $this->addTimestampWhereRange(
+                       'ipb_timestamp',
+                       $params['dir'],
+                       $params['start'],
+                       $params['end']
+               );
 
                $db = $this->getDB();
 
@@ -107,7 +112,10 @@ class ApiQueryBlocks extends ApiQueryBase {
                        # Check range validity, if it's a CIDR
                        list( $ip, $range ) = IP::parseCIDR( $params['ip'] );
                        if ( $ip !== false && $range !== false && $range < $cidrLimit ) {
-                               $this->dieUsage( "$type CIDR ranges broader than /$cidrLimit are not accepted", 'cidrtoobroad' );
+                               $this->dieUsage(
+                                       "$type CIDR ranges broader than /$cidrLimit are not accepted",
+                                       'cidrtoobroad'
+                               );
                        }
 
                        # Let IP::parseRange handle calculating $upper, instead of duplicating the logic here.
@@ -145,8 +153,10 @@ class ApiQueryBlocks extends ApiQueryBase {
                        $this->addWhereIf( 'ipb_user != 0', isset( $show['account'] ) );
                        $this->addWhereIf( 'ipb_user != 0 OR ipb_range_end > ipb_range_start', isset( $show['!ip'] ) );
                        $this->addWhereIf( 'ipb_user = 0 AND ipb_range_end = ipb_range_start', isset( $show['ip'] ) );
-                       $this->addWhereIf( 'ipb_expiry = ' . $db->addQuotes( $db->getInfinity() ), isset( $show['!temp'] ) );
-                       $this->addWhereIf( 'ipb_expiry != ' . $db->addQuotes( $db->getInfinity() ), isset( $show['temp'] ) );
+                       $this->addWhereIf( 'ipb_expiry = ' .
+                               $db->addQuotes( $db->getInfinity() ), isset( $show['!temp'] ) );
+                       $this->addWhereIf( 'ipb_expiry != ' .
+                               $db->addQuotes( $db->getInfinity() ), isset( $show['temp'] ) );
                        $this->addWhereIf( 'ipb_range_end = ipb_range_start', isset( $show['!range'] ) );
                        $this->addWhereIf( 'ipb_range_end > ipb_range_start', isset( $show['range'] ) );
                }
index e62305a..c5b12b3 100644 (file)
@@ -220,14 +220,16 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
                return array(
                        'prop' => array(
                                'Which additional properties to get for each category',
-                               ' sortkey    - Adds the sortkey (hexadecimal string) and sortkey prefix (human-readable part) for the category',
+                               ' sortkey    - Adds the sortkey (hexadecimal string) and sortkey prefix',
+                               '              (human-readable part) for the category',
                                ' timestamp  - Adds timestamp of when the category was added',
                                ' hidden     - Tags categories that are hidden with __HIDDENCAT__',
                        ),
                        'limit' => 'How many categories to return',
                        'show' => 'Which kind of categories to show',
                        'continue' => 'When more results are available, use this to continue',
-                       'categories' => 'Only list these categories. Useful for checking whether a certain page is in a certain category',
+                       'categories' => 'Only list these categories. Useful for checking ' .
+                               'whether a certain page is in a certain category',
                        'dir' => 'The direction in which to list',
                );
        }
@@ -263,8 +265,10 @@ class ApiQueryCategories extends ApiQueryGeneratorBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=query&prop=categories&titles=Albert%20Einstein' => 'Get a list of categories [[Albert Einstein]] belongs to',
-                       'api.php?action=query&generator=categories&titles=Albert%20Einstein&prop=info' => 'Get information about all categories used in the [[Albert Einstein]]',
+                       'api.php?action=query&prop=categories&titles=Albert%20Einstein'
+                               => 'Get a list of categories [[Albert Einstein]] belongs to',
+                       'api.php?action=query&generator=categories&titles=Albert%20Einstein&prop=info'
+                               => 'Get information about all categories used in the [[Albert Einstein]]',
                );
        }
 
index 4e78f02..574ef6e 100644 (file)
@@ -63,7 +63,13 @@ class ApiQueryCategoryInfo extends ApiQueryBase {
                                'pp_propname' => 'hiddencat' ) ),
                ) );
 
-               $this->addFields( array( 'cat_title', 'cat_pages', 'cat_subcats', 'cat_files', 'cat_hidden' => 'pp_propname' ) );
+               $this->addFields( array(
+                       'cat_title',
+                       'cat_pages',
+                       'cat_subcats',
+                       'cat_files',
+                       'cat_hidden' => 'pp_propname'
+               ) );
                $this->addWhere( array( 'cat_title' => $cattitles ) );
 
                if ( !is_null( $params['continue'] ) ) {
index 9dc7a32..271558b 100644 (file)
@@ -181,8 +181,10 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                $count = 0;
                foreach ( $rows as $row ) {
                        if ( ++$count > $limit ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
-                               // TODO: Security issue - if the user has no right to view next title, it will still be shown
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
+                               // @todo Security issue - if the user has no right to view next
+                               // title, it will still be shown
                                if ( $params['sort'] == 'timestamp' ) {
                                        $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->cl_timestamp ) );
                                } else {
@@ -324,14 +326,16 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                global $wgMiserMode;
                $p = $this->getModulePrefix();
                $desc = array(
-                       'title' => "Which category to enumerate (required). Must include Category: prefix. Cannot be used together with {$p}pageid",
+                       'title' => "Which category to enumerate (required). Must include ' .
+                               'Category: prefix. Cannot be used together with {$p}pageid",
                        'pageid' => "Page ID of the category to enumerate. Cannot be used together with {$p}title",
                        'prop' => array(
                                'What pieces of information to include',
                                ' ids           - Adds the page ID',
                                ' title         - Adds the title and namespace ID of the page',
                                ' sortkey       - Adds the sortkey used for sorting in the category (hexadecimal string)',
-                               ' sortkeyprefix - Adds the sortkey prefix used for sorting in the category (human-readable part of the sortkey)',
+                               ' sortkeyprefix - Adds the sortkey prefix used for sorting in the ' .
+                                       'category (human-readable part of the sortkey)',
                                ' type          - Adds the type that the page has been categorised as (page, subcat or file)',
                                ' timestamp     - Adds the timestamp of when the page was included',
                        ),
@@ -341,10 +345,15 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
                        'dir' => 'In which direction to sort',
                        'start' => "Timestamp to start listing from. Can only be used with {$p}sort=timestamp",
                        'end' => "Timestamp to end listing at. Can only be used with {$p}sort=timestamp",
-                       'startsortkey' => "Sortkey to start listing from. Must be given in binary format. Can only be used with {$p}sort=sortkey",
-                       'endsortkey' => "Sortkey to end listing at. Must be given in binary format. Can only be used with {$p}sort=sortkey",
-                       'startsortkeyprefix' => "Sortkey prefix to start listing from. Can only be used with {$p}sort=sortkey. Overrides {$p}startsortkey",
-                       'endsortkeyprefix' => "Sortkey prefix to end listing BEFORE (not at, if this value occurs it will not be included!). Can only be used with {$p}sort=sortkey. Overrides {$p}endsortkey",
+                       'startsortkey' => "Sortkey to start listing from. Must be given in ' .
+                               'binary format. Can only be used with {$p}sort=sortkey",
+                       'endsortkey' => "Sortkey to end listing at. Must be given in binary ' .
+                               'format. Can only be used with {$p}sort=sortkey",
+                       'startsortkeyprefix' => "Sortkey prefix to start listing from. Can ' .
+                               'only be used with {$p}sort=sortkey. Overrides {$p}startsortkey",
+                       'endsortkeyprefix' => "Sortkey prefix to end listing BEFORE (not at, ' .
+                               'if this value occurs it will not be included!). Can only be used with ' .
+                               '{$p}sort=sortkey. Overrides {$p}endsortkey",
                        'continue' => 'For large categories, give the value returned from previous query',
                        'limit' => 'The maximum number of pages to return.',
                );
@@ -406,8 +415,10 @@ class ApiQueryCategoryMembers extends ApiQueryGeneratorBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=query&list=categorymembers&cmtitle=Category:Physics' => 'Get first 10 pages in [[Category:Physics]]',
-                       'api.php?action=query&generator=categorymembers&gcmtitle=Category:Physics&prop=info' => 'Get page info about first 10 pages in [[Category:Physics]]',
+                       'api.php?action=query&list=categorymembers&cmtitle=Category:Physics'
+                               => 'Get first 10 pages in [[Category:Physics]]',
+                       'api.php?action=query&generator=categorymembers&gcmtitle=Category:Physics&prop=info'
+                               => 'Get page info about first 10 pages in [[Category:Physics]]',
                );
        }
 
index 0eb1ec7..35e78ac 100644 (file)
@@ -39,7 +39,10 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
                $user = $this->getUser();
                // Before doing anything at all, let's check permissions
                if ( !$user->isAllowed( 'deletedhistory' ) ) {
-                       $this->dieUsage( 'You don\'t have permission to view deleted revision information', 'permissiondenied' );
+                       $this->dieUsage(
+                               'You don\'t have permission to view deleted revision information',
+                               'permissiondenied'
+                       );
                }
 
                $db = $this->getDB();
@@ -116,7 +119,10 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
 
                        // This also means stricter restrictions
                        if ( !$user->isAllowed( 'undelete' ) ) {
-                               $this->dieUsage( 'You don\'t have permission to view deleted revision content', 'permissiondenied' );
+                               $this->dieUsage(
+                                       'You don\'t have permission to view deleted revision content',
+                                       'permissiondenied'
+                               );
                        }
                }
                // Check limits
@@ -152,7 +158,8 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
                        $this->addWhereRange( 'ar_title', $dir, $from, $to );
 
                        if ( isset( $params['prefix'] ) ) {
-                               $this->addWhere( 'ar_title' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
+                               $this->addWhere( 'ar_title' .
+                                       $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
                        }
                }
 
@@ -179,7 +186,10 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
                }
 
                $this->addOption( 'LIMIT', $limit + 1 );
-               $this->addOption( 'USE INDEX', array( 'archive' => ( $mode == 'user' ? 'usertext_timestamp' : 'name_title_timestamp' ) ) );
+               $this->addOption(
+                       'USE INDEX',
+                       array( 'archive' => ( $mode == 'user' ? 'usertext_timestamp' : 'name_title_timestamp' ) )
+               );
                if ( $mode == 'all' ) {
                        if ( $params['unique'] ) {
                                $this->addOption( 'GROUP BY', 'ar_title' );
@@ -391,7 +401,8 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
                        'Operates in three modes:',
                        ' 1) List deleted revisions for the given title(s), sorted by timestamp',
                        ' 2) List deleted contributions for the given user, sorted by timestamp (no titles specified)',
-                       " 3) List all deleted revisions in the given namespace, sorted by title and timestamp (no titles specified, {$p}user not set)",
+                       " 3) List all deleted revisions in the given namespace, sorted by title and timestamp',
+                       '    (no titles specified, {$p}user not set)",
                        'Certain parameters only apply to some modes and are ignored in others.',
                        'For instance, a parameter marked (1) only applies to mode 1 and is ignored in modes 2 and 3',
                );
@@ -399,12 +410,22 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
 
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted revision information' ),
-                       array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together' ),
-                       array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted revision content' ),
+                       array(
+                               'code' => 'permissiondenied',
+                               'info' => 'You don\'t have permission to view deleted revision information'
+                       ),
+                       array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together'
+                       ),
+                       array(
+                               'code' => 'permissiondenied',
+                               'info' => 'You don\'t have permission to view deleted revision content'
+                       ),
                        array( 'code' => 'badparams', 'info' => "The 'from' parameter cannot be used in modes 1 or 2" ),
                        array( 'code' => 'badparams', 'info' => "The 'to' parameter cannot be used in modes 1 or 2" ),
-                       array( 'code' => 'badparams', 'info' => "The 'prefix' parameter cannot be used in modes 1 or 2" ),
+                       array(
+                               'code' => 'badparams',
+                               'info' => "The 'prefix' parameter cannot be used in modes 1 or 2"
+                       ),
                        array( 'code' => 'badparams', 'info' => "The 'start' parameter cannot be used in mode 3" ),
                        array( 'code' => 'badparams', 'info' => "The 'end' parameter cannot be used in mode 3" ),
                ) );
@@ -412,7 +433,8 @@ class ApiQueryDeletedrevs extends ApiQueryBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=query&list=deletedrevs&titles=Main%20Page|Talk:Main%20Page&drprop=user|comment|content'
+                       'api.php?action=query&list=deletedrevs&titles=Main%20Page|Talk:Main%20Page&' .
+                               'drprop=user|comment|content'
                                => 'List the last deleted revisions of Main Page and Talk:Main Page, with content (mode 1)',
                        'api.php?action=query&list=deletedrevs&druser=Bob&drlimit=50'
                                => 'List the last 50 deleted contributions by Bob (mode 2)',
index 0311fa7..1854694 100644 (file)
@@ -95,7 +95,8 @@ class ApiQueryDuplicateFiles extends ApiQueryGeneratorBase {
                        $sha1s[$file->getName()] = $file->getSha1();
                }
 
-               // find all files with the hashes, result format is: array( hash => array( dup1, dup2 ), hash1 => ... )
+               // find all files with the hashes, result format is:
+               // array( hash => array( dup1, dup2 ), hash1 => ... )
                $filesToFindBySha1s = array_unique( array_values( $sha1s ) );
                if ( $params['localonly'] ) {
                        $filesBySha1s = RepoGroup::singleton()->getLocalRepo()->findBySha1s( $filesToFindBySha1s );
index ae42bf7..d220817 100644 (file)
@@ -102,7 +102,8 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
                $count = 0;
                foreach ( $res as $row ) {
                        if ( ++$count > $limit ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'offset', $offset + $limit );
                                break;
                        }
@@ -222,7 +223,8 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
                                "Protocol of the URL. If empty and {$p}query set, the protocol is http.",
                                "Leave both this and {$p}query empty to list all external links"
                        ),
-                       'query' => 'Search string without protocol. See [[Special:LinkSearch]]. Leave empty to list all external links',
+                       'query' => 'Search string without protocol. See [[Special:LinkSearch]]. ' .
+                               'Leave empty to list all external links',
                        'namespace' => 'The page namespace(s) to enumerate.',
                        'limit' => 'How many pages to return.',
                        'expandurl' => 'Expand protocol-relative URLs with the canonical protocol',
index fb132c0..5803ea7 100644 (file)
@@ -135,7 +135,8 @@ class ApiQueryExternalLinks extends ApiQueryBase {
                                "Protocol of the URL. If empty and {$p}query set, the protocol is http.",
                                "Leave both this and {$p}query empty to list all external links"
                        ),
-                       'query' => 'Search string without protocol. Useful for checking whether a certain page contains a certain external url',
+                       'query' => 'Search string without protocol. Useful for checking ' .
+                               'whether a certain page contains a certain external url',
                        'expandurl' => 'Expand protocol-relative URLs with the canonical protocol',
                );
        }
@@ -160,7 +161,8 @@ class ApiQueryExternalLinks extends ApiQueryBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=query&prop=extlinks&titles=Main%20Page' => 'Get a list of external links on the [[Main Page]]',
+                       'api.php?action=query&prop=extlinks&titles=Main%20Page'
+                               => 'Get a list of external links on the [[Main Page]]',
                );
        }
 
index 9a12ba1..3d4d38f 100644 (file)
@@ -86,7 +86,10 @@ class ApiQueryFileRepoInfo extends ApiQueryBase {
                        $props = array_merge( $props, array_keys( $repo->getInfo() ) );
                } );
 
-               return array_values( array_unique( array_merge( $props, array_keys( $repoGroup->localRepo->getInfo() ) ) ) );
+               return array_values( array_unique( array_merge(
+                       $props,
+                       array_keys( $repoGroup->localRepo->getInfo() )
+               ) ) );
        }
 
        public function getParamDescription() {
@@ -96,7 +99,8 @@ class ApiQueryFileRepoInfo extends ApiQueryBase {
                        'prop' => array(
                                'Which repository properties to get (there may be more available on some wikis):',
                                ' apiurl      - URL to the repository API - helpful for getting image info from the host.',
-                               ' name        - The key of the repository - used in e.g. $wgForeignFileRepos and imageinfo return values.',
+                               ' name        - The key of the repository - used in e.g. ' .
+                               '$wgForeignFileRepos and imageinfo return values.',
                                ' displayname - The human-readable name of the repository wiki.',
                                ' rooturl     - Root URL for image paths.',
                                ' local       - Whether that repository is the local one or not.',
index 1b2da26..f8f4558 100644 (file)
@@ -41,7 +41,10 @@ class ApiQueryFilearchive extends ApiQueryBase {
                $user = $this->getUser();
                // Before doing anything at all, let's check permissions
                if ( !$user->isAllowed( 'deletedhistory' ) ) {
-                       $this->dieUsage( 'You don\'t have permission to view deleted file information', 'permissiondenied' );
+                       $this->dieUsage(
+                               'You don\'t have permission to view deleted file information',
+                               'permissiondenied'
+                       );
                }
 
                $db = $this->getDB();
@@ -92,7 +95,8 @@ class ApiQueryFilearchive extends ApiQueryBase {
                $to = ( is_null( $params['to'] ) ? null : $this->titlePartToKey( $params['to'] ) );
                $this->addWhereRange( 'fa_name', $dir, $from, $to );
                if ( isset( $params['prefix'] ) ) {
-                       $this->addWhere( 'fa_name' . $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
+                       $this->addWhere( 'fa_name' .
+                               $db->buildLike( $this->titlePartToKey( $params['prefix'] ), $db->anyString() ) );
                }
 
                $sha1Set = isset( $params['sha1'] );
@@ -137,7 +141,8 @@ class ApiQueryFilearchive extends ApiQueryBase {
                $result = $this->getResult();
                foreach ( $res as $row ) {
                        if ( ++$count > $limit ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'continue', $row->fa_name );
                                break;
                        }
@@ -275,7 +280,8 @@ class ApiQueryFilearchive extends ApiQueryBase {
                                ' sha1              - Adds SHA-1 hash for the image',
                                ' timestamp         - Adds timestamp for the uploaded version',
                                ' user              - Adds user who uploaded the image version',
-                               ' size              - Adds the size of the image in bytes and the height, width and page count (if applicable)',
+                               ' size              - Adds the size of the image in bytes and the height, ' .
+                                       'width and page count (if applicable)',
                                ' dimensions        - Alias for size',
                                ' description       - Adds description the image version',
                                ' parseddescription - Parse the description on the version',
@@ -358,10 +364,16 @@ class ApiQueryFilearchive extends ApiQueryBase {
 
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'permissiondenied', 'info' => 'You don\'t have permission to view deleted file information' ),
+                       array(
+                               'code' => 'permissiondenied',
+                               'info' => 'You don\'t have permission to view deleted file information'
+                       ),
                        array( 'code' => 'hashsearchdisabled', 'info' => 'Search by hash disabled in Miser Mode' ),
-                       array( 'code' => 'invalidsha1hash', 'info' => 'The SHA1 hash provided is not valid' ),
-                       array( 'code' => 'invalidsha1base36hash', 'info' => 'The SHA1Base36 hash provided is not valid' ),
+                       array( 'code' => 'invalidsha1hash', 'info' => 'The SHA-1 hash provided is not valid' ),
+                       array(
+                               'code' => 'invalidsha1base36hash',
+                               'info' => 'The SHA1Base36 hash provided is not valid'
+                       ),
                ) );
        }
 
index bb6a23a..03a72a6 100644 (file)
@@ -112,9 +112,14 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase {
                $result = $this->getResult();
                foreach ( $res as $row ) {
                        if ( ++$count > $params['limit'] ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
-                               // Continue string preserved in case the redirect query doesn't pass the limit
-                               $this->setContinueEnumParameter( 'continue', "{$row->iwl_prefix}|{$row->iwl_title}|{$row->iwl_from}" );
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
+                               // Continue string preserved in case the redirect query doesn't
+                               // pass the limit
+                               $this->setContinueEnumParameter(
+                                       'continue',
+                                       "{$row->iwl_prefix}|{$row->iwl_title}|{$row->iwl_from}"
+                               );
                                break;
                        }
 
@@ -140,7 +145,10 @@ class ApiQueryIWBacklinks extends ApiQueryGeneratorBase {
 
                                $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $entry );
                                if ( !$fit ) {
-                                       $this->setContinueEnumParameter( 'continue', "{$row->iwl_prefix}|{$row->iwl_title}|{$row->iwl_from}" );
+                                       $this->setContinueEnumParameter(
+                                               'continue',
+                                               "{$row->iwl_prefix}|{$row->iwl_title}|{$row->iwl_from}"
+                                       );
                                        break;
                                }
                        }
index a339868..be64d36 100644 (file)
@@ -106,7 +106,10 @@ class ApiQueryIWLinks extends ApiQueryBase {
                        if ( ++$count > $params['limit'] ) {
                                // We've reached the one extra which shows that
                                // there are additional pages to be had. Stop here...
-                               $this->setContinueEnumParameter( 'continue', "{$row->iwl_from}|{$row->iwl_prefix}|{$row->iwl_title}" );
+                               $this->setContinueEnumParameter(
+                                       'continue',
+                                       "{$row->iwl_from}|{$row->iwl_prefix}|{$row->iwl_title}"
+                               );
                                break;
                        }
                        $entry = array( 'prefix' => $row->iwl_prefix );
@@ -121,7 +124,10 @@ class ApiQueryIWLinks extends ApiQueryBase {
                        ApiResult::setContent( $entry, $row->iwl_title );
                        $fit = $this->addPageSubItem( $row->iwl_from, $entry );
                        if ( !$fit ) {
-                               $this->setContinueEnumParameter( 'continue', "{$row->iwl_from}|{$row->iwl_prefix}|{$row->iwl_title}" );
+                               $this->setContinueEnumParameter(
+                                       'continue',
+                                       "{$row->iwl_from}|{$row->iwl_prefix}|{$row->iwl_title}"
+                               );
                                break;
                        }
                }
@@ -190,7 +196,8 @@ class ApiQueryIWLinks extends ApiQueryBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=query&prop=iwlinks&titles=Main%20Page' => 'Get interwiki links from the [[Main Page]]',
+                       'api.php?action=query&prop=iwlinks&titles=Main%20Page'
+                               => 'Get interwiki links from the [[Main Page]]',
                );
        }
 
index 990130f..9981ec1 100644 (file)
@@ -34,8 +34,9 @@ class ApiQueryImageInfo extends ApiQueryBase {
        private static $transformCount = 0;
 
        public function __construct( $query, $moduleName, $prefix = 'ii' ) {
-               // We allow a subclass to override the prefix, to create a related API module.
-               // Some other parts of MediaWiki construct this with a null $prefix, which used to be ignored when this only took two arguments
+               // We allow a subclass to override the prefix, to create a related API
+               // module. Some other parts of MediaWiki construct this with a null
+               // $prefix, which used to be ignored when this only took two arguments
                if ( is_null( $prefix ) ) {
                        $prefix = 'ii';
                }
@@ -53,6 +54,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                        'version' => $params['metadataversion'],
                        'language' => $params['extmetadatalanguage'],
                        'multilang' => $params['extmetadatamultilang'],
+                       'extmetadatafilter' => $params['extmetadatafilter'],
                );
 
                $pageIds = $this->getPageSet()->getAllTitlesByNamespace();
@@ -175,7 +177,8 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                /** @var $oldie File */
                                foreach ( $oldies as $oldie ) {
                                        if ( ++$count > $params['limit'] ) {
-                                               // We've reached the extra one which shows that there are additional pages to be had. Stop here...
+                                               // We've reached the extra one which shows that there are
+                                               // additional pages to be had. Stop here...
                                                // Only set a query-continue if there was only one title
                                                if ( count( $pageIds[NS_FILE] ) == 1 ) {
                                                        $this->setContinueEnumParameter( 'start',
@@ -286,7 +289,8 @@ class ApiQueryImageInfo extends ApiQueryBase {
                if ( isset( $paramList['width'] ) ) {
                        if ( intval( $paramList['width'] ) != intval( $thumbParams['width'] ) ) {
                                $this->setWarning( "Ignoring width value set in {$p}urlparam ({$paramList['width']}) "
-                                       . "in favor of width value derived from {$p}urlwidth/{$p}urlheight ({$thumbParams['width']})" );
+                                       . "in favor of width value derived from {$p}urlwidth/{$p}urlheight "
+                                       . "({$thumbParams['width']})" );
                        }
                }
 
@@ -321,6 +325,7 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                'version' => $metadataOpts ?: 'latest',
                                'language' => $wgContLang,
                                'multilang' => false,
+                               'extmetadatafilter' => array(),
                        );
                }
                $version = $metadataOpts['version'];
@@ -451,6 +456,11 @@ class ApiQueryImageInfo extends ApiQueryBase {
                        $format->setSingleLanguage( !$metadataOpts['multilang'] );
                        $format->getContext()->setLanguage( $metadataOpts['language'] );
                        $extmetaArray = $format->fetchExtendedMetadata( $file );
+                       if ( $metadataOpts['extmetadatafilter'] ) {
+                               $extmetaArray = array_intersect_key(
+                                       $extmetaArray, array_flip( $metadataOpts['extmetadatafilter'] )
+                               );
+                       }
                        $vals['extmetadata'] = $extmetaArray;
                }
 
@@ -571,6 +581,10 @@ class ApiQueryImageInfo extends ApiQueryBase {
                                ApiBase::PARAM_TYPE => 'boolean',
                                ApiBase::PARAM_DFLT => false,
                        ),
+                       'extmetadatafilter' => array(
+                               ApiBase::PARAM_TYPE => 'string',
+                               ApiBase::PARAM_ISMULTI => true,
+                       ),
                        'urlparam' => array(
                                ApiBase::PARAM_DFLT => '',
                                ApiBase::PARAM_TYPE => 'string',
@@ -605,18 +619,22 @@ class ApiQueryImageInfo extends ApiQueryBase {
                        'comment' =>        ' comment       - Comment on the version',
                        'parsedcomment' =>  ' parsedcomment - Parse the comment on the version',
                        'url' =>            ' url           - Gives URL to the image and the description page',
-                       'size' =>           ' size          - Adds the size of the image in bytes and the height, width and page count (if applicable)',
-                       'dimensions' =>     ' dimensions    - Alias for size', // For backwards compatibility with Allimages
+                       'size' =>           ' size          - Adds the size of the image in bytes ' .
+                               'and the height, width and page count (if applicable)',
+                       'dimensions' =>     ' dimensions    - Alias for size', // B/C with Allimages
                        'sha1' =>           ' sha1          - Adds SHA-1 hash for the image',
                        'mime' =>           ' mime          - Adds MIME type of the image',
                        'thumbmime' =>      ' thumbmime     - Adds MIME type of the image thumbnail' .
                                ' (requires url and param ' . $modulePrefix . 'urlwidth)',
                        'mediatype' =>      ' mediatype     - Adds the media type of the image',
                        'metadata' =>       ' metadata      - Lists Exif metadata for the version of the image',
-                       'extmetadata' =>    ' extmetadata   - Lists formatted metadata combined from multiple sources. Results are HTML formatted.',
-                       'archivename' =>    ' archivename   - Adds the file name of the archive version for non-latest versions',
+                       'extmetadata' =>    ' extmetadata   - Lists formatted metadata combined ' .
+                               'from multiple sources. Results are HTML formatted.',
+                       'archivename' =>    ' archivename   - Adds the file name of the archive ' .
+                               'version for non-latest versions',
                        'bitdepth' =>       ' bitdepth      - Adds the bit depth of the version',
-                       'uploadwarning' =>  ' uploadwarning - Used by the Special:Upload page to get information about an existing file. Not intended for use outside MediaWiki core',
+                       'uploadwarning' =>  ' uploadwarning - Used by the Special:Upload page to ' .
+                               'get information about an existing file. Not intended for use outside MediaWiki core',
                );
        }
 
@@ -643,21 +661,29 @@ class ApiQueryImageInfo extends ApiQueryBase {
 
                return array(
                        'prop' => self::getPropertyDescriptions( array(), $p ),
-                       'urlwidth' => array( "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.",
+                       'urlwidth' => array(
+                               "If {$p}prop=url is set, a URL to an image scaled to this width will be returned.",
                                'For performance reasons if this option is used, ' .
-                                       'no more than ' . self::TRANSFORM_LIMIT . ' scaled images will be returned.' ),
+                                       'no more than ' . self::TRANSFORM_LIMIT . ' scaled images will be returned.'
+                       ),
                        'urlheight' => "Similar to {$p}urlwidth.",
                        'urlparam' => array( "A handler specific parameter string. For example, pdf's ",
                                "might use 'page15-100px'. {$p}urlwidth must be used and be consistent with {$p}urlparam" ),
                        'limit' => 'How many image revisions to return per image',
                        'start' => 'Timestamp to start listing from',
                        'end' => 'Timestamp to stop listing at',
-                       'metadataversion' => array( "Version of metadata to use. if 'latest' is specified, use latest version.",
+                       'metadataversion'
+                               => array( "Version of metadata to use. if 'latest' is specified, use latest version.",
                                "Defaults to '1' for backwards compatibility" ),
-                       'extmetadatalanguage' => array( 'What language to fetch extmetadata in. This affects both which',
+                       'extmetadatalanguage' => array(
+                               'What language to fetch extmetadata in. This affects both which',
                                'translation to fetch, if multiple are available, as well as how things',
-                               'like numbers and various values are formatted.' ),
-                       'extmetadatamultilang' => 'If translations for extmetadata property are available, fetch all of them.',
+                               'like numbers and various values are formatted.'
+                       ),
+                       'extmetadatamultilang'
+                               =>'If translations for extmetadata property are available, fetch all of them.',
+                       'extmetadatafilter'
+                               => "If specified and non-empty, only these keys will be returned for {$p}prop=extmetadata",
                        'continue' => 'If the query response includes a continue value, use it here to get another page of results',
                        'localonly' => 'Look only for files in the local repository',
                );
@@ -805,7 +831,8 @@ class ApiQueryImageInfo extends ApiQueryBase {
        public function getExamples() {
                return array(
                        'api.php?action=query&titles=File:Albert%20Einstein%20Head.jpg&prop=imageinfo',
-                       'api.php?action=query&titles=File:Test.jpg&prop=imageinfo&iilimit=50&iiend=20071231235959&iiprop=timestamp|user|url',
+                       'api.php?action=query&titles=File:Test.jpg&prop=imageinfo&iilimit=50&' .
+                               'iiend=20071231235959&iiprop=timestamp|user|url',
                );
        }
 
index 7ec69b7..a32fb9e 100644 (file)
@@ -164,7 +164,8 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
                return array(
                        'limit' => 'How many images to return',
                        'continue' => 'When more results are available, use this to continue',
-                       'images' => 'Only list these images. Useful for checking whether a certain page has a certain Image.',
+                       'images' => 'Only list these images. Useful for checking whether a ' .
+                               'certain page has a certain Image.',
                        'dir' => 'The direction in which to list',
                );
        }
@@ -184,8 +185,10 @@ class ApiQueryImages extends ApiQueryGeneratorBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=query&prop=images&titles=Main%20Page' => 'Get a list of images used in the [[Main Page]]',
-                       'api.php?action=query&generator=images&titles=Main%20Page&prop=info' => 'Get information about all images used in the [[Main Page]]',
+                       'api.php?action=query&prop=images&titles=Main%20Page'
+                               => 'Get a list of images used in the [[Main Page]]',
+                       'api.php?action=query&generator=images&titles=Main%20Page&prop=info'
+                               => 'Get information about all images used in the [[Main Page]]',
                );
        }
 
index 7890a40..43b8c0c 100644 (file)
@@ -42,7 +42,8 @@ class ApiQueryInfo extends ApiQueryBase {
        private $pageRestrictions, $pageIsRedir, $pageIsNew, $pageTouched,
                $pageLatest, $pageLength;
 
-       private $protections, $watched, $watchers, $notificationtimestamps, $talkids, $subjectids, $displaytitles;
+       private $protections, $watched, $watchers, $notificationtimestamps,
+               $talkids, $subjectids, $displaytitles;
        private $showZeroWatchers = false;
 
        private $tokenFunctions;
@@ -108,7 +109,7 @@ class ApiQueryInfo extends ApiQueryBase {
                return $this->tokenFunctions;
        }
 
-       static $cachedTokens = array();
+       static protected $cachedTokens = array();
 
        public static function resetTokenCache() {
                ApiQueryInfo::$cachedTokens = array();
@@ -349,7 +350,8 @@ class ApiQueryInfo extends ApiQueryBase {
         */
        private function extractPageInfo( $pageid, $title ) {
                $pageInfo = array();
-               $titleExists = $pageid > 0; //$title->exists() needs pageid, which is not set for all title objects
+               // $title->exists() needs pageid, which is not set for all title objects
+               $titleExists = $pageid > 0;
                $ns = $title->getNamespace();
                $dbkey = $title->getDBkey();
 
@@ -411,7 +413,8 @@ class ApiQueryInfo extends ApiQueryBase {
                if ( $this->fld_notificationtimestamp ) {
                        $pageInfo['notificationtimestamp'] = '';
                        if ( isset( $this->notificationtimestamps[$ns][$dbkey] ) ) {
-                               $pageInfo['notificationtimestamp'] = wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] );
+                               $pageInfo['notificationtimestamp'] =
+                                       wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] );
                        }
                }
 
@@ -698,7 +701,8 @@ class ApiQueryInfo extends ApiQueryBase {
                                $this->watched[$row->wl_namespace][$row->wl_title] = true;
                        }
                        if ( $this->fld_notificationtimestamp ) {
-                               $this->notificationtimestamps[$row->wl_namespace][$row->wl_title] = $row->wl_notificationtimestamp;
+                               $this->notificationtimestamps[$row->wl_namespace][$row->wl_title] =
+                                       $row->wl_notificationtimestamp;
                        }
                }
        }
index 652fa11..e6280c8 100644 (file)
@@ -112,9 +112,13 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
                $result = $this->getResult();
                foreach ( $res as $row ) {
                        if ( ++$count > $params['limit'] ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
-                               // Continue string preserved in case the redirect query doesn't pass the limit
-                               $this->setContinueEnumParameter( 'continue', "{$row->ll_lang}|{$row->ll_title}|{$row->ll_from}" );
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here... Continue string
+                               // preserved in case the redirect query doesn't pass the limit.
+                               $this->setContinueEnumParameter(
+                                       'continue',
+                                       "{$row->ll_lang}|{$row->ll_title}|{$row->ll_from}"
+                               );
                                break;
                        }
 
@@ -140,7 +144,10 @@ class ApiQueryLangBacklinks extends ApiQueryGeneratorBase {
 
                                $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $entry );
                                if ( !$fit ) {
-                                       $this->setContinueEnumParameter( 'continue', "{$row->ll_lang}|{$row->ll_title}|{$row->ll_from}" );
+                                       $this->setContinueEnumParameter(
+                                               'continue',
+                                               "{$row->ll_lang}|{$row->ll_title}|{$row->ll_from}"
+                                       );
                                        break;
                                }
                        }
index 926a1b6..a20b855 100644 (file)
@@ -182,7 +182,8 @@ class ApiQueryLangLinks extends ApiQueryBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=query&prop=langlinks&titles=Main%20Page&redirects=' => 'Get interlanguage links from the [[Main Page]]',
+                       'api.php?action=query&prop=langlinks&titles=Main%20Page&redirects='
+                               => 'Get interlanguage links from the [[Main Page]]',
                );
        }
 
index c3a130b..3157a7b 100644 (file)
@@ -43,7 +43,8 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                                $this->prefix = 'pl';
                                $this->description = 'link';
                                $this->titlesParam = 'titles';
-                               $this->titlesParamDescription = 'Only list links to these titles. Useful for checking whether a certain page links to a certain title.';
+                               $this->titlesParamDescription = 'Only list links to these titles. Useful ' .
+                                       'for checking whether a certain page links to a certain title.';
                                $this->helpUrl = 'https://www.mediawiki.org/wiki/API:Properties#links_.2F_pl';
                                break;
                        case self::TEMPLATES:
@@ -51,7 +52,8 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
                                $this->prefix = 'tl';
                                $this->description = 'template';
                                $this->titlesParam = 'templates';
-                               $this->titlesParamDescription = 'Only list these templates. Useful for checking whether a certain page uses a certain template.';
+                               $this->titlesParamDescription = 'Only list these templates. Useful ' .
+                                       'for checking whether a certain page uses a certain template.';
                                $this->helpUrl = 'https://www.mediawiki.org/wiki/API:Properties#templates_.2F_tl';
                                break;
                        default:
@@ -241,8 +243,10 @@ class ApiQueryLinks extends ApiQueryGeneratorBase {
 
                return array(
                        "api.php?action=query&prop={$name}&titles=Main%20Page" => "Get {$desc}s from the [[Main Page]]",
-                       "api.php?action=query&generator={$name}&titles=Main%20Page&prop=info" => "Get information about the {$desc} pages in the [[Main Page]]",
-                       "api.php?action=query&prop={$name}&titles=Main%20Page&{$this->prefix}namespace=2|10" => "Get {$desc}s from the Main Page in the User and Template namespaces",
+                       "api.php?action=query&generator={$name}&titles=Main%20Page&prop=info"
+                               => "Get information about the {$desc} pages in the [[Main Page]]",
+                       "api.php?action=query&prop={$name}&titles=Main%20Page&{$this->prefix}namespace=2|10"
+                               => "Get {$desc}s from the Main Page in the User and Template namespaces",
                );
        }
 
index d177279..0d2f475 100644 (file)
@@ -84,7 +84,10 @@ class ApiQueryLogEvents extends ApiQueryBase {
                $this->addFieldsIf( array( 'log_id', 'page_id' ), $this->fld_ids );
                $this->addFieldsIf( array( 'log_user', 'log_user_text', 'user_name' ), $this->fld_user );
                $this->addFieldsIf( 'log_user', $this->fld_userid );
-               $this->addFieldsIf( array( 'log_namespace', 'log_title' ), $this->fld_title || $this->fld_parsedcomment );
+               $this->addFieldsIf(
+                       array( 'log_namespace', 'log_title' ),
+                       $this->fld_title || $this->fld_parsedcomment
+               );
                $this->addFieldsIf( 'log_comment', $this->fld_comment || $this->fld_parsedcomment );
                $this->addFieldsIf( 'log_params', $this->fld_details );
 
@@ -96,7 +99,8 @@ class ApiQueryLogEvents extends ApiQueryBase {
 
                if ( !is_null( $params['tag'] ) ) {
                        $this->addTables( 'change_tag' );
-                       $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'log_id=ct_log_id' ) ) ) );
+                       $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN',
+                               array( 'log_id=ct_log_id' ) ) ) );
                        $this->addWhereFld( 'ct_tag', $params['tag'] );
                        $index['change_tag'] = 'change_tag_tag_id';
                }
@@ -110,7 +114,12 @@ class ApiQueryLogEvents extends ApiQueryBase {
                        $index['logging'] = 'type_time';
                }
 
-               $this->addTimestampWhereRange( 'log_timestamp', $params['dir'], $params['start'], $params['end'] );
+               $this->addTimestampWhereRange(
+                       'log_timestamp',
+                       $params['dir'],
+                       $params['start'],
+                       $params['end']
+               );
 
                $limit = $params['limit'];
                $this->addOption( 'LIMIT', $limit + 1 );
@@ -169,7 +178,8 @@ class ApiQueryLogEvents extends ApiQueryBase {
                $result = $this->getResult();
                foreach ( $res as $row ) {
                        if ( ++$count > $limit ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->log_timestamp ) );
                                break;
                        }
@@ -197,7 +207,9 @@ class ApiQueryLogEvents extends ApiQueryBase {
         * @param $legacy bool
         * @return array
         */
-       public static function addLogParams( $result, &$vals, $params, $type, $action, $ts, $legacy = false ) {
+       public static function addLogParams( $result, &$vals, $params, $type,
+               $action, $ts, $legacy = false
+       ) {
                switch ( $type ) {
                        case 'move':
                                if ( $legacy ) {
index 08c883d..5438175 100644 (file)
@@ -63,7 +63,8 @@ class ApiQueryPagePropNames extends ApiQueryBase {
                $count = 0;
                foreach ( $this->select( __METHOD__ ) as $row ) {
                        if ( ++$count > $limit ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'continue', $row->pp_propname );
                                break;
                        }
index 91a8090..e51c7ab 100644 (file)
@@ -135,7 +135,8 @@ class ApiQueryPageProps extends ApiQueryBase {
        public function getParamDescription() {
                return array(
                        'continue' => 'When more results are available, use this to continue',
-                       'prop' => 'Only list these props. Useful for checking whether a certain page uses a certain page prop',
+                       'prop' => 'Only list these props. Useful for checking whether a ' .
+                               'certain page uses a certain page prop',
                );
        }
 
index 6f2f02e..e68eb56 100644 (file)
@@ -92,7 +92,8 @@ class ApiQueryPagesWithProp extends ApiQueryGeneratorBase {
                $count = 0;
                foreach ( $this->select( __METHOD__ ) as $row ) {
                        if ( ++$count > $limit ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'continue', $row->page_id );
                                break;
                        }
@@ -178,8 +179,10 @@ class ApiQueryPagesWithProp extends ApiQueryGeneratorBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=query&list=pageswithprop&pwppropname=displaytitle&pwpprop=ids|title|value' => 'Get first 10 pages using {{DISPLAYTITLE:}}',
-                       'api.php?action=query&generator=pageswithprop&gpwppropname=notoc&prop=info' => 'Get page info about first 10 pages using __NOTOC__',
+                       'api.php?action=query&list=pageswithprop&pwppropname=displaytitle&pwpprop=ids|title|value'
+                               => 'Get first 10 pages using {{DISPLAYTITLE:}}',
+                       'api.php?action=query&generator=pageswithprop&gpwppropname=notoc&prop=info'
+                               => 'Get page info about first 10 pages using __NOTOC__',
                );
        }
 
index 4273c0d..ea350ad 100644 (file)
@@ -81,7 +81,8 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase {
 
                foreach ( $res as $row ) {
                        if ( ++$count > $params['limit'] ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->pt_timestamp ) );
                                break;
                        }
@@ -131,7 +132,10 @@ class ApiQueryProtectedTitles extends ApiQueryGeneratorBase {
                }
 
                if ( is_null( $resultPageSet ) ) {
-                       $result->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), $this->getModulePrefix() );
+                       $result->setIndexedTagName_internal(
+                               array( 'query', $this->getModuleName() ),
+                               $this->getModulePrefix()
+                       );
                } else {
                        $resultPageSet->populateFromTitles( $titles );
                }
index a6e455f..88af62b 100644 (file)
@@ -126,7 +126,10 @@ class ApiQueryQueryPage extends ApiQueryGeneratorBase {
                        }
                }
                if ( is_null( $resultPageSet ) ) {
-                       $result->setIndexedTagName_internal( array( 'query', $this->getModuleName(), 'results' ), 'page' );
+                       $result->setIndexedTagName_internal(
+                               array( 'query', $this->getModuleName(), 'results' ),
+                               'page'
+                       );
                } else {
                        $resultPageSet->populateFromTitles( $titles );
                }
index b1f5ab9..e990386 100644 (file)
@@ -30,9 +30,7 @@
  *
  * @ingroup API
  */
-
 class ApiQueryRandom extends ApiQueryGeneratorBase {
-
        private $pageIDs;
 
        public function __construct( $query, $moduleName ) {
@@ -110,14 +108,26 @@ class ApiQueryRandom extends ApiQueryGeneratorBase {
                $result = $this->getResult();
                $this->pageIDs = array();
 
-               $this->prepareQuery( wfRandom(), $params['limit'], $params['namespace'], $resultPageSet, $params['redirect'] );
+               $this->prepareQuery(
+                       wfRandom(),
+                       $params['limit'],
+                       $params['namespace'],
+                       $resultPageSet,
+                       $params['redirect']
+               );
                $count = $this->runQuery( $resultPageSet );
                if ( $count < $params['limit'] ) {
                        /* We got too few pages, we probably picked a high value
                         * for page_random. We'll just take the lowest ones, see
                         * also the comment in Title::getRandomTitle()
                         */
-                       $this->prepareQuery( 0, $params['limit'] - $count, $params['namespace'], $resultPageSet, $params['redirect'] );
+                       $this->prepareQuery(
+                               0,
+                               $params['limit'] - $count,
+                               $params['namespace'],
+                               $resultPageSet,
+                               $params['redirect']
+                       );
                        $this->runQuery( $resultPageSet );
                }
 
@@ -177,9 +187,12 @@ class ApiQueryRandom extends ApiQueryGeneratorBase {
        public function getDescription() {
                return array(
                        'Get a set of random pages',
-                       'NOTE: Pages are listed in a fixed sequence, only the starting point is random. This means that if, for example, "Main Page" is the first',
-                       '      random page on your list, "List of fictional monkeys" will *always* be second, "List of people on stamps of Vanuatu" third, etc',
-                       'NOTE: If the number of pages in the namespace is lower than rnlimit, you will get fewer pages. You will not get the same page twice'
+                       'NOTE: Pages are listed in a fixed sequence, only the starting point is random.',
+                       '      This means that if, for example, "Main Page" is the first random page on',
+                       '      your list, "List of fictional monkeys" will *always* be second, "List of',
+                       '      people on stamps of Vanuatu" third, etc',
+                       'NOTE: If the number of pages in the namespace is lower than rnlimit, you will',
+                       '      get fewer pages. You will not get the same page twice'
                );
        }
 
index 9abe76b..7848853 100644 (file)
@@ -199,7 +199,10 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                        // Check permissions
                        if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) {
                                if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
-                                       $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
+                                       $this->dieUsage(
+                                               'You need the patrol right to request the patrolled flag',
+                                               'permissiondenied'
+                                       );
                                }
                        }
 
@@ -215,7 +218,10 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                        $this->addWhereIf( 'page_is_redirect = 1', isset( $show['redirect'] ) );
 
                        // Don't throw log entries out the window here
-                       $this->addWhereIf( 'page_is_redirect = 0 OR page_is_redirect IS NULL', isset( $show['!redirect'] ) );
+                       $this->addWhereIf(
+                               'page_is_redirect = 0 OR page_is_redirect IS NULL',
+                               isset( $show['!redirect'] )
+                       );
                }
 
                if ( !is_null( $params['user'] ) && !is_null( $params['excludeuser'] ) ) {
@@ -253,7 +259,10 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                        $this->initProperties( $prop );
 
                        if ( $this->fld_patrolled && !$user->useRCPatrol() && !$user->useNPPatrol() ) {
-                               $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
+                               $this->dieUsage(
+                                       'You need the patrol right to request the patrolled flag',
+                                       'permissiondenied'
+                               );
                        }
 
                        $this->addFields( 'rc_id' );
@@ -265,8 +274,12 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                        $this->addFieldsIf( array( 'rc_minor', 'rc_type', 'rc_bot' ), $this->fld_flags );
                        $this->addFieldsIf( array( 'rc_old_len', 'rc_new_len' ), $this->fld_sizes );
                        $this->addFieldsIf( 'rc_patrolled', $this->fld_patrolled );
-                       $this->addFieldsIf( array( 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ), $this->fld_loginfo );
-                       $showRedirects = $this->fld_redirect || isset( $show['redirect'] ) || isset( $show['!redirect'] );
+                       $this->addFieldsIf(
+                               array( 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ),
+                               $this->fld_loginfo
+                       );
+                       $showRedirects = $this->fld_redirect || isset( $show['redirect'] )
+                               || isset( $show['!redirect'] );
                }
 
                if ( $this->fld_tags ) {
@@ -277,13 +290,15 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
 
                if ( $this->fld_sha1 ) {
                        $this->addTables( 'revision' );
-                       $this->addJoinConds( array( 'revision' => array( 'LEFT JOIN', array( 'rc_this_oldid=rev_id' ) ) ) );
+                       $this->addJoinConds( array( 'revision' => array( 'LEFT JOIN',
+                               array( 'rc_this_oldid=rev_id' ) ) ) );
                        $this->addFields( array( 'rev_sha1', 'rev_deleted' ) );
                }
 
                if ( $params['toponly'] || $showRedirects ) {
                        $this->addTables( 'page' );
-                       $this->addJoinConds( array( 'page' => array( 'LEFT JOIN', array( 'rc_namespace=page_namespace', 'rc_title=page_title' ) ) ) );
+                       $this->addJoinConds( array( 'page' => array( 'LEFT JOIN',
+                               array( 'rc_namespace=page_namespace', 'rc_title=page_title' ) ) ) );
                        $this->addFields( 'page_is_redirect' );
 
                        if ( $params['toponly'] ) {
@@ -313,8 +328,12 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                /* Iterate through the rows, adding data extracted from them to our query result. */
                foreach ( $res as $row ) {
                        if ( ++$count > $params['limit'] ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
-                               $this->setContinueEnumParameter( 'continue', wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) . '|' . $row->rc_id );
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
+                               $this->setContinueEnumParameter(
+                                       'continue',
+                                       wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) . '|' . $row->rc_id
+                               );
                                break;
                        }
 
@@ -328,7 +347,10 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
                                }
                                $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals );
                                if ( !$fit ) {
-                                       $this->setContinueEnumParameter( 'continue', wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) . '|' . $row->rc_id );
+                                       $this->setContinueEnumParameter(
+                                               'continue',
+                                               wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) . '|' . $row->rc_id
+                                       );
                                        break;
                                }
                        } else {
@@ -790,7 +812,10 @@ class ApiQueryRecentChanges extends ApiQueryGeneratorBase {
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
                        array( 'show' ),
-                       array( 'code' => 'permissiondenied', 'info' => 'You need the patrol right to request the patrolled flag' ),
+                       array(
+                               'code' => 'permissiondenied',
+                               'info' => 'You need the patrol right to request the patrolled flag'
+                       ),
                        array( 'code' => 'user-excludeuser', 'info' => 'user and excludeuser cannot be used together' ),
                ) );
        }
index 4be1594..86351c0 100644 (file)
  */
 
 /**
- * A query action to enumerate revisions of a given page, or show top revisions of multiple pages.
- * Various pieces of information may be shown - flags, comments, and the actual wiki markup of the rev.
- * In the enumeration mode, ranges of revisions may be requested and filtered.
+ * A query action to enumerate revisions of a given page, or show top revisions
+ * of multiple pages. Various pieces of information may be shown - flags,
+ * comments, and the actual wiki markup of the rev. In the enumeration mode,
+ * ranges of revisions may be requested and filtered.
  *
  * @ingroup API
  */
@@ -40,8 +41,9 @@ class ApiQueryRevisions extends ApiQueryBase {
                parent::__construct( $query, $moduleName, 'rv' );
        }
 
-       private $fld_ids = false, $fld_flags = false, $fld_timestamp = false, $fld_size = false, $fld_sha1 = false,
-               $fld_comment = false, $fld_parsedcomment = false, $fld_user = false, $fld_userid = false,
+       private $fld_ids = false, $fld_flags = false, $fld_timestamp = false,
+               $fld_size = false, $fld_sha1 = false, $fld_comment = false,
+               $fld_parsedcomment = false, $fld_user = false, $fld_userid = false,
                $fld_content = false, $fld_tags = false, $fld_contentmodel = false;
 
        private $tokenFunctions;
@@ -107,11 +109,20 @@ class ApiQueryRevisions extends ApiQueryBase {
                }
 
                if ( $revCount > 0 && $enumRevMode ) {
-                       $this->dieUsage( 'The revids= parameter may not be used with the list options (limit, startid, endid, dirNewer, start, end).', 'revids' );
+                       $this->dieUsage(
+                               'The revids= parameter may not be used with the list options ' .
+                                       '(limit, startid, endid, dirNewer, start, end).',
+                               'revids'
+                       );
                }
 
                if ( $pageCount > 1 && $enumRevMode ) {
-                       $this->dieUsage( 'titles, pageids or a generator was used to supply multiple pages, but the limit, startid, endid, dirNewer, user, excludeuser, start and end parameters may only be used on a single page.', 'multpages' );
+                       $this->dieUsage(
+                               'titles, pageids or a generator was used to supply multiple pages, ' .
+                                       'but the limit, startid, endid, dirNewer, user, excludeuser, start ' .
+                                       'and end parameters may only be used on a single page.',
+                               'multpages'
+                       );
                }
 
                if ( !is_null( $params['difftotext'] ) ) {
@@ -123,7 +134,10 @@ class ApiQueryRevisions extends ApiQueryBase {
                        if ( ( !ctype_digit( $params['diffto'] ) || $params['diffto'] < 0 )
                                && $params['diffto'] != 'prev' && $params['diffto'] != 'next'
                        ) {
-                               $this->dieUsage( 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"', 'diffto' );
+                               $this->dieUsage(
+                                       'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"',
+                                       'diffto'
+                               );
                        }
                        // Check whether the revision exists and is readable,
                        // DifferenceEngine returns a rather ambiguous empty
@@ -184,13 +198,17 @@ class ApiQueryRevisions extends ApiQueryBase {
                if ( isset( $prop['tags'] ) ) {
                        $this->fld_tags = true;
                        $this->addTables( 'tag_summary' );
-                       $this->addJoinConds( array( 'tag_summary' => array( 'LEFT JOIN', array( 'rev_id=ts_rev_id' ) ) ) );
+                       $this->addJoinConds(
+                               array( 'tag_summary' => array( 'LEFT JOIN', array( 'rev_id=ts_rev_id' ) ) )
+                       );
                        $this->addFields( 'ts_tags' );
                }
 
                if ( !is_null( $params['tag'] ) ) {
                        $this->addTables( 'change_tag' );
-                       $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) );
+                       $this->addJoinConds(
+                               array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) )
+                       );
                        $this->addWhereFld( 'ct_tag', $params['tag'] );
                        $index['change_tag'] = 'change_tag_tag_id';
                }
@@ -368,7 +386,8 @@ class ApiQueryRevisions extends ApiQueryBase {
 
                foreach ( $res as $row ) {
                        if ( ++$count > $limit ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                if ( !$enumRevMode ) {
                                        ApiBase::dieDebug( __METHOD__, 'Got more rows then expected' ); // bug report
                                }
@@ -500,7 +519,10 @@ class ApiQueryRevisions extends ApiQueryBase {
                        if ( $content && $this->section !== false ) {
                                $content = $content->getSection( $this->section, false );
                                if ( !$content ) {
-                                       $this->dieUsage( "There is no section {$this->section} in r" . $revision->getId(), 'nosuchsection' );
+                                       $this->dieUsage(
+                                               "There is no section {$this->section} in r" . $revision->getId(),
+                                               'nosuchsection'
+                                       );
                                }
                        }
                }
@@ -511,7 +533,11 @@ class ApiQueryRevisions extends ApiQueryBase {
                                if ( $content->getModel() === CONTENT_MODEL_WIKITEXT ) {
                                        $t = $content->getNativeData(); # note: don't set $text
 
-                                       $wgParser->startExternalParse( $title, ParserOptions::newFromContext( $this->getContext() ), OT_PREPROCESS );
+                                       $wgParser->startExternalParse(
+                                               $title,
+                                               ParserOptions::newFromContext( $this->getContext() ),
+                                               OT_PREPROCESS
+                                       );
                                        $dom = $wgParser->preprocessToDom( $t );
                                        if ( is_callable( array( $dom, 'saveXML' ) ) ) {
                                                $xml = $dom->saveXML();
@@ -531,7 +557,11 @@ class ApiQueryRevisions extends ApiQueryBase {
                                if ( $content->getModel() === CONTENT_MODEL_WIKITEXT ) {
                                        $text = $content->getNativeData();
 
-                                       $text = $wgParser->preprocess( $text, $title, ParserOptions::newFromContext( $this->getContext() ) );
+                                       $text = $wgParser->preprocess(
+                                               $text,
+                                               $title,
+                                               ParserOptions::newFromContext( $this->getContext() )
+                                       );
                                } else {
                                        $this->setWarning( "Template expansion is supported for wikitext only, " .
                                                $title->getPrefixedDBkey() .
@@ -541,7 +571,11 @@ class ApiQueryRevisions extends ApiQueryBase {
                                }
                        }
                        if ( $this->parseContent ) {
-                               $po = $content->getParserOutput( $title, $revision->getId(), ParserOptions::newFromContext( $this->getContext() ) );
+                               $po = $content->getParserOutput(
+                                       $title,
+                                       $revision->getId(),
+                                       ParserOptions::newFromContext( $this->getContext() )
+                               );
                                $text = $po->getText();
                        }
 
@@ -600,7 +634,12 @@ class ApiQueryRevisions extends ApiQueryBase {
                                                        "content model $model used by $name", 'badformat' );
                                        }
 
-                                       $difftocontent = ContentHandler::makeContent( $this->difftotext, $title, $model, $this->contentFormat );
+                                       $difftocontent = ContentHandler::makeContent(
+                                               $this->difftotext,
+                                               $title,
+                                               $model,
+                                               $this->contentFormat
+                                       );
 
                                        $engine = $handler->createDifferenceEngine( $context );
                                        $engine->setContent( $content, $difftocontent );
@@ -740,8 +779,11 @@ class ApiQueryRevisions extends ApiQueryBase {
                        'continue' => 'When more results are available, use this to continue',
                        'diffto' => array( 'Revision ID to diff each revision to.',
                                'Use "prev", "next" and "cur" for the previous, next and current revision respectively' ),
-                       'difftotext' => array( 'Text to diff each revision to. Only diffs a limited number of revisions.',
-                               "Overrides {$p}diffto. If {$p}section is set, only that section will be diffed against this text" ),
+                       'difftotext' => array(
+                               'Text to diff each revision to. Only diffs a limited number of revisions.',
+                               "Overrides {$p}diffto. If {$p}section is set, only that section will be",
+                               'diffed against this text',
+                       ),
                        'tag' => 'Only list revisions tagged with this tag',
                        'contentformat' => 'Serialization format used for difftotext and expected for output of content',
                );
@@ -825,12 +867,21 @@ class ApiQueryRevisions extends ApiQueryBase {
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
                        array( 'nosuchrevid', 'diffto' ),
-                       array( 'code' => 'revids', 'info' => 'The revids= parameter may not be used with the list options '
-                               . '(limit, startid, endid, dirNewer, start, end).' ),
-                       array( 'code' => 'multpages', 'info' => 'titles, pageids or a generator was used to supply multiple pages, '
-                               . ' but the limit, startid, endid, dirNewer, user, excludeuser, '
-                               . 'start and end parameters may only be used on a single page.' ),
-                       array( 'code' => 'diffto', 'info' => 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"' ),
+                       array(
+                               'code' => 'revids',
+                               'info' => 'The revids= parameter may not be used with the list options '
+                                       . '(limit, startid, endid, dirNewer, start, end).'
+                       ),
+                       array(
+                               'code' => 'multpages',
+                               'info' => 'titles, pageids or a generator was used to supply multiple pages, '
+                                       . ' but the limit, startid, endid, dirNewer, user, excludeuser, '
+                                       . 'start and end parameters may only be used on a single page.'
+                       ),
+                       array(
+                               'code' => 'diffto',
+                               'info' => 'rvdiffto must be set to a non-negative number, "prev", "next" or "cur"'
+                       ),
                        array( 'code' => 'badparams', 'info' => 'start and startid cannot be used together' ),
                        array( 'code' => 'badparams', 'info' => 'end and endid cannot be used together' ),
                        array( 'code' => 'badparams', 'info' => 'user and excludeuser cannot be used together' ),
@@ -843,17 +894,23 @@ class ApiQueryRevisions extends ApiQueryBase {
        public function getExamples() {
                return array(
                        'Get data with content for the last revision of titles "API" and "Main Page"',
-                       '  api.php?action=query&prop=revisions&titles=API|Main%20Page&rvprop=timestamp|user|comment|content',
+                       '  api.php?action=query&prop=revisions&titles=API|Main%20Page&' .
+                               'rvprop=timestamp|user|comment|content',
                        'Get last 5 revisions of the "Main Page"',
-                       '  api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment',
+                       '  api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
+                               'rvprop=timestamp|user|comment',
                        'Get first 5 revisions of the "Main Page"',
-                       '  api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvdir=newer',
+                       '  api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
+                               'rvprop=timestamp|user|comment&rvdir=newer',
                        'Get first 5 revisions of the "Main Page" made after 2006-05-01',
-                       '  api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvdir=newer&rvstart=20060501000000',
+                       '  api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
+                               'rvprop=timestamp|user|comment&rvdir=newer&rvstart=20060501000000',
                        'Get first 5 revisions of the "Main Page" that were not made made by anonymous user "127.0.0.1"',
-                       '  api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvexcludeuser=127.0.0.1',
+                       '  api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
+                               'rvprop=timestamp|user|comment&rvexcludeuser=127.0.0.1',
                        'Get first 5 revisions of the "Main Page" that were made by the user "MediaWiki default"',
-                       '  api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvuser=MediaWiki%20default',
+                       '  api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&' .
+                               'rvprop=timestamp|user|comment&rvuser=MediaWiki%20default',
                );
        }
 
index 8f094fa..4fedebc 100644 (file)
@@ -128,7 +128,8 @@ class ApiQuerySearch extends ApiQueryGeneratorBase {
 
                while ( $result ) {
                        if ( ++$count > $limit ) {
-                               // We've reached the one extra which shows that there are additional items to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional items to be had. Stop here...
                                $this->setContinueEnumParameter( 'offset', $params['offset'] + $params['limit'] );
                                break;
                        }
index 57eb41e..1c188da 100644 (file)
@@ -391,7 +391,10 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                $lb = wfGetLB();
                if ( $includeAll ) {
                        if ( !$wgShowHostnames ) {
-                               $this->dieUsage( 'Cannot view all servers info unless $wgShowHostnames is true', 'includeAllDenied' );
+                               $this->dieUsage(
+                                       'Cannot view all servers info unless $wgShowHostnames is true',
+                                       'includeAllDenied'
+                               );
                        }
 
                        $lags = $lb->getLagTimes();
@@ -729,7 +732,8 @@ class ApiQuerySiteinfo extends ApiQueryBase {
                        'filteriw' => 'Return only local or only nonlocal entries of the interwiki map',
                        'showalldb' => 'List all database servers, not just the one lagging the most',
                        'numberingroup' => 'Lists the number of users in user groups',
-                       'inlanguagecode' => 'Language code for localised language names (best effort, use CLDR extension)',
+                       'inlanguagecode' => 'Language code for localised language names ' .
+                               '(best effort, use CLDR extension)',
                );
        }
 
index f714227..248b3d8 100644 (file)
@@ -135,7 +135,8 @@ class ApiQueryStashImageInfo extends ApiQueryImageInfo {
        public function getExamples() {
                return array(
                        'api.php?action=query&prop=stashimageinfo&siifilekey=124sd34rsdf567',
-                       'api.php?action=query&prop=stashimageinfo&siifilekey=b34edoe3|bceffd4&siiurlwidth=120&siiprop=url',
+                       'api.php?action=query&prop=stashimageinfo&siifilekey=b34edoe3|bceffd4&' .
+                               'siiurlwidth=120&siiprop=url',
                );
        }
 }
index be08c8a..6c7a57d 100644 (file)
@@ -101,7 +101,8 @@ class ApiQueryContributions extends ApiQueryBase {
                // Fetch each row
                foreach ( $res as $row ) {
                        if ( ++$count > $limit ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                if ( $this->multiUserMode ) {
                                        $this->setContinueEnumParameter( 'continue', $this->continueStr( $row ) );
                                } else {
@@ -122,7 +123,10 @@ class ApiQueryContributions extends ApiQueryBase {
                        }
                }
 
-               $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'item' );
+               $this->getResult()->setIndexedTagName_internal(
+                       array( 'query', $this->getModuleName() ),
+                       'item'
+               );
        }
 
        /**
@@ -177,7 +181,8 @@ class ApiQueryContributions extends ApiQueryBase {
                }
                // We only want pages by the specified users.
                if ( $this->prefixMode ) {
-                       $this->addWhere( 'rev_user_text' . $this->getDB()->buildLike( $this->userprefix, $this->getDB()->anyString() ) );
+                       $this->addWhere( 'rev_user_text' .
+                               $this->getDB()->buildLike( $this->userprefix, $this->getDB()->anyString() ) );
                } else {
                        $this->addWhereFld( 'rev_user_text', $this->usernames );
                }
@@ -224,7 +229,10 @@ class ApiQueryContributions extends ApiQueryBase {
                        $this->fld_patrolled
                ) {
                        if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
-                               $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
+                               $this->dieUsage(
+                                       'You need the patrol right to request the patrolled flag',
+                                       'permissiondenied'
+                               );
                        }
 
                        // Use a redundant join condition on both
@@ -262,13 +270,17 @@ class ApiQueryContributions extends ApiQueryBase {
 
                if ( $this->fld_tags ) {
                        $this->addTables( 'tag_summary' );
-                       $this->addJoinConds( array( 'tag_summary' => array( 'LEFT JOIN', array( 'rev_id=ts_rev_id' ) ) ) );
+                       $this->addJoinConds(
+                               array( 'tag_summary' => array( 'LEFT JOIN', array( 'rev_id=ts_rev_id' ) ) )
+                       );
                        $this->addFields( 'ts_tags' );
                }
 
                if ( isset( $this->params['tag'] ) ) {
                        $this->addTables( 'change_tag' );
-                       $this->addJoinConds( array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) ) );
+                       $this->addJoinConds(
+                               array( 'change_tag' => array( 'INNER JOIN', array( 'rev_id=ct_rev_id' ) ) )
+                       );
                        $this->addWhereFld( 'ct_tag', $this->params['tag'] );
                        $index['change_tag'] = 'change_tag_tag_id';
                }
@@ -348,8 +360,13 @@ class ApiQueryContributions extends ApiQueryBase {
                        $vals['size'] = intval( $row->rev_len );
                }
 
-               if ( $this->fld_sizediff && !is_null( $row->rev_len ) && !is_null( $row->rev_parent_id ) ) {
-                       $parentLen = isset( $this->parentLens[$row->rev_parent_id] ) ? $this->parentLens[$row->rev_parent_id] : 0;
+               if ( $this->fld_sizediff
+                       && !is_null( $row->rev_len )
+                       && !is_null( $row->rev_parent_id )
+               ) {
+                       $parentLen = isset( $this->parentLens[$row->rev_parent_id] )
+                               ? $this->parentLens[$row->rev_parent_id]
+                               : 0;
                        $vals['sizediff'] = intval( $row->rev_len - $parentLen );
                }
 
@@ -448,7 +465,10 @@ class ApiQueryContributions extends ApiQueryBase {
                        'end' => 'The end timestamp to return to',
                        'continue' => 'When more results are available, use this to continue',
                        'user' => 'The users to retrieve contributions for',
-                       'userprefix' => "Retrieve contributions for all users whose names begin with this value. Overrides {$p}user",
+                       'userprefix' => array(
+                               "Retrieve contributions for all users whose names begin with this value.",
+                               "Overrides {$p}user",
+                       ),
                        'dir' => $this->getDirectionDescription( $p ),
                        'namespace' => 'Only list contributions in these namespaces',
                        'prop' => array(
@@ -464,8 +484,11 @@ class ApiQueryContributions extends ApiQueryBase {
                                ' patrolled      - Tags patrolled edits',
                                ' tags           - Lists tags for the edit',
                        ),
-                       'show' => array( "Show only items that meet this criteria, e.g. non minor edits only: {$p}show=!minor",
-                               "NOTE: If {$p}show=patrolled or {$p}show=!patrolled is set, revisions older than \$wgRCMaxAge ($wgRCMaxAge) won't be shown", ),
+                       'show' => array(
+                               "Show only items that meet thse criteria, e.g. non minor edits only: {$p}show=!minor",
+                               "NOTE: If {$p}show=patrolled or {$p}show=!patrolled is set, revisions older than",
+                               "\$wgRCMaxAge ($wgRCMaxAge) won't be shown",
+                       ),
                        'tag' => 'Only list revisions tagged with this tag',
                        'toponly' => 'Only list changes which are the latest revision',
                );
@@ -539,7 +562,10 @@ class ApiQueryContributions extends ApiQueryBase {
                        array( 'code' => 'param_user', 'info' => 'User parameter may not be empty.' ),
                        array( 'code' => 'param_user', 'info' => 'User name user is not valid' ),
                        array( 'show' ),
-                       array( 'code' => 'permissiondenied', 'info' => 'You need the patrol right to request the patrolled flag' ),
+                       array(
+                               'code' => 'permissiondenied',
+                               'info' => 'You need the patrol right to request the patrolled flag'
+                       ),
                ) );
        }
 
index 1d7ed63..37cf483 100644 (file)
@@ -234,7 +234,8 @@ class ApiQueryUserInfo extends ApiQueryBase {
                                '  ratelimits       - Lists all rate limits applying to the current user',
                                '  realname         - Adds the user\'s real name',
                                '  email            - Adds the user\'s email address and email authentication date',
-                               '  acceptlang       - Echoes the Accept-Language header sent by the client in a structured format',
+                               '  acceptlang       - Echoes the Accept-Language header sent by ' .
+                                       'the client in a structured format',
                                '  registrationdate - Adds the user\'s registration date',
                        )
                );
index 78bf24e..f22140a 100644 (file)
@@ -314,7 +314,8 @@ class ApiQueryUsers extends ApiQueryBase {
                                '  rights         - Lists all the rights the user(s) has',
                                '  editcount      - Adds the user\'s edit count',
                                '  registration   - Adds the user\'s registration timestamp',
-                               '  emailable      - Tags if the user can and wants to receive email through [[Special:Emailuser]]',
+                               '  emailable      - Tags if the user can and wants to receive ' .
+                                       'email through [[Special:Emailuser]]',
                                '  gender         - Tags the gender of the user. Returns "male", "female", or "unknown"',
                        ),
                        'users' => 'A list of users to obtain the same information for',
index 2f784f4..f9af75a 100644 (file)
@@ -44,9 +44,11 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                $this->run( $resultPageSet );
        }
 
-       private $fld_ids = false, $fld_title = false, $fld_patrol = false, $fld_flags = false,
-               $fld_timestamp = false, $fld_user = false, $fld_comment = false, $fld_parsedcomment = false, $fld_sizes = false,
-               $fld_notificationtimestamp = false, $fld_userid = false, $fld_loginfo = false;
+       private $fld_ids = false, $fld_title = false, $fld_patrol = false,
+               $fld_flags = false, $fld_timestamp = false, $fld_user = false,
+               $fld_comment = false, $fld_parsedcomment = false, $fld_sizes = false,
+               $fld_notificationtimestamp = false, $fld_userid = false,
+               $fld_loginfo = false;
 
        /**
         * @param $resultPageSet ApiPageSet
@@ -103,7 +105,10 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                        $this->addFieldsIf( 'rc_patrolled', $this->fld_patrol );
                        $this->addFieldsIf( array( 'rc_old_len', 'rc_new_len' ), $this->fld_sizes );
                        $this->addFieldsIf( 'wl_notificationtimestamp', $this->fld_notificationtimestamp );
-                       $this->addFieldsIf( array( 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ), $this->fld_loginfo );
+                       $this->addFieldsIf(
+                               array( 'rc_logid', 'rc_log_type', 'rc_log_action', 'rc_params' ),
+                               $this->fld_loginfo
+                       );
                } elseif ( $params['allrev'] ) {
                        $this->addFields( 'rc_this_oldid' );
                } else {
@@ -156,7 +161,10 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                        if ( isset( $show['patrolled'] ) || isset( $show['!patrolled'] ) ) {
                                $user = $this->getUser();
                                if ( !$user->useRCPatrol() && !$user->useNPPatrol() ) {
-                                       $this->dieUsage( 'You need the patrol right to request the patrolled flag', 'permissiondenied' );
+                                       $this->dieUsage(
+                                               'You need the patrol right to request the patrolled flag',
+                                               'permissiondenied'
+                                       );
                                }
                        }
 
@@ -186,7 +194,10 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                }
 
                // This is an index optimization for mysql, as done in the Special:Watchlist page
-               $this->addWhereIf( "rc_timestamp > ''", !isset( $params['start'] ) && !isset( $params['end'] ) && $db->getType() == 'mysql' );
+               $this->addWhereIf(
+                       "rc_timestamp > ''",
+                       !isset( $params['start'] ) && !isset( $params['end'] ) && $db->getType() == 'mysql'
+               );
 
                $this->addOption( 'LIMIT', $params['limit'] + 1 );
 
@@ -196,8 +207,12 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
 
                foreach ( $res as $row ) {
                        if ( ++$count > $params['limit'] ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
-                               $this->setContinueEnumParameter( 'start', wfTimestamp( TS_ISO_8601, $row->rc_timestamp ) );
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
+                               $this->setContinueEnumParameter(
+                                       'start',
+                                       wfTimestamp( TS_ISO_8601, $row->rc_timestamp )
+                               );
                                break;
                        }
 
@@ -219,7 +234,10 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                }
 
                if ( is_null( $resultPageSet ) ) {
-                       $this->getResult()->setIndexedTagName_internal( array( 'query', $this->getModuleName() ), 'item' );
+                       $this->getResult()->setIndexedTagName_internal(
+                               array( 'query', $this->getModuleName() ),
+                               'item'
+                       );
                } elseif ( $params['allrev'] ) {
                        $resultPageSet->populateFromRevisionIDs( $ids );
                } else {
@@ -485,7 +503,8 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
                                ' log            - Log entries',
                        ),
                        'owner' => 'The name of the user whose watchlist you\'d like to access',
-                       'token' => 'Give a security token (settable in preferences) to allow access to another user\'s watchlist'
+                       'token' => 'Give a security token (settable in preferences) to ' .
+                               'allow access to another user\'s watchlist'
                );
        }
 
@@ -578,11 +597,18 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase {
        public function getPossibleErrors() {
                return array_merge( parent::getPossibleErrors(), array(
                        array( 'code' => 'bad_wlowner', 'info' => 'Specified user does not exist' ),
-                       array( 'code' => 'bad_wltoken', 'info' => 'Incorrect watchlist token provided -- please set a correct token in Special:Preferences' ),
+                       array(
+                               'code' => 'bad_wltoken',
+                               'info' => 'Incorrect watchlist token provided -- ' .
+                                       'please set a correct token in Special:Preferences'
+                       ),
                        array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ),
                        array( 'code' => 'patrol', 'info' => 'patrol property is not available' ),
                        array( 'show' ),
-                       array( 'code' => 'permissiondenied', 'info' => 'You need the patrol right to request the patrolled flag' ),
+                       array(
+                               'code' => 'permissiondenied',
+                               'info' => 'You need the patrol right to request the patrolled flag'
+                       ),
                        array( 'code' => 'user-excludeuser', 'info' => 'user and excludeuser cannot be used together' ),
                ) );
        }
index 4d97722..b53bea1 100644 (file)
@@ -100,7 +100,8 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
                $count = 0;
                foreach ( $res as $row ) {
                        if ( ++$count > $params['limit'] ) {
-                               // We've reached the one extra which shows that there are additional pages to be had. Stop here...
+                               // We've reached the one extra which shows that there are
+                               // additional pages to be had. Stop here...
                                $this->setContinueEnumParameter( 'continue', $row->wl_namespace . '|' . $row->wl_title );
                                break;
                        }
@@ -182,7 +183,8 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
                        ),
                        'show' => 'Only list items that meet these criteria',
                        'owner' => 'The name of the user whose watchlist you\'d like to access',
-                       'token' => 'Give a security token (settable in preferences) to allow access to another user\'s watchlist',
+                       'token' => 'Give a security token (settable in preferences) to allow ' .
+                               'access to another user\'s watchlist',
                        'dir' => 'Direction to sort the titles and namespaces in',
                );
        }
@@ -211,7 +213,11 @@ class ApiQueryWatchlistRaw extends ApiQueryGeneratorBase {
                        array( 'code' => 'notloggedin', 'info' => 'You must be logged-in to have a watchlist' ),
                        array( 'show' ),
                        array( 'code' => 'bad_wlowner', 'info' => 'Specified user does not exist' ),
-                       array( 'code' => 'bad_wltoken', 'info' => 'Incorrect watchlist token provided -- please set a correct token in Special:Preferences' ),
+                       array(
+                               'code' => 'bad_wltoken',
+                               'info' => 'Incorrect watchlist token provided -- ' .
+                                       'please set a correct token in Special:Preferences'
+                       ),
                ) );
        }
 
index 68137ff..e922020 100644 (file)
@@ -26,9 +26,9 @@
 
 /**
  * This class represents the result of the API operations.
- * It simply wraps a nested array() structure, adding some functions to simplify array's modifications.
- * As various modules execute, they add different pieces of information to this result,
- * structuring it as it will be given to the client.
+ * It simply wraps a nested array() structure, adding some functions to simplify
+ * array's modifications. As various modules execute, they add different pieces
+ * of information to this result, structuring it as it will be given to the client.
  *
  * Each subarray may either be a dictionary - key-value pairs with unique keys,
  * or lists, where the items are added using $data[] = $value notation.
@@ -151,14 +151,17 @@ class ApiResult extends ApiBase {
         * @param array $arr to add $value to
         * @param string $name Index of $arr to add $value at
         * @param $value mixed
-        * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. This parameter used to be
-        *        boolean, and the value of OVERRIDE=1 was specifically chosen so that it would be backwards
-        *        compatible with the new method signature.
+        * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP.
+        *    This parameter used to be boolean, and the value of OVERRIDE=1 was
+        *    specifically chosen so that it would be backwards compatible with the
+        *    new method signature.
         *
         * @since 1.21 int $flags replaced boolean $override
         */
        public static function setElement( &$arr, $name, $value, $flags = 0 ) {
-               if ( $arr === null || $name === null || $value === null || !is_array( $arr ) || is_array( $name ) ) {
+               if ( $arr === null || $name === null || $value === null
+                       || !is_array( $arr ) || is_array( $name )
+               ) {
                        ApiBase::dieDebug( __METHOD__, 'Bad parameter' );
                }
 
@@ -177,7 +180,10 @@ class ApiResult extends ApiBase {
                                ApiBase::dieDebug( __METHOD__, "Attempting to merge element $name" );
                        }
                } else {
-                       ApiBase::dieDebug( __METHOD__, "Attempting to add element $name=$value, existing value is {$arr[$name]}" );
+                       ApiBase::dieDebug(
+                               __METHOD__,
+                               "Attempting to add element $name=$value, existing value is {$arr[$name]}"
+                       );
                }
        }
 
@@ -272,9 +278,10 @@ class ApiResult extends ApiBase {
         * @param $path array|string|null
         * @param $name string
         * @param $value mixed
-        * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. This parameter used to be
-        *        boolean, and the value of OVERRIDE=1 was specifically chosen so that it would be backwards
-        *        compatible with the new method signature.
+        * @param int $flags Zero or more OR-ed flags like OVERRIDE | ADD_ON_TOP. This
+        *    parameter used to be boolean, and the value of OVERRIDE=1 was specifically
+        *    chosen so that it would be backwards compatible with the new method
+        *    signature.
         * @return bool True if $value fits in the result, false if not
         *
         * @since 1.21 int $flags replaced boolean $override
index b9873f4..2a372e4 100644 (file)
@@ -47,7 +47,14 @@ class ApiRollback extends ApiBase {
                $pageObj = WikiPage::factory( $titleObj );
                $summary = $params['summary'];
                $details = array();
-               $retval = $pageObj->doRollback( $this->getRbUser(), $summary, $params['token'], $params['markbot'], $details, $this->getUser() );
+               $retval = $pageObj->doRollback(
+                       $this->getRbUser(),
+                       $summary,
+                       $params['token'],
+                       $params['markbot'],
+                       $details,
+                       $this->getUser()
+               );
 
                if ( $retval ) {
                        // We don't care about multiple errors, just report one of them
@@ -107,11 +114,14 @@ class ApiRollback extends ApiBase {
        public function getParamDescription() {
                return array(
                        'title' => 'Title of the page you want to rollback.',
-                       'user' => 'Name of the user whose edits are to be rolled back. If set incorrectly, you\'ll get a badtoken error.',
-                       'token' => "A rollback token previously retrieved through {$this->getModulePrefix()}prop=revisions",
+                       'user' => 'Name of the user whose edits are to be rolled back. If ' .
+                               'set incorrectly, you\'ll get a badtoken error.',
+                       'token' => 'A rollback token previously retrieved through ' .
+                               "{$this->getModulePrefix()}prop=revisions",
                        'summary' => 'Custom edit summary. If empty, default summary will be used',
                        'markbot' => 'Mark the reverted edits and the revert as bot edits',
-                       'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
+                       'watchlist' => 'Unconditionally add or remove the page from your watchlist, ' .
+                               'use preferences or do not change watch',
                );
        }
 
@@ -130,8 +140,8 @@ class ApiRollback extends ApiBase {
 
        public function getDescription() {
                return array(
-                       'Undo the last edit to the page. If the last user who edited the page made multiple edits in a row,',
-                       'they will all be rolled back'
+                       'Undo the last edit to the page. If the last user who edited the page made',
+                       'multiple edits in a row, they will all be rolled back'
                );
        }
 
@@ -194,7 +204,8 @@ class ApiRollback extends ApiBase {
        public function getExamples() {
                return array(
                        'api.php?action=rollback&title=Main%20Page&user=Catrope&token=123ABC',
-                       'api.php?action=rollback&title=Main%20Page&user=217.121.114.116&token=123ABC&summary=Reverting%20vandalism&markbot=1'
+                       'api.php?action=rollback&title=Main%20Page&user=217.121.114.116&' .
+                               'token=123ABC&summary=Reverting%20vandalism&markbot=1'
                );
        }
 
index 5302896..dc593e5 100644 (file)
@@ -48,7 +48,10 @@ class ApiSetNotificationTimestamp extends ApiBase {
 
                $pageSet = $this->getPageSet();
                if ( $params['entirewatchlist'] && $pageSet->getDataSource() !== null ) {
-                       $this->dieUsage( "Cannot use 'entirewatchlist' at the same time as '{$pageSet->getDataSource()}'", 'multisource' );
+                       $this->dieUsage(
+                               "Cannot use 'entirewatchlist' at the same time as '{$pageSet->getDataSource()}'",
+                               'multisource'
+                       );
                }
 
                $dbw = wfGetDB( DB_MASTER, 'api' );
@@ -95,7 +98,9 @@ class ApiSetNotificationTimestamp extends ApiBase {
                                __METHOD__
                        );
 
-                       $result['notificationtimestamp'] = ( is_null( $timestamp ) ? '' : wfTimestamp( TS_ISO_8601, $timestamp ) );
+                       $result['notificationtimestamp'] = is_null( $timestamp )
+                               ? ''
+                               : wfTimestamp( TS_ISO_8601, $timestamp );
                } else {
                        // First, log the invalid titles
                        foreach ( $pageSet->getInvalidTitles() as $title ) {
@@ -128,7 +133,9 @@ class ApiSetNotificationTimestamp extends ApiBase {
 
                        // Query the results of our update
                        $timestamps = array();
-                       $res = $dbw->select( 'watchlist', array( 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ),
+                       $res = $dbw->select(
+                               'watchlist',
+                               array( 'wl_namespace', 'wl_title', 'wl_notificationtimestamp' ),
                                array( 'wl_user' => $user->getID(), $lb->constructSet( 'wl', $dbw ) ),
                                __METHOD__
                        );
@@ -281,7 +288,8 @@ class ApiSetNotificationTimestamp extends ApiBase {
                        $this->getRequireOnlyOneParameterErrorMessages(
                                array_merge( array( 'entirewatchlist' ), array_keys( $ps->getFinalParams() ) ) ),
                        array(
-                               array( 'code' => 'notloggedin', 'info' => 'Anonymous users cannot use watchlist change notifications' ),
+                               array( 'code' => 'notloggedin', 'info'
+                               => 'Anonymous users cannot use watchlist change notifications' ),
                                array( 'code' => 'multpages', 'info' => 'torevid may only be used with a single page' ),
                                array( 'code' => 'multpages', 'info' => 'newerthanrevid may only be used with a single page' ),
                        )
@@ -290,9 +298,14 @@ class ApiSetNotificationTimestamp extends ApiBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=setnotificationtimestamp&entirewatchlist=&token=123ABC' => 'Reset the notification status for the entire watchlist',
-                       'api.php?action=setnotificationtimestamp&titles=Main_page&token=123ABC' => 'Reset the notification status for "Main page"',
-                       'api.php?action=setnotificationtimestamp&titles=Main_page&timestamp=2012-01-01T00:00:00Z&token=123ABC' => 'Set the notification timestamp for "Main page" so all edits since 1 January 2012 are unviewed',
+                       'api.php?action=setnotificationtimestamp&entirewatchlist=&token=123ABC'
+                               => 'Reset the notification status for the entire watchlist',
+                       'api.php?action=setnotificationtimestamp&titles=Main_page&token=123ABC'
+                               => 'Reset the notification status for "Main page"',
+                       'api.php?action=setnotificationtimestamp&titles=Main_page&' .
+                               'timestamp=2012-01-01T00:00:00Z&token=123ABC'
+                               => 'Set the notification timestamp for "Main page" so all edits ' .
+                                       'since 1 January 2012 are unviewed',
                );
        }
 
index 78137a8..dabb8da 100644 (file)
@@ -98,8 +98,10 @@ class ApiUnblock extends ApiBase {
                $p = $this->getModulePrefix();
 
                return array(
-                       'id' => "ID of the block you want to unblock (obtained through list=blocks). Cannot be used together with {$p}user",
-                       'user' => "Username, IP address or IP range you want to unblock. Cannot be used together with {$p}id",
+                       'id' => "ID of the block you want to unblock (obtained through list=blocks). ' .
+                               'Cannot be used together with {$p}user",
+                       'user' => "Username, IP address or IP range you want to unblock. ' .
+                               'Cannot be used together with {$p}id",
                        'token' => "An unblock token previously obtained through prop=info",
                        'reason' => 'Reason for unblock',
                );
index 4bbe568..93cefef 100644 (file)
@@ -122,8 +122,10 @@ class ApiUndelete extends ApiBase {
                        'title' => 'Title of the page you want to restore',
                        'token' => 'An undelete token previously retrieved through list=deletedrevs',
                        'reason' => 'Reason for restoring',
-                       'timestamps' => 'Timestamps of the revisions to restore. If not set, all revisions will be restored.',
-                       'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
+                       'timestamps' => 'Timestamps of the revisions to restore. If not set, all ' .
+                               'revisions will be restored.',
+                       'watchlist' => 'Unconditionally add or remove the page from your ' .
+                               'watchlist, use preferences or do not change watch',
                );
        }
 
@@ -140,8 +142,8 @@ class ApiUndelete extends ApiBase {
 
        public function getDescription() {
                return array(
-                       'Restore certain revisions of a deleted page. A list of deleted revisions (including timestamps) can be',
-                       'retrieved through list=deletedrevs'
+                       'Restore certain revisions of a deleted page. A list of deleted revisions ',
+                       '(including timestamps) can be retrieved through list=deletedrevs'
                );
        }
 
index 6d5861d..01e0f6e 100644 (file)
@@ -574,7 +574,9 @@ class ApiUpload extends ApiBase {
                        if ( isset( $warnings['exists'] ) ) {
                                $warning = $warnings['exists'];
                                unset( $warnings['exists'] );
-                               $localFile = isset( $warning['normalizedFile'] ) ? $warning['normalizedFile'] : $warning['file'];
+                               $localFile = isset( $warning['normalizedFile'] )
+                                       ? $warning['normalizedFile']
+                                       : $warning['file'];
                                $warnings[$warning['warning']] = $localFile->getName();
                        }
                }
@@ -751,16 +753,19 @@ class ApiUpload extends ApiBase {
                $params = array(
                        'filename' => 'Target filename',
                        'token' => 'Edit token. You can get one of these through prop=info',
-                       'comment' => 'Upload comment. Also used as the initial page text for new files if "text" is not specified',
+                       'comment' => 'Upload comment. Also used as the initial page text for new ' .
+                               'files if "text" is not specified',
                        'text' => 'Initial page text for new files',
                        'watch' => 'Watch the page',
-                       'watchlist' => 'Unconditionally add or remove the page from your watchlist, use preferences or do not change watch',
+                       'watchlist' => 'Unconditionally add or remove the page from your watchlist, ' .
+                               'use preferences or do not change watch',
                        'ignorewarnings' => 'Ignore any warnings',
                        'file' => 'File contents',
                        'url' => 'URL to fetch the file from',
                        'filekey' => 'Key that identifies a previous upload that was stashed temporarily.',
                        'sessionkey' => 'Same as filekey, maintained for backward compatibility.',
-                       'stash' => 'If set, the server will not add the file to the repository and stash it temporarily.',
+                       'stash' => 'If set, the server will not add the file to the repository ' .
+                               'and stash it temporarily.',
 
                        'chunk' => 'Chunk contents',
                        'offset' => 'Offset of chunk in bytes',
@@ -858,7 +863,8 @@ class ApiUpload extends ApiBase {
 
        public function getExamples() {
                return array(
-                       'api.php?action=upload&filename=Wiki.png&url=http%3A//upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png'
+                       'api.php?action=upload&filename=Wiki.png' .
+                       '&url=http%3A//upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png'
                                => 'Upload from a URL',
                        'api.php?action=upload&filename=Wiki.png&filekey=filekey&ignorewarnings=1'
                                => 'Complete an upload that failed due to warnings',
index c7d636a..7ad286f 100644 (file)
@@ -49,21 +49,26 @@ class ApiWatch extends ApiBase {
 
                $res = array( 'title' => $title->getPrefixedText() );
 
-               // Currently unnecessary, code to act as a safeguard against any change in current behavior of uselang
+               // Currently unnecessary, code to act as a safeguard against any change
+               // in current behavior of uselang.
                // Copy from ApiParse
                $oldLang = null;
-               if ( isset( $params['uselang'] ) && $params['uselang'] != $this->getContext()->getLanguage()->getCode() ) {
+               if ( isset( $params['uselang'] ) &&
+                       $params['uselang'] != $this->getContext()->getLanguage()->getCode()
+               ) {
                        $oldLang = $this->getContext()->getLanguage(); // Backup language
                        $this->getContext()->setLanguage( Language::factory( $params['uselang'] ) );
                }
 
                if ( $params['unwatch'] ) {
                        $res['unwatched'] = '';
-                       $res['message'] = $this->msg( 'removedwatchtext', $title->getPrefixedText() )->title( $title )->parseAsBlock();
+                       $res['message'] = $this->msg( 'removedwatchtext', $title->getPrefixedText() )
+                               ->title( $title )->parseAsBlock();
                        $status = UnwatchAction::doUnwatch( $title, $user );
                } else {
                        $res['watched'] = '';
-                       $res['message'] = $this->msg( 'addedwatchtext', $title->getPrefixedText() )->title( $title )->parseAsBlock();
+                       $res['message'] = $this->msg( 'addedwatchtext', $title->getPrefixedText() )
+                               ->title( $title )->parseAsBlock();
                        $status = WatchAction::doWatch( $title, $user );
                }
 
index c8e98a7..6cf7376 100644 (file)
@@ -285,9 +285,16 @@ class RedisConnectionPool {
        }
 
        /**
-        * Resend an AUTH request to the redis server (useful after disconnects)
+        * Re-send an AUTH request to the redis server (useful after disconnects).
         *
-        * This method is for internal use only
+        * This works around an upstream bug in phpredis. phpredis hides disconnects by transparently
+        * reconnecting, but it neglects to re-authenticate the new connection. To the user of the
+        * phpredis client API this manifests as a seemingly random tendency of connections to lose
+        * their authentication status.
+        *
+        * This method is for internal use only.
+        *
+        * @see https://github.com/nicolasff/phpredis/issues/403
         *
         * @param string $server
         * @param Redis $conn
@@ -317,6 +324,7 @@ class RedisConnRef {
        protected $conn;
 
        protected $server; // string
+       protected $lastError; // string
 
        /**
         * @param $pool RedisConnectionPool
@@ -329,8 +337,29 @@ class RedisConnRef {
                $this->conn = $conn;
        }
 
+       public function getLastError() {
+               return $this->lastError;
+       }
+
+       public function clearLastError() {
+               $this->lastError = null;
+       }
+
        public function __call( $name, $arguments ) {
-               return call_user_func_array( array( $this->conn, $name ), $arguments );
+               $conn = $this->conn; // convenience
+
+               $conn->clearLastError();
+               $res = call_user_func_array( array( $conn, $name ), $arguments );
+               if ( preg_match( '/^ERR operation not permitted\b/', $conn->getLastError() ) ) {
+                       $this->pool->reauthenticateConnection( $this->server, $conn );
+                       $conn->clearLastError();
+                       $res = call_user_func_array( array( $conn, $name ), $arguments );
+                       wfDebugLog( 'redis', "Used automatic re-authentication for method '$name'." );
+               }
+
+               $this->lastError = $conn->getLastError() ?: $this->lastError;
+
+               return $res;
        }
 
        /**
@@ -369,6 +398,8 @@ class RedisConnRef {
                        wfDebugLog( 'redis', "Lua script error on server $server: " . $conn->getLastError() );
                }
 
+               $this->lastError = $conn->getLastError() ?: $this->lastError;
+
                return $res;
        }
 
index c677d74..c54c309 100644 (file)
@@ -788,7 +788,6 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
                        'postgres' => array(),
                        'sqlite'   => array(),
                        'oracle'   => array(),
-                       'mssql'    => array(),
                );
 
                $driver = false;
diff --git a/includes/db/DatabaseMssql.php b/includes/db/DatabaseMssql.php
deleted file mode 100644 (file)
index 240a097..0000000
+++ /dev/null
@@ -1,1202 +0,0 @@
-<?php
-/**
- * This is the MS SQL Server Native database abstraction layer.
- *
- * 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
- * @ingroup Database
- * @author Joel Penner <a-joelpe at microsoft dot com>
- * @author Chris Pucci <a-cpucci at microsoft dot com>
- * @author Ryan Biesemeyer <v-ryanbi at microsoft dot com>
- */
-
-/**
- * @ingroup Database
- */
-class DatabaseMssql extends DatabaseBase {
-       var $mInsertId = null;
-       var $mLastResult = null;
-       var $mAffectedRows = null;
-
-       var $mPort;
-
-       function cascadingDeletes() {
-               return true;
-       }
-
-       function cleanupTriggers() {
-               return true;
-       }
-
-       function strictIPs() {
-               return true;
-       }
-
-       function realTimestamps() {
-               return true;
-       }
-
-       function implicitGroupby() {
-               return false;
-       }
-
-       function implicitOrderby() {
-               return false;
-       }
-
-       function functionalIndexes() {
-               return true;
-       }
-
-       function unionSupportsOrderAndLimit() {
-               return false;
-       }
-
-       /**
-        * Usually aborts on failure
-        * @param string $server
-        * @param string $user
-        * @param string $password
-        * @param string $dbName
-        * @throws DBConnectionError
-        * @return bool|DatabaseBase|null
-        */
-       function open( $server, $user, $password, $dbName ) {
-               # Test for driver support, to avoid suppressed fatal error
-               if ( !function_exists( 'sqlsrv_connect' ) ) {
-                       throw new DBConnectionError( $this, "MS Sql Server Native (sqlsrv) functions missing. You can download the driver from: http://go.microsoft.com/fwlink/?LinkId=123470\n" );
-               }
-
-               global $wgDBport;
-
-               if ( !strlen( $user ) ) { # e.g. the class is being loaded
-                       return;
-               }
-
-               $this->close();
-               $this->mServer = $server;
-               $this->mPort = $wgDBport;
-               $this->mUser = $user;
-               $this->mPassword = $password;
-               $this->mDBname = $dbName;
-
-               $connectionInfo = array();
-
-               if ( $dbName ) {
-                       $connectionInfo['Database'] = $dbName;
-               }
-
-               // Start NT Auth Hack
-               // Quick and dirty work around to provide NT Auth designation support.
-               // Current solution requires installer to know to input 'ntauth' for both username and password
-               // to trigger connection via NT Auth. - ugly, ugly, ugly
-               // TO-DO: Make this better and add NT Auth choice to MW installer when SQL Server option is chosen.
-               $ntAuthUserTest = strtolower( $user );
-               $ntAuthPassTest = strtolower( $password );
-
-               // Decide which auth scenerio to use
-               if ( $ntAuthPassTest == 'ntauth' && $ntAuthUserTest == 'ntauth' ) {
-                       // Don't add credentials to $connectionInfo
-               } else {
-                       $connectionInfo['UID'] = $user;
-                       $connectionInfo['PWD'] = $password;
-               }
-               // End NT Auth Hack
-
-               wfSuppressWarnings();
-               $this->mConn = sqlsrv_connect( $server, $connectionInfo );
-               wfRestoreWarnings();
-
-               if ( $this->mConn === false ) {
-                       wfDebug( "DB connection error\n" );
-                       wfDebug( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" );
-                       wfDebug( $this->lastError() . "\n" );
-                       return false;
-               }
-
-               $this->mOpened = true;
-               return $this->mConn;
-       }
-
-       /**
-        * Closes a database connection, if it is open
-        * Returns success, true if already closed
-        * @return bool
-        */
-       protected function closeConnection() {
-               return sqlsrv_close( $this->mConn );
-       }
-
-       protected function doQuery( $sql ) {
-               wfDebug( "SQL: [$sql]\n" );
-               $this->offset = 0;
-
-               // several extensions seem to think that all databases support limits via LIMIT N after the WHERE clause
-               // well, MSSQL uses SELECT TOP N, so to catch any of those extensions we'll do a quick check for a LIMIT
-               // clause and pass $sql through $this->LimitToTopN() which parses the limit clause and passes the result to
-               // $this->limitResult();
-               if ( preg_match( '/\bLIMIT\s*/i', $sql ) ) {
-                       // massage LIMIT -> TopN
-                       $sql = $this->LimitToTopN( $sql );
-               }
-
-               // MSSQL doesn't have EXTRACT(epoch FROM XXX)
-               if ( preg_match( '#\bEXTRACT\s*?\(\s*?EPOCH\s+FROM\b#i', $sql, $matches ) ) {
-                       // This is same as UNIX_TIMESTAMP, we need to calc # of seconds from 1970
-                       $sql = str_replace( $matches[0], "DATEDIFF(s,CONVERT(datetime,'1/1/1970'),", $sql );
-               }
-
-               // perform query
-               $stmt = sqlsrv_query( $this->mConn, $sql );
-               if ( $stmt == false ) {
-                       $message = "A database error has occurred. Did you forget to run maintenance/update.php after upgrading?  See: http://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script\n" .
-                               "Query: " . htmlentities( $sql ) . "\n" .
-                               "Function: " . __METHOD__ . "\n";
-                       // process each error (our driver will give us an array of errors unlike other providers)
-                       foreach ( sqlsrv_errors() as $error ) {
-                               $message .= $message . "ERROR[" . $error['code'] . "] " . $error['message'] . "\n";
-                       }
-
-                       throw new DBUnexpectedError( $this, $message );
-               }
-               // remember number of rows affected
-               $this->mAffectedRows = sqlsrv_rows_affected( $stmt );
-
-               // if it is a SELECT statement, or an insert with a request to output something we want to return a row.
-               if ( ( preg_match( '#\bSELECT\s#i', $sql ) ) ||
-                       ( preg_match( '#\bINSERT\s#i', $sql ) && preg_match( '#\bOUTPUT\s+INSERTED\b#i', $sql ) ) ) {
-                       // this is essentially a rowset, but Mediawiki calls these 'result'
-                       // the rowset owns freeing the statement
-                       $res = new MssqlResult( $stmt );
-               } else {
-                       // otherwise we simply return it was successful, failure throws an exception
-                       $res = true;
-               }
-               return $res;
-       }
-
-       function freeResult( $res ) {
-               if ( $res instanceof ResultWrapper ) {
-                       $res = $res->result;
-               }
-               $res->free();
-       }
-
-       function fetchObject( $res ) {
-               if ( $res instanceof ResultWrapper ) {
-                       $res = $res->result;
-               }
-               $row = $res->fetch( 'OBJECT' );
-               return $row;
-       }
-
-       function getErrors() {
-               $strRet = '';
-               $retErrors = sqlsrv_errors( SQLSRV_ERR_ALL );
-               if ( $retErrors != null ) {
-                       foreach ( $retErrors as $arrError ) {
-                               $strRet .= "SQLState: " . $arrError['SQLSTATE'] . "\n";
-                               $strRet .= "Error Code: " . $arrError['code'] . "\n";
-                               $strRet .= "Message: " . $arrError['message'] . "\n";
-                       }
-               } else {
-                       $strRet = "No errors found";
-               }
-               return $strRet;
-       }
-
-       function fetchRow( $res ) {
-               if ( $res instanceof ResultWrapper ) {
-                       $res = $res->result;
-               }
-               $row = $res->fetch( SQLSRV_FETCH_BOTH );
-               return $row;
-       }
-
-       function numRows( $res ) {
-               if ( $res instanceof ResultWrapper ) {
-                       $res = $res->result;
-               }
-               return ( $res ) ? $res->numrows() : 0;
-       }
-
-       function numFields( $res ) {
-               if ( $res instanceof ResultWrapper ) {
-                       $res = $res->result;
-               }
-               return ( $res ) ? $res->numfields() : 0;
-       }
-
-       function fieldName( $res, $n ) {
-               if ( $res instanceof ResultWrapper ) {
-                       $res = $res->result;
-               }
-               return ( $res ) ? $res->fieldname( $n ) : 0;
-       }
-
-       /**
-        * This must be called after nextSequenceVal
-        * @return null
-        */
-       function insertId() {
-               return $this->mInsertId;
-       }
-
-       function dataSeek( $res, $row ) {
-               if ( $res instanceof ResultWrapper ) {
-                       $res = $res->result;
-               }
-               return ( $res ) ? $res->seek( $row ) : false;
-       }
-
-       function lastError() {
-               if ( $this->mConn ) {
-                       return $this->getErrors();
-               } else {
-                       return "No database connection";
-               }
-       }
-
-       function lastErrno() {
-               $err = sqlsrv_errors( SQLSRV_ERR_ALL );
-               if ( $err[0] ) {
-                       return $err[0]['code'];
-               } else {
-                       return 0;
-               }
-       }
-
-       function affectedRows() {
-               return $this->mAffectedRows;
-       }
-
-       /**
-        * SELECT wrapper
-        *
-        * @param $table   Mixed: array or string, table name(s) (prefix auto-added)
-        * @param $vars    Mixed: array or string, field name(s) to be retrieved
-        * @param $conds   Mixed: array or string, condition(s) for WHERE
-        * @param $fname   String: calling function name (use __METHOD__) for logs/profiling
-        * @param array $options associative array of options (e.g. array('GROUP BY' => 'page_title')),
-        *                 see Database::makeSelectOptions code for list of supported stuff
-        * @param $join_conds Array: Associative array of table join conditions (optional)
-        *                                                 (e.g. array( 'page' => array('LEFT JOIN','page_latest=rev_id') )
-        * @return Mixed: database result resource (feed to Database::fetchObject or whatever), or false on failure
-        */
-       function select( $table, $vars, $conds = '', $fname = __METHOD__, $options = array(), $join_conds = array() )
-       {
-               $sql = $this->selectSQLText( $table, $vars, $conds, $fname, $options, $join_conds );
-               if ( isset( $options['EXPLAIN'] ) ) {
-                       sqlsrv_query( $this->mConn, "SET SHOWPLAN_ALL ON;" );
-                       $ret = $this->query( $sql, $fname );
-                       sqlsrv_query( $this->mConn, "SET SHOWPLAN_ALL OFF;" );
-                       return $ret;
-               }
-               return $this->query( $sql, $fname );
-       }
-
-       /**
-        * SELECT wrapper
-        *
-        * @param $table   Mixed:  Array or string, table name(s) (prefix auto-added)
-        * @param $vars    Mixed:  Array or string, field name(s) to be retrieved
-        * @param $conds   Mixed:  Array or string, condition(s) for WHERE
-        * @param $fname   String: Calling function name (use __METHOD__) for logs/profiling
-        * @param array $options  Associative array of options (e.g. array('GROUP BY' => 'page_title')),
-        *                 see Database::makeSelectOptions code for list of supported stuff
-        * @param $join_conds Array: Associative array of table join conditions (optional)
-        *                    (e.g. array( 'page' => array('LEFT JOIN','page_latest=rev_id') )
-        * @return string, the SQL text
-        */
-       function selectSQLText( $table, $vars, $conds = '', $fname = __METHOD__, $options = array(), $join_conds = array() ) {
-               if ( isset( $options['EXPLAIN'] ) ) {
-                       unset( $options['EXPLAIN'] );
-               }
-               return parent::selectSQLText( $table, $vars, $conds, $fname, $options, $join_conds );
-       }
-
-       /**
-        * Estimate rows in dataset
-        * Returns estimated count, based on SHOWPLAN_ALL output
-        * This is not necessarily an accurate estimate, so use sparingly
-        * Returns -1 if count cannot be found
-        * Takes same arguments as Database::select()
-        * @return int
-        */
-       function estimateRowCount( $table, $vars = '*', $conds = '', $fname = __METHOD__, $options = array() ) {
-               $options['EXPLAIN'] = true;// http://msdn2.microsoft.com/en-us/library/aa259203.aspx
-               $res = $this->select( $table, $vars, $conds, $fname, $options );
-
-               $rows = -1;
-               if ( $res ) {
-                       $row = $this->fetchRow( $res );
-                       if ( isset( $row['EstimateRows'] ) ) {
-                               $rows = $row['EstimateRows'];
-                       }
-               }
-               return $rows;
-       }
-
-       /**
-        * Returns information about an index
-        * If errors are explicitly ignored, returns NULL on failure
-        * @return array|bool|null
-        */
-       function indexInfo( $table, $index, $fname = __METHOD__ ) {
-               # This does not return the same info as MYSQL would, but that's OK because MediaWiki never uses the
-               # returned value except to check for the existance of indexes.
-               $sql = "sp_helpindex '" . $table . "'";
-               $res = $this->query( $sql, $fname );
-               if ( !$res ) {
-                       return null;
-               }
-
-               $result = array();
-               foreach ( $res as $row ) {
-                       if ( $row->index_name == $index ) {
-                               $row->Non_unique = !stristr( $row->index_description, "unique" );
-                               $cols = explode( ", ", $row->index_keys );
-                               foreach ( $cols as $col ) {
-                                       $row->Column_name = trim( $col );
-                                       $result[] = clone $row;
-                               }
-                       } elseif ( $index == 'PRIMARY' && stristr( $row->index_description, 'PRIMARY' ) ) {
-                               $row->Non_unique = 0;
-                               $cols = explode( ", ", $row->index_keys );
-                               foreach ( $cols as $col ) {
-                                       $row->Column_name = trim( $col );
-                                       $result[] = clone $row;
-                               }
-                       }
-               }
-               return empty( $result ) ? false : $result;
-       }
-
-       /**
-        * INSERT wrapper, inserts an array into a table
-        *
-        * $arrToInsert may be a single associative array, or an array of these with numeric keys, for
-        * multi-row insert.
-        *
-        * Usually aborts on failure
-        * If errors are explicitly ignored, returns success
-        * @param string $table
-        * @param array $arrToInsert
-        * @param string $fname
-        * @param array $options
-        * @throws DBQueryError
-        * @return bool
-        */
-       function insert( $table, $arrToInsert, $fname = __METHOD__, $options = array() ) {
-               # No rows to insert, easy just return now
-               if ( !count( $arrToInsert ) ) {
-                       return true;
-               }
-
-               if ( !is_array( $options ) ) {
-                       $options = array( $options );
-               }
-
-               $table = $this->tableName( $table );
-
-               if ( !( isset( $arrToInsert[0] ) && is_array( $arrToInsert[0] ) ) ) {// Not multi row
-                       $arrToInsert = array( 0 => $arrToInsert );// make everything multi row compatible
-               }
-
-               $allOk = true;
-
-               // We know the table we're inserting into, get its identity column
-               $identity = null;
-               $tableRaw = preg_replace( '#\[([^\]]*)\]#', '$1', $table ); // strip matching square brackets from table name
-               $res = $this->doQuery( "SELECT NAME AS idColumn FROM SYS.IDENTITY_COLUMNS WHERE OBJECT_NAME(OBJECT_ID)='{$tableRaw}'" );
-               if ( $res && $res->numrows() ) {
-                       // There is an identity for this table.
-                       $identity = array_pop( $res->fetch( SQLSRV_FETCH_ASSOC ) );
-               }
-               unset( $res );
-
-               foreach ( $arrToInsert as $a ) {
-                       // start out with empty identity column, this is so we can return it as a result of the insert logic
-                       $sqlPre = '';
-                       $sqlPost = '';
-                       $identityClause = '';
-
-                       // if we have an identity column
-                       if ( $identity ) {
-                               // iterate through
-                               foreach ( $a as $k => $v ) {
-                                       if ( $k == $identity ) {
-                                               if ( !is_null( $v ) ) {
-                                                       // there is a value being passed to us, we need to turn on and off inserted identity
-                                                       $sqlPre = "SET IDENTITY_INSERT $table ON;";
-                                                       $sqlPost = ";SET IDENTITY_INSERT $table OFF;";
-
-                                               } else {
-                                                       // we can't insert NULL into an identity column, so remove the column from the insert.
-                                                       unset( $a[$k] );
-                                               }
-                                       }
-                               }
-                               $identityClause = "OUTPUT INSERTED.$identity "; // we want to output an identity column as result
-                       }
-
-                       $keys = array_keys( $a );
-
-                       // INSERT IGNORE is not supported by SQL Server
-                       // remove IGNORE from options list and set ignore flag to true
-                       $ignoreClause = false;
-                       foreach ( $options as $k => $v ) {
-                               if ( strtoupper( $v ) == "IGNORE" ) {
-                                       unset( $options[$k] );
-                                       $ignoreClause = true;
-                               }
-                       }
-
-                       // translate MySQL INSERT IGNORE to something SQL Server can use
-                       // example:
-                       // MySQL: INSERT IGNORE INTO user_groups (ug_user,ug_group) VALUES ('1','sysop')
-                       // MSSQL: IF NOT EXISTS (SELECT * FROM user_groups WHERE ug_user = '1') INSERT INTO user_groups (ug_user,ug_group) VALUES ('1','sysop')
-                       if ( $ignoreClause ) {
-                               $prival = $a[$keys[0]];
-                               $sqlPre .= "IF NOT EXISTS (SELECT * FROM $table WHERE $keys[0] = '$prival')";
-                       }
-
-                       // Build the actual query
-                       $sql = $sqlPre . 'INSERT ' . implode( ' ', $options ) .
-                               " INTO $table (" . implode( ',', $keys ) . ") $identityClause VALUES (";
-
-                       $first = true;
-                       foreach ( $a as $value ) {
-                               if ( $first ) {
-                                       $first = false;
-                               } else {
-                                       $sql .= ',';
-                               }
-                               if ( is_string( $value ) ) {
-                                       $sql .= $this->addQuotes( $value );
-                               } elseif ( is_null( $value ) ) {
-                                       $sql .= 'null';
-                               } elseif ( is_array( $value ) || is_object( $value ) ) {
-                                       if ( is_object( $value ) && strtolower( get_class( $value ) ) == 'blob' ) {
-                                               $sql .= $this->addQuotes( $value );
-                                       } else {
-                                               $sql .= $this->addQuotes( serialize( $value ) );
-                                       }
-                               } else {
-                                       $sql .= $value;
-                               }
-                       }
-                       $sql .= ')' . $sqlPost;
-
-                       // Run the query
-                       $ret = sqlsrv_query( $this->mConn, $sql );
-
-                       if ( $ret === false ) {
-                               throw new DBQueryError( $this, $this->getErrors(), $this->lastErrno(), $sql, $fname );
-                       } elseif ( $ret != null ) {
-                               // remember number of rows affected
-                               $this->mAffectedRows = sqlsrv_rows_affected( $ret );
-                               if ( !is_null( $identity ) ) {
-                                       // then we want to get the identity column value we were assigned and save it off
-                                       $row = sqlsrv_fetch_object( $ret );
-                                       $this->mInsertId = $row->$identity;
-                               }
-                               sqlsrv_free_stmt( $ret );
-                               continue;
-                       }
-                       $allOk = false;
-               }
-               return $allOk;
-       }
-
-       /**
-        * INSERT SELECT wrapper
-        * $varMap must be an associative array of the form array( 'dest1' => 'source1', ...)
-        * Source items may be literals rather than field names, but strings should be quoted with Database::addQuotes()
-        * $conds may be "*" to copy the whole table
-        * srcTable may be an array of tables.
-        * @param string $destTable
-        * @param array|string $srcTable
-        * @param array $varMap
-        * @param array $conds
-        * @param string $fname
-        * @param array $insertOptions
-        * @param array $selectOptions
-        * @throws DBQueryError
-        * @return null|ResultWrapper
-        */
-       function insertSelect( $destTable, $srcTable, $varMap, $conds, $fname = __METHOD__,
-               $insertOptions = array(), $selectOptions = array() ) {
-               $ret = parent::insertSelect( $destTable, $srcTable, $varMap, $conds, $fname, $insertOptions, $selectOptions );
-
-               if ( $ret === false ) {
-                       throw new DBQueryError( $this, $this->getErrors(), $this->lastErrno(), /*$sql*/ '', $fname );
-               } elseif ( $ret != null ) {
-                       // remember number of rows affected
-                       $this->mAffectedRows = sqlsrv_rows_affected( $ret );
-                       return $ret;
-               }
-               return null;
-       }
-
-       /**
-        * Return the next in a sequence, save the value for retrieval via insertId()
-        * @return
-        */
-       function nextSequenceValue( $seqName ) {
-               if ( !$this->tableExists( 'sequence_' . $seqName ) ) {
-                       sqlsrv_query( $this->mConn, "CREATE TABLE [sequence_$seqName] (id INT NOT NULL IDENTITY PRIMARY KEY, junk varchar(10) NULL)" );
-               }
-               sqlsrv_query( $this->mConn, "INSERT INTO [sequence_$seqName] (junk) VALUES ('')" );
-               $ret = sqlsrv_query( $this->mConn, "SELECT TOP 1 id FROM [sequence_$seqName] ORDER BY id DESC" );
-               $row = sqlsrv_fetch_array( $ret, SQLSRV_FETCH_ASSOC );// KEEP ASSOC THERE, weird weird bug dealing with the return value if you don't
-
-               sqlsrv_free_stmt( $ret );
-               $this->mInsertId = $row['id'];
-               return $row['id'];
-       }
-
-       /**
-        * Return the current value of a sequence. Assumes it has ben nextval'ed in this session.
-        * @return
-        */
-       function currentSequenceValue( $seqName ) {
-               $ret = sqlsrv_query( $this->mConn, "SELECT TOP 1 id FROM [sequence_$seqName] ORDER BY id DESC" );
-               if ( $ret !== false ) {
-                       $row = sqlsrv_fetch_array( $ret );
-                       sqlsrv_free_stmt( $ret );
-                       return $row['id'];
-               } else {
-                       return $this->nextSequenceValue( $seqName );
-               }
-       }
-
-       # Returns the size of a text field, or -1 for "unlimited"
-       function textFieldSize( $table, $field ) {
-               $table = $this->tableName( $table );
-               $sql = "SELECT CHARACTER_MAXIMUM_LENGTH,DATA_TYPE FROM INFORMATION_SCHEMA.Columns
-                       WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field'";
-               $res = $this->query( $sql );
-               $row = $this->fetchRow( $res );
-               $size = -1;
-               if ( strtolower( $row['DATA_TYPE'] ) != 'text' ) {
-                       $size = $row['CHARACTER_MAXIMUM_LENGTH'];
-               }
-               return $size;
-       }
-
-       /**
-        * Construct a LIMIT query with optional offset
-        * This is used for query pages
-        * $sql string SQL query we will append the limit too
-        * $limit integer the SQL limit
-        * $offset integer the SQL offset (default false)
-        * @return mixed|string
-        */
-       function limitResult( $sql, $limit, $offset = false ) {
-               if ( $offset === false || $offset == 0 ) {
-                       if ( strpos( $sql, "SELECT" ) === false ) {
-                               return "TOP {$limit} " . $sql;
-                       } else {
-                               return preg_replace( '/\bSELECT(\s*DISTINCT)?\b/Dsi', 'SELECT$1 TOP ' . $limit, $sql, 1 );
-                       }
-               } else {
-                       $sql = '
-                               SELECT * FROM (
-                                       SELECT sub2.*, ROW_NUMBER() OVER(ORDER BY sub2.line2) AS line3 FROM (
-                                               SELECT 1 AS line2, sub1.* FROM (' . $sql . ') AS sub1
-                                       ) as sub2
-                               ) AS sub3
-                               WHERE line3 BETWEEN ' . ( $offset + 1 ) . ' AND ' . ( $offset + $limit );
-                       return $sql;
-               }
-       }
-
-       // If there is a limit clause, parse it, strip it, and pass the remaining sql through limitResult()
-       // with the appropriate parameters. Not the prettiest solution, but better than building a whole new parser.
-       // This exists becase there are still too many extensions that don't use dynamic sql generation.
-       function LimitToTopN( $sql ) {
-               // Matches: LIMIT {[offset,] row_count | row_count OFFSET offset}
-               $pattern = '/\bLIMIT\s+((([0-9]+)\s*,\s*)?([0-9]+)(\s+OFFSET\s+([0-9]+))?)/i';
-               if ( preg_match( $pattern, $sql, $matches ) ) {
-                       // row_count = $matches[4]
-                       $row_count = $matches[4];
-                       // offset = $matches[3] OR $matches[6]
-                       $offset = $matches[3] or
-                               $offset = $matches[6] or
-                               $offset = false;
-
-                       // strip the matching LIMIT clause out
-                       $sql = str_replace( $matches[0], '', $sql );
-                       return $this->limitResult( $sql, $row_count, $offset );
-               }
-               return $sql;
-       }
-
-       function timestamp( $ts = 0 ) {
-               return wfTimestamp( TS_ISO_8601, $ts );
-       }
-
-       /**
-        * @return string wikitext of a link to the server software's web site
-        */
-       public function getSoftwareLink() {
-               return "[http://www.microsoft.com/sql/ MS SQL Server]";
-       }
-
-       /**
-        * @return string Version information from the database
-        */
-       function getServerVersion() {
-               $server_info = sqlsrv_server_info( $this->mConn );
-               $version = 'Error';
-               if ( isset( $server_info['SQLServerVersion'] ) ) {
-                       $version = $server_info['SQLServerVersion'];
-               }
-               return $version;
-       }
-
-       function tableExists( $table, $fname = __METHOD__, $schema = false ) {
-               $res = sqlsrv_query( $this->mConn, "SELECT * FROM information_schema.tables
-                       WHERE table_type='BASE TABLE' AND table_name = '$table'" );
-               if ( $res === false ) {
-                       print "Error in tableExists query: " . $this->getErrors();
-                       return false;
-               }
-               if ( sqlsrv_fetch( $res ) ) {
-                       return true;
-               } else {
-                       return false;
-               }
-       }
-
-       /**
-        * Query whether a given column exists in the mediawiki schema
-        * @return bool
-        */
-       function fieldExists( $table, $field, $fname = __METHOD__ ) {
-               $table = $this->tableName( $table );
-               $res = sqlsrv_query( $this->mConn, "SELECT DATA_TYPE FROM INFORMATION_SCHEMA.Columns
-                       WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field'" );
-               if ( $res === false ) {
-                       print "Error in fieldExists query: " . $this->getErrors();
-                       return false;
-               }
-               if ( sqlsrv_fetch( $res ) ) {
-                       return true;
-               } else {
-                       return false;
-               }
-       }
-
-       function fieldInfo( $table, $field ) {
-               $table = $this->tableName( $table );
-               $res = sqlsrv_query( $this->mConn, "SELECT * FROM INFORMATION_SCHEMA.Columns
-                       WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$field'" );
-               if ( $res === false ) {
-                       print "Error in fieldInfo query: " . $this->getErrors();
-                       return false;
-               }
-               $meta = $this->fetchRow( $res );
-               if ( $meta ) {
-                       return new MssqlField( $meta );
-               }
-               return false;
-       }
-
-       /**
-        * Begin a transaction, committing any previously open transaction
-        */
-       protected function doBegin( $fname = __METHOD__ ) {
-               sqlsrv_begin_transaction( $this->mConn );
-               $this->mTrxLevel = 1;
-       }
-
-       /**
-        * End a transaction
-        */
-       protected function doCommit( $fname = __METHOD__ ) {
-               sqlsrv_commit( $this->mConn );
-               $this->mTrxLevel = 0;
-       }
-
-       /**
-        * Rollback a transaction.
-        * No-op on non-transactional databases.
-        */
-       protected function doRollback( $fname = __METHOD__ ) {
-               sqlsrv_rollback( $this->mConn );
-               $this->mTrxLevel = 0;
-       }
-
-       /**
-        * Escapes a identifier for use inm SQL.
-        * Throws an exception if it is invalid.
-        * Reference: http://msdn.microsoft.com/en-us/library/aa224033%28v=SQL.80%29.aspx
-        * @param $identifier
-        * @throws MWException
-        * @return string
-        */
-       private function escapeIdentifier( $identifier ) {
-               if ( strlen( $identifier ) == 0 ) {
-                       throw new MWException( "An identifier must not be empty" );
-               }
-               if ( strlen( $identifier ) > 128 ) {
-                       throw new MWException( "The identifier '$identifier' is too long (max. 128)" );
-               }
-               if ( ( strpos( $identifier, '[' ) !== false ) || ( strpos( $identifier, ']' ) !== false ) ) {
-                       // It may be allowed if you quoted with double quotation marks, but that would break if QUOTED_IDENTIFIER is OFF
-                       throw new MWException( "You can't use square brackers in the identifier '$identifier'" );
-               }
-               return "[$identifier]";
-       }
-
-       /**
-        * Initial setup.
-        * Precondition: This object is connected as the superuser.
-        * Creates the database, schema, user and login.
-        */
-       function initial_setup( $dbName, $newUser, $loginPassword ) {
-               $dbName = $this->escapeIdentifier( $dbName );
-
-               // It is not clear what can be used as a login,
-               // From http://msdn.microsoft.com/en-us/library/ms173463.aspx
-               // a sysname may be the same as an identifier.
-               $newUser = $this->escapeIdentifier( $newUser );
-               $loginPassword = $this->addQuotes( $loginPassword );
-
-               $this->doQuery( "CREATE DATABASE $dbName;" );
-               $this->doQuery( "USE $dbName;" );
-               $this->doQuery( "CREATE SCHEMA $dbName;" );
-               $this->doQuery( "
-                                               CREATE
-                                                       LOGIN $newUser
-                                               WITH
-                                                       PASSWORD=$loginPassword
-                                               ;
-                                       " );
-               $this->doQuery( "
-                                               CREATE
-                                                       USER $newUser
-                                               FOR
-                                                       LOGIN $newUser
-                                               WITH
-                                                       DEFAULT_SCHEMA=$dbName
-                                               ;
-                                       " );
-               $this->doQuery( "
-                                               GRANT
-                                                       BACKUP DATABASE,
-                                                       BACKUP LOG,
-                                                       CREATE DEFAULT,
-                                                       CREATE FUNCTION,
-                                                       CREATE PROCEDURE,
-                                                       CREATE RULE,
-                                                       CREATE TABLE,
-                                                       CREATE VIEW,
-                                                       CREATE FULLTEXT CATALOG
-                                               ON
-                                                       DATABASE::$dbName
-                                               TO $newUser
-                                               ;
-                                       " );
-               $this->doQuery( "
-                                               GRANT
-                                                       CONTROL
-                                               ON
-                                                       SCHEMA::$dbName
-                                               TO $newUser
-                                               ;
-                                       " );
-       }
-
-       function encodeBlob( $b ) {
-       // we can't have zero's and such, this is a simple encoding to make sure we don't barf
-               return base64_encode( $b );
-       }
-
-       function decodeBlob( $b ) {
-       // we can't have zero's and such, this is a simple encoding to make sure we don't barf
-       return base64_decode( $b );
-       }
-
-       /**
-        * @private
-        * @return string
-        */
-       function tableNamesWithUseIndexOrJOIN( $tables, $use_index = array(), $join_conds = array() ) {
-               $ret = array();
-               $retJOIN = array();
-               $use_index_safe = is_array( $use_index ) ? $use_index : array();
-               $join_conds_safe = is_array( $join_conds ) ? $join_conds : array();
-               foreach ( $tables as $table ) {
-                       // Is there a JOIN and INDEX clause for this table?
-                       if ( isset( $join_conds_safe[$table] ) && isset( $use_index_safe[$table] ) ) {
-                               $tableClause = $join_conds_safe[$table][0] . ' ' . $this->tableName( $table );
-                               $tableClause .= ' ' . $this->useIndexClause( implode( ',', (array)$use_index_safe[$table] ) );
-                               $tableClause .= ' ON (' . $this->makeList( (array)$join_conds_safe[$table][1], LIST_AND ) . ')';
-                               $retJOIN[] = $tableClause;
-                       // Is there an INDEX clause?
-                       } elseif ( isset( $use_index_safe[$table] ) ) {
-                               $tableClause = $this->tableName( $table );
-                               $tableClause .= ' ' . $this->useIndexClause( implode( ',', (array)$use_index_safe[$table] ) );
-                               $ret[] = $tableClause;
-                       // Is there a JOIN clause?
-                       } elseif ( isset( $join_conds_safe[$table] ) ) {
-                               $tableClause = $join_conds_safe[$table][0] . ' ' . $this->tableName( $table );
-                               $tableClause .= ' ON (' . $this->makeList( (array)$join_conds_safe[$table][1], LIST_AND ) . ')';
-                               $retJOIN[] = $tableClause;
-                       } else {
-                               $tableClause = $this->tableName( $table );
-                               $ret[] = $tableClause;
-                       }
-               }
-               // We can't separate explicit JOIN clauses with ',', use ' ' for those
-               $straightJoins = !empty( $ret ) ? implode( ',', $ret ) : "";
-               $otherJoins = !empty( $retJOIN ) ? implode( ' ', $retJOIN ) : "";
-               // Compile our final table clause
-               return implode( ' ', array( $straightJoins, $otherJoins ) );
-       }
-
-       function strencode( $s ) { # Should not be called by us
-               return str_replace( "'", "''", $s );
-       }
-
-       function addQuotes( $s ) {
-               if ( $s instanceof Blob ) {
-                       return "'" . $s->fetch( $s ) . "'";
-               } else {
-                       return parent::addQuotes( $s );
-               }
-       }
-
-       public function addIdentifierQuotes( $s ) {
-               // http://msdn.microsoft.com/en-us/library/aa223962.aspx
-               return '[' . $s . ']';
-       }
-
-       public function isQuotedIdentifier( $name ) {
-               return $name[0] == '[' && substr( $name, -1, 1 ) == ']';
-       }
-
-       function selectDB( $db ) {
-               return ( $this->query( "SET DATABASE $db" ) !== false );
-       }
-
-       /**
-        * @private
-        *
-        * @param array $options an associative array of options to be turned into
-        *                 an SQL query, valid keys are listed in the function.
-        * @return Array
-        */
-       function makeSelectOptions( $options ) {
-               $tailOpts = '';
-               $startOpts = '';
-
-               $noKeyOptions = array();
-               foreach ( $options as $key => $option ) {
-                       if ( is_numeric( $key ) ) {
-                               $noKeyOptions[$option] = true;
-                       }
-               }
-
-               $tailOpts .= $this->makeGroupByWithHaving( $options );
-
-               $tailOpts .= $this->makeOrderBy( $options );
-
-               if ( isset( $noKeyOptions['DISTINCT'] ) && isset( $noKeyOptions['DISTINCTROW'] ) ) {
-                       $startOpts .= 'DISTINCT';
-               }
-
-               // we want this to be compatible with the output of parent::makeSelectOptions()
-               return array( $startOpts, '', $tailOpts, '' );
-       }
-
-       /**
-        * Get the type of the DBMS, as it appears in $wgDBtype.
-        * @return string
-        */
-       function getType() {
-               return 'mssql';
-       }
-
-       function buildConcat( $stringList ) {
-               return implode( ' + ', $stringList );
-       }
-
-       public function getSearchEngine() {
-               return "SearchMssql";
-       }
-
-       /**
-        * Since MSSQL doesn't recognize the infinity keyword, set date manually.
-        * @todo Remove magic date
-        * @return string
-        */
-       public function getInfinity() {
-               return '3000-01-31 00:00:00.000';
-       }
-
-} // end DatabaseMssql class
-
-/**
- * Utility class.
- *
- * @ingroup Database
- */
-class MssqlField implements Field {
-       private $name, $tablename, $default, $max_length, $nullable, $type;
-       function __construct( $info ) {
-               $this->name = $info['COLUMN_NAME'];
-               $this->tablename = $info['TABLE_NAME'];
-               $this->default = $info['COLUMN_DEFAULT'];
-               $this->max_length = $info['CHARACTER_MAXIMUM_LENGTH'];
-               $this->nullable = !( strtolower( $info['IS_NULLABLE'] ) == 'no' );
-               $this->type = $info['DATA_TYPE'];
-       }
-
-       function name() {
-               return $this->name;
-       }
-
-       function tableName() {
-               return $this->tableName;
-       }
-
-       function defaultValue() {
-               return $this->default;
-       }
-
-       function maxLength() {
-               return $this->max_length;
-       }
-
-       function isNullable() {
-               return $this->nullable;
-       }
-
-       function type() {
-               return $this->type;
-       }
-}
-
-/**
- * The MSSQL PHP driver doesn't support sqlsrv_num_rows, so we recall all rows into an array and maintain our
- * own cursor index into that array...This is similar to the way the Oracle driver handles this same issue
- *
- * @ingroup Database
- */
-class MssqlResult {
-
-       public function __construct( $queryresult = false ) {
-               $this->mCursor = 0;
-               $this->mRows = array();
-               $this->mNumFields = sqlsrv_num_fields( $queryresult );
-               $this->mFieldMeta = sqlsrv_field_metadata( $queryresult );
-
-               $rows = sqlsrv_fetch_array( $queryresult, SQLSRV_FETCH_ASSOC );
-
-               foreach ( $rows as $row ) {
-                       if ( $row !== null ) {
-                               foreach ( $row as $k => $v ) {
-                                       if ( is_object( $v ) && method_exists( $v, 'format' ) ) {// DateTime Object
-                                               $row[$k] = $v->format( "Y-m-d\TH:i:s\Z" );
-                                       }
-                               }
-                               $this->mRows[] = $row;// read results into memory, cursors are not supported
-                       }
-               }
-               $this->mRowCount = count( $this->mRows );
-               sqlsrv_free_stmt( $queryresult );
-       }
-
-       private function array_to_obj( $array, &$obj ) {
-               foreach ( $array as $key => $value ) {
-                       if ( is_array( $value ) ) {
-                               $obj->$key = new stdClass();
-                               $this->array_to_obj( $value, $obj->$key );
-                       } else {
-                               if ( !empty( $key ) ) {
-                                       $obj->$key = $value;
-                               }
-                       }
-               }
-               return $obj;
-       }
-
-       public function fetch( $mode = SQLSRV_FETCH_BOTH, $object_class = 'stdClass' ) {
-               if ( $this->mCursor >= $this->mRowCount || $this->mRowCount == 0 ) {
-                       return false;
-               }
-               $arrNum = array();
-               if ( $mode == SQLSRV_FETCH_NUMERIC || $mode == SQLSRV_FETCH_BOTH ) {
-                       foreach ( $this->mRows[$this->mCursor] as $value ) {
-                               $arrNum[] = $value;
-                       }
-               }
-               switch ( $mode ) {
-                       case SQLSRV_FETCH_ASSOC:
-                               $ret = $this->mRows[$this->mCursor];
-                               break;
-                       case SQLSRV_FETCH_NUMERIC:
-                               $ret = $arrNum;
-                               break;
-                       case 'OBJECT':
-                               $o = new $object_class;
-                               $ret = $this->array_to_obj( $this->mRows[$this->mCursor], $o );
-                               break;
-                       case SQLSRV_FETCH_BOTH:
-                       default:
-                               $ret = $this->mRows[$this->mCursor] + $arrNum;
-                               break;
-               }
-
-               $this->mCursor++;
-               return $ret;
-       }
-
-       public function get( $pos, $fld ) {
-               return $this->mRows[$pos][$fld];
-       }
-
-       public function numrows() {
-               return $this->mRowCount;
-       }
-
-       public function seek( $iRow ) {
-               $this->mCursor = min( $iRow, $this->mRowCount );
-       }
-
-       public function numfields() {
-               return $this->mNumFields;
-       }
-
-       public function fieldname( $nr ) {
-               $arrKeys = array_keys( $this->mRows[0] );
-               return $arrKeys[$nr];
-       }
-
-       public function fieldtype( $nr ) {
-               $i = 0;
-               $intType = -1;
-               foreach ( $this->mFieldMeta as $meta ) {
-                       if ( $nr == $i ) {
-                               $intType = $meta['Type'];
-                               break;
-                       }
-                       $i++;
-               }
-               // http://msdn.microsoft.com/en-us/library/cc296183.aspx contains type table
-               switch ( $intType ) {
-                       case SQLSRV_SQLTYPE_BIGINT:
-                               $strType = 'bigint';
-                               break;
-                       case SQLSRV_SQLTYPE_BINARY:
-                               $strType = 'binary';
-                               break;
-                       case SQLSRV_SQLTYPE_BIT:
-                               $strType = 'bit';
-                               break;
-                       case SQLSRV_SQLTYPE_CHAR:
-                               $strType = 'char';
-                               break;
-                       case SQLSRV_SQLTYPE_DATETIME:
-                               $strType = 'datetime';
-                               break;
-                       case SQLSRV_SQLTYPE_DECIMAL: // ($precision, $scale)
-                               $strType = 'decimal';
-                               break;
-                       case SQLSRV_SQLTYPE_FLOAT:
-                               $strType = 'float';
-                               break;
-                       case SQLSRV_SQLTYPE_IMAGE:
-                               $strType = 'image';
-                               break;
-                       case SQLSRV_SQLTYPE_INT:
-                               $strType = 'int';
-                               break;
-                       case SQLSRV_SQLTYPE_MONEY:
-                               $strType = 'money';
-                               break;
-                       case SQLSRV_SQLTYPE_NCHAR: // ($charCount):
-                               $strType = 'nchar';
-                               break;
-                       case SQLSRV_SQLTYPE_NUMERIC: // ($precision, $scale):
-                               $strType = 'numeric';
-                               break;
-                       case SQLSRV_SQLTYPE_NVARCHAR: // ($charCount)
-                               $strType = 'nvarchar';
-                               break;
-                       // case SQLSRV_SQLTYPE_NVARCHAR('max'):
-                       //       $strType = 'nvarchar(MAX)';
-                       //       break;
-                       case SQLSRV_SQLTYPE_NTEXT:
-                               $strType = 'ntext';
-                               break;
-                       case SQLSRV_SQLTYPE_REAL:
-                               $strType = 'real';
-                               break;
-                       case SQLSRV_SQLTYPE_SMALLDATETIME:
-                               $strType = 'smalldatetime';
-                               break;
-                       case SQLSRV_SQLTYPE_SMALLINT:
-                               $strType = 'smallint';
-                               break;
-                       case SQLSRV_SQLTYPE_SMALLMONEY:
-                               $strType = 'smallmoney';
-                               break;
-                       case SQLSRV_SQLTYPE_TEXT:
-                               $strType = 'text';
-                               break;
-                       case SQLSRV_SQLTYPE_TIMESTAMP:
-                               $strType = 'timestamp';
-                               break;
-                       case SQLSRV_SQLTYPE_TINYINT:
-                               $strType = 'tinyint';
-                               break;
-                       case SQLSRV_SQLTYPE_UNIQUEIDENTIFIER:
-                               $strType = 'uniqueidentifier';
-                               break;
-                       case SQLSRV_SQLTYPE_UDT:
-                               $strType = 'UDT';
-                               break;
-                       case SQLSRV_SQLTYPE_VARBINARY: // ($byteCount)
-                               $strType = 'varbinary';
-                               break;
-                       // case SQLSRV_SQLTYPE_VARBINARY('max'):
-                       //       $strType = 'varbinary(MAX)';
-                       //       break;
-                       case SQLSRV_SQLTYPE_VARCHAR: // ($charCount)
-                               $strType = 'varchar';
-                               break;
-                       // case SQLSRV_SQLTYPE_VARCHAR('max'):
-                       //       $strType = 'varchar(MAX)';
-                       //       break;
-                       case SQLSRV_SQLTYPE_XML:
-                               $strType = 'xml';
-                               break;
-                       default:
-                               $strType = $intType;
-               }
-               return $strType;
-       }
-
-       public function free() {
-               unset( $this->mRows );
-       }
-}
index 26c9d24..cdfa769 100644 (file)
@@ -76,6 +76,7 @@ abstract class DatabaseMysqlBase extends DatabaseBase {
                } catch ( Exception $ex ) {
                        wfProfileOut( "dbconnect-$server" );
                        wfProfileOut( __METHOD__ );
+                       $this->restoreErrorHandler();
                        throw $ex;
                }
                $error = $this->restoreErrorHandler();
index e564a16..72371a2 100644 (file)
@@ -370,7 +370,14 @@ class DatabasePostgres extends DatabaseBase {
                $this->connectString = $this->makeConnectionString( $connectVars, PGSQL_CONNECT_FORCE_NEW );
                $this->close();
                $this->installErrorHandler();
-               $this->mConn = pg_connect( $this->connectString );
+
+               try {
+                       $this->mConn = pg_connect( $this->connectString );
+               } catch ( Exception $ex ) {
+                       $this->restoreErrorHandler();
+                       throw $ex;
+               }
+
                $phpError = $this->restoreErrorHandler();
 
                if ( !$this->mConn ) {
index 53cb7dc..b37e6b3 100644 (file)
@@ -336,7 +336,12 @@ class WebInstaller extends Installer {
 
                $this->phpErrors = array();
                set_error_handler( array( $this, 'errorHandler' ) );
-               session_start();
+               try {
+                       session_start();
+               } catch ( Exception $e ) {
+                       restore_error_handler();
+                       throw $e;
+               }
                restore_error_handler();
 
                if ( $this->phpErrors ) {
index 6380efc..91acd11 100644 (file)
@@ -68,7 +68,8 @@ class ResourceLoader {
         */
        public function preloadModuleInfo( array $modules, ResourceLoaderContext $context ) {
                if ( !count( $modules ) ) {
-                       return; // or else Database*::select() will explode, plus it's cheaper!
+                       // Or else Database*::select() will explode, plus it's cheaper!
+                       return;
                }
                $dbr = wfGetDB( DB_SLAVE );
                $skin = $context->getSkin();
@@ -451,7 +452,7 @@ class ResourceLoader {
                wfProfileIn( __METHOD__ );
                $errors = '';
 
-               // Split requested modules into two groups, modules and missing
+               // Find out which modules are missing and instantiate the others
                $modules = array();
                $missing = array();
                foreach ( $context->getModules() as $name ) {
@@ -527,7 +528,7 @@ class ResourceLoader {
                }
 
                // Save response to file cache unless there are errors
-               if ( isset( $fileCache ) && !$errors && !$missing ) {
+               if ( isset( $fileCache ) && !$errors && !count( $missing ) ) {
                        // Cache single modules...and other requests if there are enough hits
                        if ( ResourceFileCache::useFileCache( $context ) ) {
                                if ( $fileCache->isCacheWorthy() ) {
@@ -704,21 +705,24 @@ class ResourceLoader {
        /**
         * Generates code for a response
         *
-        * @param $context ResourceLoaderContext: Context in which to generate a response
+        * @param $context ResourceLoaderContext Context in which to generate a response
         * @param array $modules List of module objects keyed by module name
-        * @param array $missing List of unavailable modules (optional)
-        * @return String: Response data
+        * @param array $missing List of requested module names that are unregistered (optional)
+        * @return string Response data
         */
        public function makeModuleResponse( ResourceLoaderContext $context,
-               array $modules, $missing = array()
+               array $modules, array $missing = array()
        ) {
                $out = '';
                $exceptions = '';
-               if ( $modules === array() && $missing === array() ) {
+               $states = array();
+
+               if ( !count( $modules ) && !count( $missing ) ) {
                        return '/* No modules requested. Max made me put this here */';
                }
 
                wfProfileIn( __METHOD__ );
+
                // Pre-fetch blobs
                if ( $context->shouldIncludeMessages() ) {
                        try {
@@ -734,6 +738,11 @@ class ResourceLoader {
                        $blobs = array();
                }
 
+
+               foreach ( $missing as $name ) {
+                       $states[$name] = 'missing';
+               }
+
                // Generate output
                $isRaw = false;
                foreach ( $modules as $name => $module ) {
@@ -838,8 +847,8 @@ class ResourceLoader {
                                // Add exception to the output as a comment
                                $exceptions .= self::formatException( $e );
 
-                               // Register module as missing
-                               $missing[] = $name;
+                               // Respond to client with error-state instead of module implementation
+                               $states[$name] = 'error';
                                unset( $modules[$name] );
                        }
                        $isRaw |= $module->isRaw();
@@ -848,14 +857,17 @@ class ResourceLoader {
 
                // Update module states
                if ( $context->shouldIncludeScripts() && !$context->getRaw() && !$isRaw ) {
-                       // Set the state of modules loaded as only scripts to ready
                        if ( count( $modules ) && $context->getOnly() === 'scripts' ) {
-                               $out .= self::makeLoaderStateScript(
-                                       array_fill_keys( array_keys( $modules ), 'ready' ) );
+                               // Set the state of modules loaded as only scripts to ready as
+                               // they don't have an mw.loader.implement wrapper that sets the state
+                               foreach ( $modules as $name => $module ) {
+                                       $states[$name] = 'ready';
+                               }
                        }
-                       // Set the state of modules which were requested but unavailable as missing
-                       if ( is_array( $missing ) && count( $missing ) ) {
-                               $out .= self::makeLoaderStateScript( array_fill_keys( $missing, 'missing' ) );
+
+                       // Set the state of modules we didn't respond to with mw.loader.implement
+                       if ( count( $states ) ) {
+                               $out .= self::makeLoaderStateScript( $states );
                        }
                }
 
index 9ed181e..7b85001 100644 (file)
@@ -745,6 +745,8 @@ class ResourceLoaderFileModule extends ResourceLoaderModule {
         * recompiles as necessary.
         *
         * @since 1.22
+        * @throws Exception If Less encounters a parse error
+        * @throws MWException If Less compilation returns unexpection result
         * @param string $fileName File path of LESS source
         * @return string: CSS source
         */
diff --git a/includes/search/SearchMssql.php b/includes/search/SearchMssql.php
deleted file mode 100644 (file)
index cbc1a7a..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-<?php
-/**
- * Mssql search engine
- *
- * 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
- * @ingroup Search
- */
-
-/**
- * Search engine hook base class for Mssql (ConText).
- * @ingroup Search
- */
-class SearchMssql extends SearchEngine {
-
-       /**
-        * Creates an instance of this class
-        * @param $db DatabaseMssql: database object
-        */
-       function __construct( $db ) {
-               parent::__construct( $db );
-       }
-
-       /**
-        * Perform a full text search query and return a result set.
-        *
-        * @param string $term raw search term
-        * @return MssqlSearchResultSet
-        * @access public
-        */
-       function searchText( $term ) {
-               $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), true ) ) );
-               return new MssqlSearchResultSet( $resultSet, $this->searchTerms );
-       }
-
-       /**
-        * Perform a title-only search query and return a result set.
-        *
-        * @param string $term raw search term
-        * @return MssqlSearchResultSet
-        * @access public
-        */
-       function searchTitle( $term ) {
-               $resultSet = $this->db->resultObject( $this->db->query( $this->getQuery( $this->filter( $term ), false ) ) );
-               return new MssqlSearchResultSet( $resultSet, $this->searchTerms );
-       }
-
-       /**
-        * Return a partial WHERE clause to exclude redirects, if so set
-        *
-        * @return String
-        * @private
-        */
-       function queryRedirect() {
-               if ( $this->showRedirects ) {
-                       return '';
-               } else {
-                       return 'AND page_is_redirect=0';
-               }
-       }
-
-       /**
-        * Return a partial WHERE clause to limit the search to the given namespaces
-        *
-        * @return String
-        * @private
-        */
-       function queryNamespaces() {
-               $namespaces = implode( ',', $this->namespaces );
-               if ( $namespaces == '' ) {
-                       $namespaces = '0';
-               }
-               return 'AND page_namespace IN (' . $namespaces . ')';
-       }
-
-       /**
-        * Return a LIMIT clause to limit results on the query.
-        *
-        * @param $sql string
-        *
-        * @return String
-        */
-       function queryLimit( $sql ) {
-               return $this->db->limitResult( $sql, $this->limit, $this->offset );
-       }
-
-       /**
-        * Does not do anything for generic search engine
-        * subclasses may define this though
-        *
-        * @return String
-        */
-       function queryRanking( $filteredTerm, $fulltext ) {
-               return ' ORDER BY ftindex.[RANK] DESC'; // return ' ORDER BY score(1)';
-       }
-
-       /**
-        * Construct the full SQL query to do the search.
-        * The guts shoulds be constructed in queryMain()
-        *
-        * @param $filteredTerm String
-        * @param $fulltext Boolean
-        * @return String
-        */
-       function getQuery( $filteredTerm, $fulltext ) {
-               return $this->queryLimit( $this->queryMain( $filteredTerm, $fulltext ) . ' ' .
-                       $this->queryRedirect() . ' ' .
-                       $this->queryNamespaces() . ' ' .
-                       $this->queryRanking( $filteredTerm, $fulltext ) . ' ' );
-       }
-
-       /**
-        * Picks which field to index on, depending on what type of query.
-        *
-        * @param $fulltext Boolean
-        * @return string
-        */
-       function getIndexField( $fulltext ) {
-               return $fulltext ? 'si_text' : 'si_title';
-       }
-
-       /**
-        * Get the base part of the search query.
-        *
-        * @param $filteredTerm String
-        * @param $fulltext Boolean
-        * @return String
-        * @private
-        */
-       function queryMain( $filteredTerm, $fulltext ) {
-               $match = $this->parseQuery( $filteredTerm, $fulltext );
-               $page = $this->db->tableName( 'page' );
-               $searchindex = $this->db->tableName( 'searchindex' );
-
-               return 'SELECT page_id, page_namespace, page_title, ftindex.[RANK]' .
-                       "FROM $page,FREETEXTTABLE($searchindex , $match, LANGUAGE 'English') as ftindex " .
-                       'WHERE page_id=ftindex.[KEY] ';
-       }
-
-       /** @todo document
-        * @return string
-        */
-       function parseQuery( $filteredText, $fulltext ) {
-               global $wgContLang;
-               $lc = SearchEngine::legalSearchChars();
-               $this->searchTerms = array();
-
-               # @todo FIXME: This doesn't handle parenthetical expressions.
-               $m = array();
-               $q = array();
-
-               if ( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
-                       $filteredText, $m, PREG_SET_ORDER ) ) {
-                       foreach ( $m as $terms ) {
-                               $q[] = $terms[1] . $wgContLang->normalizeForSearch( $terms[2] );
-
-                               if ( !empty( $terms[3] ) ) {
-                                       $regexp = preg_quote( $terms[3], '/' );
-                                       if ( $terms[4] ) {
-                                               $regexp .= "[0-9A-Za-z_]+";
-                                       }
-                               } else {
-                                       $regexp = preg_quote( str_replace( '"', '', $terms[2] ), '/' );
-                               }
-                               $this->searchTerms[] = $regexp;
-                       }
-               }
-
-               $searchon = $this->db->strencode( join( ',', $q ) );
-               $field = $this->getIndexField( $fulltext );
-               return "$field, '$searchon'";
-       }
-
-       /**
-        * Create or update the search index record for the given page.
-        * Title and text should be pre-processed.
-        *
-        * @param $id Integer
-        * @param $title String
-        * @param $text String
-        * @return bool|ResultWrapper
-        */
-       function update( $id, $title, $text ) {
-               // We store the column data as UTF-8 byte order marked binary stream
-               // because we are invoking the plain text IFilter on it so that, and we want it
-               // to properly decode the stream as UTF-8.  SQL doesn't support UTF8 as a data type
-               // but the indexer will correctly handle it by this method.  Since all we are doing
-               // is passing this data to the indexer and never retrieving it via PHP, this will save space
-               $table = $this->db->tableName( 'searchindex' );
-               $utf8bom = '0xEFBBBF';
-               $si_title = $utf8bom . bin2hex( $title );
-               $si_text = $utf8bom . bin2hex( $text );
-               $sql = "DELETE FROM $table WHERE si_page = $id;";
-               $sql .= "INSERT INTO $table (si_page, si_title, si_text) VALUES ($id, $si_title, $si_text)";
-               return $this->db->query( $sql, 'SearchMssql::update' );
-       }
-
-       /**
-        * Update a search index record's title only.
-        * Title should be pre-processed.
-        *
-        * @param $id Integer
-        * @param $title String
-        * @return bool|ResultWrapper
-        */
-       function updateTitle( $id, $title ) {
-               $table = $this->db->tableName( 'searchindex' );
-
-               // see update for why we are using the utf8bom
-               $utf8bom = '0xEFBBBF';
-               $si_title = $utf8bom . bin2hex( $title );
-               $sql = "DELETE FROM $table WHERE si_page = $id;";
-               $sql .= "INSERT INTO $table (si_page, si_title, si_text) VALUES ($id, $si_title, 0x00)";
-               return $this->db->query( $sql, 'SearchMssql::updateTitle' );
-       }
-}
-
-/**
- * @ingroup Search
- */
-class MssqlSearchResultSet extends SearchResultSet {
-       function __construct( $resultSet, $terms ) {
-               $this->mResultSet = $resultSet;
-               $this->mTerms = $terms;
-       }
-
-       function termMatches() {
-               return $this->mTerms;
-       }
-
-       function numRows() {
-               return $this->mResultSet->numRows();
-       }
-
-       function next() {
-               $row = $this->mResultSet->fetchObject();
-               if ( $row === false ) {
-                       return false;
-               }
-               return new SearchResult( $row );
-       }
-}
index 87b6442..1373df1 100644 (file)
@@ -308,6 +308,8 @@ class SpecialUploadStash extends UnlistedSpecialPage {
                header( "Content-Type: $contentType", true );
                header( 'Content-Transfer-Encoding: binary', true );
                header( 'Expires: Sun, 17-Jan-2038 19:14:07 GMT', true );
+               // Bug 53032 - It shouldn't be a problem here, but let's be safe and not cache
+               header( 'Cache-Control: private' );
                header( "Content-Length: $size", true );
        }
 
index d88c54c..233bbfb 100644 (file)
@@ -1464,8 +1464,8 @@ $2
 'revdelete-hide-user' => 'أخف اسم/آيبي المستخدم',
 'revdelete-hide-restricted' => 'أخف البيانات عن الإداريين إضافة إلى الآخرين',
 'revdelete-radio-same' => '(لا تغير)',
-'revdelete-radio-set' => 'Ù\86عÙ\85',
-'revdelete-radio-unset' => 'Ù\84ا',
+'revdelete-radio-set' => 'Ù\85Ø®Ù\81Ù\8a',
+'revdelete-radio-unset' => 'Ù\85رئÙ\8a',
 'revdelete-suppress' => 'أخف البيانات عن مديري النظام والبقية',
 'revdelete-unsuppress' => 'إزالة الضوابط من المراجعات المسترجعة',
 'revdelete-log' => 'السبب:',
index a39894c..5be4f13 100644 (file)
@@ -809,8 +809,8 @@ Mümkündür ki, bununla bağlı təfərrüatlar [{{fullurl:{{#Special:Log}}/del
 'revdelete-hide-user' => 'Redaktə müəllifinin istifadəçi adını/IP ünvanını gizlə',
 'revdelete-hide-restricted' => 'Məlumatları idarəçilərdən də gizlə',
 'revdelete-radio-same' => '(dəyişdirmə)',
-'revdelete-radio-set' => 'li',
-'revdelete-radio-unset' => 'Xeyr',
+'revdelete-radio-set' => 'Gizli',
+'revdelete-radio-unset' => 'Görünür',
 'revdelete-suppress' => 'Məlumatları idarəçilərdən də gizlə',
 'revdelete-unsuppress' => 'Bərpa olunan versiyalar üzərindən məhdudiyyətləri qaldır',
 'revdelete-log' => 'Səbəb:',
index 35acefa..e78e27e 100644 (file)
@@ -1072,8 +1072,8 @@ An ibang administrador sa {{SITENAME}} puwede pa man makagamit sa pinagtagong la
 'revdelete-hide-user' => 'Paraliwat na ngaran-paragamit/IP na estada',
 'revdelete-hide-restricted' => 'Ilubog an mga datos gikan sa mga administrador asin man kan iba',
 'revdelete-radio-same' => '(dae pagribayan)',
-'revdelete-radio-set' => 'Namamansayan',
-'revdelete-radio-unset' => 'Itinago',
+'revdelete-radio-set' => 'Itinago',
+'revdelete-radio-unset' => 'Hiling-hiling',
 'revdelete-suppress' => 'Dai ipahilíng an mga datos sa mga sysops asin sa mga iba pa',
 'revdelete-unsuppress' => 'Halîon an mga restriksyón sa mga ibinalík na pagpakarhay',
 'revdelete-log' => 'Rason:',
index aac7dca..b47591c 100644 (file)
@@ -1325,8 +1325,8 @@ pokud nebyla nastavena další omezení.",
 'revdelete-hide-user' => 'Uživatelské jméno / IP adresa',
 'revdelete-hide-restricted' => 'Utajit data i před správci',
 'revdelete-radio-same' => '(neměnit)',
-'revdelete-radio-set' => 'Viditelný',
-'revdelete-radio-unset' => 'Skrytý',
+'revdelete-radio-set' => 'Skrytý',
+'revdelete-radio-unset' => 'Viditelný',
 'revdelete-suppress' => 'Utajit data i před správci',
 'revdelete-unsuppress' => 'Odstranit omezení na vrácené verze',
 'revdelete-log' => 'Důvod:',
index ee87588..6915b32 100644 (file)
@@ -1386,8 +1386,8 @@ Andere Administratoren auf {{SITENAME}} haben Zugriff auf den versteckten Inhalt
 'revdelete-hide-user' => 'Benutzername/IP-Adresse des Bearbeiters',
 'revdelete-hide-restricted' => 'Daten sowohl vor Administratoren als auch anderen Benutzern unterdrücken',
 'revdelete-radio-same' => '(nicht ändern)',
-'revdelete-radio-set' => 'Sichtbar',
-'revdelete-radio-unset' => 'Versteckt',
+'revdelete-radio-set' => 'Versteckt',
+'revdelete-radio-unset' => 'Sichtbar',
 'revdelete-suppress' => 'Grund der Löschung auch vor Administratoren verstecken',
 'revdelete-unsuppress' => 'Einschränkungen für wiederhergestellte Versionen aufheben',
 'revdelete-log' => 'Grund:',
index 0c4ca01..433915e 100644 (file)
@@ -1717,8 +1717,8 @@ Other administrators on {{SITENAME}} will still be able to access the hidden con
 'revdelete-hide-user'         => "Editor's username/IP address",
 'revdelete-hide-restricted'   => 'Suppress data from administrators as well as others',
 'revdelete-radio-same'        => '(do not change)',
-'revdelete-radio-set'         => 'Visible',
-'revdelete-radio-unset'       => 'Hidden',
+'revdelete-radio-set'         => 'Hidden',
+'revdelete-radio-unset'       => 'Visible',
 'revdelete-suppress'          => 'Suppress data from administrators as well as others',
 'revdelete-unsuppress'        => 'Remove restrictions on restored revisions',
 'revdelete-log'               => 'Reason:',
index e173cfd..5ef2ad3 100644 (file)
@@ -1351,8 +1351,8 @@ Les autres administrateurs de {{SITENAME}} pourront toujours accéder au contenu
 'revdelete-hide-user' => 'Nom d’utilisateur/utilisatrice ou adresse IP de l’éditeur/éditrice',
 'revdelete-hide-restricted' => "Supprimer ces données aux administrateurs et administratrices ainsi bien qu'aux autres",
 'revdelete-radio-same' => '(ne pas changer)',
-'revdelete-radio-set' => 'Visible',
-'revdelete-radio-unset' => 'Masqué',
+'revdelete-radio-set' => 'Masqué',
+'revdelete-radio-unset' => 'Visible',
 'revdelete-suppress' => 'Masquer également les données pour les administrateurs',
 'revdelete-unsuppress' => 'Enlever les restrictions sur les versions restaurées',
 'revdelete-log' => 'Motif :',
@@ -3486,7 +3486,7 @@ Les autres liens sur la même ligne sont considérés comme des exceptions, par
 'exif-compressedbitsperpixel' => "Mode de compression de l'image",
 'exif-pixelydimension' => "Largeur de l'image",
 'exif-pixelxdimension' => "Hauteur de l'image",
-'exif-usercomment' => "Commentaires de l'utilisateur",
+'exif-usercomment' => "Commentaires de l'utilisateur ou de l’utilisatrice",
 'exif-relatedsoundfile' => 'Fichier audio associé',
 'exif-datetimeoriginal' => 'Date de la prise originelle',
 'exif-datetimedigitized' => 'Date de la numérisation',
index aa7b289..ca60280 100644 (file)
@@ -1371,6 +1371,7 @@ $3 մասնակիցը տվել է հետևյալ պատճառը. ''$2''",
 'right-upload' => 'Նիշքերի բեռնում',
 'right-upload_by_url' => 'Բեռնել նիշքեր ինտերնետային հասցեից',
 'right-delete' => 'Էջերի ջնջում',
+'right-rollback' => 'Արագ հետ գլորել տվյալ էջը վերջին անգամ խմբագրած մասնակցի խմբագրումները',
 
 # Special:Log/newusers
 'newuserlogpage' => 'Մասնակիցների գրանցման տեղեկամատյան',
@@ -1390,6 +1391,7 @@ $3 մասնակիցը տվել է հետևյալ պատճառը. ''$2''",
 'action-delete' => 'Ջնջել այս էջը',
 'action-deleterevision' => 'Ջնջել այս փոփոխությունը',
 'action-deletedhistory' => 'Դիտել այս էջի ջնջված պատմությունը',
+'action-rollback' => 'արագ հետ գլորել էջը վերջին անգամ խմբագրած մասնակցի կատարած փոփոխությունները',
 
 # Recent changes
 'nchanges' => '$1 {{PLURAL:$1|փոփոխություն|փոփոխություն}}',
@@ -1905,11 +1907,12 @@ $NEWPAGE
 'rollback' => 'Հետ գլորել խմբագրումները',
 'rollback_short' => 'Հետ գլորել',
 'rollbacklink' => 'հետ գլորել',
+'rollbacklinkcount' => 'հետ գլորել $1 {{PLURAL:$1|խմբագրում}}',
 'rollbackfailed' => 'Հետ գլորումը ձախողվեց',
 'cantrollback' => 'Չհաջողվեց հետ շրջել խմբագրումը։ Վերջին ներդրումը կատարվել է էջի միակ հեղինակի կողմից։',
-'alreadyrolled' => 'Õ\89Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Ö\81 Õ°Õ¥Õ¿ Õ£Õ¬Õ¸Ö\80Õ¥Õ¬ [[:$1]] Õ§Õ»Õ« Õ¾Õ¥Ö\80Õ»Õ«Õ¶ Õ­Õ´Õ¢Õ¡Õ£Ö\80Õ¸Ö\82Õ´Õ¶Õ¥Ö\80Õ¨Õ\9d Õ¯Õ¡Õ¿Õ¡Ö\80Õ¾Õ¡Õ® [[User:$2|$2]] ([[User talk:$2|Õ\94Õ¶Õ¶Õ¡Ö\80Õ¯Õ¸Ö\82Õ´]]) Õ´Õ¡Õ½Õ¶Õ¡Õ¯Ö\81Õ« Õ¯Õ¸Õ²Õ´Õ«Ö\81Ö\89 Õ\84Õ¥Õ¯ Õ¸Ö\82Ö\80Õ«Õ·Õ¨ Õ¡Ö\80Õ¤Õ¥Õ¶ Õ­Õ´Õ¢Õ¡Õ£Ö\80Õ¥Õ¬ Õ§ Õ¯Õ¡Õ´ Õ°Õ¥Õ¿ Õ§ Õ£Õ¬Õ¸Ö\80Õ¥Õ¬ էջը։
+'alreadyrolled' => 'Õ\89Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Ö\81 Õ°Õ¥Õ¿ Õ£Õ¬Õ¸Ö\80Õ¥Õ¬ [[:$1]] Õ§Õ»Õ¸Ö\82Õ´ [[User:$2|$2]] ([[User talk:$2|Õ\94Õ¶Õ¶Õ¡Ö\80Õ¯Õ¸Ö\82Õ´]]) Õ´Õ¡Õ½Õ¶Õ¡Õ¯Ö\81Õ« Õ¾Õ¥Ö\80Õ»Õ«Õ¶ Õ­Õ´Õ¢Õ¡Õ£Ö\80Õ¸Ö\82Õ´Õ¶Õ¥Ö\80Õ¨â\80¤ Õ´Õ¥Õ¯ Õ¸Ö\82Ö\80Õ«Õ·Õ¶ Õ¡Ö\80Õ¤Õ¥Õ¶ Õ°Õ¥Õ¿ Õ§ Õ£Õ¬Õ¸Ö\80Õ¥Õ¬ Õ¯Õ¡Õ´ Õ­Õ´Õ¢Õ¡Õ£Ö\80Õ¥Õ¬ Õ§ էջը։
 
\8eÕ¥Ö\80Õ»Õ«Õ¶ Õ­Õ´Õ¢Õ¡Õ£Ö\80Õ¸Ö\82Õ´Õ¨ Õ¯Õ¡Õ¿Õ¡Ö\80Õ¾Õ¥Õ¬ Õ§ [[User:$3|$3]] ([[User talk:$3|Õ\94Õ¶Õ¶Õ¡Ö\80Õ¯Õ¸Ö\82Õ´]]) Õ´Õ¡Õ½Õ¶Õ¡Õ¯Ö\81Õ« Õ¯Õ¸Õ²Õ´Õ«Ö\81։',
\8eÕ¥Ö\80Õ»Õ«Õ¶ Õ­Õ´Õ¢Õ¡Õ£Ö\80Õ¸Ö\82Õ´Õ¨ Õ¯Õ¡Õ¿Õ¡Ö\80Õ¥Õ¬ Õ§ [[User:$3|$3]] ([[User talk:$3|Õ\94Õ¶Õ¶Õ¡Ö\80Õ¯Õ¸Ö\82Õ´]]) Õ´Õ¡Õ½Õ¶Õ¡Õ¯Õ«Ö\81Õ¨։',
 'editcomment' => "Խմբագրման մեկնաբանումն էր. «''$1''»։",
 'revertpage' => '[[Special:Contributions/$2|$2]] ([[User talk:$2|քննարկում]]) մասնակցի խմբագրումները հետ են շրջվել [[User:$1|$1]] մասնակցի վերջին տարբերակին։',
 'revertpage-nouser' => 'Հետ շրջվեց (անունը ջնջված է) մասնակցի խմբագրումը՝ [[User:$1|$1]] մասնակցի տարբերակին',
index 955c931..bf94c90 100644 (file)
@@ -3787,6 +3787,7 @@ Per favore, conferma che vuoi veramente ricreare questa pagina.",
 
 # Separators for various lists, etc.
 'percent' => '$1&#160;%',
+'quotation-marks' => '«$1»',
 
 # Multipage image navigation
 'imgmultipageprev' => '← pagina precedente',
index 10a1759..fcc9758 100644 (file)
@@ -1374,8 +1374,8 @@ $3が示した理由: ''$2''",
 'revdelete-hide-user' => '投稿者の利用者名/IPアドレス',
 'revdelete-hide-restricted' => '他の利用者と同様に管理者からもデータを隠す',
 'revdelete-radio-same' => '(変更しない)',
-'revdelete-radio-set' => '表示',
-'revdelete-radio-unset' => 'é\9d\9e表示',
+'revdelete-radio-set' => '非公開',
+'revdelete-radio-unset' => 'é\96²è¦§å\8f¯è\83½',
 'revdelete-suppress' => '他の利用者と同様に管理者からもデータを隠す',
 'revdelete-unsuppress' => '復元版に対する制限を除去',
 'revdelete-log' => '理由:',
index c2e1c12..8bf3c4b 100644 (file)
@@ -1346,8 +1346,8 @@ $2개 보다 적게 {{PLURAL:$2|써야}} 하지만 {{PLURAL:$1|지금은 $1개
 'revdelete-hide-user' => '편집자의 사용자 이름/IP 주소',
 'revdelete-hide-restricted' => '관리자도 보지 못하게 숨기기',
 'revdelete-radio-same' => '(바꾸지 않음)',
-'revdelete-radio-set' => '보이기',
-'revdelete-radio-unset' => '숨기기',
+'revdelete-radio-set' => '숨겨짐',
+'revdelete-radio-unset' => '보여짐',
 'revdelete-suppress' => '문서 내용을 관리자에게도 보이지 않게 숨기기',
 'revdelete-unsuppress' => '되살린 판에 대한 제한을 해제',
 'revdelete-log' => '이유:',
@@ -3317,6 +3317,7 @@ $2',
 'pageinfo-length' => '문서 길이 (바이트)',
 'pageinfo-article-id' => '문서 ID',
 'pageinfo-language' => '문서 내용 언어',
+'pageinfo-content-model' => '문서 콘텐츠 모델',
 'pageinfo-robot-policy' => '로봇에 의한 색인',
 'pageinfo-robot-index' => '허용됨',
 'pageinfo-robot-noindex' => '불허됨',
index 9f89013..d0cfffc 100644 (file)
@@ -1152,8 +1152,8 @@ Aner {{SITENAME}}-Administrateure kënnen de geläschten Inhalt oder aner geläs
 'revdelete-hide-user' => 'Dem Auteur säi Benotzernumm/IP-Adress',
 'revdelete-hide-restricted' => 'Donnéeën och fir Administrateuren suppriméieren geneesou wéi fir déi Aner',
 'revdelete-radio-same' => '(net änneren)',
-'revdelete-radio-set' => 'Visibel',
-'revdelete-radio-unset' => 'Verstoppt',
+'revdelete-radio-set' => 'Verstoppt',
+'revdelete-radio-unset' => 'Visibel',
 'revdelete-suppress' => 'Grond vum Läschen och fir Administrateure verstoppt',
 'revdelete-unsuppress' => 'Limitatiounen fir restauréiert Versiounen ophiewen',
 'revdelete-log' => 'Grond:',
index 91854da..5fc7998 100644 (file)
@@ -1011,8 +1011,8 @@ J'àutri aministrator dzora a {{SITENAME}} a saran ancó sempe bon a s-ciairé 
 'revdelete-hide-user' => "Stranòm/adrëssa IP dl'utent",
 'revdelete-hide-restricted' => "Stërmé j'anformassion a j'aministrator tan-me a j'àutri",
 'revdelete-radio-same' => '(cambia pa)',
-'revdelete-radio-set' => 'Visìbil',
-'revdelete-radio-unset' => 'Stërmà',
+'revdelete-radio-set' => 'Stërmà',
+'revdelete-radio-unset' => 'Visìbil',
 'revdelete-suppress' => "Smon-je pa ij dat gnanca a j'aministrator",
 'revdelete-unsuppress' => "Gava le limitassion da 'nt le version ciapà andaré",
 'revdelete-log' => 'Rason:',
index c2f01a0..de1ed6a 100644 (file)
@@ -2449,14 +2449,14 @@ There are three radio buttons in each row, and the captions above each column re
 * {{msg-mw|Revdelete-radio-same}}
 * {{msg-mw|Revdelete-radio-set}}
 * {{msg-mw|Revdelete-radio-unset}}
-{{Identical|Visible}}',
+{{Identical|Hidden}}',
 'revdelete-radio-unset' => 'This message is a part of the [[mw:RevisionDelete|RevisionDelete]] feature. The message is a caption for a column of radioboxes inside a box with {{msg-mw|Revdelete-legend}} as a title.
 [[File:RevDelete Special-RevisionDelete (r60428).png|frame|center|Screenshot of the interface]]
 There are three radio buttons in each row, and the captions above each column read:
 * {{msg-mw|Revdelete-radio-same}}
 * {{msg-mw|Revdelete-radio-set}}
 * {{msg-mw|Revdelete-radio-unset}}
-{{Identical|Hidden}}',
+{{Identical|Visible}}',
 'revdelete-suppress' => 'Option for oversight; used in [[Special:RevisionDelete]].
 
 See also:
index 3eb6277..9fd5270 100644 (file)
@@ -1424,8 +1424,8 @@ $3 {{GENDER:$3|указал|указала}} следующую причину:
 'revdelete-hide-user' => 'Имя участника/IP-адрес',
 'revdelete-hide-restricted' => 'Скрыть данные также и от администраторов',
 'revdelete-radio-same' => '(не изменять)',
-'revdelete-radio-set' => 'Ð\92идимая',
-'revdelete-radio-unset' => 'СкÑ\80Ñ\8bÑ\82ая',
+'revdelete-radio-set' => 'СкÑ\80Ñ\8bÑ\82ая',
+'revdelete-radio-unset' => 'Ð\92идимая',
 'revdelete-suppress' => 'Скрывать данные также и от администраторов',
 'revdelete-unsuppress' => 'Снять ограничения с восстановленных версий',
 'revdelete-log' => 'Причина:',
index edf45c0..58c76a6 100644 (file)
@@ -1266,7 +1266,7 @@ $2
 Проверите разлике испод, па сачувајте измене.',
 'undo-failure' => 'Не могу да вратим измену због постојања сукобљених међуизмена.',
 'undo-norev' => 'Не могу да вратим измену јер не постоји или је обрисана.',
-'undo-summary' => 'Поништена измена $1  {{GENDER:$2|корисника|кориснице}} [[Special:Contributions/$2|$2]] ([[User talk:$2|разговор]])',
+'undo-summary' => 'Поништена измена $1 {{GENDER:$2|корисника|кориснице}} [[Special:Contributions/$2|$2]] ([[User talk:$2|разговор]])',
 'undo-summary-username-hidden' => 'Поништи измену $1 скривеног корисника',
 
 # Account creation failure
index 062e735..a5142ae 100644 (file)
@@ -2249,7 +2249,7 @@ Tugon at karagdagang tulong:
 'excontentauthor' => "ang nilalaman ay: '$1' (at ang tanging nag-ambag ay si '[[Special:Contributions/$2|$2]]')",
 'exbeforeblank' => "nilalaman bago nablangko: '$1'",
 'exblank' => 'walang laman ang pahina',
-'delete-confirm' => 'Burahin "$1"',
+'delete-confirm' => 'Burahin ang "$1"',
 'delete-legend' => 'Burahin',
 'historywarning' => "'''Babala''': May kasaysayan ang pahinang buburahin mo na tinatayang may $1 {{PLURAL:$1|pagbabago|mga pagbabago}}:",
 'confirmdeletetext' => 'Lubos mo nang buburahin ang pahinang ito pati ang kalahatan ng kasaysayan nito.
index 6c4b8cb..fd70746 100644 (file)
@@ -1342,11 +1342,11 @@ $3 зазначив таку причину: ''$2''",
 * Потенційно наклепницькі відомості
 * Недоречна особиста інформація
 *: ''домашні адреси, номери телефонів, номер паспорта тощо.''",
-'revdelete-legend' => 'УÑ\81Ñ\82ановиÑ\82и Ð¾Ð±Ð¼ÐµÐ¶ÐµÐ½Ð½Ñ\8f',
-'revdelete-hide-text' => 'ТекÑ\81Ñ\82 Ð²Ð¸Ð¿Ñ\80авленÑ\8c',
+'revdelete-legend' => 'Ð\92Ñ\81Ñ\82ановиÑ\82и Ð¾Ð±Ð¼ÐµÐ¶ÐµÐ½Ð½Ñ\8f Ð²Ð¸Ð´Ð¸Ð¼Ð¾Ñ\81Ñ\82Ñ\96',
+'revdelete-hide-text' => 'ТекÑ\81Ñ\82 Ð²ÐµÑ\80Ñ\81Ñ\96Ñ\97 Ñ\81Ñ\82оÑ\80Ñ\96нки',
 'revdelete-hide-image' => 'Приховати вміст файлу',
 'revdelete-hide-name' => "Приховати дію та її об'єкт",
-'revdelete-hide-comment' => 'Ð\9fÑ\96дÑ\81Ñ\83мок Ð·Ð¼Ñ\96н',
+'revdelete-hide-comment' => 'Ð\9aоменÑ\82аÑ\80 Ñ\80едагÑ\83ваннÑ\8f',
 'revdelete-hide-user' => "Ім'я автора/IP адреса",
 'revdelete-hide-restricted' => 'Приховати дані також і від адміністраторів',
 'revdelete-radio-same' => '(не змінювати)',
index 4cdff2a..3829b69 100644 (file)
@@ -1284,8 +1284,8 @@ Các quản lý khác ở {{SITENAME}} vẫn có thể truy nhập vào nội du
 'revdelete-hide-user' => 'Tên người dùng hay địa chỉ IP của người viết trang',
 'revdelete-hide-restricted' => 'Ẩn giấu thông tin khỏi các Quản lý lẫn thành viên khác',
 'revdelete-radio-same' => '(không đổi)',
-'revdelete-radio-set' => 'Xem được',
-'revdelete-radio-unset' => 'n',
+'revdelete-radio-set' => 'Ẩn',
+'revdelete-radio-unset' => 'Hiện',
 'revdelete-suppress' => 'Che dữ liệu đối với bảo quản viên cũng như các thành viên khác',
 'revdelete-unsuppress' => 'Bỏ các hạn chế trên các phiên bản được phục hồi',
 'revdelete-log' => 'Lý do:',
@@ -4083,7 +4083,7 @@ hoặc [//www.gnu.org/licenses/old-licenses/gpl-2.0.html đọc nó trực tuy
 # Special:Redirect
 'redirect' => 'Đổi hướng đến tập tin, người dùng, hoặc số phiên bản',
 'redirect-legend' => 'Đổi hướng đến tập tin hoặc trang',
-'redirect-summary' => 'Trang đặc biệt này đổi hướng đến một tập tin (theo tên tập tin được cho vào), trang (theo số phiên bản được cho vào), hoặc trang cá nhân (theo số thành viên). Cách sử dụng: [[{{#Special:Redirect}}/file/Ví dụ.jpg]], [[{{#Special:Redirect}}/revision/328429]], hoặc [[{{#Special:Redirect}}/user/101]].',
+'redirect-summary' => 'Trang đặc biệt này đổi hướng đến một tập tin (theo tên tập tin được cho vào), trang (theo số phiên bản được cho vào), hoặc trang cá nhân (theo số thành viên). Cách sử dụng: [[{{#Special:Redirect}}/file/Example.jpg]], [[{{#Special:Redirect}}/revision/328429]], hoặc [[{{#Special:Redirect}}/user/101]].',
 'redirect-submit' => 'Đi',
 'redirect-lookup' => 'Tra cứu:',
 'redirect-value' => 'Giá trị:',
index 21dc8dc..5a1dd26 100644 (file)
@@ -1171,9 +1171,10 @@ $2
 'revdelete-text' => "'''אויסגעמעקטע רעוויזיעס און געשעענישן וועלן בלייבן אין דער בלאט היסטאריע און די לאגביכער, אבער טיילן פון זייער אינהאלט וועט ווערן אומגרייכלעך צום קהל. '''
 אנדערע סיסאפן אויף {{SITENAME}} וועלן נאך האבן צוטריט צום באהאלטענעם אינהאלט און קענען אים צוריקשטעלן דורך דעם זעלבן אייבערפלאך,  אחוץ ווען מען שטעלט נאך באגרענעצונגען.",
 'revdelete-confirm' => 'זייט אזוי גוט און באשטעטיקט אז דאס איז טאקע אייער כוונה, אז איר פארשטייט די קאנסעקווענצן, און אז איר טוט דאס לויט  [[{{MediaWiki:Policy-url}}|דער פאליסי]].',
-'revdelete-suppress-text' => "באהאלטן זאל בלויז גענוצט ווערן '''נאר''' אין די פאלגענדע פעלער:
+'revdelete-suppress-text' => "אונטערדרוקן זאל בלויז גענוצט ווערן '''נאר''' אין די פאלגנדע פעלער:
+* אינפארמאציע וואס קען זיין מוציא שם רע
 * אויפדעקונג פון פריוואטקייט אינפארמאציע
-* ''היים אדרעסן, טעלעפאן נומערן, אדער סאשעל סעקיורעטי, א.א.וו.:'''",
+*: ''היים אדרעסן, טעלעפאן נומערן, נאציאנאלע אידענטיפיקאציע נומערן, א.א.וו.''",
 'revdelete-legend' => 'שטעלט ווייזונג באגרענעצונגען',
 'revdelete-hide-text' => 'ווערסיע טעקסט',
 'revdelete-hide-image' => 'באהאלט טעקע אינהאלט',
@@ -1182,8 +1183,8 @@ $2
 'revdelete-hide-user' => "רעדאַקטאר'ס באניצער-נאמען/IP-אַדרעס",
 'revdelete-hide-restricted' => 'באהאלט אינפארמאציע אויך פון אדמיניסטראטורן פונקט ווי פשוטע באנוצער',
 'revdelete-radio-same' => '(נישט ענדערן)',
-'revdelete-radio-set' => '×\96×¢×\91×\90ר',
-'revdelete-radio-unset' => 'פֿ×\90ַר×\91×\90ָר×\92×\9f',
+'revdelete-radio-set' => 'פֿ×\90ַר×\91×\90ָר×\92×\9f',
+'revdelete-radio-unset' => '×\96×¢×\91×\90ר',
 'revdelete-suppress' => 'באַהאַלטן אינפֿארמאַציע פון אַדמיניסטראַטארן ווי אויך אנדערע',
 'revdelete-unsuppress' => 'טוה אפ באגרענעצונגן אין גענדערטע רעוויזיעס',
 'revdelete-log' => 'אורזאַך:',
@@ -1558,6 +1559,7 @@ $1",
 'right-editmyusercss' => 'רעדאקטירע אײַערע אייגענע באניצער CSS טעקעס',
 'right-editmyuserjs' => 'רעדאקטירן אײַערע אייגענע באניצער JavaScript טעקעס',
 'right-viewmywatchlist' => 'באקוקן אייער אייגענע אויפפאסונג ליסטע',
+'right-editmywatchlist' => 'רעדאקטירן אייער אייגענע אויפפאסונג ליסטער. טייל פעולות וועלן דאך צולייגן בלעטער אפילו אן דעם רעכט.',
 'right-viewmyprivateinfo' => 'באקוקן אײַער אייגענע פריוואטע דאטן (צ"ב ע־פאסט אדרעס, אמתער נאמען)',
 'right-editmyprivateinfo' => 'רעדאקטירן אײַער אייגענע פריוואטע דאטן (צ"ב ע־פאסט אדרעס, אמתער נאמען)',
 'right-editmyoptions' => 'רעדאקטירן אײַערע אייגענע פרעפערענצן',
@@ -2102,6 +2104,7 @@ $1",
 'listusers' => 'באַניצער ליסטע',
 'listusers-editsonly' => 'ווייזן נאר באניצערס מיט רעדאקטירונגען',
 'listusers-creationsort' => 'סארטירן לויט דער שאַפן דאַטע',
+'listusers-desc' => 'סארטירן אין אראפרשטייגעדיקן סדר',
 'usereditcount' => '{{PLURAL:$1|רעדאַקטירונג|$1 רעדאַקטירונגען}}',
 'usercreated' => '{{GENDER:$3|געשאַפֿן}} אום $2, $1',
 'newpages' => 'נייע בלעטער',
index a3ff98e..ea0153a 100644 (file)
@@ -1266,8 +1266,8 @@ $3的理由是''$2''",
 'revdelete-hide-user' => '编辑者的用户名/IP地址',
 'revdelete-hide-restricted' => '同时阻止管理员与其他用户查看数据',
 'revdelete-radio-same' => '(不要更改)',
-'revdelete-radio-set' => '可见',
-'revdelete-radio-unset' => '隐藏',
+'revdelete-radio-set' => '隐藏',
+'revdelete-radio-unset' => '可见',
 'revdelete-suppress' => '同时阻止管理员与其他用户查看数据',
 'revdelete-unsuppress' => '在已恢复的修订中移除限制',
 'revdelete-log' => '原因:',
index dc04d1d..0b4ed98 100644 (file)
@@ -1201,8 +1201,9 @@ $2
 'revdelete-text' => "'''刪除的修訂仍將顯示在頁面歷史中, 但它們的文字內容已不能被公眾訪問。'''
 在{{SITENAME}}的其他管理員將仍能訪問隱藏的內容並透過與此相同的介面恢復刪除,除非網站工作者進行了一些附加的限制。",
 'revdelete-confirm' => '請確認您肯定去做的話,您就要明白到後果,以及這個程序符合[[{{MediaWiki:Policy-url}}|政策]]。',
-'revdelete-suppress-text' => "壓制'''只'''應在以下的情況下進行:
-* 不合適的個人資料
+'revdelete-suppress-text' => "禁制應'''僅'''於下述情形之一時使用:
+* 潛在誹謗性資訊
+* 不合適個人資料
 *: ''住家地址、電話號碼、社群保安號碼等。''",
 'revdelete-legend' => '設定可見性之限制',
 'revdelete-hide-text' => '修訂文字',
@@ -1212,8 +1213,8 @@ $2
 'revdelete-hide-user' => '編輯者的用戶名/IP位址',
 'revdelete-hide-restricted' => '同時廢止由操作員以及其他用戶的資料',
 'revdelete-radio-same' => '(不要更改)',
-'revdelete-radio-set' => '可見',
-'revdelete-radio-unset' => '隱藏',
+'revdelete-radio-set' => '隱藏',
+'revdelete-radio-unset' => '可見',
 'revdelete-suppress' => '同時廢止由操作員以及其他用戶的資料',
 'revdelete-unsuppress' => '在已恢復的修訂中移除限制',
 'revdelete-log' => '理由:',
@@ -3102,6 +3103,7 @@ $2',
 'pageinfo-length' => '頁面長度 (以位元組為單位)',
 'pageinfo-article-id' => '頁面編號',
 'pageinfo-language' => '頁面內容語言',
+'pageinfo-content-model' => '頁面內容模型',
 'pageinfo-robot-policy' => '機械人索引',
 'pageinfo-robot-index' => '容許',
 'pageinfo-robot-noindex' => '阻止',
@@ -3772,6 +3774,7 @@ $5
 'colon-separator' => ':',
 'word-separator' => '',
 'parentheses' => '($1)',
+'quotation-marks' => '“$1”',
 
 # Multipage image navigation
 'imgmultipageprev' => '← 上一頁',
index 164b5b0..cf39523 100644 (file)
@@ -188,7 +188,6 @@ Mostlinkedcategories
 Mostlinkedtemplates
 Mostrevisions
 Move
-Mssql
 Mwstore
 Myuploads
 NEWPAGE
@@ -2442,7 +2441,6 @@ msgsmall
 msgtext
 msie
 msmetafile
-mssql
 msvideo
 msword
 mtime
index 34e6428..f991c1b 100644 (file)
@@ -21,7 +21,7 @@
  * @ingroup Maintenance
  * @author Tim Starling
  *
- * USAGE: php moveBatch.php [-u <user>] [-r <reason>] [-i <interval>] [listfile]
+ * USAGE: php moveBatch.php [-u <user>] [-r <reason>] [-i <interval>] [-noredirects] [listfile]
  *
  * [listfile] - file with two titles per line, separated with pipe characters;
  * the first title is the source, the second is the destination.
@@ -29,6 +29,7 @@
  * <user> - username to perform moves as
  * <reason> - reason to be given for moves
  * <interval> - number of seconds to sleep after each move
+ * <noredirects> - suppress creation of redirects
  *
  * This will print out error codes from Title::moveTo() if something goes wrong,
  * e.g. immobile_namespace for namespaces which can't be moved
@@ -48,6 +49,7 @@ class MoveBatch extends Maintenance {
                $this->addOption( 'u', "User to perform move", false, true );
                $this->addOption( 'r', "Reason to move page", false, true );
                $this->addOption( 'i', "Interval to sleep between moves" );
+               $this->addOption( 'noredirects', "Suppress creation of redirects" );
                $this->addArg( 'listfile', 'List of pages to move, newline delimited', false );
        }
 
@@ -62,6 +64,7 @@ class MoveBatch extends Maintenance {
                $user = $this->getOption( 'u', 'Move page script' );
                $reason = $this->getOption( 'r', '' );
                $interval = $this->getOption( 'i', 0 );
+               $noredirects = $this->getOption( 'noredirects', false );
                if ( $this->hasArg() ) {
                        $file = fopen( $this->getArg(), 'r' );
                } else {
@@ -99,7 +102,7 @@ class MoveBatch extends Maintenance {
 
                        $this->output( $source->getPrefixedText() . ' --> ' . $dest->getPrefixedText() );
                        $dbw->begin( __METHOD__ );
-                       $err = $source->moveTo( $dest, false, $reason );
+                       $err = $source->moveTo( $dest, false, $reason, !$noredirects );
                        if ( $err !== true ) {
                                $msg = array_shift( $err[0] );
                                $this->output( "\nFAILED: " . wfMessage( $msg, $err[0] )->text() );
diff --git a/maintenance/mssql/tables.sql b/maintenance/mssql/tables.sql
deleted file mode 100644 (file)
index 7356c38..0000000
+++ /dev/null
@@ -1,732 +0,0 @@
--- Experimental table definitions for Microsoft SQL Server with
--- content-holding fields switched to explicit BINARY charset.
--- ------------------------------------------------------------
-
--- SQL to create the initial tables for the MediaWiki database.
--- This is read and executed by the install script; you should
--- not have to run it by itself unless doing a manual install.
-
---
--- General notes:
---
--- The comments in this and other files are
--- replaced with the defined table prefix by the installer
--- and updater scripts. If you are installing or running
--- updates manually, you will need to manually insert the
--- table prefix if any when running these scripts.
---
-
-
---
--- The user table contains basic account information,
--- authentication keys, etc.
---
--- Some multi-wiki sites may share a single central user table
--- between separate wikis using the $wgSharedDB setting.
---
--- Note that when a external authentication plugin is used,
--- user table entries still need to be created to store
--- preferences and to key tracking information in the other
--- tables.
-
--- LINE:53
-CREATE TABLE /*$wgDBprefix*/user (
-   user_id           INT           NOT NULL  PRIMARY KEY IDENTITY(0,1),
-   user_name         NVARCHAR(255)  NOT NULL UNIQUE DEFAULT '',
-   user_real_name    NVARCHAR(255)  NOT NULL DEFAULT '',
-   user_password     NVARCHAR(255)  NOT NULL DEFAULT '',
-   user_newpassword  NVARCHAR(255)  NOT NULL DEFAULT '',
-   user_newpass_time DATETIME NULL,
-   user_email        NVARCHAR(255)  NOT NULL DEFAULT '',
-   user_options      NVARCHAR(MAX) NOT NULL DEFAULT '',
-   user_touched      DATETIME      NOT NULL DEFAULT GETDATE(),
-   user_token        NCHAR(32)      NOT NULL DEFAULT '',
-   user_email_authenticated DATETIME DEFAULT NULL,
-   user_email_token  NCHAR(32) DEFAULT '',
-   user_email_token_expires DATETIME DEFAULT NULL,
-   user_registration DATETIME DEFAULT NULL,
-   user_editcount    INT NULL
-);
-CREATE        INDEX /*$wgDBprefix*/user_email_token ON /*$wgDBprefix*/[user](user_email_token);
-CREATE UNIQUE INDEX /*$wgDBprefix*/[user_name]        ON /*$wgDBprefix*/[user]([user_name]);
-;
-
---
--- User permissions have been broken out to a separate table;
--- this allows sites with a shared user table to have different
--- permissions assigned to a user in each project.
---
--- This table replaces the old user_rights field which used a
--- comma-separated blob.
-CREATE TABLE /*$wgDBprefix*/user_groups (
-   ug_user  INT     NOT NULL REFERENCES /*$wgDBprefix*/[user](user_id) ON DELETE CASCADE,
-   ug_group NVARCHAR(16) NOT NULL DEFAULT '',
-);
-CREATE UNIQUE clustered INDEX /*$wgDBprefix*/user_groups_unique ON /*$wgDBprefix*/user_groups(ug_user, ug_group);
-CREATE INDEX /*$wgDBprefix*/user_group ON /*$wgDBprefix*/user_groups(ug_group);
-
--- Stores notifications of user talk page changes, for the display
--- of the "you have new messages" box
--- Changed user_id column to mwuser_id to avoid clashing with user_id function
-CREATE TABLE /*$wgDBprefix*/user_newtalk (
-   user_id INT         NOT NULL DEFAULT 0 REFERENCES /*$wgDBprefix*/[user](user_id) ON DELETE CASCADE,
-   user_ip NVARCHAR(40) NOT NULL DEFAULT '',
-   user_last_timestamp DATETIME NOT NULL DEFAULT '',
-);
-CREATE INDEX /*$wgDBprefix*/user_group_id ON /*$wgDBprefix*/user_newtalk([user_id]);
-CREATE INDEX /*$wgDBprefix*/user_ip       ON /*$wgDBprefix*/user_newtalk(user_ip);
-
---
--- User preferences and other fun stuff
--- replaces old user.user_options BLOB
---
-CREATE TABLE /*$wgDBprefix*/user_properties (
-       up_user INT NOT NULL,
-       up_property NVARCHAR(32) NOT NULL,
-       up_value NVARCHAR(MAX),
-);
-CREATE UNIQUE clustered INDEX /*$wgDBprefix*/user_props_user_prop ON /*$wgDBprefix*/user_properties(up_user, up_property);
-CREATE INDEX /*$wgDBprefix*/user_props_prop ON /*$wgDBprefix*/user_properties(up_property);
-
-
---
--- Core of the wiki: each page has an entry here which identifies
--- it by title and contains some essential metadata.
---
-CREATE TABLE /*$wgDBprefix*/page (
-   page_id        INT          NOT NULL  PRIMARY KEY clustered IDENTITY,
-   page_namespace INT          NOT NULL,
-   page_title     NVARCHAR(255)  NOT NULL,
-   page_restrictions NVARCHAR(255) NULL,
-   page_counter BIGINT            NOT NULL DEFAULT 0,
-   page_is_redirect BIT           NOT NULL DEFAULT 0,
-   page_is_new BIT                NOT NULL DEFAULT 0,
-   page_random NUMERIC(15,14)     NOT NULL DEFAULT RAND(),
-   page_touched DATETIME NOT NULL DEFAULT GETDATE(),
-   page_latest INT NOT NULL,
-   page_len INT NOT NULL,
-);
-CREATE UNIQUE INDEX /*$wgDBprefix*/page_unique_name ON /*$wgDBprefix*/page(page_namespace, page_title);
-CREATE        INDEX /*$wgDBprefix*/page_random_idx  ON /*$wgDBprefix*/page(page_random);
-CREATE        INDEX /*$wgDBprefix*/page_len_idx     ON /*$wgDBprefix*/page(page_len);
-;
-
---
--- Every edit of a page creates also a revision row.
--- This stores metadata about the revision, and a reference
--- to the TEXT storage backend.
---
-CREATE TABLE /*$wgDBprefix*/revision (
-   rev_id INT NOT NULL UNIQUE IDENTITY,
-   rev_page INT NOT NULL,
-   rev_text_id INT  NOT NULL,
-   rev_comment NVARCHAR(max) NOT NULL,
-   rev_user INT  NOT NULL DEFAULT 0 /*REFERENCES [user](user_id)*/,
-   rev_user_text NVARCHAR(255) NOT NULL DEFAULT '',
-   rev_timestamp DATETIME NOT NULL DEFAULT GETDATE(),
-   rev_minor_edit BIT NOT NULL DEFAULT 0,
-   rev_deleted BIT  NOT NULL DEFAULT 0,
-   rev_len INT,
-   rev_parent_id INT DEFAULT NULL,
-
-);
-CREATE UNIQUE clustered INDEX /*$wgDBprefix*/revision_unique ON /*$wgDBprefix*/revision(rev_page, rev_id);
-CREATE UNIQUE INDEX /*$wgDBprefix*/rev_id             ON /*$wgDBprefix*/revision(rev_id);
-CREATE        INDEX /*$wgDBprefix*/rev_timestamp      ON /*$wgDBprefix*/revision(rev_timestamp);
-CREATE        INDEX /*$wgDBprefix*/page_timestamp     ON /*$wgDBprefix*/revision(rev_page, rev_timestamp);
-CREATE        INDEX /*$wgDBprefix*/user_timestamp     ON /*$wgDBprefix*/revision(rev_user, rev_timestamp);
-CREATE        INDEX /*$wgDBprefix*/usertext_timestamp ON /*$wgDBprefix*/revision(rev_user_text, rev_timestamp);
-;
-
---
--- Holds TEXT of individual page revisions.
---
--- Field names are a holdover from the 'old' revisions table in
--- MediaWiki 1.4 and earlier: an upgrade will transform that
--- table INTo the 'text' table to minimize unnecessary churning
--- and downtime. If upgrading, the other fields will be left unused.
-CREATE TABLE /*$wgDBprefix*/text (
-   old_id INT NOT NULL  PRIMARY KEY clustered IDENTITY,
-   old_text TEXT NOT NULL,
-   old_flags NVARCHAR(255) NOT NULL,
-);
-
---
--- Holding area for deleted articles, which may be viewed
--- or restored by admins through the Special:Undelete interface.
--- The fields generally correspond to the page, revision, and text
--- fields, with several caveats.
--- Cannot reasonably create views on this table, due to the presence of TEXT
--- columns.
-CREATE TABLE /*$wgDBprefix*/archive (
-   ar_id NOT NULL PRIMARY KEY clustered IDENTITY,
-   ar_namespace SMALLINT NOT NULL DEFAULT 0,
-   ar_title NVARCHAR(255) NOT NULL DEFAULT '',
-   ar_text NVARCHAR(MAX) NOT NULL,
-   ar_comment NVARCHAR(255) NOT NULL,
-   ar_user INT NULL REFERENCES /*$wgDBprefix*/[user](user_id) ON DELETE SET NULL,
-   ar_user_text NVARCHAR(255) NOT NULL,
-   ar_timestamp DATETIME NOT NULL DEFAULT GETDATE(),
-   ar_minor_edit BIT NOT NULL DEFAULT 0,
-   ar_flags NVARCHAR(255) NOT NULL,
-   ar_rev_id INT,
-   ar_text_id INT,
-   ar_deleted BIT NOT NULL DEFAULT 0,
-   ar_len INT DEFAULT NULL,
-   ar_page_id INT NULL,
-   ar_parent_id INT NULL,
-);
-CREATE INDEX /*$wgDBprefix*/ar_name_title_timestamp ON /*$wgDBprefix*/archive(ar_namespace,ar_title,ar_timestamp);
-CREATE INDEX /*$wgDBprefix*/ar_usertext_timestamp ON /*$wgDBprefix*/archive(ar_user_text,ar_timestamp);
-CREATE INDEX /*$wgDBprefix*/ar_user_text    ON /*$wgDBprefix*/archive(ar_user_text);
-
-
---
--- Track page-to-page hyperlinks within the wiki.
---
-CREATE TABLE /*$wgDBprefix*/pagelinks (
-   pl_from INT NOT NULL DEFAULT 0 REFERENCES /*$wgDBprefix*/page(page_id) ON DELETE CASCADE,
-   pl_namespace SMALLINT NOT NULL DEFAULT 0,
-   pl_title NVARCHAR(255) NOT NULL DEFAULT '',
-);
-CREATE UNIQUE INDEX /*$wgDBprefix*/pl_from ON /*$wgDBprefix*/pagelinks(pl_from,pl_namespace,pl_title);
-CREATE UNIQUE INDEX /*$wgDBprefix*/pl_namespace ON /*$wgDBprefix*/pagelinks(pl_namespace,pl_title,pl_from);
-
---
--- Track template inclusions.
---
-CREATE TABLE /*$wgDBprefix*/templatelinks (
-   tl_from INT NOT NULL DEFAULT 0 REFERENCES /*$wgDBprefix*/page(page_id) ON DELETE CASCADE,
-   tl_namespace SMALLINT NOT NULL DEFAULT 0,
-   tl_title NVARCHAR(255) NOT NULL DEFAULT '',
-);
-CREATE UNIQUE INDEX /*$wgDBprefix*/tl_from ON /*$wgDBprefix*/templatelinks(tl_from,tl_namespace,tl_title);
-CREATE UNIQUE INDEX /*$wgDBprefix*/tl_namespace ON /*$wgDBprefix*/templatelinks(tl_namespace,tl_title,tl_from);
-
---
--- Track links to images *used inline*
--- We don't distinguish live from broken links here, so
--- they do not need to be changed ON upload/removal.
---
-CREATE TABLE /*$wgDBprefix*/imagelinks (
-   il_from INT NOT NULL DEFAULT 0 REFERENCES /*$wgDBprefix*/page(page_id) ON DELETE CASCADE,
-   il_to NVARCHAR(255)  NOT NULL DEFAULT '',
-   CONSTRAINT /*$wgDBprefix*/il_from PRIMARY KEY(il_from,il_to),
-);
-CREATE UNIQUE INDEX /*$wgDBprefix*/il_from_to ON /*$wgDBprefix*/imagelinks(il_from,il_to);
-CREATE UNIQUE INDEX /*$wgDBprefix*/il_to_from ON /*$wgDBprefix*/imagelinks(il_to,il_from);
-
---
--- Track category inclusions *used inline*
--- This tracks a single level of category membership
--- (folksonomic tagging, really).
---
-CREATE TABLE /*$wgDBprefix*/categorylinks (
-   cl_from INT NOT NULL DEFAULT 0,
-   cl_to NVARCHAR(255)  NOT NULL DEFAULT '',
-   cl_sortkey NVARCHAR(150)  NOT NULL DEFAULT '',
-   cl_timestamp DATETIME NOT NULL DEFAULT GETDATE(),
-   CONSTRAINT /*$wgDBprefix*/cl_from PRIMARY KEY(cl_from, cl_to),
-);
-CREATE UNIQUE INDEX /*$wgDBprefix*/cl_from_to   ON /*$wgDBprefix*/categorylinks(cl_from,cl_to);
--- We always sort within a given category...
-CREATE INDEX /*$wgDBprefix*/cl_sortkey   ON /*$wgDBprefix*/categorylinks(cl_to,cl_sortkey);
--- Not really used?
-CREATE INDEX /*$wgDBprefix*/cl_timestamp ON /*$wgDBprefix*/categorylinks(cl_to,cl_timestamp);
---;
-
---
--- Track all existing categories.  Something is a category if 1) it has an en-
--- try somewhere in categorylinks, or 2) it once did.  Categories might not
--- have corresponding pages, so they need to be tracked separately.
---
-CREATE TABLE /*$wgDBprefix*/category (
-  cat_id int NOT NULL IDENTITY(1,1),
-  cat_title nvarchar(255)  NOT NULL,
-  cat_pages int NOT NULL default 0,
-  cat_subcats int NOT NULL default 0,
-  cat_files int NOT NULL default 0,
-  cat_hidden tinyint NOT NULL default 0,
-);
-
-CREATE UNIQUE INDEX /*$wgDBprefix*/cat_title   ON /*$wgDBprefix*/category(cat_title);
--- For Special:Mostlinkedcategories
-CREATE INDEX /*$wgDBprefix*/cat_pages   ON /*$wgDBprefix*/category(cat_pages);
-
-
-CREATE TABLE /*$wgDBprefix*/change_tag (
-  ct_rc_id   int  NOT NULL default 0,
-  ct_log_id  int  NOT NULL default 0,
-  ct_rev_id  int  NOT NULL default 0,
-  ct_tag     varchar(255)  NOT NULL,
-  ct_params  varchar(255)  NOT NULL,
-);
-CREATE UNIQUE INDEX /*$wgDBprefix*/change_tag_rc_tag ON /*$wgDBprefix*/change_tag(ct_rc_id,ct_tag);
-CREATE UNIQUE INDEX /*$wgDBprefix*/change_tag_log_tag ON /*$wgDBprefix*/change_tag(ct_log_id,ct_tag);
-CREATE UNIQUE INDEX /*$wgDBprefix*/change_tag_rev_tag ON /*$wgDBprefix*/change_tag(ct_rev_id,ct_tag);
-CREATE INDEX /*$wgDBprefix*/change_tag_tag_id ON /*$wgDBprefix*/change_tag(ct_tag,ct_rc_id,ct_rev_id,ct_log_id);
-
-CREATE TABLE /*$wgDBprefix*/tag_summary (
-  ts_rc_id   INT NOT NULL default 0,
-  ts_log_id  INT NOT NULL default 0,
-  ts_rev_id  INT NOT NULL default 0,
-  ts_tags    varchar(255)  NOT NULL
-);
-CREATE UNIQUE INDEX /*$wgDBprefix*/tag_summary_rc_id ON /*$wgDBprefix*/tag_summary(ts_rc_id);
-CREATE UNIQUE INDEX /*$wgDBprefix*/tag_summary_log_id ON /*$wgDBprefix*/tag_summary(ts_log_id);
-CREATE UNIQUE INDEX /*$wgDBprefix*/tag_summary_rev_id ON /*$wgDBprefix*/tag_summary(ts_rev_id);
-
-CREATE TABLE /*$wgDBprefix*/valid_tag (
-  vt_tag varchar(255) NOT NULL PRIMARY KEY
-);
-
---
--- Table for storing localisation data
---
-CREATE TABLE /*$wgDBprefix*/l10n_cache (
-       -- language code
-       lc_lang NVARCHAR(32) NOT NULL,
-
-       -- cache key
-       lc_key NVARCHAR(255) NOT NULL,
-
-       -- Value
-       lc_value TEXT NOT NULL DEFAULT '',
-);
-CREATE INDEX /*$wgDBprefix*/lc_lang_key ON /*$wgDBprefix*/l10n_cache (lc_lang, lc_key);
-
---
--- Track links to external URLs
--- IE >= 4 supports no more than 2083 characters in a URL
-CREATE TABLE /*$wgDBprefix*/externallinks (
-   el_id INT NOT NULL PRIMARY KEY clustered IDENTITY,
-   el_from INT NOT NULL DEFAULT '0',
-   el_to VARCHAR(2083) NOT NULL,
-   el_index VARCHAR(896) NOT NULL,
-);
--- Maximum key length ON SQL Server is 900 bytes
-CREATE INDEX /*$wgDBprefix*/externallinks_index   ON /*$wgDBprefix*/externallinks(el_index);
-
---
--- Track INTerlanguage links
---
-CREATE TABLE /*$wgDBprefix*/langlinks (
-   ll_from  INT          NOT NULL DEFAULT 0,
-   ll_lang  NVARCHAR(20)  NOT NULL DEFAULT '',
-   ll_title NVARCHAR(255)  NOT NULL DEFAULT '',
-   CONSTRAINT /*$wgDBprefix*/langlinks_pk PRIMARY KEY(ll_from, ll_lang),
-);
-CREATE UNIQUE INDEX /*$wgDBprefix*/langlinks_reverse_key ON /*$wgDBprefix*/langlinks(ll_lang,ll_title);
-
---
--- Track inline interwiki links
---
-CREATE TABLE /*$wgDBprefix*/iwlinks (
-       -- page_id of the referring page
-       iwl_from INT NOT NULL DEFAULT 0,
-
-       -- Interwiki prefix code of the target
-       iwl_prefix NVARCHAR(20) NOT NULL DEFAULT '',
-
-       -- Title of the target, including namespace
-       iwl_title NVARCHAR(255) NOT NULL DEFAULT '',
-);
-
-CREATE UNIQUE INDEX /*$wgDBprefix*/iwl_from ON /*$wgDBprefix*/iwlinks(iwl_from,iwl_prefix,iwl_title);
-CREATE UNIQUE INDEX /*$wgDBprefix*/iwl_prefix ON /*$wgDBprefix*/iwlinks(iwl_prefix,iwl_title);
-
-
---
--- Contains a single row with some aggregate info
--- ON the state of the site.
---
-CREATE TABLE /*$wgDBprefix*/site_stats (
-   ss_row_id        INT  NOT NULL DEFAULT 1 PRIMARY KEY,
-   ss_total_views   BIGINT DEFAULT 0,
-   ss_total_edits   BIGINT DEFAULT 0,
-   ss_good_articles BIGINT DEFAULT 0,
-   ss_total_pages   BIGINT DEFAULT -1,
-   ss_users         BIGINT DEFAULT -1,
-   ss_active_users  BIGINT DEFAULT -1,
-   ss_admins        INT    DEFAULT -1,
-   ss_images INT DEFAULT 0,
-);
-
--- INSERT INTO site_stats DEFAULT VALUES;
-
---
--- Stores an ID for every time any article is visited;
--- depending ON $wgHitcounterUpdateFreq, it is
--- periodically cleared and the page_counter column
--- in the page table updated for the all articles
--- that have been visited.)
---
-CREATE TABLE /*$wgDBprefix*/hitcounter (
-   hc_id BIGINT NOT NULL
-);
-
---
--- The Internet is full of jerks, alas. Sometimes it's handy
--- to block a vandal or troll account.
---
-CREATE TABLE /*$wgDBprefix*/ipblocks (
-       ipb_id      INT NOT NULL  PRIMARY KEY,
-       ipb_address NVARCHAR(255) NOT NULL,
-       ipb_user    INT NOT NULL DEFAULT 0,
-       ipb_by      INT NOT NULL DEFAULT 0,
-       ipb_by_text NVARCHAR(255) NOT NULL DEFAULT '',
-       ipb_reason  NVARCHAR(255) NOT NULL,
-       ipb_timestamp DATETIME NOT NULL DEFAULT GETDATE(),
-       ipb_auto BIT NOT NULL DEFAULT 0,
-       ipb_anon_only BIT NOT NULL DEFAULT 0,
-       ipb_create_account BIT NOT NULL DEFAULT 1,
-       ipb_enable_autoblock BIT NOT NULL DEFAULT 1,
-       ipb_expiry DATETIME NOT NULL DEFAULT GETDATE(),
-       ipb_range_start NVARCHAR(32) NOT NULL DEFAULT '',
-       ipb_range_end NVARCHAR(32) NOT NULL DEFAULT '',
-       ipb_deleted BIT NOT NULL DEFAULT 0,
-       ipb_block_email BIT NOT NULL DEFAULT 0,
-       ipb_allow_usertalk BIT NOT NULL DEFAULT 0,
-       ipb_parent_block_id   INT DEFAULT NULL,
-);
--- Unique index to support "user already blocked" messages
--- Any new options which prevent collisions should be included
---UNIQUE INDEX ipb_address (ipb_address(255), ipb_user, ipb_auto, ipb_anon_only),
-CREATE UNIQUE INDEX /*$wgDBprefix*/ipb_address   ON /*$wgDBprefix*/ipblocks(ipb_address, ipb_user, ipb_auto, ipb_anon_only);
-CREATE        INDEX /*$wgDBprefix*/ipb_user      ON /*$wgDBprefix*/ipblocks(ipb_user);
-CREATE        INDEX /*$wgDBprefix*/ipb_range     ON /*$wgDBprefix*/ipblocks(ipb_range_start, ipb_range_end);
-CREATE        INDEX /*$wgDBprefix*/ipb_timestamp ON /*$wgDBprefix*/ipblocks(ipb_timestamp);
-CREATE        INDEX /*$wgDBprefix*/ipb_expiry    ON /*$wgDBprefix*/ipblocks(ipb_expiry);
-;
-
---
--- Uploaded images and other files.
-CREATE TABLE /*$wgDBprefix*/image (
-   img_name varchar(255) NOT NULL default '',
-   img_size INT  NOT NULL DEFAULT 0,
-   img_width INT NOT NULL DEFAULT 0,
-   img_height INT NOT NULL DEFAULT 0,
-   img_metadata TEXT NOT NULL, -- was MEDIUMBLOB
-   img_bits SMALLINT NOT NULL DEFAULT 0,
-   img_media_type NVARCHAR(MAX) DEFAULT 'UNKNOWN',
-   img_major_mime NVARCHAR(MAX) DEFAULT 'UNKNOWN',
-   img_minor_mime NVARCHAR(MAX) NOT NULL DEFAULT 'unknown',
-   img_description NVARCHAR(MAX) NOT NULL,
-   img_user INT NOT NULL DEFAULT 0,
-   img_user_text VARCHAR(255) NOT NULL DEFAULT '',
-   img_timestamp DATETIME NOT NULL DEFAULT GETDATE(),
-   img_sha1 VARCHAR(255) NOT NULL default '',
-);
--- Used by Special:Imagelist for sort-by-size
-CREATE INDEX /*$wgDBprefix*/img_size ON /*$wgDBprefix*/[image](img_size);
--- Used by Special:Newimages and Special:Imagelist
-CREATE INDEX /*$wgDBprefix*/img_timestamp ON /*$wgDBprefix*/[image](img_timestamp)
-CREATE INDEX /*$wgDBprefix*/[img_sha1] ON /*wgDBprefix*/[image](img_sha1)
-
---
--- Previous revisions of uploaded files.
--- Awkwardly, image rows have to be moved into
--- this table at re-upload time.
---
-CREATE TABLE /*$wgDBprefix*/oldimage (
-   oi_name VARCHAR(255) NOT NULL DEFAULT '',
-   oi_archive_name VARCHAR(255) NOT NULL DEFAULT '',
-   oi_size INT NOT NULL DEFAULT 0,
-   oi_width INT NOT NULL DEFAULT 0,
-   oi_height INT NOT NULL DEFAULT 0,
-   oi_bits SMALLINT NOT NULL DEFAULT 0,
-   oi_description NVARCHAR(MAX) NOT NULL,
-   oi_user INT NOT NULL DEFAULT 0,
-   oi_user_text VARCHAR(255) NOT NULL DEFAULT '',
-   oi_timestamp DATETIME NOT NULL DEFAULT GETDATE(),
-   oi_metadata TEXT NOT NULL,
-   oi_media_type NVARCHAR(MAX) DEFAULT 'UNKNOWN',
-   oi_major_mime NVARCHAR(MAX) NOT NULL DEFAULT 'UNKNOWN',
-   oi_minor_mime NVARCHAR(MAX) NOT NULL DEFAULT 'unknown',
-   oi_deleted BIT NOT NULL default 0,
-   oi_sha1 VARCHAR(255) NOT NULL default '',
-);
-CREATE INDEX /*$wgDBprefix*/oi_usertext_timestamp ON /*$wgDBprefix*/oldimage(oi_user_text,oi_timestamp);
-CREATE INDEX /*$wgDBprefix*/oi_name_timestamp ON /*$wgDBprefix*/oldimage(oi_name, oi_timestamp);
-CREATE INDEX /*$wgDBprefix*/oi_name_archive_name ON /*$wgDBprefix*/oldimage(oi_name,oi_archive_name);
-CREATE INDEX /*$wgDBprefix*/[oi_sha1] ON /*$wgDBprefix*/oldimage(oi_sha1);
-
---
--- Record of deleted file data
---
-CREATE TABLE /*$wgDBprefix*/filearchive (
-   fa_id INT NOT NULL PRIMARY KEY,
-   fa_name NVARCHAR(255)  NOT NULL DEFAULT '',
-   fa_archive_name NVARCHAR(255)  DEFAULT '',
-   fa_storage_group NVARCHAR(16),
-   fa_storage_key NVARCHAR(64)  DEFAULT '',
-   fa_deleted_user INT,
-   fa_deleted_timestamp NVARCHAR(14) DEFAULT NULL,
-   fa_deleted_reason NVARCHAR(255),
-   fa_size SMALLINT  DEFAULT 0,
-   fa_width SMALLINT DEFAULT 0,
-   fa_height SMALLINT DEFAULT 0,
-   fa_metadata NVARCHAR(MAX), -- was mediumblob
-   fa_bits SMALLINT DEFAULT 0,
-   fa_media_type NVARCHAR(11) DEFAULT NULL,
-   fa_major_mime NVARCHAR(11) DEFAULT 'unknown',
-   fa_minor_mime NVARCHAR(32) DEFAULT 'unknown',
-   fa_description NVARCHAR(255),
-   fa_user INT DEFAULT 0,
-   fa_user_text NVARCHAR(255) DEFAULT '',
-   fa_timestamp DATETIME DEFAULT GETDATE(),
-   fa_deleted BIT NOT NULL DEFAULT 0,
-);
--- Pick by image name
-CREATE INDEX /*$wgDBprefix*/filearchive_name ON /*$wgDBprefix*/filearchive(fa_name,fa_timestamp);
--- Pick by dupe files
-CREATE INDEX /*$wgDBprefix*/filearchive_dupe ON /*$wgDBprefix*/filearchive(fa_storage_group,fa_storage_key);
--- Pick by deletion time
-CREATE INDEX /*$wgDBprefix*/filearchive_time ON /*$wgDBprefix*/filearchive(fa_deleted_timestamp);
--- Pick by deleter
-CREATE INDEX /*$wgDBprefix*/filearchive_user ON /*$wgDBprefix*/filearchive(fa_deleted_user);
-
---
--- Primarily a summary table for Special:Recentchanges,
--- this table contains some additional info on edits from
--- the last few days, see Article::editUpdates()
---
-CREATE TABLE /*$wgDBprefix*/recentchanges (
-   rc_id INT NOT NULL,
-   rc_timestamp DATETIME DEFAULT GETDATE(),
-   rc_cur_time DATETIME DEFAULT GETDATE(),
-   rc_user INT DEFAULT 0,
-   rc_user_text NVARCHAR(255) DEFAULT '',
-   rc_namespace SMALLINT DEFAULT 0,
-   rc_title NVARCHAR(255)  DEFAULT '',
-   rc_comment NVARCHAR(255) DEFAULT '',
-   rc_minor BIT DEFAULT 0,
-   rc_bot BIT DEFAULT 0,
-   rc_new BIT DEFAULT 0,
-   rc_cur_id INT DEFAULT 0,
-   rc_this_oldid INT DEFAULT 0,
-   rc_last_oldid INT DEFAULT 0,
-   rc_type tinyint DEFAULT 0,
-   rc_patrolled BIT DEFAULT 0,
-   rc_ip NCHAR(40) DEFAULT '',
-   rc_old_len INT DEFAULT 0,
-   rc_new_len INT DEFAULT 0,
-   rc_deleted BIT DEFAULT 0,
-   rc_logid INT DEFAULT 0,
-   rc_log_type NVARCHAR(255) NULL DEFAULT NULL,
-   rc_log_action NVARCHAR(255) NULL DEFAULT NULL,
-   rc_params NVARCHAR(MAX) DEFAULT '',
-);
-CREATE INDEX /*$wgDBprefix*/rc_timestamp       ON /*$wgDBprefix*/recentchanges(rc_timestamp);
-CREATE INDEX /*$wgDBprefix*/rc_namespace_title ON /*$wgDBprefix*/recentchanges(rc_namespace, rc_title);
-CREATE INDEX /*$wgDBprefix*/rc_cur_id          ON /*$wgDBprefix*/recentchanges(rc_cur_id);
-CREATE INDEX /*$wgDBprefix*/new_name_timestamp ON /*$wgDBprefix*/recentchanges(rc_new,rc_namespace,rc_timestamp);
-CREATE INDEX /*$wgDBprefix*/rc_ip              ON /*$wgDBprefix*/recentchanges(rc_ip);
-CREATE INDEX /*$wgDBprefix*/rc_ns_usertext     ON /*$wgDBprefix*/recentchanges(rc_namespace, rc_user_text);
-CREATE INDEX /*$wgDBprefix*/rc_user_text       ON /*$wgDBprefix*/recentchanges(rc_user_text, rc_timestamp);
-;
-
-CREATE TABLE /*$wgDBprefix*/watchlist (
-   wl_user INT NOT NULL,
-   wl_namespace SMALLINT NOT NULL DEFAULT 0,
-   wl_title NVARCHAR(255)  NOT NULL DEFAULT '',
-   wl_notificationtimestamp NVARCHAR(14) DEFAULT NULL,
-
-);
-CREATE UNIQUE INDEX /*$wgDBprefix*/namespace_title ON /*$wgDBprefix*/watchlist(wl_namespace,wl_title);
-
--- Needs fulltext index.
-CREATE TABLE /*$wgDBprefix*/searchindex (
-   si_page INT NOT NULL unique REFERENCES /*$wgDBprefix*/page(page_id) ON DELETE CASCADE,
-   si_title varbinary(max) NOT NULL,
-   si_text varbinary(max) NOT NULL,
-   si_ext CHAR(4) NOT NULL DEFAULT '.txt',
-);
-CREATE FULLTEXT CATALOG wikidb AS DEFAULT;
-CREATE UNIQUE CLUSTERED INDEX searchindex_page ON searchindex (si_page);
-CREATE FULLTEXT INDEX on searchindex (si_title TYPE COLUMN si_ext, si_text  TYPE COLUMN si_ext)
-KEY INDEX searchindex_page
-;
-
--- This table is not used unless profiling is turned on
-CREATE TABLE profiling (
-  pf_count   INTEGER         NOT NULL DEFAULT 0,
-  pf_time    NUMERIC(18,10)  NOT NULL DEFAULT 0,
-  pf_name    NVARCHAR(200)            NOT NULL,
-  pf_server  NVARCHAR(200)            NULL
-);
-CREATE UNIQUE INDEX pf_name_server ON profiling (pf_name, pf_server);
-
---
--- Recognized INTerwiki link prefixes
---
-CREATE TABLE /*$wgDBprefix*/interwiki (
-   iw_prefix NCHAR(32) NOT NULL PRIMARY KEY,
-   iw_url NCHAR(127)   NOT NULL,
-   iw_api TEXT NOT NULL DEFAULT '',
-   iw_wikiid NVARCHAR(64) NOT NULL DEFAULT '',
-   iw_local BIT NOT NULL,
-   iw_trans BIT NOT NULL DEFAULT 0,
-);
-
---
--- Used for caching expensive grouped queries
---
-CREATE TABLE /*$wgDBprefix*/querycache (
-   qc_type      NCHAR(32)  NOT NULL,
-   qc_value     INT       NOT NULL DEFAULT '0',
-   qc_namespace SMALLINT       NOT NULL DEFAULT 0,
-   qc_title     NCHAR(255)  NOT NULL DEFAULT '',
-   CONSTRAINT /*$wgDBprefix*/qc_pk PRIMARY KEY (qc_type,qc_value)
-);
-
---
--- For a few generic cache operations if not using Memcached
---
-CREATE TABLE /*$wgDBprefix*/objectcache (
-   keyname NCHAR(255)  NOT NULL DEFAULT '',
-   [value] NVARCHAR(MAX), -- IMAGE,
-   exptime DATETIME, -- This is treated as a DATETIME
-);
-CREATE CLUSTERED INDEX /*$wgDBprefix*/[objectcache_time] ON /*$wgDBprefix*/objectcache(exptime);
-CREATE UNIQUE INDEX /*$wgDBprefix*/[objectcache_PK] ON /*wgDBprefix*/objectcache(keyname);
---
--- Cache of INTerwiki transclusion
---
-CREATE TABLE /*$wgDBprefix*/transcache (
-   tc_url      NVARCHAR(255)  NOT NULL PRIMARY KEY,
-   tc_contents NVARCHAR(MAX),
-   tc_time     INT NOT NULL,
-);
-
-CREATE TABLE /*$wgDBprefix*/logging (
-   log_id INT  PRIMARY KEY IDENTITY,
-   log_type NCHAR(10) NOT NULL DEFAULT '',
-   log_action NCHAR(10) NOT NULL DEFAULT '',
-   log_timestamp DATETIME NOT NULL DEFAULT GETDATE(),
-   log_user INT NOT NULL DEFAULT 0,
-   log_user_text NVARCHAR(255) NOT NULL DEFAULT '',
-   log_namespace INT NOT NULL DEFAULT 0,
-   log_title NVARCHAR(255)  NOT NULL DEFAULT '',
-   log_page INT NULL DEFAULT NULL,
-   log_comment NVARCHAR(255) NOT NULL DEFAULT '',
-   log_params NVARCHAR(MAX) NOT NULL,
-   log_deleted BIT NOT NULL DEFAULT 0,
-);
-CREATE INDEX /*$wgDBprefix*/type_time ON /*$wgDBprefix*/logging (log_type, log_timestamp);
-CREATE INDEX /*$wgDBprefix*/user_time ON /*$wgDBprefix*/logging (log_user, log_timestamp);
-CREATE INDEX /*$wgDBprefix*/page_time ON /*$wgDBprefix*/logging (log_namespace, log_title, log_timestamp);
-CREATE INDEX /*$wgDBprefix*/times ON /*$wgDBprefix*/logging (log_timestamp);
-CREATE INDEX /*$wgDBprefix*/log_user_type_time ON /*$wgDBprefix*/logging (log_user, log_type, log_timestamp);
-CREATE INDEX /*$wgDBprefix*/log_page_id_time ON /*$wgDBprefix*/logging (log_page,log_timestamp);
-
-CREATE TABLE /*$wgDBprefix*/log_search (
-       -- The type of ID (rev ID, log ID, rev timestamp, username)
-       ls_field NVARCHAR(32) NOT NULL,
-       -- The value of the ID
-       ls_value NVARCHAR(255) NOT NULL,
-       -- Key to log_id
-       ls_log_id INT NOT NULL default 0,
-);
-CREATE UNIQUE INDEX /*$wgDBprefix*/ls_field_val ON /*$wgDBprefix*/log_search (ls_field,ls_value,ls_log_id);
-CREATE INDEX /*$wgDBprefix*/ls_log_id ON /*$wgDBprefix*/log_search (ls_log_id);
-
-
--- Jobs performed by parallel apache threads or a command-line daemon
-CREATE TABLE /*$wgDBprefix*/job (
-   job_id INT NOT NULL  PRIMARY KEY,
-   job_cmd NVARCHAR(200)  NOT NULL DEFAULT '',
-   job_namespace INT NOT NULL,
-   job_title NVARCHAR(200)  NOT NULL,
-   job_params NVARCHAR(255)  NOT NULL,
-);
-CREATE INDEX /*$wgDBprefix*/job_idx ON /*$wgDBprefix*/job(job_cmd,job_namespace,job_title);
-
--- Details of updates to cached special pages
-CREATE TABLE /*$wgDBprefix*/querycache_info (
-   qci_type NVARCHAR(32) NOT NULL DEFAULT '' PRIMARY KEY,
-   qci_timestamp NVARCHAR(14) NOT NULL DEFAULT '19700101000000',
-);
-
--- For each redirect, this table contains exactly one row defining its target
-CREATE TABLE /*$wgDBprefix*/redirect (
-       rd_from INT NOT NULL DEFAULT 0 REFERENCES /*$wgDBprefix*/[page](page_id) ON DELETE CASCADE,
-       rd_namespace SMALLINT NOT NULL DEFAULT '0',
-       rd_title NVARCHAR(255)  NOT NULL DEFAULT '',
-       rd_interwiki NVARCHAR(32) DEFAULT NULL,
-       rd_fragment NVARCHAR(255) DEFAULT NULL,
-);
-CREATE UNIQUE INDEX /*$wgDBprefix*/rd_ns_title ON /*$wgDBprefix*/redirect(rd_namespace,rd_title,rd_from);
-
--- Used for caching expensive grouped queries that need two links (for example double-redirects)
-CREATE TABLE /*$wgDBprefix*/querycachetwo (
-   qcc_type NCHAR(32) NOT NULL,
-   qcc_value INT NOT NULL DEFAULT 0,
-   qcc_namespace INT NOT NULL DEFAULT 0,
-   qcc_title NCHAR(255)  NOT NULL DEFAULT '',
-   qcc_namespacetwo INT NOT NULL DEFAULT 0,
-   qcc_titletwo NCHAR(255)  NOT NULL DEFAULT '',
-   CONSTRAINT /*$wgDBprefix*/qcc_type PRIMARY KEY(qcc_type,qcc_value),
-);
-CREATE UNIQUE INDEX /*$wgDBprefix*/qcc_title    ON /*$wgDBprefix*/querycachetwo(qcc_type,qcc_namespace,qcc_title);
-CREATE UNIQUE INDEX /*$wgDBprefix*/qcc_titletwo ON /*$wgDBprefix*/querycachetwo(qcc_type,qcc_namespacetwo,qcc_titletwo);
-
-
---- Used for storing page restrictions (i.e. protection levels)
-CREATE TABLE /*$wgDBprefix*/page_restrictions (
-   pr_page INT NOT NULL REFERENCES /*$wgDBprefix*/page(page_id) ON DELETE CASCADE,
-   pr_type NVARCHAR(200) NOT NULL,
-   pr_level NVARCHAR(200) NOT NULL,
-   pr_cascade SMALLINT NOT NULL,
-   pr_user INT NULL,
-   pr_expiry DATETIME NULL,
-   pr_id INT UNIQUE IDENTITY,
-   CONSTRAINT /*$wgDBprefix*/pr_pagetype PRIMARY KEY(pr_page,pr_type),
-);
-CREATE INDEX /*$wgDBprefix*/pr_page      ON /*$wgDBprefix*/page_restrictions(pr_page);
-CREATE INDEX /*$wgDBprefix*/pr_typelevel ON /*$wgDBprefix*/page_restrictions(pr_type,pr_level);
-CREATE INDEX /*$wgDBprefix*/pr_pagelevel ON /*$wgDBprefix*/page_restrictions(pr_level);
-CREATE INDEX /*$wgDBprefix*/pr_cascade   ON /*$wgDBprefix*/page_restrictions(pr_cascade);
-;
-
--- Protected titles - nonexistent pages that have been protected
-CREATE TABLE /*$wgDBprefix*/protected_titles (
-  pt_namespace int NOT NULL,
-  pt_title NVARCHAR(255) NOT NULL,
-  pt_user int NOT NULL,
-  pt_reason NVARCHAR(3555),
-  pt_timestamp DATETIME NOT NULL,
-  pt_expiry DATETIME NOT NULL default '',
-  pt_create_perm NVARCHAR(60) NOT NULL,
-  PRIMARY KEY (pt_namespace,pt_title),
-);
-CREATE INDEX /*$wgDBprefix*/pt_timestamp   ON /*$wgDBprefix*/protected_titles(pt_timestamp);
-;
-
--- Name/value pairs indexed by page_id
-CREATE TABLE /*$wgDBprefix*/page_props (
-  pp_page int NOT NULL,
-  pp_propname NVARCHAR(60) NOT NULL,
-  pp_value NVARCHAR(MAX) NOT NULL,
-  PRIMARY KEY (pp_page,pp_propname)
-);
-
--- A table to log updates, one text key row per update.
-CREATE TABLE /*$wgDBprefix*/updatelog (
-  ul_key NVARCHAR(255) NOT NULL,
-  PRIMARY KEY (ul_key)
-);
-
--- NOTE To enable full text indexing on SQL 2008 you need to create an account FDH$MSSQLSERVER
--- AND assign a password for the FDHOST process to run under
--- Once you have assigned a password to that account, you need to run the following stored procedure
--- replacing XXXXX with the password you used.
--- EXEC sp_fulltext_resetfdhostaccount @username = 'FDH$MSSQLSERVER', @password = 'XXXXXX' ;
-
-
---- Add the full-text capabilities, depricated in SQL Server 2005, FTS is enabled on all user created tables by default unless you are using SQL Server 2005 Express
---sp_fulltext_database 'enable';
---sp_fulltext_catalog 'WikiCatalog', 'create'
---sp_fulltext_table
---sp_fulltext_column
---sp_fulltext_table 'Articles', 'activate'
index d4d9f43..cc935da 100644 (file)
@@ -11709,6 +11709,70 @@ MSIE CSS safety test: comment in expression
 
 !! end
 
+!! test
+CSS safety test: vertical tab
+!! input
+<p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
+!! result
+<p style="/* invalid control char */">A</p>
+
+!! end
+
+!! test
+MSIE CSS safety test: Fullwidth
+!! input
+<p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
+<div style="top:EXPRESSION(alert())">B</div>
+!! result
+<p style="/* insecure input */">A</p>
+<div style="/* insecure input */">B</div>
+
+!! end
+
+!! test
+MSIE CSS safety test: IPA extensions
+!! input
+<div style="background-image:uʀʟ(javascript:alert())">A</div>
+<p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
+!! result
+<div style="/* insecure input */">A</div>
+<p style="/* insecure input */">B</p>
+
+!! end
+
+!! test
+MSIE CSS safety test: sup/sub script
+!! input
+<div style="background-image:url⁽javascript:alert())">A</div>
+<div style="background-image:url₍javascript:alert())">B</div>
+<p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
+!! result
+<div style="/* insecure input */">A</div>
+<div style="/* insecure input */">B</div>
+<p style="/* insecure input */">C</p>
+
+!! end
+
+!! test
+MSIE CSS safety test: Repetition markers
+!! input
+<p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
+<p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
+<p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
+<p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
+<p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
+<p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
+<p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
+!! result
+<p style="/* insecure input */">A</p>
+<p style="/* insecure input */">B</p>
+<p style="/* insecure input */">C</p>
+<p style="/* insecure input */">D</p>
+<p style="/* insecure input */">E</p>
+<p style="/* insecure input */">F</p>
+<p style="/* insecure input */">G</p>
+
+!! end
 
 !! test
 Table attribute legitimate extension