/**
* @var string Set by subclasses
*/
- protected static $notMinimumVerisonMessage;
+ protected static $notMinimumVersionMessage;
/**
* The database connection.
public static function meetsMinimumRequirement( $serverVersion ) {
if ( version_compare( $serverVersion, static::$minimumVersion ) < 0 ) {
return Status::newFatal(
- static::$notMinimumVerisonMessage, static::$minimumVersion, $serverVersion
+ static::$notMinimumVersionMessage, static::$minimumVersion, $serverVersion
);
}
// SQL Server 2005 RTM
// @todo Are SQL Express version numbers different?)
public static $minimumVersion = '9.00.1399';
- protected static $notMinimumVerisonMessage = 'config-mssql-old';
+ protected static $notMinimumVersionMessage = 'config-mssql-old';
// These are schema-level privs
// Note: the web user will be created will full permissions if possible, this permission
public $supportedEngines = [ 'InnoDB', 'MyISAM' ];
public static $minimumVersion = '5.5.8';
- protected static $notMinimumVerisonMessage = 'config-mysql-old';
+ protected static $notMinimumVersionMessage = 'config-mysql-old';
public $webUserPrivs = [
'DELETE',
];
public static $minimumVersion = '9.0.1'; // 9iR1
- protected static $notMinimumVerisonMessage = 'config-oracle-old';
+ protected static $notMinimumVersionMessage = 'config-oracle-old';
protected $connError = null;
];
public static $minimumVersion = '9.2';
- protected static $notMinimumVerisonMessage = 'config-postgres-old';
+ protected static $notMinimumVersionMessage = 'config-postgres-old';
public $maxRoleSearchDepth = 5;
protected $pgConns = [];
class SqliteInstaller extends DatabaseInstaller {
public static $minimumVersion = '3.8.0';
- protected static $notMinimumVerisonMessage = 'config-outdated-sqlite';
+ protected static $notMinimumVersionMessage = 'config-outdated-sqlite';
/**
* @var DatabaseSqlite
$mime = 'application/zip';
$opendocTypes = [
+ # In OASIS Open Document Format v1.2, Database front end document
+ # has a recommended MIME type of:
+ # application/vnd.oasis.opendocument.base
+ # Despite the type registered at the IANA being 'database' which is
+ # supposed to be normative.
+ # T35515
+ 'base',
+
'chart-template',
'chart',
'formula-template',
'text-web',
'text' ];
- // https://lists.oasis-open.org/archives/office/200505/msg00006.html
+ // The list of document types is available in OASIS Open Document
+ // Format version 1.2 under Appendix C. It is not normative though,
+ // supposedly types registered at the IANA should be.
+ // http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html
$types = '(?:' . implode( '|', $opendocTypes ) . ')';
$opendocRegex = "/^mimetype(application\/vnd\.oasis\.opendocument\.$types)/";
public $stack, $rootAccum;
/**
- * @var PPDStack
+ * @var PPDStack|false
*/
public $top;
public $out;
/**
* @throws MWException
* @param string|int $key
- * @param string|PPNode_DOM|DOMDocument $root
+ * @param string|PPNode_DOM|DOMNode|DOMNodeList $root
* @param int $flags
* @return string
*/
/**
* @throws MWException
- * @param string|PPNode_DOM|DOMDocument $root
+ * @param string|PPNode_DOM|DOMNode $root
* @param int $flags
* @return string
*/
/**
* @param string $sep
* @param int $flags
- * @param string|PPNode_DOM|DOMDocument ...$args
+ * @param string|PPNode_DOM|DOMNode ...$args
* @return string
*/
public function implodeWithFlags( $sep, $flags, ...$args ) {
* This previously called implodeWithFlags but has now been inlined to reduce stack depth
*
* @param string $sep
- * @param string|PPNode_DOM|DOMDocument ...$args
+ * @param string|PPNode_DOM|DOMNode ...$args
* @return string
*/
public function implode( $sep, ...$args ) {
* with implode()
*
* @param string $sep
- * @param string|PPNode_DOM|DOMDocument ...$args
+ * @param string|PPNode_DOM|DOMNode ...$args
* @return array
*/
public function virtualImplode( $sep, ...$args ) {
* @param string $start
* @param string $sep
* @param string $end
- * @param string|PPNode_DOM|DOMDocument ...$args
+ * @param string|PPNode_DOM|DOMNode ...$args
* @return array
*/
public function virtualBracketedImplode( $start, $sep, $end, ...$args ) {
/**
* Get an array-type node containing the children of this node.
* Returns false if this is not a tree node.
- * @return PPNode
+ * @return false|PPNode
*/
public function getChildren();
/**
* Get the first child of a tree node. False if there isn't one.
*
- * @return PPNode
+ * @return false|PPNode
*/
public function getFirstChild();
/**
* Get the next sibling of any node. False if there isn't one
- * @return PPNode
+ * @return false|PPNode
*/
public function getNextSibling();
* Get all children of this tree node which have a given name.
* Returns an array-type node, or false if this is not a tree node.
* @param string $type
- * @return bool|PPNode
+ * @return false|PPNode
*/
public function getChildrenOfType( $type );
class PPNode_DOM implements PPNode {
/**
- * @var DOMElement
+ * @var DOMElement|DOMNodeList
*/
public $node;
public $xpath;
}
/**
- * @return bool|PPNode_DOM
+ * @return false|PPNode_DOM
*/
public function getChildren() {
return $this->node->childNodes ? new self( $this->node->childNodes ) : false;
}
/**
- * @return bool|PPNode_DOM
+ * @return false|PPNode_DOM
*/
public function getFirstChild() {
return $this->node->firstChild ? new self( $this->node->firstChild ) : false;
}
/**
- * @return bool|PPNode_DOM
+ * @return false|PPNode_DOM
*/
public function getNextSibling() {
return $this->node->nextSibling ? new self( $this->node->nextSibling ) : false;
/**
* @param string $type
*
- * @return bool|PPNode_DOM
+ * @return false|PPNode_DOM
*/
public function getChildrenOfType( $type ) {
return new self( $this->getXPath()->query( $type, $this->node ) );
* return a temporary proxy object: different instances will be returned
* if this is called more than once on the same node.
*
- * @return PPNode_Hash_Tree|PPNode_Hash_Attr|PPNode_Hash_Text|bool
+ * @return PPNode_Hash_Tree|PPNode_Hash_Attr|PPNode_Hash_Text|false
*/
public function getFirstChild() {
if ( !isset( $this->rawChildren[0] ) ) {
* return a temporary proxy object: different instances will be returned
* if this is called more than once on the same node.
*
- * @return PPNode_Hash_Tree|PPNode_Hash_Attr|PPNode_Hash_Text|bool
+ * @return PPNode_Hash_Tree|PPNode_Hash_Attr|PPNode_Hash_Text|false
*/
public function getNextSibling() {
return self::factory( $this->store, $this->index + 1 );
public $mLinkID;
public $mIncludeSizes, $mPPNodeCount, $mGeneratedPPNodeCount, $mHighestExpansionDepth;
public $mDefaultSort;
- public $mTplRedirCache, $mTplDomCache, $mHeadings, $mDoubleUnderscores;
+ public $mTplRedirCache, $mHeadings, $mDoubleUnderscores;
public $mExpensiveFunctionCount; # number of expensive parser function calls
public $mShowToc, $mForceTocPosition;
+ /** @var array */
+ public $mTplDomCache;
/**
* @var User
* self::OT_HTML: all templates and extension tags
*
* @param string $text The text to transform
- * @param bool|PPFrame $frame Object describing the arguments passed to the
+ * @param false|PPFrame|array $frame Object describing the arguments passed to the
* template. Arguments may also be provided as an associative array, as
* was the usual case before MW1.12. Providing arguments this way may be
* useful for extensions wishing to perform variable replacement
* $piece['lineStart']: whether the brace was at the start of a line
* @param PPFrame $frame The current frame, contains template arguments
* @throws Exception
- * @return string The text of the template
+ * @return string|array The text of the template
*/
public function braceSubstitution( $piece, $frame ) {
// Flags
const CACHE_PREFIX = 'preprocess-xml';
+ /**
+ * @param Parser $parser
+ */
public function __construct( $parser ) {
wfDeprecated( __METHOD__, '1.34' ); // T204945
$this->parser = $parser;
const CACHE_PREFIX = 'preprocess-hash';
const CACHE_VERSION = 2;
+ /**
+ * @param Parser $parser
+ */
public function __construct( $parser ) {
$this->parser = $parser;
}
$actualType = $this->doGuessMimeType( [ $file, 'doc' ] );
$this->assertEquals( 'application/msword', $actualType );
}
+
+ /**
+ * @covers MimeAnalyzer::detectZipType
+ * @dataProvider provideOpendocumentsformatHeaders
+ */
+ function testDetectZipTypeRecognizesOpendocuments( $expected, $header ) {
+ $this->assertEquals(
+ $expected,
+ $this->mimeAnalyzer->detectZipType( $header )
+ );
+ }
+
+ /**
+ * An ODF file is a ZIP file of multiple files. The first one being
+ * 'mimetype' and is not compressed.
+ */
+ function provideOpendocumentsformatHeaders() {
+ $thirtychars = str_repeat( 0, 30 );
+ return [
+ 'Database front end document header based on ODF 1.2' => [
+ 'application/vnd.oasis.opendocument.base',
+ $thirtychars . 'mimetypeapplication/vnd.oasis.opendocument.basePK',
+ ],
+ ];
+ }
+
}
$user = User::newFromName( 'UTSysop' );
try {
- $executor->executeSpecialPage( $page, '', null, null, $user );
+ $executor->executeSpecialPage( $page, '', null, 'qqx', $user );
} catch ( \PHPUnit\Framework\Error\Deprecated $deprecated ) {
// Allow deprecation,
// this test want to check fatals or other things breaking the extension