mirror of
https://github.com/Universal-Omega/DynamicPageList3
synced 2024-11-24 00:04:19 +00:00
Support MediaWiki 1.39 for actor and templatelinks migration (#188)
This adds support for 1.39, and drops support for older versions, since 1.39 is the current LTS release.
This commit is contained in:
parent
afb60b4105
commit
8dd8d03d61
160
.github/workflows/mediawiki-tests.yml
vendored
160
.github/workflows/mediawiki-tests.yml
vendored
|
@ -13,41 +13,13 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
# Latest stable MediaWiki - PHP 7.3 (phan)
|
|
||||||
- mw: 'REL1_36'
|
|
||||||
php: 7.3
|
|
||||||
php-docker: 73
|
|
||||||
experimental: false
|
|
||||||
stage: phan
|
|
||||||
|
|
||||||
# Latest stable MediaWiki - PHP 7.4 (phan)
|
# Latest stable MediaWiki - PHP 7.4 (phan)
|
||||||
- mw: 'REL1_36'
|
- mw: 'REL1_39'
|
||||||
php: 7.4
|
php: 7.4
|
||||||
php-docker: 74
|
php-docker: 74
|
||||||
experimental: false
|
experimental: false
|
||||||
stage: phan
|
stage: phan
|
||||||
|
|
||||||
# Latest MediaWiki release branch - PHP 7.3 (phan)
|
|
||||||
- mw: 'REL1_37'
|
|
||||||
php: 7.3
|
|
||||||
php-docker: 73
|
|
||||||
experimental: true
|
|
||||||
stage: phan
|
|
||||||
|
|
||||||
# Latest MediaWiki release branch - PHP 7.4 (phan)
|
|
||||||
- mw: 'REL1_37'
|
|
||||||
php: 7.4
|
|
||||||
php-docker: 74
|
|
||||||
experimental: true
|
|
||||||
stage: phan
|
|
||||||
|
|
||||||
# Latest MediaWiki master - PHP 7.3 (phan)
|
|
||||||
- mw: 'master'
|
|
||||||
php: 7.3
|
|
||||||
php-docker: 73
|
|
||||||
experimental: true
|
|
||||||
stage: phan
|
|
||||||
|
|
||||||
# Latest MediaWiki master - PHP 7.4 (phan)
|
# Latest MediaWiki master - PHP 7.4 (phan)
|
||||||
- mw: 'master'
|
- mw: 'master'
|
||||||
php: 7.4
|
php: 7.4
|
||||||
|
@ -55,62 +27,20 @@ jobs:
|
||||||
experimental: true
|
experimental: true
|
||||||
stage: phan
|
stage: phan
|
||||||
|
|
||||||
# Latest stable MediaWiki - PHP 7.3 (coverage)
|
# Latest MediaWiki master - PHP 7.4 (coverage)
|
||||||
- mw: 'REL1_36'
|
|
||||||
php: 7.3
|
|
||||||
php-docker: 73
|
|
||||||
experimental: false
|
|
||||||
stage: coverage
|
|
||||||
|
|
||||||
# Latest MediaWiki release branch - PHP 7.3 (coverage)
|
|
||||||
- mw: 'REL1_37'
|
|
||||||
php: 7.3
|
|
||||||
php-docker: 73
|
|
||||||
experimental: false
|
|
||||||
stage: coverage
|
|
||||||
|
|
||||||
# Latest MediaWiki master - PHP 7.3 (coverage)
|
|
||||||
- mw: 'master'
|
- mw: 'master'
|
||||||
php: 7.3
|
php: 7.4
|
||||||
php-docker: 73
|
php-docker: 74
|
||||||
experimental: false
|
experimental: false
|
||||||
stage: coverage
|
stage: coverage
|
||||||
|
|
||||||
# Latest stable MediaWiki - PHP 7.3 (phpunit-unit)
|
|
||||||
- mw: 'REL1_36'
|
|
||||||
php: 7.3
|
|
||||||
php-docker: 73
|
|
||||||
experimental: false
|
|
||||||
stage: phpunit-unit
|
|
||||||
|
|
||||||
# Latest stable MediaWiki - PHP 7.4 (phpunit-unit)
|
# Latest stable MediaWiki - PHP 7.4 (phpunit-unit)
|
||||||
- mw: 'REL1_36'
|
- mw: 'REL1_39'
|
||||||
php: 7.4
|
php: 7.4
|
||||||
php-docker: 74
|
php-docker: 74
|
||||||
experimental: false
|
experimental: false
|
||||||
stage: phpunit-unit
|
stage: phpunit-unit
|
||||||
|
|
||||||
# Latest MediaWiki release branch - PHP 7.3 (phpunit-unit)
|
|
||||||
- mw: 'REL1_37'
|
|
||||||
php: 7.3
|
|
||||||
php-docker: 73
|
|
||||||
experimental: false
|
|
||||||
stage: phpunit-unit
|
|
||||||
|
|
||||||
# Latest MediaWiki release branch - PHP 7.4 (phpunit-unit)
|
|
||||||
- mw: 'REL1_37'
|
|
||||||
php: 7.4
|
|
||||||
php-docker: 74
|
|
||||||
experimental: false
|
|
||||||
stage: phpunit-unit
|
|
||||||
|
|
||||||
# Latest MediaWiki master - PHP 7.3 (phpunit-unit)
|
|
||||||
- mw: 'master'
|
|
||||||
php: 7.3
|
|
||||||
php-docker: 73
|
|
||||||
experimental: false
|
|
||||||
stage: phpunit-unit
|
|
||||||
|
|
||||||
# Latest MediaWiki master - PHP 7.4 (phpunit-unit)
|
# Latest MediaWiki master - PHP 7.4 (phpunit-unit)
|
||||||
- mw: 'master'
|
- mw: 'master'
|
||||||
php: 7.4
|
php: 7.4
|
||||||
|
@ -118,41 +48,13 @@ jobs:
|
||||||
experimental: false
|
experimental: false
|
||||||
stage: phpunit-unit
|
stage: phpunit-unit
|
||||||
|
|
||||||
# Latest stable MediaWiki - PHP 7.3 (phpunit)
|
|
||||||
- mw: 'REL1_36'
|
|
||||||
php: 7.3
|
|
||||||
php-docker: 73
|
|
||||||
experimental: false
|
|
||||||
stage: phpunit
|
|
||||||
|
|
||||||
# Latest stable MediaWiki - PHP 7.4 (phpunit)
|
# Latest stable MediaWiki - PHP 7.4 (phpunit)
|
||||||
- mw: 'REL1_36'
|
- mw: 'REL1_39'
|
||||||
php: 7.4
|
php: 7.4
|
||||||
php-docker: 74
|
php-docker: 74
|
||||||
experimental: false
|
experimental: false
|
||||||
stage: phpunit
|
stage: phpunit
|
||||||
|
|
||||||
# Latest MediaWiki release branch - PHP 7.3 (phpunit)
|
|
||||||
- mw: 'REL1_37'
|
|
||||||
php: 7.3
|
|
||||||
php-docker: 73
|
|
||||||
experimental: false
|
|
||||||
stage: phpunit
|
|
||||||
|
|
||||||
# Latest MediaWiki release branch - PHP 7.4 (phpunit)
|
|
||||||
- mw: 'REL1_37'
|
|
||||||
php: 7.4
|
|
||||||
php-docker: 74
|
|
||||||
experimental: false
|
|
||||||
stage: phpunit
|
|
||||||
|
|
||||||
# Latest MediaWiki master - PHP 7.3 (phpunit)
|
|
||||||
- mw: 'master'
|
|
||||||
php: 7.3
|
|
||||||
php-docker: 73
|
|
||||||
experimental: false
|
|
||||||
stage: phpunit
|
|
||||||
|
|
||||||
# Latest MediaWiki master - PHP 7.4 (phpunit)
|
# Latest MediaWiki master - PHP 7.4 (phpunit)
|
||||||
- mw: 'master'
|
- mw: 'master'
|
||||||
php: 7.4
|
php: 7.4
|
||||||
|
@ -160,52 +62,38 @@ jobs:
|
||||||
experimental: false
|
experimental: false
|
||||||
stage: phpunit
|
stage: phpunit
|
||||||
|
|
||||||
# Latest stable MediaWiki - PHP 7.3 (selenium)
|
# Latest stable MediaWiki - PHP 7.4 (selenium)
|
||||||
- mw: 'REL1_36'
|
- mw: 'REL1_39'
|
||||||
php: 7.3
|
php: 7.4
|
||||||
php-docker: 73
|
php-docker: 74
|
||||||
experimental: false
|
experimental: false
|
||||||
stage: selenium
|
stage: selenium
|
||||||
|
|
||||||
# Latest MediaWiki release branch - PHP 7.3 (selenium)
|
# Latest MediaWiki master - PHP 7.4 (selenium)
|
||||||
- mw: 'REL1_37'
|
|
||||||
php: 7.3
|
|
||||||
php-docker: 73
|
|
||||||
experimental: false
|
|
||||||
stage: selenium
|
|
||||||
|
|
||||||
# Latest MediaWiki master - PHP 7.3 (selenium)
|
|
||||||
- mw: 'master'
|
- mw: 'master'
|
||||||
php: 7.3
|
php: 7.4
|
||||||
php-docker: 73
|
php-docker: 74
|
||||||
experimental: false
|
experimental: false
|
||||||
stage: selenium
|
stage: selenium
|
||||||
|
|
||||||
# Latest stable MediaWiki - PHP 7.3 (qunit)
|
# Latest stable MediaWiki - PHP 7.4 (qunit)
|
||||||
- mw: 'REL1_36'
|
- mw: 'REL1_39'
|
||||||
php: 7.3
|
php: 7.4
|
||||||
php-docker: 73
|
php-docker: 74
|
||||||
experimental: false
|
experimental: false
|
||||||
stage: qunit
|
stage: qunit
|
||||||
|
|
||||||
# Latest MediaWiki release branch - PHP 7.3 (qunit)
|
# Latest MediaWiki master - PHP 7.4 (qunit)
|
||||||
- mw: 'REL1_37'
|
|
||||||
php: 7.3
|
|
||||||
php-docker: 73
|
|
||||||
experimental: false
|
|
||||||
stage: qunit
|
|
||||||
|
|
||||||
# Latest MediaWiki master - PHP 7.3 (qunit)
|
|
||||||
- mw: 'master'
|
- mw: 'master'
|
||||||
php: 7.3
|
php: 7.4
|
||||||
php-docker: 73
|
php-docker: 74
|
||||||
experimental: false
|
experimental: false
|
||||||
stage: qunit
|
stage: qunit
|
||||||
|
|
||||||
# Latest stable MediaWiki - PHP 7.3 (composer-test)
|
# Latest stable MediaWiki - PHP 7.4 (composer-test)
|
||||||
- mw: 'REL1_37'
|
- mw: 'REL1_39'
|
||||||
php: 7.3
|
php: 7.4
|
||||||
php-docker: 73
|
php-docker: 74
|
||||||
experimental: false
|
experimental: false
|
||||||
stage: composer-test
|
stage: composer-test
|
||||||
|
|
||||||
|
|
16
CHANGELOG.md
16
CHANGELOG.md
|
@ -787,3 +787,19 @@ Many thanks to GreenReaper on GitHub for reporting and finding issues with core
|
||||||
* Updated CreateTemplate to mention DPL3, not DPL
|
* Updated CreateTemplate to mention DPL3, not DPL
|
||||||
* Used database update maintenance script for creating VIEW
|
* Used database update maintenance script for creating VIEW
|
||||||
* Added additional isset check for mTemplatePath
|
* Added additional isset check for mTemplatePath
|
||||||
|
|
||||||
|
# Version 3.5.0
|
||||||
|
* Dropped `revision_actor_temp` support and completed actor migration
|
||||||
|
* Added support for `templatelinks` migration
|
||||||
|
* Added support for MediaWiki 1.39 and dropped support for older MediaWiki versions (before 1.39.0)
|
||||||
|
* Dropped official support for PHP versions before PHP 7.4.3, because MediaWiki 1.39 does not support older PHP versions anymore
|
||||||
|
* Fixed installing via composer version 2.2.1 and later
|
||||||
|
* Fixed using imagecontainer with openreferences
|
||||||
|
* Replaced usages of `intval()` with `(int)` in Query.php and Parse.php
|
||||||
|
* Swapped order of mapping for `Query::addTables()` from `[ alias => table ]` to `[ table => alias ]`
|
||||||
|
* Replaced usages of deprecated `wfGetDB()`
|
||||||
|
* Replaced usages of deprecated `Parser::getTitle()`
|
||||||
|
* Replaced usage of deprecated `Title::isProtected()`
|
||||||
|
* Replaced usage of deprecated `User::matchEditToken()`
|
||||||
|
* Replaced usage of deprecated `Article::doDelete()`
|
||||||
|
* Added `null` checks on `Parser::getPage()` and `ParserOutput` before using to avoid fatals
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "DynamicPageList3",
|
"name": "DynamicPageList3",
|
||||||
"version": "3.4.6",
|
"version": "3.5.0",
|
||||||
"author": [
|
"author": [
|
||||||
"'''Universal Omega'''",
|
"'''Universal Omega'''",
|
||||||
"Alexia E. Smith",
|
"Alexia E. Smith",
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
"license-name": "GPL-3.0-or-later",
|
"license-name": "GPL-3.0-or-later",
|
||||||
"type": "parserhook",
|
"type": "parserhook",
|
||||||
"requires": {
|
"requires": {
|
||||||
"MediaWiki": ">= 1.35.3"
|
"MediaWiki": ">= 1.39.0"
|
||||||
},
|
},
|
||||||
"GroupPermissions": {
|
"GroupPermissions": {
|
||||||
"sysop": {
|
"sysop": {
|
||||||
|
|
|
@ -210,8 +210,8 @@ class Article {
|
||||||
$article = new self( $title, $pageNamespace );
|
$article = new self( $title, $pageNamespace );
|
||||||
|
|
||||||
$revActorName = null;
|
$revActorName = null;
|
||||||
if ( isset( $row->revactor_actor ) ) {
|
if ( isset( $row->rev_actor ) ) {
|
||||||
$revActorName = $userFactory->newFromActorId( $row->revactor_actor )->getName();
|
$revActorName = $userFactory->newFromActorId( $row->rev_actor )->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
$titleText = $title->getText();
|
$titleText = $title->getText();
|
||||||
|
@ -286,9 +286,9 @@ class Article {
|
||||||
if ( $parameters->getParameter( 'goal' ) != 'categories' ) {
|
if ( $parameters->getParameter( 'goal' ) != 'categories' ) {
|
||||||
// REVISION SPECIFIED
|
// REVISION SPECIFIED
|
||||||
if ( $parameters->getParameter( 'lastrevisionbefore' ) || $parameters->getParameter( 'allrevisionsbefore' ) || $parameters->getParameter( 'firstrevisionsince' ) || $parameters->getParameter( 'allrevisionssince' ) ) {
|
if ( $parameters->getParameter( 'lastrevisionbefore' ) || $parameters->getParameter( 'allrevisionsbefore' ) || $parameters->getParameter( 'firstrevisionsince' ) || $parameters->getParameter( 'allrevisionssince' ) ) {
|
||||||
$article->mRevision = $row->revactor_rev;
|
$article->mRevision = $row->rev_id;
|
||||||
$article->mUser = $revActorName;
|
$article->mUser = $revActorName;
|
||||||
$article->mDate = $row->revactor_timestamp;
|
$article->mDate = $row->rev_timestamp;
|
||||||
|
|
||||||
// $article->mComment = $row->rev_comment;
|
// $article->mComment = $row->rev_comment;
|
||||||
}
|
}
|
||||||
|
@ -298,8 +298,8 @@ class Article {
|
||||||
$article->mDate = $row->page_touched;
|
$article->mDate = $row->page_touched;
|
||||||
} elseif ( $parameters->getParameter( 'addfirstcategorydate' ) ) {
|
} elseif ( $parameters->getParameter( 'addfirstcategorydate' ) ) {
|
||||||
$article->mDate = $row->cl_timestamp;
|
$article->mDate = $row->cl_timestamp;
|
||||||
} elseif ( $parameters->getParameter( 'addeditdate' ) && isset( $row->revactor_timestamp ) ) {
|
} elseif ( $parameters->getParameter( 'addeditdate' ) && isset( $row->rev_timestamp ) ) {
|
||||||
$article->mDate = $row->revactor_timestamp;
|
$article->mDate = $row->rev_timestamp;
|
||||||
} elseif ( $parameters->getParameter( 'addeditdate' ) && isset( $row->page_touched ) ) {
|
} elseif ( $parameters->getParameter( 'addeditdate' ) && isset( $row->page_touched ) ) {
|
||||||
$article->mDate = $row->page_touched;
|
$article->mDate = $row->page_touched;
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,7 +278,7 @@ class Hooks {
|
||||||
// @phan-suppress-next-line PhanPluginMixedKeyNoKey
|
// @phan-suppress-next-line PhanPluginMixedKeyNoKey
|
||||||
$parser->getPreprocessor()->preprocessToObj( $dplresult, 1 ),
|
$parser->getPreprocessor()->preprocessToObj( $dplresult, 1 ),
|
||||||
'isLocalObj' => true,
|
'isLocalObj' => true,
|
||||||
'title' => $parser->getTitle()
|
'title' => $parser->getPage()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,6 @@ class LST {
|
||||||
* @param Parser $parser
|
* @param Parser $parser
|
||||||
* @param string $part1
|
* @param string $part1
|
||||||
* @return bool
|
* @return bool
|
||||||
*
|
|
||||||
* @suppress PhanUndeclaredProperty Use of Parser::mTemplatePath
|
|
||||||
*/
|
*/
|
||||||
public static function open( $parser, $part1 ) {
|
public static function open( $parser, $part1 ) {
|
||||||
// Infinite loop test
|
// Infinite loop test
|
||||||
|
@ -70,8 +68,6 @@ class LST {
|
||||||
*
|
*
|
||||||
* @param Parser $parser
|
* @param Parser $parser
|
||||||
* @param string $part1
|
* @param string $part1
|
||||||
*
|
|
||||||
* @suppress PhanUndeclaredProperty Use of Parser::mTemplatePath
|
|
||||||
*/
|
*/
|
||||||
public static function close( $parser, $part1 ) {
|
public static function close( $parser, $part1 ) {
|
||||||
// Infinite loop test
|
// Infinite loop test
|
||||||
|
@ -111,7 +107,7 @@ class LST {
|
||||||
|
|
||||||
// Handle recursion here, so we can break cycles.
|
// Handle recursion here, so we can break cycles.
|
||||||
if ( $recursionCheck == false ) {
|
if ( $recursionCheck == false ) {
|
||||||
$text = $parser->preprocess( $text, $parser->getTitle(), $parser->getOptions() );
|
$text = $parser->preprocess( $text, $parser->getPage(), $parser->getOptions() );
|
||||||
self::close( $parser, $part1 );
|
self::close( $parser, $part1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +120,8 @@ class LST {
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return "[[" . $parser->getTitle()->getPrefixedText() . "]]" . "<!-- WARNING: LST loop detected -->";
|
$title = Title::castFromPageReference( $parser->getPage() );
|
||||||
|
return "[[" . $title->getPrefixedText() . "]]" . "<!-- WARNING: LST loop detected -->";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -708,7 +705,7 @@ class LST {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// put a red link into the output
|
// put a red link into the output
|
||||||
$output[0] = $parser->preprocess( '{{' . $defaultTemplate . '|%PAGE%=' . $page . '|%TITLE%=' . $title->getText() . '|%DATE%=' . $date . '|%USER%=' . $user . '}}', $parser->getTitle(), $parser->getOptions() );
|
$output[0] = $parser->preprocess( '{{' . $defaultTemplate . '|%PAGE%=' . $page . '|%TITLE%=' . $title->getText() . '|%DATE%=' . $date . '|%USER%=' . $user . '}}', $parser->getPage(), $parser->getOptions() );
|
||||||
}
|
}
|
||||||
|
|
||||||
unset( $title );
|
unset( $title );
|
||||||
|
@ -757,7 +754,7 @@ class LST {
|
||||||
}
|
}
|
||||||
|
|
||||||
$argChain .= '|%DATE%=' . $date . '|%USER%=' . $user . '|%ARGS%=' . str_replace( '|', '§', preg_replace( '/[}]+/', '}', preg_replace( '/[{]+/', '{', substr( $invocation, strlen( $template2 ) + 2 ) ) ) ) . '}}';
|
$argChain .= '|%DATE%=' . $date . '|%USER%=' . $user . '|%ARGS%=' . str_replace( '|', '§', preg_replace( '/[}]+/', '}', preg_replace( '/[{]+/', '{', substr( $invocation, strlen( $template2 ) + 2 ) ) ) ) . '}}';
|
||||||
$output[++$n] = $parser->preprocess( $argChain, $parser->getTitle(), $parser->getOptions() );
|
$output[++$n] = $parser->preprocess( $argChain, $parser->getPage(), $parser->getOptions() );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,8 +98,6 @@ class Parse {
|
||||||
* @param array &$eliminate
|
* @param array &$eliminate
|
||||||
* @param bool $isParserTag
|
* @param bool $isParserTag
|
||||||
* @return string
|
* @return string
|
||||||
*
|
|
||||||
* @suppress PhanUndeclaredProperty Use of Parser::mTemplatePath
|
|
||||||
*/
|
*/
|
||||||
public function parse( $input, Parser $parser, &$reset, &$eliminate, $isParserTag = false ) {
|
public function parse( $input, Parser $parser, &$reset, &$eliminate, $isParserTag = false ) {
|
||||||
$dplStartTime = microtime( true );
|
$dplStartTime = microtime( true );
|
||||||
|
@ -107,17 +105,20 @@ class Parse {
|
||||||
// Reset headings when being ran more than once in the same page load.
|
// Reset headings when being ran more than once in the same page load.
|
||||||
Article::resetHeadings();
|
Article::resetHeadings();
|
||||||
|
|
||||||
|
$title = Title::castFromPageReference( $parser->getPage() );
|
||||||
|
|
||||||
// Check that we are not in an infinite transclusion loop
|
// Check that we are not in an infinite transclusion loop
|
||||||
if ( isset( $parser->mTemplatePath[$parser->getTitle()->getPrefixedText()] ) ) {
|
if ( isset( $parser->mTemplatePath[$title->getPrefixedText()] ) ) {
|
||||||
$this->logger->addMessage( Hooks::WARN_TRANSCLUSIONLOOP, $parser->getTitle()->getPrefixedText() );
|
$this->logger->addMessage( Hooks::WARN_TRANSCLUSIONLOOP, $title->getPrefixedText() );
|
||||||
|
|
||||||
return $this->getFullOutput();
|
return $this->getFullOutput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$restrictionStore = MediaWikiServices::getInstance()->getRestrictionStore();
|
||||||
// Check if DPL shall only be executed from protected pages.
|
// Check if DPL shall only be executed from protected pages.
|
||||||
if ( Config::getSetting( 'runFromProtectedPagesOnly' ) === true && !$parser->getTitle()->isProtected( 'edit' ) ) {
|
if ( Config::getSetting( 'runFromProtectedPagesOnly' ) === true && $title && !$restrictionStore->isProtected( $title, 'edit' ) ) {
|
||||||
// Ideally we would like to allow using a DPL query if the query istelf is coded on a template page which is protected. Then there would be no need for the article to be protected. However, how can one find out from which wiki source an extension has been invoked???
|
// Ideally we would like to allow using a DPL query if the query istelf is coded on a template page which is protected. Then there would be no need for the article to be protected. However, how can one find out from which wiki source an extension has been invoked???
|
||||||
$this->logger->addMessage( Hooks::FATAL_NOTPROTECTED, $parser->getTitle()->getPrefixedText() );
|
$this->logger->addMessage( Hooks::FATAL_NOTPROTECTED, $title->getPrefixedText() );
|
||||||
|
|
||||||
return $this->getFullOutput();
|
return $this->getFullOutput();
|
||||||
}
|
}
|
||||||
|
@ -203,7 +204,7 @@ class Parse {
|
||||||
|
|
||||||
$foundRows = null;
|
$foundRows = null;
|
||||||
$profilingContext = '';
|
$profilingContext = '';
|
||||||
$currentTitle= $parser->getTitle();
|
$currentTitle = $parser->getPage();
|
||||||
if ( $currentTitle instanceof Title ) {
|
if ( $currentTitle instanceof Title ) {
|
||||||
$profilingContext
|
$profilingContext
|
||||||
= str_replace( [ '*', '/' ], '-', $currentTitle->getPrefixedDBkey() );
|
= str_replace( [ '*', '/' ], '-', $currentTitle->getPrefixedDBkey() );
|
||||||
|
@ -405,7 +406,7 @@ class Parse {
|
||||||
}
|
}
|
||||||
|
|
||||||
$title = Title::makeTitle( $pageNamespace, $pageTitle );
|
$title = Title::makeTitle( $pageNamespace, $pageTitle );
|
||||||
$thisTitle = $parser->getTitle();
|
$thisTitle = Title::castFromPageReference( $parser->getPage() );
|
||||||
|
|
||||||
// Block recursion from happening by seeing if this result row is the page the DPL query was ran from.
|
// Block recursion from happening by seeing if this result row is the page the DPL query was ran from.
|
||||||
if ( $this->parameters->getParameter( 'skipthispage' ) && $thisTitle->equals( $title ) ) {
|
if ( $this->parameters->getParameter( 'skipthispage' ) && $thisTitle->equals( $title ) ) {
|
||||||
|
@ -590,7 +591,7 @@ class Parse {
|
||||||
* @return mixed Type to use: 'results', 'oneresult', or 'noresults'. False if invalid or none should be used.
|
* @return mixed Type to use: 'results', 'oneresult', or 'noresults'. False if invalid or none should be used.
|
||||||
*/
|
*/
|
||||||
private function getHeaderFooterType( $position, $count ) {
|
private function getHeaderFooterType( $position, $count ) {
|
||||||
$count = intval( $count );
|
$count = (int)$count;
|
||||||
|
|
||||||
if ( $position != 'header' && $position != 'footer' ) {
|
if ( $position != 'header' && $position != 'footer' ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -714,7 +715,7 @@ class Parse {
|
||||||
|
|
||||||
// No more than one type of date at a time!
|
// No more than one type of date at a time!
|
||||||
// @TODO: Can this be fixed to allow all three later after fixing the article class?
|
// @TODO: Can this be fixed to allow all three later after fixing the article class?
|
||||||
if ( ( intval( $this->parameters->getParameter( 'addpagetoucheddate' ) ) + intval( $this->parameters->getParameter( 'addfirstcategorydate' ) ) + intval( $this->parameters->getParameter( 'addeditdate' ) ) ) > 1 ) {
|
if ( ( (int)$this->parameters->getParameter( 'addpagetoucheddate' ) + (int)$this->parameters->getParameter( 'addfirstcategorydate' ) + (int)$this->parameters->getParameter( 'addeditdate' ) ) > 1 ) {
|
||||||
$this->logger->addMessage( Hooks::FATAL_MORETHAN1TYPEOFDATE );
|
$this->logger->addMessage( Hooks::FATAL_MORETHAN1TYPEOFDATE );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -906,7 +907,9 @@ class Parse {
|
||||||
global $wgHooks;
|
global $wgHooks;
|
||||||
|
|
||||||
$localParser = MediaWikiServices::getInstance()->getParserFactory()->create();
|
$localParser = MediaWikiServices::getInstance()->getParserFactory()->create();
|
||||||
$parserOutput = $localParser->parse( $output, $parser->getTitle(), $parser->getOptions() );
|
|
||||||
|
$page = $parser->getPage();
|
||||||
|
$parserOutput = $page ? $localParser->parse( $output, $page, $parser->getOptions() ) : null;
|
||||||
|
|
||||||
if ( !is_array( $reset ) ) {
|
if ( !is_array( $reset ) ) {
|
||||||
$reset = [];
|
$reset = [];
|
||||||
|
@ -967,7 +970,7 @@ class Parse {
|
||||||
$wgHooks['ParserAfterTidy'][] = 'MediaWiki\\Extension\\DynamicPageList3\\Hooks::endEliminate';
|
$wgHooks['ParserAfterTidy'][] = 'MediaWiki\\Extension\\DynamicPageList3\\Hooks::endEliminate';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $eliminate['links'] ) && $eliminate['links'] ) {
|
if ( $parserOutput && isset( $eliminate['links'] ) && $eliminate['links'] ) {
|
||||||
// Trigger the mediawiki parser to find links, images, categories etc. which are contained in the DPL output. This allows us to remove these links from the link list later. If the article containing the DPL statement itself uses one of these links they will be thrown away!
|
// Trigger the mediawiki parser to find links, images, categories etc. which are contained in the DPL output. This allows us to remove these links from the link list later. If the article containing the DPL statement itself uses one of these links they will be thrown away!
|
||||||
Hooks::$createdLinks[0] = [];
|
Hooks::$createdLinks[0] = [];
|
||||||
|
|
||||||
|
@ -976,7 +979,7 @@ class Parse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $eliminate['templates'] ) && $eliminate['templates'] ) {
|
if ( $parserOutput && isset( $eliminate['templates'] ) && $eliminate['templates'] ) {
|
||||||
Hooks::$createdLinks[1] = [];
|
Hooks::$createdLinks[1] = [];
|
||||||
|
|
||||||
foreach ( $parserOutput->getTemplates() as $nsp => $tpl ) {
|
foreach ( $parserOutput->getTemplates() as $nsp => $tpl ) {
|
||||||
|
@ -984,11 +987,11 @@ class Parse {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $eliminate['categories'] ) && $eliminate['categories'] ) {
|
if ( $parserOutput && isset( $eliminate['categories'] ) && $eliminate['categories'] ) {
|
||||||
Hooks::$createdLinks[2] = $parserOutput->mCategories;
|
Hooks::$createdLinks[2] = $parserOutput->mCategories;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $eliminate['images'] ) && $eliminate['images'] ) {
|
if ( $parserOutput && isset( $eliminate['images'] ) && $eliminate['images'] ) {
|
||||||
Hooks::$createdLinks[3] = $parserOutput->mImages;
|
Hooks::$createdLinks[3] = $parserOutput->mImages;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ class Query {
|
||||||
|
|
||||||
$this->tableNames = self::getTableNames();
|
$this->tableNames = self::getTableNames();
|
||||||
|
|
||||||
$this->dbr = wfGetDB( DB_REPLICA, 'dpl' );
|
$this->dbr = MediaWikiServices::getInstance()->getDBLoadBalancer()->getConnection( DB_REPLICA, 'dpl' );
|
||||||
|
|
||||||
$this->userFactory = MediaWikiServices::getInstance()->getUserFactory();
|
$this->userFactory = MediaWikiServices::getInstance()->getUserFactory();
|
||||||
}
|
}
|
||||||
|
@ -440,7 +440,7 @@ class Query {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getTableNames() {
|
public static function getTableNames() {
|
||||||
$dbr = wfGetDB( DB_REPLICA, 'dpl' );
|
$dbr = MediaWikiServices::getInstance()->getDBLoadBalancer()->getConnection( DB_REPLICA, 'dpl' );
|
||||||
|
|
||||||
$tables = [
|
$tables = [
|
||||||
'categorylinks',
|
'categorylinks',
|
||||||
|
@ -448,11 +448,11 @@ class Query {
|
||||||
'externallinks',
|
'externallinks',
|
||||||
'flaggedpages',
|
'flaggedpages',
|
||||||
'imagelinks',
|
'imagelinks',
|
||||||
|
'linktarget',
|
||||||
'page',
|
'page',
|
||||||
'pagelinks',
|
'pagelinks',
|
||||||
'recentchanges',
|
'recentchanges',
|
||||||
'revision',
|
'revision',
|
||||||
'revision_actor_temp',
|
|
||||||
'templatelinks'
|
'templatelinks'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -492,10 +492,10 @@ class Query {
|
||||||
/**
|
/**
|
||||||
* Add multiple tables to the output.
|
* Add multiple tables to the output.
|
||||||
*
|
*
|
||||||
* @param array $tablesByAlias
|
* @param array $tablesByAlias [ table => alias ]
|
||||||
*/
|
*/
|
||||||
public function addTables( array $tablesByAlias ) {
|
public function addTables( array $tablesByAlias ) {
|
||||||
foreach ( $tablesByAlias as $alias => $table ) {
|
foreach ( $tablesByAlias as $table => $alias ) {
|
||||||
$this->addTable( $table, $alias );
|
$this->addTable( $table, $alias );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -648,7 +648,7 @@ class Query {
|
||||||
*/
|
*/
|
||||||
public function setLimit( $limit ) {
|
public function setLimit( $limit ) {
|
||||||
if ( is_numeric( $limit ) ) {
|
if ( is_numeric( $limit ) ) {
|
||||||
$this->limit = intval( $limit );
|
$this->limit = (int)$limit;
|
||||||
} else {
|
} else {
|
||||||
$this->limit = false;
|
$this->limit = false;
|
||||||
}
|
}
|
||||||
|
@ -664,7 +664,7 @@ class Query {
|
||||||
*/
|
*/
|
||||||
public function setOffset( $offset ) {
|
public function setOffset( $offset ) {
|
||||||
if ( is_numeric( $offset ) ) {
|
if ( is_numeric( $offset ) ) {
|
||||||
$this->offset = intval( $offset );
|
$this->offset = (int)$offset;
|
||||||
} else {
|
} else {
|
||||||
$this->offset = false;
|
$this->offset = false;
|
||||||
}
|
}
|
||||||
|
@ -710,7 +710,7 @@ class Query {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getSubcategories( $categoryName, $depth = 1 ) {
|
public static function getSubcategories( $categoryName, $depth = 1 ) {
|
||||||
$dbr = wfGetDB( DB_REPLICA, 'dpl' );
|
$dbr = MediaWikiServices::getInstance()->getDBLoadBalancer()->getConnection( DB_REPLICA, 'dpl' );
|
||||||
|
|
||||||
if ( $depth > 2 ) {
|
if ( $depth > 2 ) {
|
||||||
// Hard constrain depth because lots of recursion is bad.
|
// Hard constrain depth because lots of recursion is bad.
|
||||||
|
@ -722,7 +722,7 @@ class Query {
|
||||||
[ 'page', 'categorylinks' ],
|
[ 'page', 'categorylinks' ],
|
||||||
[ 'page_title' ],
|
[ 'page_title' ],
|
||||||
[
|
[
|
||||||
'page_namespace' => intval( NS_CATEGORY ),
|
'page_namespace' => NS_CATEGORY,
|
||||||
'cl_to' => str_replace( ' ', '_', $categoryName )
|
'cl_to' => str_replace( ' ', '_', $categoryName )
|
||||||
],
|
],
|
||||||
__METHOD__,
|
__METHOD__,
|
||||||
|
@ -802,11 +802,11 @@ class Query {
|
||||||
private function _addauthor( $option ) {
|
private function _addauthor( $option ) {
|
||||||
// Addauthor can not be used with addlasteditor.
|
// Addauthor can not be used with addlasteditor.
|
||||||
if ( !isset( $this->parametersProcessed['addlasteditor'] ) || !$this->parametersProcessed['addlasteditor'] ) {
|
if ( !isset( $this->parametersProcessed['addlasteditor'] ) || !$this->parametersProcessed['addlasteditor'] ) {
|
||||||
$this->addTable( 'revision_actor_temp', 'rev' );
|
$this->addTable( 'revision', 'rev' );
|
||||||
$this->addWhere(
|
$this->addWhere(
|
||||||
[
|
[
|
||||||
$this->tableNames['page'] . '.page_id = rev.revactor_page',
|
$this->tableNames['page'] . '.page_id = rev.rev_page',
|
||||||
'rev.revactor_timestamp = (SELECT MIN(rev_aux_min.revactor_timestamp) FROM ' . $this->tableNames['revision_actor_temp'] . ' AS rev_aux_min WHERE rev_aux_min.revactor_page = rev.revactor_page)'
|
'rev.rev_timestamp = (SELECT MIN(rev_aux_min.rev_timestamp) FROM ' . $this->tableNames['revision'] . ' AS rev_aux_min WHERE rev_aux_min.rev_page = rev.rev_page)'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -868,12 +868,12 @@ class Query {
|
||||||
* @param mixed $option
|
* @param mixed $option
|
||||||
*/
|
*/
|
||||||
private function _addeditdate( $option ) {
|
private function _addeditdate( $option ) {
|
||||||
$this->addTable( 'revision_actor_temp', 'rev' );
|
$this->addTable( 'revision', 'rev' );
|
||||||
$this->addSelect( [ 'rev.revactor_timestamp' ] );
|
$this->addSelect( [ 'rev.rev_timestamp' ] );
|
||||||
|
|
||||||
$this->addWhere(
|
$this->addWhere(
|
||||||
[
|
[
|
||||||
$this->tableNames['page'] . '.page_id = rev.revactor_page',
|
$this->tableNames['page'] . '.page_id = rev.rev_page',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -900,12 +900,12 @@ class Query {
|
||||||
private function _addlasteditor( $option ) {
|
private function _addlasteditor( $option ) {
|
||||||
// Addlasteditor can not be used with addauthor.
|
// Addlasteditor can not be used with addauthor.
|
||||||
if ( !isset( $this->parametersProcessed['addauthor'] ) || !$this->parametersProcessed['addauthor'] ) {
|
if ( !isset( $this->parametersProcessed['addauthor'] ) || !$this->parametersProcessed['addauthor'] ) {
|
||||||
$this->addTable( 'revision_actor_temp', 'rev' );
|
$this->addTable( 'revision', 'rev' );
|
||||||
|
|
||||||
$this->addWhere(
|
$this->addWhere(
|
||||||
[
|
[
|
||||||
$this->tableNames['page'] . '.page_id = rev.revactor_page',
|
$this->tableNames['page'] . '.page_id = rev.rev_page',
|
||||||
'rev.revactor_timestamp = (SELECT MAX(rev_aux_max.revactor_timestamp) FROM ' . $this->tableNames['revision_actor_temp'] . ' AS rev_aux_max WHERE rev_aux_max.revactor_page = rev.revactor_page)'
|
'rev.rev_timestamp = (SELECT MAX(rev_aux_max.rev_timestamp) FROM ' . $this->tableNames['revision'] . ' AS rev_aux_max WHERE rev_aux_max.rev_page = rev.rev_page)'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -976,7 +976,7 @@ class Query {
|
||||||
|
|
||||||
$this->addSelect(
|
$this->addSelect(
|
||||||
[
|
[
|
||||||
$tableAlias . 'revactor_actor',
|
$tableAlias . 'rev_actor',
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -987,21 +987,21 @@ class Query {
|
||||||
* @param mixed $option
|
* @param mixed $option
|
||||||
*/
|
*/
|
||||||
private function _allrevisionsbefore( $option ) {
|
private function _allrevisionsbefore( $option ) {
|
||||||
$this->addTable( 'revision_actor_temp', 'rev' );
|
$this->addTable( 'revision', 'rev' );
|
||||||
$this->addSelect(
|
$this->addSelect(
|
||||||
[
|
[
|
||||||
'rev.revactor_rev',
|
'rev.rev_id',
|
||||||
'rev.revactor_timestamp'
|
'rev.rev_timestamp'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addOrderBy( 'rev.revactor_rev' );
|
$this->addOrderBy( 'rev.rev_id' );
|
||||||
$this->setOrderDir( 'DESC' );
|
$this->setOrderDir( 'DESC' );
|
||||||
|
|
||||||
$this->addWhere(
|
$this->addWhere(
|
||||||
[
|
[
|
||||||
$this->tableNames['page'] . '.page_id = rev.revactor_page',
|
$this->tableNames['page'] . '.page_id = rev.rev_page',
|
||||||
'rev.revactor_timestamp < ' . $this->convertTimestamp( $option )
|
'rev.rev_timestamp < ' . $this->convertTimestamp( $option )
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1012,21 +1012,21 @@ class Query {
|
||||||
* @param mixed $option
|
* @param mixed $option
|
||||||
*/
|
*/
|
||||||
private function _allrevisionssince( $option ) {
|
private function _allrevisionssince( $option ) {
|
||||||
$this->addTable( 'revision_actor_temp', 'rev' );
|
$this->addTable( 'revision', 'rev' );
|
||||||
$this->addSelect(
|
$this->addSelect(
|
||||||
[
|
[
|
||||||
'rev.revactor_rev',
|
'rev.rev_id',
|
||||||
'rev.revactor_timestamp'
|
'rev.rev_timestamp'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addOrderBy( 'rev.revactor_rev' );
|
$this->addOrderBy( 'rev.rev_id' );
|
||||||
$this->setOrderDir( 'DESC' );
|
$this->setOrderDir( 'DESC' );
|
||||||
|
|
||||||
$this->addWhere(
|
$this->addWhere(
|
||||||
[
|
[
|
||||||
$this->tableNames['page'] . '.page_id = rev.revactor_page',
|
$this->tableNames['page'] . '.page_id = rev.rev_page',
|
||||||
'rev.revactor_timestamp >= ' . $this->convertTimestamp( $option )
|
'rev.rev_timestamp >= ' . $this->convertTimestamp( $option )
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1047,11 +1047,11 @@ class Query {
|
||||||
*/
|
*/
|
||||||
private function _categoriesminmax( $option ) {
|
private function _categoriesminmax( $option ) {
|
||||||
if ( is_numeric( $option[0] ) ) {
|
if ( is_numeric( $option[0] ) ) {
|
||||||
$this->addWhere( intval( $option[0] ) . ' <= (SELECT count(*) FROM ' . $this->tableNames['categorylinks'] . ' WHERE ' . $this->tableNames['categorylinks'] . '.cl_from=page_id)' );
|
$this->addWhere( (int)$option[0] . ' <= (SELECT count(*) FROM ' . $this->tableNames['categorylinks'] . ' WHERE ' . $this->tableNames['categorylinks'] . '.cl_from=page_id)' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $option[1] ) && is_numeric( $option[1] ) ) {
|
if ( isset( $option[1] ) && is_numeric( $option[1] ) ) {
|
||||||
$this->addWhere( intval( $option[1] ) . ' >= (SELECT count(*) FROM ' . $this->tableNames['categorylinks'] . ' WHERE ' . $this->tableNames['categorylinks'] . '.cl_from=page_id)' );
|
$this->addWhere( (int)$option[1] . ' >= (SELECT count(*) FROM ' . $this->tableNames['categorylinks'] . ' WHERE ' . $this->tableNames['categorylinks'] . '.cl_from=page_id)' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1150,13 +1150,12 @@ class Query {
|
||||||
*/
|
*/
|
||||||
private function _createdby( $option ) {
|
private function _createdby( $option ) {
|
||||||
$this->addTable( 'revision', 'creation_rev' );
|
$this->addTable( 'revision', 'creation_rev' );
|
||||||
$this->addTable( 'revision_actor_temp', 'creation_rev_actor' );
|
$this->_adduser( null, 'creation_rev' );
|
||||||
$this->_adduser( null, 'creation_rev_actor' );
|
|
||||||
|
|
||||||
$this->addWhere(
|
$this->addWhere(
|
||||||
[
|
[
|
||||||
$this->dbr->addQuotes( $this->userFactory->newFromName( $option )->getActorId() ) . ' = creation_rev_actor.revactor_actor',
|
$this->dbr->addQuotes( $this->userFactory->newFromName( $option )->getActorId() ) . ' = creation_rev.rev_actor',
|
||||||
'creation_rev_actor.revactor_page = page_id',
|
'creation_rev.rev_page = page_id',
|
||||||
'creation_rev.rev_parent_id = 0'
|
'creation_rev.rev_parent_id = 0'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
@ -1181,26 +1180,26 @@ class Query {
|
||||||
* @param mixed $option
|
* @param mixed $option
|
||||||
*/
|
*/
|
||||||
private function _firstrevisionsince( $option ) {
|
private function _firstrevisionsince( $option ) {
|
||||||
$this->addTable( 'revision_actor_temp', 'rev' );
|
$this->addTable( 'revision', 'rev' );
|
||||||
$this->addSelect(
|
$this->addSelect(
|
||||||
[
|
[
|
||||||
'rev.revactor_rev',
|
'rev.rev_id',
|
||||||
'rev.revactor_timestamp'
|
'rev.rev_timestamp'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
// tell the query optimizer not to look at rows that the following subquery will filter out anyway
|
// tell the query optimizer not to look at rows that the following subquery will filter out anyway
|
||||||
$this->addWhere(
|
$this->addWhere(
|
||||||
[
|
[
|
||||||
$this->tableNames['page'] . '.page_id = rev.revactor_page',
|
$this->tableNames['page'] . '.page_id = rev.rev_page',
|
||||||
'rev.revactor_timestamp >= ' . $this->dbr->addQuotes( $option )
|
'rev.rev_timestamp >= ' . $this->dbr->addQuotes( $option )
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addWhere(
|
$this->addWhere(
|
||||||
[
|
[
|
||||||
$this->tableNames['page'] . '.page_id = rev.revactor_page',
|
$this->tableNames['page'] . '.page_id = rev.rev_page',
|
||||||
'rev.revactor_timestamp = (SELECT MIN(rev_aux_snc.revactor_timestamp) FROM ' . $this->tableNames['revision_actor_temp'] . ' AS rev_aux_snc WHERE rev_aux_snc.revactor_page=rev.revactor_page AND rev_aux_snc.revactor_timestamp >= ' . $this->convertTimestamp( $option ) . ')'
|
'rev.rev_timestamp = (SELECT MIN(rev_aux_snc.rev_timestamp) FROM ' . $this->tableNames['revision'] . ' AS rev_aux_snc WHERE rev_aux_snc.rev_page=rev.rev_page AND rev_aux_snc.rev_timestamp >= ' . $this->convertTimestamp( $option ) . ')'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1243,7 +1242,7 @@ class Query {
|
||||||
|
|
||||||
if ( !$this->parameters->getParameter( 'openreferences' ) ) {
|
if ( !$this->parameters->getParameter( 'openreferences' ) ) {
|
||||||
$where = [
|
$where = [
|
||||||
"{$this->tableNames['page']}.page_namespace = " . intval( NS_FILE ),
|
"{$this->tableNames['page']}.page_namespace = " . NS_FILE,
|
||||||
"{$this->tableNames['page']}.page_title = ic.il_to"
|
"{$this->tableNames['page']}.page_title = ic.il_to"
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -1305,7 +1304,7 @@ class Query {
|
||||||
* @param mixed $option
|
* @param mixed $option
|
||||||
*/
|
*/
|
||||||
private function _lastmodifiedby( $option ) {
|
private function _lastmodifiedby( $option ) {
|
||||||
$this->addWhere( $this->dbr->addQuotes( $this->userFactory->newFromName( $option )->getActorId() ) . ' = (SELECT revactor_actor FROM ' . $this->tableNames['revision_actor_temp'] . ' WHERE ' . $this->tableNames['revision_actor_temp'] . '.revactor_page=page_id ORDER BY ' . $this->tableNames['revision_actor_temp'] . '.revactor_timestamp DESC LIMIT 1)' );
|
$this->addWhere( $this->dbr->addQuotes( $this->userFactory->newFromName( $option )->getActorId() ) . ' = (SELECT rev_actor FROM ' . $this->tableNames['revision'] . ' WHERE ' . $this->tableNames['revision'] . '.rev_page=page_id ORDER BY ' . $this->tableNames['revision'] . '.rev_timestamp DESC LIMIT 1)' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1314,21 +1313,21 @@ class Query {
|
||||||
* @param mixed $option
|
* @param mixed $option
|
||||||
*/
|
*/
|
||||||
private function _lastrevisionbefore( $option ) {
|
private function _lastrevisionbefore( $option ) {
|
||||||
$this->addTable( 'revision_actor_temp', 'rev' );
|
$this->addTable( 'revision', 'rev' );
|
||||||
$this->addSelect( [ 'rev.revactor_rev', 'rev.revactor_timestamp' ] );
|
$this->addSelect( [ 'rev.rev_id', 'rev.rev_timestamp' ] );
|
||||||
|
|
||||||
// tell the query optimizer not to look at rows that the following subquery will filter out anyway
|
// tell the query optimizer not to look at rows that the following subquery will filter out anyway
|
||||||
$this->addWhere(
|
$this->addWhere(
|
||||||
[
|
[
|
||||||
$this->tableNames['page'] . '.page_id = rev.revactor_page',
|
$this->tableNames['page'] . '.page_id = rev.rev_page',
|
||||||
'rev.revactor_timestamp < ' . $this->convertTimestamp( $option )
|
'rev.rev_timestamp < ' . $this->convertTimestamp( $option )
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->addWhere(
|
$this->addWhere(
|
||||||
[
|
[
|
||||||
$this->tableNames['page'] . '.page_id = rev.revactor_page',
|
$this->tableNames['page'] . '.page_id = rev.rev_page',
|
||||||
'rev.revactor_timestamp = (SELECT MAX(rev_aux_bef.revactor_timestamp) FROM ' . $this->tableNames['revision_actor_temp'] . ' AS rev_aux_bef WHERE rev_aux_bef.revactor_page=rev.revactor_page AND rev_aux_bef.revactor_timestamp < ' . $this->convertTimestamp( $option ) . ')'
|
'rev.rev_timestamp = (SELECT MAX(rev_aux_bef.rev_timestamp) FROM ' . $this->tableNames['revision'] . ' AS rev_aux_bef WHERE rev_aux_bef.rev_page=rev.rev_page AND rev_aux_bef.rev_timestamp < ' . $this->convertTimestamp( $option ) . ')'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1403,7 +1402,7 @@ class Query {
|
||||||
$ors = [];
|
$ors = [];
|
||||||
|
|
||||||
foreach ( $linkGroup as $link ) {
|
foreach ( $linkGroup as $link ) {
|
||||||
$_or = '(pl.pl_namespace=' . intval( $link->getNamespace() );
|
$_or = '(pl.pl_namespace=' . (int)$link->getNamespace();
|
||||||
if ( strpos( $link->getDBkey(), '%' ) >= 0 ) {
|
if ( strpos( $link->getDBkey(), '%' ) >= 0 ) {
|
||||||
$operator = 'LIKE';
|
$operator = 'LIKE';
|
||||||
} else {
|
} else {
|
||||||
|
@ -1426,7 +1425,7 @@ class Query {
|
||||||
$ors = [];
|
$ors = [];
|
||||||
|
|
||||||
foreach ( $linkGroup as $link ) {
|
foreach ( $linkGroup as $link ) {
|
||||||
$_or = '(' . $this->tableNames['pagelinks'] . '.pl_namespace=' . intval( $link->getNamespace() );
|
$_or = '(' . $this->tableNames['pagelinks'] . '.pl_namespace=' . (int)$link->getNamespace();
|
||||||
if ( strpos( $link->getDBkey(), '%' ) >= 0 ) {
|
if ( strpos( $link->getDBkey(), '%' ) >= 0 ) {
|
||||||
$operator = 'LIKE';
|
$operator = 'LIKE';
|
||||||
} else {
|
} else {
|
||||||
|
@ -1466,7 +1465,7 @@ class Query {
|
||||||
$ands = [];
|
$ands = [];
|
||||||
foreach ( $option as $linkGroup ) {
|
foreach ( $option as $linkGroup ) {
|
||||||
foreach ( $linkGroup as $link ) {
|
foreach ( $linkGroup as $link ) {
|
||||||
$ands[] = 'pl_from <> ' . intval( $link->getArticleID() ) . ' ';
|
$ands[] = 'pl_from <> ' . (int)$link->getArticleID() . ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1477,7 +1476,7 @@ class Query {
|
||||||
|
|
||||||
foreach ( $option as $linkGroup ) {
|
foreach ( $option as $linkGroup ) {
|
||||||
foreach ( $linkGroup as $link ) {
|
foreach ( $linkGroup as $link ) {
|
||||||
$ors[] = $this->tableNames['pagelinks'] . '.pl_from = ' . intval( $link->getArticleID() );
|
$ors[] = $this->tableNames['pagelinks'] . '.pl_from = ' . (int)$link->getArticleID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1503,7 +1502,7 @@ class Query {
|
||||||
|
|
||||||
foreach ( $option as $linkGroup ) {
|
foreach ( $option as $linkGroup ) {
|
||||||
foreach ( $linkGroup as $link ) {
|
foreach ( $linkGroup as $link ) {
|
||||||
$_or = '(' . $this->tableNames['pagelinks'] . '.pl_namespace=' . intval( $link->getNamespace() );
|
$_or = '(' . $this->tableNames['pagelinks'] . '.pl_namespace=' . (int)$link->getNamespace();
|
||||||
if ( strpos( $link->getDBkey(), '%' ) >= 0 ) {
|
if ( strpos( $link->getDBkey(), '%' ) >= 0 ) {
|
||||||
$operator = 'LIKE';
|
$operator = 'LIKE';
|
||||||
} else {
|
} else {
|
||||||
|
@ -1573,7 +1572,7 @@ class Query {
|
||||||
* @param mixed $option
|
* @param mixed $option
|
||||||
*/
|
*/
|
||||||
private function _maxrevisions( $option ) {
|
private function _maxrevisions( $option ) {
|
||||||
$this->addWhere( "((SELECT count(rev_aux3.revactor_page) FROM {$this->tableNames['revision_actor_temp']} AS rev_aux3 WHERE rev_aux3.revactor_page = {$this->tableNames['page']}.page_id) <= {$option})" );
|
$this->addWhere( "((SELECT count(rev_aux3.rev_page) FROM {$this->tableNames['revision']} AS rev_aux3 WHERE rev_aux3.rev_page = {$this->tableNames['page']}.page_id) <= {$option})" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1594,7 +1593,7 @@ class Query {
|
||||||
* @param mixed $option
|
* @param mixed $option
|
||||||
*/
|
*/
|
||||||
private function _minrevisions( $option ) {
|
private function _minrevisions( $option ) {
|
||||||
$this->addWhere( "((SELECT count(rev_aux2.revactor_page) FROM {$this->tableNames['revision_actor_temp']} AS rev_aux2 WHERE rev_aux2.revactor_page = {$this->tableNames['page']}.page_id) >= {$option})" );
|
$this->addWhere( "((SELECT count(rev_aux2.rev_page) FROM {$this->tableNames['revision']} AS rev_aux2 WHERE rev_aux2.rev_page = {$this->tableNames['page']}.page_id) >= {$option})" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1603,9 +1602,9 @@ class Query {
|
||||||
* @param mixed $option
|
* @param mixed $option
|
||||||
*/
|
*/
|
||||||
private function _modifiedby( $option ) {
|
private function _modifiedby( $option ) {
|
||||||
$this->addTable( 'revision_actor_temp', 'change_rev' );
|
$this->addTable( 'revision', 'change_rev' );
|
||||||
|
|
||||||
$this->addWhere( $this->dbr->addQuotes( $this->userFactory->newFromName( $option )->getActorId() ) . ' = change_rev.revactor_actor AND change_rev.revactor_page = page_id' );
|
$this->addWhere( $this->dbr->addQuotes( $this->userFactory->newFromName( $option )->getActorId() ) . ' = change_rev.rev_actor AND change_rev.rev_page = page_id' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1638,9 +1637,8 @@ class Query {
|
||||||
*/
|
*/
|
||||||
private function _notcreatedby( $option ) {
|
private function _notcreatedby( $option ) {
|
||||||
$this->addTable( 'revision', 'no_creation_rev' );
|
$this->addTable( 'revision', 'no_creation_rev' );
|
||||||
$this->addTable( 'revision_actor_temp', 'no_creation_rev_actor' );
|
|
||||||
|
|
||||||
$this->addWhere( $this->dbr->addQuotes( $this->userFactory->newFromName( $option )->getActorId() ) . ' != no_creation_rev_actor.revactor_actor AND no_creation_rev_actor.revactor_page = page_id AND no_creation_rev.rev_parent_id = 0' );
|
$this->addWhere( $this->dbr->addQuotes( $this->userFactory->newFromName( $option )->getActorId() ) . ' != no_creation_rev.rev_actor AND no_creation_rev.rev_page = page_id AND no_creation_rev.rev_parent_id = 0' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1649,7 +1647,7 @@ class Query {
|
||||||
* @param mixed $option
|
* @param mixed $option
|
||||||
*/
|
*/
|
||||||
private function _notlastmodifiedby( $option ) {
|
private function _notlastmodifiedby( $option ) {
|
||||||
$this->addWhere( $this->dbr->addQuotes( $this->userFactory->newFromName( $option )->getActorId() ) . ' != (SELECT revactor_actor FROM ' . $this->tableNames['revision_actor_temp'] . ' WHERE ' . $this->tableNames['revision_actor_temp'] . '.revactor_page=page_id ORDER BY ' . $this->tableNames['revision_actor_temp'] . '.revactor_timestamp DESC LIMIT 1)' );
|
$this->addWhere( $this->dbr->addQuotes( $this->userFactory->newFromName( $option )->getActorId() ) . ' != (SELECT rev_actor FROM ' . $this->tableNames['revision'] . ' WHERE ' . $this->tableNames['revision'] . '.rev_page=page_id ORDER BY ' . $this->tableNames['revision'] . '.rev_timestamp DESC LIMIT 1)' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1658,7 +1656,7 @@ class Query {
|
||||||
* @param mixed $option
|
* @param mixed $option
|
||||||
*/
|
*/
|
||||||
private function _notmodifiedby( $option ) {
|
private function _notmodifiedby( $option ) {
|
||||||
$this->addWhere( 'NOT EXISTS (SELECT 1 FROM ' . $this->tableNames['revision_actor_temp'] . ' WHERE ' . $this->tableNames['revision_actor_temp'] . '.revactor_page=page_id AND ' . $this->tableNames['revision_actor_temp'] . '.revactor_actor = ' . $this->dbr->addQuotes( $this->userFactory->newFromName( $option )->getActorId() ) . ' LIMIT 1)' );
|
$this->addWhere( 'NOT EXISTS (SELECT 1 FROM ' . $this->tableNames['revision'] . ' WHERE ' . $this->tableNames['revision'] . '.rev_page=page_id AND ' . $this->tableNames['revision'] . '.rev_actor = ' . $this->dbr->addQuotes( $this->userFactory->newFromName( $option )->getActorId() ) . ' LIMIT 1)' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1764,7 +1762,7 @@ class Query {
|
||||||
$_namespaceIdToText = "CASE {$this->tableNames['page']}.page_namespace";
|
$_namespaceIdToText = "CASE {$this->tableNames['page']}.page_namespace";
|
||||||
|
|
||||||
foreach ( $namespaces as $id => $name ) {
|
foreach ( $namespaces as $id => $name ) {
|
||||||
$_namespaceIdToText .= ' WHEN ' . intval( $id ) . ' THEN ' . $this->dbr->addQuotes( $name . ':' );
|
$_namespaceIdToText .= ' WHEN ' . (int)$id . ' THEN ' . $this->dbr->addQuotes( $name . ':' );
|
||||||
}
|
}
|
||||||
|
|
||||||
$_namespaceIdToText .= ' END';
|
$_namespaceIdToText .= ' END';
|
||||||
|
@ -1835,20 +1833,20 @@ class Query {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'firstedit':
|
case 'firstedit':
|
||||||
$this->addOrderBy( 'rev.revactor_timestamp' );
|
$this->addOrderBy( 'rev.rev_timestamp' );
|
||||||
$this->addTable( 'revision_actor_temp', 'rev' );
|
$this->addTable( 'revision', 'rev' );
|
||||||
|
|
||||||
$this->addSelect(
|
$this->addSelect(
|
||||||
[
|
[
|
||||||
'rev.revactor_timestamp'
|
'rev.rev_timestamp'
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( !$this->revisionAuxWhereAdded ) {
|
if ( !$this->revisionAuxWhereAdded ) {
|
||||||
$this->addWhere(
|
$this->addWhere(
|
||||||
[
|
[
|
||||||
"{$this->tableNames['page']}.page_id = rev.revactor_page",
|
"{$this->tableNames['page']}.page_id = rev.rev_page",
|
||||||
"rev.revactor_timestamp = (SELECT MIN(rev_aux.revactor_timestamp) FROM {$this->tableNames['revision_actor_temp']} AS rev_aux WHERE rev_aux.revactor_page=rev.revactor_page)"
|
"rev.rev_timestamp = (SELECT MIN(rev_aux.rev_timestamp) FROM {$this->tableNames['revision']} AS rev_aux WHERE rev_aux.rev_page=rev.rev_page)"
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1864,15 +1862,15 @@ class Query {
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$this->addOrderBy( 'rev.revactor_timestamp' );
|
$this->addOrderBy( 'rev.rev_timestamp' );
|
||||||
$this->addTable( 'revision_actor_temp', 'rev' );
|
$this->addTable( 'revision', 'rev' );
|
||||||
$this->addSelect( [ 'rev.revactor_timestamp' ] );
|
$this->addSelect( [ 'rev.rev_timestamp' ] );
|
||||||
|
|
||||||
if ( !$this->revisionAuxWhereAdded ) {
|
if ( !$this->revisionAuxWhereAdded ) {
|
||||||
$this->addWhere(
|
$this->addWhere(
|
||||||
[
|
[
|
||||||
"{$this->tableNames['page']}.page_id = rev.revactor_page",
|
"{$this->tableNames['page']}.page_id = rev.rev_page",
|
||||||
"rev.revactor_timestamp = (SELECT MAX(rev_aux.revactor_timestamp) FROM {$this->tableNames['revision_actor_temp']} AS rev_aux WHERE rev_aux.revactor_page = rev.revactor_page)"
|
"rev.rev_timestamp = (SELECT MAX(rev_aux.rev_timestamp) FROM {$this->tableNames['revision']} AS rev_aux WHERE rev_aux.rev_page = rev.rev_page)"
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1962,8 +1960,8 @@ class Query {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'user':
|
case 'user':
|
||||||
$this->addOrderBy( 'rev.revactor_actor' );
|
$this->addOrderBy( 'rev.rev_actor' );
|
||||||
$this->addTable( 'revision_actor_temp', 'rev' );
|
$this->addTable( 'revision', 'rev' );
|
||||||
|
|
||||||
$this->_adduser( null, 'rev' );
|
$this->_adduser( null, 'rev' );
|
||||||
break;
|
break;
|
||||||
|
@ -2196,22 +2194,29 @@ class Query {
|
||||||
|
|
||||||
foreach ( $option as $linkGroup ) {
|
foreach ( $option as $linkGroup ) {
|
||||||
foreach ( $linkGroup as $link ) {
|
foreach ( $linkGroup as $link ) {
|
||||||
$ors[] = 'tpl_from = ' . intval( $link->getArticleID() );
|
$ors[] = 'tpl_from = ' . (int)$link->getArticleID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$where = '(' . implode( ' OR ', $ors ) . ')';
|
$where = '(' . implode( ' OR ', $ors ) . ')';
|
||||||
} else {
|
} else {
|
||||||
$this->addTable( 'templatelinks', 'tpl' );
|
$this->addTables( [
|
||||||
$this->addTable( 'page', 'tplsrc' );
|
'linktarget' => 'lt',
|
||||||
|
'page' => 'tplsrc',
|
||||||
|
'templatelinks' => 'tpl',
|
||||||
|
] );
|
||||||
|
|
||||||
|
$linksMigration = MediaWikiServices::getInstance()->getLinksMigration();
|
||||||
|
list( $nsField, $titleField ) = $linksMigration->getTitleFields( 'templatelinks' );
|
||||||
|
|
||||||
$this->addSelect( [ 'tpl_sel_title' => 'tplsrc.page_title', 'tpl_sel_ns' => 'tplsrc.page_namespace' ] );
|
$this->addSelect( [ 'tpl_sel_title' => 'tplsrc.page_title', 'tpl_sel_ns' => 'tplsrc.page_namespace' ] );
|
||||||
$where = $this->tableNames['page'] . '.page_namespace = tpl.tl_namespace AND ' .
|
$where = $this->tableNames['page'] . '.page_namespace = lt.' . $nsField . ' AND ' .
|
||||||
$this->tableNames['page'] . '.page_title = tpl.tl_title AND tplsrc.page_id = tpl.tl_from AND ';
|
$this->tableNames['page'] . '.page_title = lt.' . $titleField . ' AND tplsrc.page_id = tpl.tl_from AND ';
|
||||||
$ors = [];
|
$ors = [];
|
||||||
|
|
||||||
foreach ( $option as $linkGroup ) {
|
foreach ( $option as $linkGroup ) {
|
||||||
foreach ( $linkGroup as $link ) {
|
foreach ( $linkGroup as $link ) {
|
||||||
$ors[] = 'tpl.tl_from = ' . intval( $link->getArticleID() );
|
$ors[] = 'tpl.tl_from = ' . (int)$link->getArticleID();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2227,18 +2232,25 @@ class Query {
|
||||||
* @param mixed $option
|
* @param mixed $option
|
||||||
*/
|
*/
|
||||||
private function _uses( $option ) {
|
private function _uses( $option ) {
|
||||||
$this->addTable( 'templatelinks', 'tl' );
|
$this->addTables( [
|
||||||
$where = $this->tableNames['page'] . '.page_id=tl.tl_from AND (';
|
'linktarget' => 'lt',
|
||||||
|
'templatelinks' => 'tl',
|
||||||
|
] );
|
||||||
|
|
||||||
|
$where = $this->tableNames['page'] . '.page_id=tl.tl_from AND lt.lt_id = tl.tl_target_id AND (';
|
||||||
$ors = [];
|
$ors = [];
|
||||||
|
|
||||||
|
$linksMigration = MediaWikiServices::getInstance()->getLinksMigration();
|
||||||
|
list( $nsField, $titleField ) = $linksMigration->getTitleFields( 'templatelinks' );
|
||||||
|
|
||||||
foreach ( $option as $linkGroup ) {
|
foreach ( $option as $linkGroup ) {
|
||||||
foreach ( $linkGroup as $link ) {
|
foreach ( $linkGroup as $link ) {
|
||||||
$_or = '(tl.tl_namespace=' . intval( $link->getNamespace() );
|
$_or = '(lt.' . $nsField . '=' . (int)$link->getNamespace();
|
||||||
|
|
||||||
if ( $this->parameters->getParameter( 'ignorecase' ) ) {
|
if ( $this->parameters->getParameter( 'ignorecase' ) ) {
|
||||||
$_or .= ' AND LOWER(CAST(tl.tl_title AS char)) = LOWER(' . $this->dbr->addQuotes( $link->getDBkey() ) . '))';
|
$_or .= ' AND LOWER(CAST(lt.' . $titleField . ' AS char)) = LOWER(' . $this->dbr->addQuotes( $link->getDBkey() ) . '))';
|
||||||
} else {
|
} else {
|
||||||
$_or .= ' AND tl.tl_title = ' . $this->dbr->addQuotes( $link->getDBkey() ) . ')';
|
$_or .= ' AND ' . $titleField . ' = ' . $this->dbr->addQuotes( $link->getDBkey() ) . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
$ors[] = $_or;
|
$ors[] = $_or;
|
||||||
|
@ -2259,14 +2271,17 @@ class Query {
|
||||||
$where = $this->tableNames['page'] . '.page_id NOT IN (SELECT ' . $this->tableNames['templatelinks'] . '.tl_from FROM ' . $this->tableNames['templatelinks'] . ' WHERE (';
|
$where = $this->tableNames['page'] . '.page_id NOT IN (SELECT ' . $this->tableNames['templatelinks'] . '.tl_from FROM ' . $this->tableNames['templatelinks'] . ' WHERE (';
|
||||||
$ors = [];
|
$ors = [];
|
||||||
|
|
||||||
|
$linksMigration = MediaWikiServices::getInstance()->getLinksMigration();
|
||||||
|
list( $nsField, $titleField ) = $linksMigration->getTitleFields( 'templatelinks' );
|
||||||
|
|
||||||
foreach ( $option as $linkGroup ) {
|
foreach ( $option as $linkGroup ) {
|
||||||
foreach ( $linkGroup as $link ) {
|
foreach ( $linkGroup as $link ) {
|
||||||
$_or = '(' . $this->tableNames['templatelinks'] . '.tl_namespace=' . intval( $link->getNamespace() );
|
$_or = '(' . $this->tableNames['linktarget'] . '.' . $nsField . '=' . (int)$link->getNamespace();
|
||||||
|
|
||||||
if ( $this->parameters->getParameter( 'ignorecase' ) ) {
|
if ( $this->parameters->getParameter( 'ignorecase' ) ) {
|
||||||
$_or .= ' AND LOWER(CAST(' . $this->tableNames['templatelinks'] . '.tl_title AS char)) = LOWER(' . $this->dbr->addQuotes( $link->getDBkey() ) . '))';
|
$_or .= ' AND LOWER(CAST(' . $this->tableNames['linktarget'] . '.' . $titleField . ' AS char)) = LOWER(' . $this->dbr->addQuotes( $link->getDBkey() ) . '))';
|
||||||
} else {
|
} else {
|
||||||
$_or .= ' AND ' . $this->tableNames['templatelinks'] . '.tl_title = ' . $this->dbr->addQuotes( $link->getDBkey() ) . ')';
|
$_or .= ' AND ' . $this->tableNames['linktarget'] . '.' . $titleField . ' = ' . $this->dbr->addQuotes( $link->getDBkey() ) . ')';
|
||||||
}
|
}
|
||||||
$ors[] = $_or;
|
$ors[] = $_or;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,6 @@ use MediaWiki\Revision\SlotRecord;
|
||||||
use ReadOnlyError;
|
use ReadOnlyError;
|
||||||
use RequestContext;
|
use RequestContext;
|
||||||
use Title;
|
use Title;
|
||||||
use WikiPage;
|
|
||||||
|
|
||||||
class UpdateArticle {
|
class UpdateArticle {
|
||||||
/**
|
/**
|
||||||
|
@ -311,7 +310,8 @@ class UpdateArticle {
|
||||||
$form .= "<input type='hidden' " . $hide . " />";
|
$form .= "<input type='hidden' " . $hide . " />";
|
||||||
}
|
}
|
||||||
|
|
||||||
$form .= "<input type='hidden' name='wpEditToken' value='{$user->getEditToken()}'/>";
|
$csrfTokenSet = RequestContext::getMain()->getCsrfTokenSet();
|
||||||
|
$form .= "<input type='hidden' name='wpEditToken' value='{$csrfTokenSet->getToken()}'/>";
|
||||||
foreach ( $preview as $prev ) {
|
foreach ( $preview as $prev ) {
|
||||||
$form .= "<input type='submit' " . $prev . " /> ";
|
$form .= "<input type='submit' " . $prev . " /> ";
|
||||||
}
|
}
|
||||||
|
@ -393,11 +393,10 @@ class UpdateArticle {
|
||||||
*/
|
*/
|
||||||
private static function doUpdateArticle( $title, $text, $summary ) {
|
private static function doUpdateArticle( $title, $text, $summary ) {
|
||||||
$context = RequestContext::getMain();
|
$context = RequestContext::getMain();
|
||||||
$request = $context->getRequest();
|
|
||||||
$out = $context->getOutput();
|
$out = $context->getOutput();
|
||||||
$user = $context->getUser();
|
$user = $context->getUser();
|
||||||
|
|
||||||
if ( !$user->matchEditToken( $request->getVal( 'wpEditToken' ) ) ) {
|
if ( !$context->getCsrfTokenSet()->matchTokenField( 'wpEditToken' ) ) {
|
||||||
$out->addWikiMsg( 'sessionfailure' );
|
$out->addWikiMsg( 'sessionfailure' );
|
||||||
|
|
||||||
return 'session failure';
|
return 'session failure';
|
||||||
|
@ -408,14 +407,8 @@ class UpdateArticle {
|
||||||
|
|
||||||
if ( count( $permission_errors ) == 0 ) {
|
if ( count( $permission_errors ) == 0 ) {
|
||||||
$services = MediaWikiServices::getInstance();
|
$services = MediaWikiServices::getInstance();
|
||||||
// MW 1.36+
|
$wikiPageFactory = $services->getWikiPageFactory();
|
||||||
if ( method_exists( $services, 'getWikiPageFactory' ) ) {
|
$page = $wikiPageFactory->newFromTitle( $titleX );
|
||||||
$wikiPageFactory = $services->getWikiPageFactory();
|
|
||||||
$page = $wikiPageFactory->newFromTitle( $titleX );
|
|
||||||
} else {
|
|
||||||
// @phan-suppress-next-line PhanDeprecatedFunction
|
|
||||||
$page = WikiPage::factory( $titleX );
|
|
||||||
}
|
|
||||||
|
|
||||||
$updater = $page->newPageUpdater( $user );
|
$updater = $page->newPageUpdater( $user );
|
||||||
$content = $page->getContentHandler()->makeContent( $text, $titleX );
|
$content = $page->getContentHandler()->makeContent( $text, $titleX );
|
||||||
|
@ -768,8 +761,14 @@ class UpdateArticle {
|
||||||
} elseif ( $isReadOnly ) {
|
} elseif ( $isReadOnly ) {
|
||||||
throw new ReadOnlyError;
|
throw new ReadOnlyError;
|
||||||
} else {
|
} else {
|
||||||
$articleX = new Article( $titleX );
|
$wikiPageFactory = MediaWikiServices::getInstance()->getWikiPageFactory();
|
||||||
$articleX->doDelete( $reason );
|
$deletePageFactory = MediaWikiServices::getInstance()->getDeletePageFactory();
|
||||||
|
$deletePage = $deletePageFactory->newDeletePage(
|
||||||
|
$wikiPageFactory->newFromTitle( $titleX ),
|
||||||
|
$user
|
||||||
|
);
|
||||||
|
|
||||||
|
$deletePage->deleteIfAllowed( $reason );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$message .= "set 'exec yes' to delete     <big>'''$title'''</big>\n";
|
$message .= "set 'exec yes' to delete     <big>'''$title'''</big>\n";
|
||||||
|
|
|
@ -8,7 +8,6 @@ use MediaWiki\MediaWikiServices;
|
||||||
use MediaWiki\Revision\SlotRecord;
|
use MediaWiki\Revision\SlotRecord;
|
||||||
use Title;
|
use Title;
|
||||||
use User;
|
use User;
|
||||||
use WikiPage;
|
|
||||||
|
|
||||||
$IP = getenv( 'MW_INSTALL_PATH' );
|
$IP = getenv( 'MW_INSTALL_PATH' );
|
||||||
if ( $IP === false ) {
|
if ( $IP === false ) {
|
||||||
|
@ -54,14 +53,9 @@ class CreateTemplate extends LoggedUpdateMaintenance {
|
||||||
// Make sure template does not already exist
|
// Make sure template does not already exist
|
||||||
if ( !$title->exists() ) {
|
if ( !$title->exists() ) {
|
||||||
$services = MediaWikiServices::getInstance();
|
$services = MediaWikiServices::getInstance();
|
||||||
// MW 1.36+
|
$wikiPageFactory = $services->getWikiPageFactory();
|
||||||
if ( method_exists( $services, 'getWikiPageFactory' ) ) {
|
$page = $wikiPageFactory->newFromTitle( $title );
|
||||||
$wikiPageFactory = $services->getWikiPageFactory();
|
|
||||||
$page = $wikiPageFactory->newFromTitle( $title );
|
|
||||||
} else {
|
|
||||||
// @phan-suppress-next-line PhanDeprecatedFunction
|
|
||||||
$page = WikiPage::factory( $title );
|
|
||||||
}
|
|
||||||
$updater = $page->newPageUpdater( User::newSystemUser( 'DynamicPageList3 extension' ) );
|
$updater = $page->newPageUpdater( User::newSystemUser( 'DynamicPageList3 extension' ) );
|
||||||
$content = $page->getContentHandler()->makeContent( '<noinclude>This page was automatically created. It serves as an anchor page for all \'\'\'[[Special:WhatLinksHere/Template:Extension_DPL|invocations]]\'\'\' of [https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:DynamicPageList3 Extension:DynamicPageList3].</noinclude>', $title );
|
$content = $page->getContentHandler()->makeContent( '<noinclude>This page was automatically created. It serves as an anchor page for all \'\'\'[[Special:WhatLinksHere/Template:Extension_DPL|invocations]]\'\'\' of [https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:DynamicPageList3 Extension:DynamicPageList3].</noinclude>', $title );
|
||||||
$updater->setContent( SlotRecord::MAIN, $content );
|
$updater->setContent( SlotRecord::MAIN, $content );
|
||||||
|
|
|
@ -88,12 +88,7 @@ abstract class DPLIntegrationTestCase extends MediaWikiIntegrationTestCase {
|
||||||
$source = new ImportStreamSource( $seedDataFile );
|
$source = new ImportStreamSource( $seedDataFile );
|
||||||
$services = MediaWikiServices::getInstance();
|
$services = MediaWikiServices::getInstance();
|
||||||
|
|
||||||
if ( $services->hasService( 'WikiImporterFactory' ) ) {
|
return $services->getWikiImporterFactory()->getWikiImporter( $source );
|
||||||
return $services->getWikiImporterFactory()->getWikiImporter( $source );
|
|
||||||
}
|
|
||||||
|
|
||||||
// MW 1.36
|
|
||||||
return new WikiImporter( $source, $services->getMainConfig() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getAuthManager(): AuthManager {
|
private function getAuthManager(): AuthManager {
|
||||||
|
@ -155,6 +150,7 @@ abstract class DPLIntegrationTestCase extends MediaWikiIntegrationTestCase {
|
||||||
$parserOptions = ParserOptions::newCanonical(
|
$parserOptions = ParserOptions::newCanonical(
|
||||||
RequestContext::getMain()
|
RequestContext::getMain()
|
||||||
);
|
);
|
||||||
|
|
||||||
$parserOutput = $parser->parse( $invocation, $title, $parserOptions );
|
$parserOutput = $parser->parse( $invocation, $title, $parserOptions );
|
||||||
|
|
||||||
return $parserOutput->getText();
|
return $parserOutput->getText();
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<sitename>MediaWiki</sitename>
|
<sitename>MediaWiki</sitename>
|
||||||
<dbname>mwdev</dbname>
|
<dbname>mwdev</dbname>
|
||||||
<base>http://localhost:8080/wiki/Main_Page</base>
|
<base>http://localhost:8080/wiki/Main_Page</base>
|
||||||
<generator>MediaWiki 1.37.0-alpha</generator>
|
<generator>MediaWiki 1.39.0</generator>
|
||||||
<case>first-letter</case>
|
<case>first-letter</case>
|
||||||
<namespaces>
|
<namespaces>
|
||||||
<namespace key="-2" case="first-letter">Media</namespace>
|
<namespace key="-2" case="first-letter">Media</namespace>
|
||||||
|
@ -252,12 +252,27 @@
|
||||||
</revision>
|
</revision>
|
||||||
<revision>
|
<revision>
|
||||||
<id>28</id>
|
<id>28</id>
|
||||||
<timestamp>2021-09-04T03:01:00Z</timestamp>
|
<timestamp>2021-09-04T03:01:14Z</timestamp>
|
||||||
<contributor>
|
<contributor>
|
||||||
<username>DPLTestUser</username>
|
<username>DPLTestUser</username>
|
||||||
|
<id>2</id>
|
||||||
</contributor>
|
</contributor>
|
||||||
<comment>Page edited</comment>
|
<comment>Page edited</comment>
|
||||||
<origin>27</origin>
|
<origin>28</origin>
|
||||||
|
<model>wikitext</model>
|
||||||
|
<format>text/x-wiki</format>
|
||||||
|
<text xml:space="preserve">Uncategorized test page edit</text>
|
||||||
|
<sha1 />
|
||||||
|
</revision>
|
||||||
|
<revision>
|
||||||
|
<id>29</id>
|
||||||
|
<timestamp>2021-09-04T03:01:26Z</timestamp>
|
||||||
|
<contributor>
|
||||||
|
<username>DPLTestAdmin</username>
|
||||||
|
<id>1</id>
|
||||||
|
</contributor>
|
||||||
|
<comment>Page edited</comment>
|
||||||
|
<origin>29</origin>
|
||||||
<model>wikitext</model>
|
<model>wikitext</model>
|
||||||
<format>text/x-wiki</format>
|
<format>text/x-wiki</format>
|
||||||
<text xml:space="preserve">Uncategorized test page edit</text>
|
<text xml:space="preserve">Uncategorized test page edit</text>
|
||||||
|
@ -267,16 +282,16 @@
|
||||||
<page>
|
<page>
|
||||||
<title>DPLTestOpenReferences</title>
|
<title>DPLTestOpenReferences</title>
|
||||||
<ns>0</ns>
|
<ns>0</ns>
|
||||||
<id>29</id>
|
<id>30</id>
|
||||||
<revision>
|
<revision>
|
||||||
<id>29</id>
|
<id>30</id>
|
||||||
<timestamp>2021-09-04T04:00:00Z</timestamp>
|
<timestamp>2021-09-04T04:00:00Z</timestamp>
|
||||||
<contributor>
|
<contributor>
|
||||||
<username>DPLTestUser</username>
|
<username>DPLTestUser</username>
|
||||||
<id>2</id>
|
<id>2</id>
|
||||||
</contributor>
|
</contributor>
|
||||||
<comment>Create test page with red link</comment>
|
<comment>Create test page with red link</comment>
|
||||||
<origin>29</origin>
|
<origin>30</origin>
|
||||||
<model>wikitext</model>
|
<model>wikitext</model>
|
||||||
<format>text/x-wiki</format>
|
<format>text/x-wiki</format>
|
||||||
<text xml:space="preserve">[[DPLTestArticle 1]][[DPLTestArticle 2]][[RedLink]][[DPLTestArticle 3]]</text>
|
<text xml:space="preserve">[[DPLTestArticle 1]][[DPLTestArticle 2]][[RedLink]][[DPLTestArticle 3]]</text>
|
||||||
|
|
Loading…
Reference in a new issue