Merge "Drop SpecialPage::getTitle()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 10 Jun 2019 05:49:20 +0000 (05:49 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 10 Jun 2019 05:49:20 +0000 (05:49 +0000)
14 files changed:
.travis.yml
docs/extension.schema.v1.json
docs/extension.schema.v2.json
includes/cache/BacklinkCache.php
includes/cache/LinkBatch.php
includes/db/DatabaseOracle.php
includes/libs/objectcache/BagOStuff.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/DatabaseMssql.php
includes/libs/rdbms/database/DatabaseMysqlBase.php
includes/libs/rdbms/database/DatabaseSqlite.php
includes/libs/rdbms/database/IDatabase.php
includes/libs/rdbms/database/IMaintainableDatabase.php
includes/registration/ExtensionJsonValidator.php

index e4a173d..ada60e4 100644 (file)
@@ -58,6 +58,7 @@ addons:
     - tidy
 
 before_script:
+  - echo 'opcache.enable_cli = 1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
   - composer install --prefer-source --quiet --no-interaction
   - if [ "$dbtype" = postgres ]; then psql -c "CREATE DATABASE traviswiki WITH OWNER travis;" -U postgres; fi
   - >
index cf02f2b..86fa1b3 100644 (file)
                },
                "ParserTestFiles": {
                        "type": "array",
-                       "description": "Parser test suite files to be run by parserTests.php when no specific filename is passed to it"
+                       "description": "DEPRECATED: Parser test suite files to be run by parserTests.php when no specific filename is passed to it"
                },
                "ServiceWiringFiles": {
                        "type": "array",
index f29f850..6076581 100644 (file)
                },
                "ParserTestFiles": {
                        "type": "array",
-                       "description": "Parser test suite files to be run by parserTests.php when no specific filename is passed to it"
+                       "description": "DEPRECATED: Parser test suite files to be run by parserTests.php when no specific filename is passed to it"
                },
                "ServiceWiringFiles": {
                        "type": "array",
index 1407271..c2fb52a 100644 (file)
@@ -25,9 +25,9 @@
  * @copyright © 2011, Antoine Musso
  */
 
-use Wikimedia\Rdbms\ResultWrapper;
 use Wikimedia\Rdbms\FakeResultWrapper;
 use Wikimedia\Rdbms\IDatabase;
+use Wikimedia\Rdbms\IResultWrapper;
 use MediaWiki\MediaWikiServices;
 
 /**
@@ -67,7 +67,7 @@ class BacklinkCache {
         *
         * Initialized with BacklinkCache::getLinks()
         * Cleared with BacklinkCache::clear()
-        * @var ResultWrapper[]
+        * @var IResultWrapper[]
         */
        protected $fullResultCache = [];
 
@@ -179,7 +179,7 @@ class BacklinkCache {
         * @param int|bool $endId
         * @param int $max
         * @param string $select 'all' or 'ids'
-        * @return ResultWrapper
+        * @return IResultWrapper
         */
        protected function queryLinks( $table, $startId, $endId, $max, $select = 'all' ) {
                $fromField = $this->getPrefix( $table ) . '_from';
@@ -472,7 +472,7 @@ class BacklinkCache {
 
        /**
         * Partition a DB result with backlinks in it into batches
-        * @param ResultWrapper $res Database result
+        * @param IResultWrapper $res Database result
         * @param int $batchSize
         * @param bool $isComplete Whether $res includes all the backlinks
         * @throws MWException
index 7a0826e..2573f8a 100644 (file)
@@ -22,7 +22,7 @@
  */
 use MediaWiki\Linker\LinkTarget;
 use MediaWiki\MediaWikiServices;
-use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\IResultWrapper;
 use Wikimedia\Rdbms\IDatabase;
 
 /**
@@ -152,7 +152,7 @@ class LinkBatch {
         * parsing to avoid extra DB queries.
         *
         * @param LinkCache $cache
-        * @param ResultWrapper $res
+        * @param IResultWrapper $res
         * @return array Array of remaining titles
         */
        public function addResultToCache( $cache, $res ) {
@@ -188,7 +188,7 @@ class LinkBatch {
 
        /**
         * Perform the existence test query, return a ResultWrapper with page_id fields
-        * @return bool|ResultWrapper
+        * @return bool|IResultWrapper
         */
        public function doQuery() {
                if ( $this->isEmpty() ) {
index f4753d6..5df7aef 100644 (file)
@@ -26,6 +26,7 @@ use Wikimedia\Rdbms\Database;
 use Wikimedia\Rdbms\DatabaseDomain;
 use Wikimedia\Rdbms\Blob;
 use Wikimedia\Rdbms\ResultWrapper;
+use Wikimedia\Rdbms\IResultWrapper;
 use Wikimedia\Rdbms\DBConnectionError;
 use Wikimedia\Rdbms\DBUnexpectedError;
 use Wikimedia\Rdbms\DBExpectedError;
@@ -250,7 +251,7 @@ class DatabaseOracle extends Database {
 
        /**
         * Frees resources associated with the LOB descriptor
-        * @param ResultWrapper|ORAResult $res
+        * @param IResultWrapper|ORAResult $res
         */
        function freeResult( $res ) {
                if ( $res instanceof ResultWrapper ) {
@@ -261,8 +262,8 @@ class DatabaseOracle extends Database {
        }
 
        /**
-        * @param ResultWrapper|ORAResult $res
-        * @return mixed
+        * @param IResultWrapper|ORAResult $res
+        * @return stdClass|bool
         */
        function fetchObject( $res ) {
                if ( $res instanceof ResultWrapper ) {
@@ -273,8 +274,8 @@ class DatabaseOracle extends Database {
        }
 
        /**
-        * @param ResultWrapper|ORAResult $res
-        * @return mixed
+        * @param IResultWrapper|ORAResult $res
+        * @return stdClass|bool
         */
        function fetchRow( $res ) {
                if ( $res instanceof ResultWrapper ) {
@@ -285,7 +286,7 @@ class DatabaseOracle extends Database {
        }
 
        /**
-        * @param ResultWrapper|ORAResult $res
+        * @param IResultWrapper|ORAResult $res
         * @return int
         */
        function numRows( $res ) {
@@ -297,7 +298,7 @@ class DatabaseOracle extends Database {
        }
 
        /**
-        * @param ResultWrapper|ORAResult $res
+        * @param IResultWrapper|ORAResult $res
         * @return int
         */
        function numFields( $res ) {
index 0dd7b57..321476b 100644 (file)
@@ -806,15 +806,17 @@ abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface {
        }
 
        /**
+        * @internal For testing only
         * @return float UNIX timestamp
         * @codeCoverageIgnore
         */
-       protected function getCurrentTime() {
+       public function getCurrentTime() {
                return $this->wallClockOverride ?: microtime( true );
        }
 
        /**
-        * @param float|null &$time Mock UNIX timestamp for testing
+        * @internal For testing only
+        * @param float|null &$time Mock UNIX timestamp
         * @codeCoverageIgnore
         */
        public function setMockTime( &$time ) {
index de9ea55..fe23a38 100644 (file)
@@ -1284,7 +1284,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
         * @param string $commentedSql SQL query with debugging/trace comment
         * @param bool $isEffectiveWrite Whether the query is a (non-temporary table) write
         * @param string $fname Name of the calling function
-        * @return bool|ResultWrapper True for a successful write query, ResultWrapper
+        * @return bool|IResultWrapper True for a successful write query, ResultWrapper
         *     object for a successful read query, or false on failure
         */
        private function attemptQuery( $sql, $commentedSql, $isEffectiveWrite, $fname ) {
@@ -4112,8 +4112,8 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
         * a wrapper. Nowadays, raw database objects are never exposed to external
         * callers, so this is unnecessary in external code.
         *
-        * @param bool|ResultWrapper|resource $result
-        * @return bool|ResultWrapper
+        * @param bool|IResultWrapper|resource $result
+        * @return bool|IResultWrapper
         */
        protected function resultObject( $result ) {
                if ( !$result ) {
@@ -4603,7 +4603,7 @@ abstract class Database implements IDatabase, IMaintainableDatabase, LoggerAware
         * Delete a table
         * @param string $tableName
         * @param string $fName
-        * @return bool|ResultWrapper
+        * @return bool|IResultWrapper
         * @since 1.18
         */
        public function dropTable( $tableName, $fName = __METHOD__ ) {
index 6d266ae..a532ec2 100644 (file)
@@ -1358,7 +1358,7 @@ class DatabaseMssql extends Database {
         * Delete a table
         * @param string $tableName
         * @param string $fName
-        * @return bool|ResultWrapper
+        * @return bool|IResultWrapper
         * @since 1.18
         */
        public function dropTable( $tableName, $fName = __METHOD__ ) {
index 36c947f..6d28717 100644 (file)
@@ -277,7 +277,7 @@ abstract class DatabaseMysqlBase extends Database {
        abstract protected function mysqlSetCharset( $charset );
 
        /**
-        * @param ResultWrapper|resource $res
+        * @param IResultWrapper|resource $res
         * @throws DBUnexpectedError
         */
        public function freeResult( $res ) {
@@ -301,7 +301,7 @@ abstract class DatabaseMysqlBase extends Database {
        abstract protected function mysqlFreeResult( $res );
 
        /**
-        * @param ResultWrapper|resource $res
+        * @param IResultWrapper|resource $res
         * @return stdClass|bool
         * @throws DBUnexpectedError
         */
@@ -374,7 +374,7 @@ abstract class DatabaseMysqlBase extends Database {
 
        /**
         * @throws DBUnexpectedError
-        * @param ResultWrapper|resource $res
+        * @param IResultWrapper|resource $res
         * @return int
         */
        function numRows( $res ) {
@@ -402,7 +402,7 @@ abstract class DatabaseMysqlBase extends Database {
        abstract protected function mysqlNumRows( $res );
 
        /**
-        * @param ResultWrapper|resource $res
+        * @param IResultWrapper|resource $res
         * @return int
         */
        public function numFields( $res ) {
@@ -422,7 +422,7 @@ abstract class DatabaseMysqlBase extends Database {
        abstract protected function mysqlNumFields( $res );
 
        /**
-        * @param ResultWrapper|resource $res
+        * @param IResultWrapper|resource $res
         * @param int $n
         * @return string
         */
@@ -437,7 +437,7 @@ abstract class DatabaseMysqlBase extends Database {
        /**
         * Get the name of the specified field in a result
         *
-        * @param ResultWrapper|resource $res
+        * @param IResultWrapper|resource $res
         * @param int $n
         * @return string
         */
@@ -445,7 +445,7 @@ abstract class DatabaseMysqlBase extends Database {
 
        /**
         * mysql_field_type() wrapper
-        * @param ResultWrapper|resource $res
+        * @param IResultWrapper|resource $res
         * @param int $n
         * @return string
         */
@@ -460,14 +460,14 @@ abstract class DatabaseMysqlBase extends Database {
        /**
         * Get the type of the specified field in a result
         *
-        * @param ResultWrapper|resource $res
+        * @param IResultWrapper|resource $res
         * @param int $n
         * @return string
         */
        abstract protected function mysqlFieldType( $res, $n );
 
        /**
-        * @param ResultWrapper|resource $res
+        * @param IResultWrapper|resource $res
         * @param int $row
         * @return bool
         */
@@ -482,7 +482,7 @@ abstract class DatabaseMysqlBase extends Database {
        /**
         * Move internal result pointer
         *
-        * @param ResultWrapper|resource $res
+        * @param IResultWrapper|resource $res
         * @param int $row
         * @return bool
         */
@@ -1490,7 +1490,7 @@ abstract class DatabaseMysqlBase extends Database {
        /**
         * @param string $tableName
         * @param string $fName
-        * @return bool|ResultWrapper
+        * @return bool|IResultWrapper
         */
        public function dropTable( $tableName, $fName = __METHOD__ ) {
                if ( !$this->tableExists( $tableName, $fName ) ) {
index c9942a5..8e1b06d 100644 (file)
@@ -303,7 +303,7 @@ class DatabaseSqlite extends Database {
         * @param bool|string $file Database file name. If omitted, will be generated
         *   using $name and configured data directory
         * @param string $fname Calling function name
-        * @return ResultWrapper
+        * @return IResultWrapper
         */
        function attachDatabase( $name, $file = false, $fname = __METHOD__ ) {
                if ( !$file ) {
@@ -330,7 +330,7 @@ class DatabaseSqlite extends Database {
         * SQLite doesn't allow buffered results or data seeking etc, so we'll use fetchAll as the result
         *
         * @param string $sql
-        * @return bool|ResultWrapper
+        * @return bool|IResultWrapper
         */
        protected function doQuery( $sql ) {
                $res = $this->getBindingHandle()->query( $sql );
@@ -346,7 +346,7 @@ class DatabaseSqlite extends Database {
        }
 
        /**
-        * @param ResultWrapper|mixed $res
+        * @param IResultWrapper|mixed $res
         */
        function freeResult( $res ) {
                if ( $res instanceof ResultWrapper ) {
@@ -357,7 +357,7 @@ class DatabaseSqlite extends Database {
        }
 
        /**
-        * @param ResultWrapper|array $res
+        * @param IResultWrapper|array $res
         * @return stdClass|bool
         */
        function fetchObject( $res ) {
@@ -384,7 +384,7 @@ class DatabaseSqlite extends Database {
        }
 
        /**
-        * @param ResultWrapper|mixed $res
+        * @param IResultWrapper|mixed $res
         * @return array|bool
         */
        function fetchRow( $res ) {
@@ -406,7 +406,7 @@ class DatabaseSqlite extends Database {
        /**
         * The PDO::Statement class implements the array interface so count() will work
         *
-        * @param ResultWrapper|array|false $res
+        * @param IResultWrapper|array|false $res
         * @return int
         */
        function numRows( $res ) {
@@ -417,7 +417,7 @@ class DatabaseSqlite extends Database {
        }
 
        /**
-        * @param ResultWrapper $res
+        * @param IResultWrapper $res
         * @return int
         */
        function numFields( $res ) {
@@ -432,7 +432,7 @@ class DatabaseSqlite extends Database {
        }
 
        /**
-        * @param ResultWrapper $res
+        * @param IResultWrapper $res
         * @param int $n
         * @return bool
         */
@@ -474,7 +474,7 @@ class DatabaseSqlite extends Database {
        }
 
        /**
-        * @param ResultWrapper|array $res
+        * @param IResultWrapper|array $res
         * @param int $row
         */
        function dataSeek( $res, $row ) {
@@ -990,7 +990,7 @@ class DatabaseSqlite extends Database {
         * @param string $newName
         * @param bool $temporary
         * @param string $fname
-        * @return bool|ResultWrapper
+        * @return bool|IResultWrapper
         * @throws RuntimeException
         */
        function duplicateTableStructure( $oldName, $newName, $temporary = false, $fname = __METHOD__ ) {
@@ -1086,7 +1086,7 @@ class DatabaseSqlite extends Database {
         *
         * @param string $tableName
         * @param string $fName
-        * @return bool|ResultWrapper
+        * @return bool|IResultWrapper
         * @throws DBReadOnlyError
         */
        public function dropTable( $tableName, $fName = __METHOD__ ) {
index 333bd81..90e30fa 100644 (file)
@@ -217,7 +217,7 @@ interface IDatabase {
         * the LB info array is set to that parameter. If it is called with two
         * parameters, the member with the given name is set to the given value.
         *
-        * @param string $name
+        * @param array|string $name
         * @param array|null $value
         */
        public function setLBInfo( $name, $value = null );
index 5706435..28e94a0 100644 (file)
@@ -150,7 +150,7 @@ interface IMaintainableDatabase extends IDatabase {
         * Delete a table
         * @param string $tableName
         * @param string $fName
-        * @return bool|ResultWrapper
+        * @return bool|IResultWrapper
         */
        public function dropTable( $tableName, $fName = __METHOD__ );
 
@@ -303,7 +303,7 @@ interface IMaintainableDatabase extends IDatabase {
         * @param string $table Table name
         * @param string $field Field name
         *
-        * @return Field
+        * @return false|Field
         */
        public function fieldInfo( $table, $field );
 }
index ba5df52..0d95b22 100644 (file)
@@ -141,6 +141,12 @@ class ExtensionJsonValidator {
                        }
                }
 
+               // Deprecated stuff
+               if ( isset( $data->ParserTestFiles ) ) {
+                       // phpcs:ignore Generic.Files.LineLength.TooLong
+                       $extraErrors[] = '[ParserTestFiles] DEPRECATED: see <https://www.mediawiki.org/wiki/Manual:Extension.json/Schema#ParserTestFiles>';
+               }
+
                $validator = new Validator;
                $validator->check( $data, (object)[ '$ref' => 'file://' . $schemaPath ] );
                if ( $validator->isValid() && !$extraErrors ) {