2006-09-26 01:44:13 +00:00
|
|
|
<?php
|
2010-02-24 14:45:19 +00:00
|
|
|
/**
|
2012-07-15 20:13:02 +00:00
|
|
|
* Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
|
2006-09-26 01:44:13 +00:00
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
2010-06-21 13:13:32 +00:00
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-09-26 01:44:13 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
2010-08-07 19:59:42 +00:00
|
|
|
*
|
|
|
|
|
* @file
|
2006-09-26 01:44:13 +00:00
|
|
|
*/
|
2024-09-25 16:17:29 +00:00
|
|
|
|
|
|
|
|
namespace MediaWiki\Api;
|
|
|
|
|
|
2020-12-11 15:57:35 +00:00
|
|
|
use MediaWiki\Cache\LinkBatchFactory;
|
2023-05-19 15:17:55 +00:00
|
|
|
use MediaWiki\EditPage\IntroMessageBuilder;
|
|
|
|
|
use MediaWiki\EditPage\PreloadedContentBuilder;
|
2024-08-08 09:39:26 +00:00
|
|
|
use MediaWiki\Language\ILanguageConverter;
|
|
|
|
|
use MediaWiki\Language\Language;
|
2021-07-03 21:22:48 +00:00
|
|
|
use MediaWiki\Languages\LanguageConverterFactory;
|
2022-04-21 19:35:30 +00:00
|
|
|
use MediaWiki\Linker\LinksMigration;
|
2016-04-20 08:29:21 +00:00
|
|
|
use MediaWiki\Linker\LinkTarget;
|
2022-04-13 15:28:26 +00:00
|
|
|
use MediaWiki\MainConfigNames;
|
2023-06-16 21:24:56 +00:00
|
|
|
use MediaWiki\Page\PageIdentity;
|
2023-05-19 15:17:55 +00:00
|
|
|
use MediaWiki\Page\PageReference;
|
2020-12-10 23:39:12 +00:00
|
|
|
use MediaWiki\ParamValidator\TypeDef\TitleDef;
|
2021-01-11 15:26:02 +00:00
|
|
|
use MediaWiki\Permissions\PermissionStatus;
|
2022-04-13 20:03:34 +00:00
|
|
|
use MediaWiki\Permissions\RestrictionStore;
|
2023-05-19 15:17:55 +00:00
|
|
|
use MediaWiki\Revision\RevisionLookup;
|
2023-09-18 14:17:28 +00:00
|
|
|
use MediaWiki\Title\NamespaceInfo;
|
2023-03-01 20:33:26 +00:00
|
|
|
use MediaWiki\Title\Title;
|
2022-11-26 01:15:16 +00:00
|
|
|
use MediaWiki\Title\TitleFactory;
|
2023-09-18 14:26:53 +00:00
|
|
|
use MediaWiki\Title\TitleFormatter;
|
2023-09-18 13:56:39 +00:00
|
|
|
use MediaWiki\Title\TitleValue;
|
2023-04-27 19:22:02 +00:00
|
|
|
use MediaWiki\User\TempUser\TempUserCreator;
|
2023-10-29 21:37:26 +00:00
|
|
|
use MediaWiki\User\UserFactory;
|
2023-05-31 22:11:12 +00:00
|
|
|
use MediaWiki\Utils\UrlUtils;
|
2024-05-17 09:37:08 +00:00
|
|
|
use MediaWiki\Watchlist\WatchedItem;
|
2024-05-20 14:49:03 +00:00
|
|
|
use MediaWiki\Watchlist\WatchedItemStore;
|
2024-09-25 16:17:29 +00:00
|
|
|
use MessageLocalizer;
|
2022-06-05 23:18:50 +00:00
|
|
|
use Wikimedia\ParamValidator\ParamValidator;
|
2022-06-06 01:24:41 +00:00
|
|
|
use Wikimedia\ParamValidator\TypeDef\EnumDef;
|
2006-09-26 01:44:13 +00:00
|
|
|
|
2007-04-20 08:55:14 +00:00
|
|
|
/**
|
2007-05-20 23:31:44 +00:00
|
|
|
* A query module to show basic page information.
|
2008-04-14 07:45:50 +00:00
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup API
|
2007-04-20 08:55:14 +00:00
|
|
|
*/
|
2006-09-26 01:44:13 +00:00
|
|
|
class ApiQueryInfo extends ApiQueryBase {
|
2009-11-19 17:57:27 +00:00
|
|
|
|
2023-08-28 15:32:58 +00:00
|
|
|
private ILanguageConverter $languageConverter;
|
|
|
|
|
private LinkBatchFactory $linkBatchFactory;
|
|
|
|
|
private NamespaceInfo $namespaceInfo;
|
|
|
|
|
private TitleFactory $titleFactory;
|
|
|
|
|
private TitleFormatter $titleFormatter;
|
|
|
|
|
private WatchedItemStore $watchedItemStore;
|
|
|
|
|
private RestrictionStore $restrictionStore;
|
|
|
|
|
private LinksMigration $linksMigration;
|
|
|
|
|
private TempUserCreator $tempUserCreator;
|
2023-10-29 21:37:26 +00:00
|
|
|
private UserFactory $userFactory;
|
2023-08-28 15:32:58 +00:00
|
|
|
private IntroMessageBuilder $introMessageBuilder;
|
|
|
|
|
private PreloadedContentBuilder $preloadedContentBuilder;
|
|
|
|
|
private RevisionLookup $revisionLookup;
|
|
|
|
|
private UrlUtils $urlUtils;
|
2020-12-11 15:57:35 +00:00
|
|
|
|
2024-04-21 14:42:27 +00:00
|
|
|
private bool $fld_protection = false;
|
|
|
|
|
private bool $fld_talkid = false;
|
|
|
|
|
private bool $fld_subjectid = false;
|
|
|
|
|
private bool $fld_url = false;
|
|
|
|
|
private bool $fld_readable = false;
|
|
|
|
|
private bool $fld_watched = false;
|
|
|
|
|
private bool $fld_watchers = false;
|
|
|
|
|
private bool $fld_visitingwatchers = false;
|
|
|
|
|
private bool $fld_notificationtimestamp = false;
|
|
|
|
|
private bool $fld_preload = false;
|
|
|
|
|
private bool $fld_preloadcontent = false;
|
|
|
|
|
private bool $fld_editintro = false;
|
|
|
|
|
private bool $fld_displaytitle = false;
|
|
|
|
|
private bool $fld_varianttitles = false;
|
2006-09-26 01:44:13 +00:00
|
|
|
|
2020-12-10 23:39:12 +00:00
|
|
|
/**
|
|
|
|
|
* @var bool Whether to include link class information for the
|
|
|
|
|
* given page titles.
|
|
|
|
|
*/
|
|
|
|
|
private $fld_linkclasses = false;
|
|
|
|
|
|
2021-06-08 05:16:45 +00:00
|
|
|
/**
|
|
|
|
|
* @var bool Whether to include the name of the associated page
|
|
|
|
|
*/
|
|
|
|
|
private $fld_associatedpage = false;
|
|
|
|
|
|
2024-09-07 20:22:13 +00:00
|
|
|
/** @var array */
|
2016-01-26 19:05:19 +00:00
|
|
|
private $params;
|
|
|
|
|
|
2024-07-07 14:30:26 +00:00
|
|
|
/** @var array<int,PageIdentity> */
|
2016-01-26 19:05:19 +00:00
|
|
|
private $titles;
|
2024-07-07 14:30:26 +00:00
|
|
|
/** @var array<int,PageIdentity> */
|
2016-01-26 19:05:19 +00:00
|
|
|
private $missing;
|
2024-07-07 14:30:26 +00:00
|
|
|
/** @var array<int,PageIdentity> */
|
2016-01-26 19:05:19 +00:00
|
|
|
private $everything;
|
2011-02-27 21:10:11 +00:00
|
|
|
|
2024-07-07 14:30:26 +00:00
|
|
|
/**
|
|
|
|
|
* @var array<int,bool> [page_id] => page_is_redirect database field, guaranteed to be
|
|
|
|
|
* initialized via execute()
|
|
|
|
|
*/
|
2024-04-21 14:42:27 +00:00
|
|
|
private $pageIsRedir;
|
2024-07-07 14:30:26 +00:00
|
|
|
/**
|
|
|
|
|
* @var array<int,bool> [page_id] => page_is_new database field, guaranteed to be
|
|
|
|
|
* initialized via execute()
|
|
|
|
|
*/
|
2024-04-21 14:42:27 +00:00
|
|
|
private $pageIsNew;
|
2024-07-07 14:30:26 +00:00
|
|
|
/**
|
|
|
|
|
* @var array<int,int> [page_id] => page_touched database field, guaranteed to be
|
|
|
|
|
* initialized via execute()
|
|
|
|
|
*/
|
2024-04-21 14:42:27 +00:00
|
|
|
private $pageTouched;
|
2024-07-07 14:30:26 +00:00
|
|
|
/**
|
|
|
|
|
* @var array<int,int> [page_id] => page_latest database field, guaranteed to be
|
|
|
|
|
* initialized via execute()
|
|
|
|
|
*/
|
2024-04-21 14:42:27 +00:00
|
|
|
private $pageLatest;
|
2024-07-07 14:30:26 +00:00
|
|
|
/**
|
|
|
|
|
* @var array<int,int> [page_id] => page_len database field, guaranteed to be
|
|
|
|
|
* initialized via execute()
|
|
|
|
|
*/
|
2024-04-21 14:42:27 +00:00
|
|
|
private $pageLength;
|
2011-02-27 21:10:11 +00:00
|
|
|
|
2024-09-07 20:22:13 +00:00
|
|
|
/** @var array[][][] */
|
2024-04-21 14:42:27 +00:00
|
|
|
private $protections;
|
2024-09-07 20:22:13 +00:00
|
|
|
/** @var string[][][] */
|
2024-04-21 14:42:27 +00:00
|
|
|
private $restrictionTypes;
|
2024-09-07 20:22:13 +00:00
|
|
|
/** @var bool[][] */
|
2024-04-21 14:42:27 +00:00
|
|
|
private $watched;
|
2024-09-07 20:22:13 +00:00
|
|
|
/** @var int[][] */
|
2024-04-21 14:42:27 +00:00
|
|
|
private $watchers;
|
2024-09-07 20:22:13 +00:00
|
|
|
/** @var int[][] */
|
2024-04-21 14:42:27 +00:00
|
|
|
private $visitingwatchers;
|
2024-09-07 20:22:13 +00:00
|
|
|
/** @var string[][] */
|
2024-04-21 14:42:27 +00:00
|
|
|
private $notificationtimestamps;
|
2024-09-07 20:22:13 +00:00
|
|
|
/** @var int[][] */
|
2024-04-21 14:42:27 +00:00
|
|
|
private $talkids;
|
2024-09-07 20:22:13 +00:00
|
|
|
/** @var int[][] */
|
2024-04-21 14:42:27 +00:00
|
|
|
private $subjectids;
|
2024-09-07 20:22:13 +00:00
|
|
|
/** @var string[][] */
|
2024-04-21 14:42:27 +00:00
|
|
|
private $displaytitles;
|
2024-09-07 20:22:13 +00:00
|
|
|
/** @var string[][] */
|
2024-04-21 14:42:27 +00:00
|
|
|
private $variantTitles;
|
2020-12-10 23:39:12 +00:00
|
|
|
|
2020-12-14 22:29:18 +00:00
|
|
|
/**
|
|
|
|
|
* Watchlist expiries that corresponds with the $watched property. Keyed by namespace and title.
|
|
|
|
|
* @var array<int,array<string,string>>
|
|
|
|
|
*/
|
|
|
|
|
private $watchlistExpiries;
|
|
|
|
|
|
2020-12-10 23:39:12 +00:00
|
|
|
/**
|
|
|
|
|
* @var array<int,string[]> Mapping of page id to list of 'extra link
|
|
|
|
|
* classes' for the given page
|
|
|
|
|
*/
|
|
|
|
|
private $linkClasses;
|
|
|
|
|
|
2024-09-07 20:22:13 +00:00
|
|
|
/** @var bool */
|
2013-01-23 20:40:57 +00:00
|
|
|
private $showZeroWatchers = false;
|
2011-02-27 21:10:11 +00:00
|
|
|
|
2024-09-07 20:22:13 +00:00
|
|
|
/** @var int */
|
2015-01-29 20:14:40 +00:00
|
|
|
private $countTestedActions = 0;
|
|
|
|
|
|
2020-12-11 15:57:35 +00:00
|
|
|
public function __construct(
|
|
|
|
|
ApiQuery $queryModule,
|
2024-10-14 20:12:27 +00:00
|
|
|
string $moduleName,
|
2020-12-11 15:57:35 +00:00
|
|
|
Language $contentLanguage,
|
|
|
|
|
LinkBatchFactory $linkBatchFactory,
|
|
|
|
|
NamespaceInfo $namespaceInfo,
|
|
|
|
|
TitleFactory $titleFactory,
|
2021-06-08 05:16:45 +00:00
|
|
|
TitleFormatter $titleFormatter,
|
2021-07-03 21:22:48 +00:00
|
|
|
WatchedItemStore $watchedItemStore,
|
2022-04-13 20:03:34 +00:00
|
|
|
LanguageConverterFactory $languageConverterFactory,
|
2022-04-21 19:35:30 +00:00
|
|
|
RestrictionStore $restrictionStore,
|
2023-04-27 19:22:02 +00:00
|
|
|
LinksMigration $linksMigration,
|
2023-05-19 15:17:55 +00:00
|
|
|
TempUserCreator $tempUserCreator,
|
2023-10-29 21:37:26 +00:00
|
|
|
UserFactory $userFactory,
|
2023-05-19 15:17:55 +00:00
|
|
|
IntroMessageBuilder $introMessageBuilder,
|
|
|
|
|
PreloadedContentBuilder $preloadedContentBuilder,
|
2023-05-31 22:11:12 +00:00
|
|
|
RevisionLookup $revisionLookup,
|
|
|
|
|
UrlUtils $urlUtils
|
2020-12-11 15:57:35 +00:00
|
|
|
) {
|
|
|
|
|
parent::__construct( $queryModule, $moduleName, 'in' );
|
2021-07-03 21:22:48 +00:00
|
|
|
$this->languageConverter = $languageConverterFactory->getLanguageConverter( $contentLanguage );
|
2020-12-11 15:57:35 +00:00
|
|
|
$this->linkBatchFactory = $linkBatchFactory;
|
|
|
|
|
$this->namespaceInfo = $namespaceInfo;
|
|
|
|
|
$this->titleFactory = $titleFactory;
|
2021-06-08 05:16:45 +00:00
|
|
|
$this->titleFormatter = $titleFormatter;
|
2020-12-11 15:57:35 +00:00
|
|
|
$this->watchedItemStore = $watchedItemStore;
|
2022-04-13 20:03:34 +00:00
|
|
|
$this->restrictionStore = $restrictionStore;
|
2022-04-21 19:35:30 +00:00
|
|
|
$this->linksMigration = $linksMigration;
|
2023-04-27 19:22:02 +00:00
|
|
|
$this->tempUserCreator = $tempUserCreator;
|
2023-10-29 21:37:26 +00:00
|
|
|
$this->userFactory = $userFactory;
|
2023-05-19 15:17:55 +00:00
|
|
|
$this->introMessageBuilder = $introMessageBuilder;
|
|
|
|
|
$this->preloadedContentBuilder = $preloadedContentBuilder;
|
|
|
|
|
$this->revisionLookup = $revisionLookup;
|
2023-05-31 22:11:12 +00:00
|
|
|
$this->urlUtils = $urlUtils;
|
2006-09-26 01:44:13 +00:00
|
|
|
}
|
|
|
|
|
|
2011-02-19 00:30:18 +00:00
|
|
|
/**
|
2014-04-15 18:12:09 +00:00
|
|
|
* @param ApiPageSet $pageSet
|
2012-01-12 19:41:18 +00:00
|
|
|
* @return void
|
2011-02-19 00:30:18 +00:00
|
|
|
*/
|
2010-01-11 15:55:52 +00:00
|
|
|
public function requestExtraData( $pageSet ) {
|
2014-11-17 16:18:09 +00:00
|
|
|
// If the pageset is resolving redirects we won't get page_is_redirect.
|
|
|
|
|
// But we can't know for sure until the pageset is executed (revids may
|
|
|
|
|
// turn it off), so request it unconditionally.
|
|
|
|
|
$pageSet->requestField( 'page_is_redirect' );
|
2010-01-11 15:55:52 +00:00
|
|
|
$pageSet->requestField( 'page_is_new' );
|
2014-01-24 02:51:11 +00:00
|
|
|
$config = $this->getConfig();
|
2010-01-11 15:55:52 +00:00
|
|
|
$pageSet->requestField( 'page_touched' );
|
|
|
|
|
$pageSet->requestField( 'page_latest' );
|
|
|
|
|
$pageSet->requestField( 'page_len' );
|
2019-12-17 16:20:32 +00:00
|
|
|
$pageSet->requestField( 'page_content_model' );
|
2022-04-13 15:28:26 +00:00
|
|
|
if ( $config->get( MainConfigNames::PageLanguageUseDB ) ) {
|
2014-11-04 17:56:44 +00:00
|
|
|
$pageSet->requestField( 'page_lang' );
|
|
|
|
|
}
|
2006-10-01 20:17:16 +00:00
|
|
|
}
|
|
|
|
|
|
2006-09-27 05:13:48 +00:00
|
|
|
public function execute() {
|
2009-02-13 14:44:19 +00:00
|
|
|
$this->params = $this->extractRequestParams();
|
2020-01-09 23:48:34 +00:00
|
|
|
if ( $this->params['prop'] !== null ) {
|
2021-06-11 02:52:06 +00:00
|
|
|
$prop = array_fill_keys( $this->params['prop'], true );
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->fld_protection = isset( $prop['protection'] );
|
|
|
|
|
$this->fld_watched = isset( $prop['watched'] );
|
2013-01-23 20:40:57 +00:00
|
|
|
$this->fld_watchers = isset( $prop['watchers'] );
|
2016-01-09 03:14:12 +00:00
|
|
|
$this->fld_visitingwatchers = isset( $prop['visitingwatchers'] );
|
2012-06-18 20:33:19 +00:00
|
|
|
$this->fld_notificationtimestamp = isset( $prop['notificationtimestamp'] );
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->fld_talkid = isset( $prop['talkid'] );
|
|
|
|
|
$this->fld_subjectid = isset( $prop['subjectid'] );
|
|
|
|
|
$this->fld_url = isset( $prop['url'] );
|
|
|
|
|
$this->fld_readable = isset( $prop['readable'] );
|
2010-02-24 14:45:19 +00:00
|
|
|
$this->fld_preload = isset( $prop['preload'] );
|
2023-05-19 15:17:55 +00:00
|
|
|
$this->fld_preloadcontent = isset( $prop['preloadcontent'] );
|
|
|
|
|
$this->fld_editintro = isset( $prop['editintro'] );
|
2010-07-22 07:00:38 +00:00
|
|
|
$this->fld_displaytitle = isset( $prop['displaytitle'] );
|
2017-10-18 19:42:42 +00:00
|
|
|
$this->fld_varianttitles = isset( $prop['varianttitles'] );
|
2020-12-10 23:39:12 +00:00
|
|
|
$this->fld_linkclasses = isset( $prop['linkclasses'] );
|
2021-06-08 05:16:45 +00:00
|
|
|
$this->fld_associatedpage = isset( $prop['associatedpage'] );
|
2007-06-18 02:00:23 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2006-10-01 20:17:16 +00:00
|
|
|
$pageSet = $this->getPageSet();
|
2023-06-16 21:24:56 +00:00
|
|
|
$this->titles = $pageSet->getGoodPages();
|
|
|
|
|
$this->missing = $pageSet->getMissingPages();
|
2009-02-13 15:14:21 +00:00
|
|
|
$this->everything = $this->titles + $this->missing;
|
2006-10-25 03:54:56 +00:00
|
|
|
$result = $this->getResult();
|
2006-09-26 01:44:13 +00:00
|
|
|
|
2023-05-19 15:17:55 +00:00
|
|
|
if (
|
|
|
|
|
( $this->fld_preloadcontent || $this->fld_editintro ) &&
|
|
|
|
|
( count( $this->everything ) > 1 || count( $this->getPageSet()->getRevisionIDs() ) > 1 )
|
|
|
|
|
) {
|
|
|
|
|
// This is relatively slow, so disallow doing it for multiple pages, just in case.
|
|
|
|
|
// (Also, handling multiple revisions would be tricky.)
|
|
|
|
|
$this->dieWithError(
|
|
|
|
|
[ 'apierror-info-singlepagerevision', $this->getModulePrefix() ], 'invalidparammix'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-13 00:02:09 +00:00
|
|
|
uasort( $this->everything, [ Title::class, 'compare' ] );
|
2020-01-09 23:48:34 +00:00
|
|
|
if ( $this->params['continue'] !== null ) {
|
2009-02-13 15:36:32 +00:00
|
|
|
// Throw away any titles we're gonna skip so they don't
|
|
|
|
|
// clutter queries
|
2022-09-16 14:38:10 +00:00
|
|
|
$cont = $this->parseContinueParamOrDie( $this->params['continue'], [ 'int', 'string' ] );
|
|
|
|
|
$conttitle = $this->titleFactory->makeTitleSafe( $cont[0], $cont[1] );
|
2022-02-18 23:05:25 +00:00
|
|
|
$this->dieContinueUsageIf( !$conttitle );
|
2023-06-16 21:24:56 +00:00
|
|
|
foreach ( $this->everything as $pageid => $page ) {
|
|
|
|
|
if ( Title::compare( $page, $conttitle ) >= 0 ) {
|
2009-02-13 15:36:32 +00:00
|
|
|
break;
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2010-01-11 15:55:52 +00:00
|
|
|
unset( $this->titles[$pageid] );
|
|
|
|
|
unset( $this->missing[$pageid] );
|
|
|
|
|
unset( $this->everything[$pageid] );
|
2009-02-13 15:36:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-08 15:09:04 +00:00
|
|
|
// when resolving redirects, no page will have this field
|
|
|
|
|
$this->pageIsRedir = !$pageSet->isResolvingRedirects()
|
|
|
|
|
? $pageSet->getCustomField( 'page_is_redirect' )
|
2016-02-17 09:09:32 +00:00
|
|
|
: [];
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->pageIsNew = $pageSet->getCustomField( 'page_is_new' );
|
2010-11-04 13:10:38 +00:00
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->pageTouched = $pageSet->getCustomField( 'page_touched' );
|
|
|
|
|
$this->pageLatest = $pageSet->getCustomField( 'page_latest' );
|
|
|
|
|
$this->pageLength = $pageSet->getCustomField( 'page_len' );
|
2006-10-01 20:17:16 +00:00
|
|
|
|
2009-02-13 14:44:19 +00:00
|
|
|
// Get protection info if requested
|
2010-02-24 14:45:19 +00:00
|
|
|
if ( $this->fld_protection ) {
|
2009-02-13 14:44:19 +00:00
|
|
|
$this->getProtectionInfo();
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2007-06-18 02:00:23 +00:00
|
|
|
|
2012-06-18 20:33:19 +00:00
|
|
|
if ( $this->fld_watched || $this->fld_notificationtimestamp ) {
|
2009-11-19 17:57:27 +00:00
|
|
|
$this->getWatchedInfo();
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2009-11-19 17:57:27 +00:00
|
|
|
|
2013-01-23 20:40:57 +00:00
|
|
|
if ( $this->fld_watchers ) {
|
|
|
|
|
$this->getWatcherInfo();
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-09 03:14:12 +00:00
|
|
|
if ( $this->fld_visitingwatchers ) {
|
|
|
|
|
$this->getVisitingWatcherInfo();
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-13 14:44:19 +00:00
|
|
|
// Run the talkid/subjectid query if requested
|
2010-02-24 14:45:19 +00:00
|
|
|
if ( $this->fld_talkid || $this->fld_subjectid ) {
|
2009-02-13 14:44:19 +00:00
|
|
|
$this->getTSIDs();
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2010-07-23 07:33:40 +00:00
|
|
|
|
2010-07-22 08:48:34 +00:00
|
|
|
if ( $this->fld_displaytitle ) {
|
|
|
|
|
$this->getDisplayTitle();
|
|
|
|
|
}
|
2009-02-13 14:44:19 +00:00
|
|
|
|
2017-10-18 19:42:42 +00:00
|
|
|
if ( $this->fld_varianttitles ) {
|
|
|
|
|
$this->getVariantTitles();
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-10 23:39:12 +00:00
|
|
|
if ( $this->fld_linkclasses ) {
|
|
|
|
|
$this->getLinkClasses( $this->params['linkcontext'] );
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-16 21:24:56 +00:00
|
|
|
/** @var PageIdentity $page */
|
|
|
|
|
foreach ( $this->everything as $pageid => $page ) {
|
|
|
|
|
$pageInfo = $this->extractPageInfo( $pageid, $page );
|
2016-02-17 09:09:32 +00:00
|
|
|
$fit = $pageInfo !== null && $result->addValue( [
|
2009-02-13 14:44:19 +00:00
|
|
|
'query',
|
|
|
|
|
'pages'
|
2016-02-17 09:09:32 +00:00
|
|
|
], $pageid, $pageInfo );
|
2010-02-24 14:45:19 +00:00
|
|
|
if ( !$fit ) {
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->setContinueEnumParameter( 'continue',
|
2023-06-16 21:24:56 +00:00
|
|
|
$page->getNamespace() . '|' .
|
|
|
|
|
$this->titleFormatter->getText( $page ) );
|
2009-02-13 14:44:19 +00:00
|
|
|
break;
|
2008-05-04 15:10:58 +00:00
|
|
|
}
|
2007-06-18 02:00:23 +00:00
|
|
|
}
|
2009-02-13 14:44:19 +00:00
|
|
|
}
|
2008-05-04 16:24:05 +00:00
|
|
|
|
2009-02-13 14:44:19 +00:00
|
|
|
/**
|
|
|
|
|
* Get a result array with information about a title
|
2013-03-11 17:15:01 +00:00
|
|
|
* @param int $pageid Page ID (negative for missing titles)
|
2023-06-16 21:24:56 +00:00
|
|
|
* @param PageIdentity $page
|
2015-01-29 20:14:40 +00:00
|
|
|
* @return array|null
|
2009-02-13 14:44:19 +00:00
|
|
|
*/
|
2023-06-16 21:24:56 +00:00
|
|
|
private function extractPageInfo( $pageid, $page ) {
|
|
|
|
|
$title = $this->titleFactory->newFromPageIdentity( $page );
|
2016-02-17 09:09:32 +00:00
|
|
|
$pageInfo = [];
|
2023-06-16 21:24:56 +00:00
|
|
|
// $page->exists() needs pageid, which is not set for all title objects
|
|
|
|
|
$pageExists = $pageid > 0;
|
|
|
|
|
$ns = $page->getNamespace();
|
|
|
|
|
$dbkey = $page->getDBkey();
|
2013-05-08 18:08:40 +00:00
|
|
|
|
|
|
|
|
$pageInfo['contentmodel'] = $title->getContentModel();
|
2015-11-04 16:50:48 +00:00
|
|
|
|
|
|
|
|
$pageLanguage = $title->getPageLanguage();
|
|
|
|
|
$pageInfo['pagelanguage'] = $pageLanguage->getCode();
|
|
|
|
|
$pageInfo['pagelanguagehtmlcode'] = $pageLanguage->getHtmlCode();
|
|
|
|
|
$pageInfo['pagelanguagedir'] = $pageLanguage->getDir();
|
2013-05-08 18:08:40 +00:00
|
|
|
|
2023-06-16 21:24:56 +00:00
|
|
|
if ( $pageExists ) {
|
2010-01-11 15:55:52 +00:00
|
|
|
$pageInfo['touched'] = wfTimestamp( TS_ISO_8601, $this->pageTouched[$pageid] );
|
2019-02-25 00:38:33 +00:00
|
|
|
$pageInfo['lastrevid'] = (int)$this->pageLatest[$pageid];
|
|
|
|
|
$pageInfo['length'] = (int)$this->pageLength[$pageid];
|
2010-07-22 07:00:38 +00:00
|
|
|
|
2012-07-08 15:09:04 +00:00
|
|
|
if ( isset( $this->pageIsRedir[$pageid] ) && $this->pageIsRedir[$pageid] ) {
|
2015-01-16 19:00:07 +00:00
|
|
|
$pageInfo['redirect'] = true;
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
|
|
|
|
if ( $this->pageIsNew[$pageid] ) {
|
2015-01-16 19:00:07 +00:00
|
|
|
$pageInfo['new'] = true;
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2008-01-08 16:31:50 +00:00
|
|
|
}
|
2008-04-14 07:45:50 +00:00
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( $this->fld_protection ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
$pageInfo['protection'] = [];
|
2012-06-08 09:02:46 +00:00
|
|
|
if ( isset( $this->protections[$ns][$dbkey] ) ) {
|
2009-02-13 14:44:19 +00:00
|
|
|
$pageInfo['protection'] =
|
2012-06-08 09:02:46 +00:00
|
|
|
$this->protections[$ns][$dbkey];
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
API: Overhaul ApiResult, make format=xml not throw, and add json formatversion
ApiResult was a mess: some methods could only be used with an array
reference instead of manipulating the stored data, methods that had both
array-ref and internal-data versions had names that didn't at all
correspond, some methods that worked on an array reference were
annoyingly non-static, and then the whole mess with setIndexedTagName.
ApiFormatXml is also entirely annoying to deal with, as it liked to
throw exceptions if certain metadata wasn't provided that no other
formatter required. Its legacy also means we have this silly convention
of using empty-string rather than boolean true, annoying restrictions on
keys (leading to things that should be hashes being arrays of key-value
object instead), '*' used as a key all over the place, and so on.
So, changes here:
* ApiResult is no longer an ApiBase or a ContextSource.
* Wherever sensible, ApiResult provides a static method working on an
arrayref and a non-static method working on internal data.
* Metadata is now always added to ApiResult's internal data structure.
Formatters are responsible for stripping it if necessary. "raw mode"
is deprecated.
* New metadata to replace the '*' key, solve the array() => '[]' vs '{}'
question, and so on.
* New class for formatting warnings and errors using i18n messages, and
support for multiple errors and a more machine-readable format for
warnings. For the moment, though, the actual output will not be changing
yet (see T47843 for future plans).
* New formatversion parameter for format=json and format=php, to select
between BC mode and the modern output.
* In BC mode, booleans will be converted to empty-string presence style;
modules currently returning booleans will need to use
ApiResult::META_BC_BOOLS to preserve their current output.
Actual changes to the API modules' output (e.g. actually returning
booleans for the new formatversion) beyond the use of
ApiResult::setContentValue() are left for a future change.
Bug: T76728
Bug: T57371
Bug: T33629
Change-Id: I7b37295e8862b188d1f3b0cd07f66ac34629678f
2014-12-03 22:14:22 +00:00
|
|
|
ApiResult::setIndexedTagName( $pageInfo['protection'], 'pr' );
|
2014-12-26 22:13:50 +00:00
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$pageInfo['restrictiontypes'] = [];
|
2014-12-26 22:13:50 +00:00
|
|
|
if ( isset( $this->restrictionTypes[$ns][$dbkey] ) ) {
|
|
|
|
|
$pageInfo['restrictiontypes'] =
|
|
|
|
|
$this->restrictionTypes[$ns][$dbkey];
|
|
|
|
|
}
|
API: Overhaul ApiResult, make format=xml not throw, and add json formatversion
ApiResult was a mess: some methods could only be used with an array
reference instead of manipulating the stored data, methods that had both
array-ref and internal-data versions had names that didn't at all
correspond, some methods that worked on an array reference were
annoyingly non-static, and then the whole mess with setIndexedTagName.
ApiFormatXml is also entirely annoying to deal with, as it liked to
throw exceptions if certain metadata wasn't provided that no other
formatter required. Its legacy also means we have this silly convention
of using empty-string rather than boolean true, annoying restrictions on
keys (leading to things that should be hashes being arrays of key-value
object instead), '*' used as a key all over the place, and so on.
So, changes here:
* ApiResult is no longer an ApiBase or a ContextSource.
* Wherever sensible, ApiResult provides a static method working on an
arrayref and a non-static method working on internal data.
* Metadata is now always added to ApiResult's internal data structure.
Formatters are responsible for stripping it if necessary. "raw mode"
is deprecated.
* New metadata to replace the '*' key, solve the array() => '[]' vs '{}'
question, and so on.
* New class for formatting warnings and errors using i18n messages, and
support for multiple errors and a more machine-readable format for
warnings. For the moment, though, the actual output will not be changing
yet (see T47843 for future plans).
* New formatversion parameter for format=json and format=php, to select
between BC mode and the modern output.
* In BC mode, booleans will be converted to empty-string presence style;
modules currently returning booleans will need to use
ApiResult::META_BC_BOOLS to preserve their current output.
Actual changes to the API modules' output (e.g. actually returning
booleans for the new formatversion) beyond the use of
ApiResult::setContentValue() are left for a future change.
Bug: T76728
Bug: T57371
Bug: T33629
Change-Id: I7b37295e8862b188d1f3b0cd07f66ac34629678f
2014-12-03 22:14:22 +00:00
|
|
|
ApiResult::setIndexedTagName( $pageInfo['restrictiontypes'], 'rt' );
|
2009-02-13 14:44:19 +00:00
|
|
|
}
|
2010-01-23 22:47:49 +00:00
|
|
|
|
2021-01-12 14:16:35 +00:00
|
|
|
if ( $this->fld_watched ) {
|
|
|
|
|
$pageInfo['watched'] = false;
|
|
|
|
|
|
|
|
|
|
if ( isset( $this->watched[$ns][$dbkey] ) ) {
|
|
|
|
|
$pageInfo['watched'] = $this->watched[$ns][$dbkey];
|
|
|
|
|
}
|
2020-12-14 22:29:18 +00:00
|
|
|
|
|
|
|
|
if ( isset( $this->watchlistExpiries[$ns][$dbkey] ) ) {
|
|
|
|
|
$pageInfo['watchlistexpiry'] = $this->watchlistExpiries[$ns][$dbkey];
|
|
|
|
|
}
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-23 20:40:57 +00:00
|
|
|
if ( $this->fld_watchers ) {
|
2016-03-16 16:07:31 +00:00
|
|
|
if ( $this->watchers !== null && $this->watchers[$ns][$dbkey] !== 0 ) {
|
2013-01-23 20:40:57 +00:00
|
|
|
$pageInfo['watchers'] = $this->watchers[$ns][$dbkey];
|
2016-03-16 16:07:31 +00:00
|
|
|
} elseif ( $this->showZeroWatchers ) {
|
|
|
|
|
$pageInfo['watchers'] = 0;
|
2013-01-23 20:40:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-09 03:14:12 +00:00
|
|
|
if ( $this->fld_visitingwatchers ) {
|
2016-03-15 10:39:22 +00:00
|
|
|
if ( $this->visitingwatchers !== null && $this->visitingwatchers[$ns][$dbkey] !== 0 ) {
|
2016-01-09 03:14:12 +00:00
|
|
|
$pageInfo['visitingwatchers'] = $this->visitingwatchers[$ns][$dbkey];
|
|
|
|
|
} elseif ( $this->showZeroWatchers ) {
|
|
|
|
|
$pageInfo['visitingwatchers'] = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-18 20:33:19 +00:00
|
|
|
if ( $this->fld_notificationtimestamp ) {
|
|
|
|
|
$pageInfo['notificationtimestamp'] = '';
|
2021-01-12 14:16:35 +00:00
|
|
|
if ( isset( $this->notificationtimestamps[$ns][$dbkey] ) ) {
|
2013-11-14 14:18:38 +00:00
|
|
|
$pageInfo['notificationtimestamp'] =
|
|
|
|
|
wfTimestamp( TS_ISO_8601, $this->notificationtimestamps[$ns][$dbkey] );
|
2012-06-18 20:33:19 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-26 16:18:59 +00:00
|
|
|
if ( $this->fld_talkid && isset( $this->talkids[$ns][$dbkey] ) ) {
|
2012-06-08 09:02:46 +00:00
|
|
|
$pageInfo['talkid'] = $this->talkids[$ns][$dbkey];
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2010-01-23 22:47:49 +00:00
|
|
|
|
2012-06-08 09:02:46 +00:00
|
|
|
if ( $this->fld_subjectid && isset( $this->subjectids[$ns][$dbkey] ) ) {
|
|
|
|
|
$pageInfo['subjectid'] = $this->subjectids[$ns][$dbkey];
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2010-01-23 22:47:49 +00:00
|
|
|
|
2021-06-08 05:16:45 +00:00
|
|
|
if ( $this->fld_associatedpage && $ns >= NS_MAIN ) {
|
|
|
|
|
$pageInfo['associatedpage'] = $this->titleFormatter->getPrefixedText(
|
2023-06-16 21:24:56 +00:00
|
|
|
$this->namespaceInfo->getAssociatedPage( TitleValue::newFromPage( $page ) )
|
2021-06-08 05:16:45 +00:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( $this->fld_url ) {
|
2023-05-31 22:11:12 +00:00
|
|
|
$pageInfo['fullurl'] = (string)$this->urlUtils->expand(
|
|
|
|
|
$title->getFullURL(), PROTO_CURRENT
|
|
|
|
|
);
|
|
|
|
|
$pageInfo['editurl'] = (string)$this->urlUtils->expand(
|
|
|
|
|
$title->getFullURL( 'action=edit' ), PROTO_CURRENT
|
|
|
|
|
);
|
|
|
|
|
$pageInfo['canonicalurl'] = (string)$this->urlUtils->expand(
|
|
|
|
|
$title->getFullURL(), PROTO_CANONICAL
|
|
|
|
|
);
|
2009-02-13 14:44:19 +00:00
|
|
|
}
|
2015-01-16 19:00:07 +00:00
|
|
|
if ( $this->fld_readable ) {
|
2023-06-16 21:24:56 +00:00
|
|
|
$pageInfo['readable'] = $this->getAuthority()->definitelyCan( 'read', $page );
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
|
|
|
|
|
2010-01-31 22:06:02 +00:00
|
|
|
if ( $this->fld_preload ) {
|
2023-06-16 21:24:56 +00:00
|
|
|
if ( $pageExists ) {
|
2010-01-31 22:06:02 +00:00
|
|
|
$pageInfo['preload'] = '';
|
2010-02-24 14:45:19 +00:00
|
|
|
} else {
|
2010-07-22 07:00:38 +00:00
|
|
|
$text = null;
|
2021-10-25 19:15:52 +00:00
|
|
|
// @phan-suppress-next-line PhanTypeMismatchArgument Type mismatch on pass-by-ref args
|
Hooks::run() call site migration
Migrate all callers of Hooks::run() to use the new
HookContainer/HookRunner system.
General principles:
* Use DI if it is already used. We're not changing the way state is
managed in this patch.
* HookContainer is always injected, not HookRunner. HookContainer
is a service, it's a more generic interface, it is the only
thing that provides isRegistered() which is needed in some cases,
and a HookRunner can be efficiently constructed from it
(confirmed by benchmark). Because HookContainer is needed
for object construction, it is also needed by all factories.
* "Ask your friendly local base class". Big hierarchies like
SpecialPage and ApiBase have getHookContainer() and getHookRunner()
methods in the base class, and classes that extend that base class
are not expected to know or care where the base class gets its
HookContainer from.
* ProtectedHookAccessorTrait provides protected getHookContainer() and
getHookRunner() methods, getting them from the global service
container. The point of this is to ease migration to DI by ensuring
that call sites ask their local friendly base class rather than
getting a HookRunner from the service container directly.
* Private $this->hookRunner. In some smaller classes where accessor
methods did not seem warranted, there is a private HookRunner property
which is accessed directly. Very rarely (two cases), there is a
protected property, for consistency with code that conventionally
assumes protected=private, but in cases where the class might actually
be overridden, a protected accessor is preferred over a protected
property.
* The last resort: Hooks::runner(). Mostly for static, file-scope and
global code. In a few cases it was used for objects with broken
construction schemes, out of horror or laziness.
Constructors with new required arguments:
* AuthManager
* BadFileLookup
* BlockManager
* ClassicInterwikiLookup
* ContentHandlerFactory
* ContentSecurityPolicy
* DefaultOptionsManager
* DerivedPageDataUpdater
* FullSearchResultWidget
* HtmlCacheUpdater
* LanguageFactory
* LanguageNameUtils
* LinkRenderer
* LinkRendererFactory
* LocalisationCache
* MagicWordFactory
* MessageCache
* NamespaceInfo
* PageEditStash
* PageHandlerFactory
* PageUpdater
* ParserFactory
* PermissionManager
* RevisionStore
* RevisionStoreFactory
* SearchEngineConfig
* SearchEngineFactory
* SearchFormWidget
* SearchNearMatcher
* SessionBackend
* SpecialPageFactory
* UserNameUtils
* UserOptionsManager
* WatchedItemQueryService
* WatchedItemStore
Constructors with new optional arguments:
* DefaultPreferencesFactory
* Language
* LinkHolderArray
* MovePage
* Parser
* ParserCache
* PasswordReset
* Router
setHookContainer() now required after construction:
* AuthenticationProvider
* ResourceLoaderModule
* SearchEngine
Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
2020-03-19 02:42:09 +00:00
|
|
|
$this->getHookRunner()->onEditFormPreloadText( $text, $title );
|
2010-02-24 14:45:19 +00:00
|
|
|
|
2010-01-31 22:06:02 +00:00
|
|
|
$pageInfo['preload'] = $text;
|
|
|
|
|
}
|
2010-02-13 01:41:37 +00:00
|
|
|
}
|
2010-07-23 07:33:40 +00:00
|
|
|
|
2023-05-19 15:17:55 +00:00
|
|
|
if ( $this->fld_preloadcontent ) {
|
|
|
|
|
$newSection = $this->params['preloadnewsection'];
|
|
|
|
|
// Preloaded content is not supported for already existing pages or sections.
|
|
|
|
|
// The actual page/section content should be shown for editing (from prop=revisions API).
|
2023-06-16 21:24:56 +00:00
|
|
|
if ( !$pageExists || $newSection ) {
|
2023-05-19 15:17:55 +00:00
|
|
|
$content = $this->preloadedContentBuilder->getPreloadedContent(
|
|
|
|
|
$title->toPageIdentity(),
|
|
|
|
|
$this->getAuthority(),
|
|
|
|
|
$this->params['preloadcustom'],
|
|
|
|
|
$this->params['preloadparams'] ?? [],
|
|
|
|
|
$newSection ? 'new' : null
|
|
|
|
|
);
|
|
|
|
|
$defaultContent = $newSection ? null :
|
|
|
|
|
$this->preloadedContentBuilder->getDefaultContent( $title->toPageIdentity() );
|
|
|
|
|
$contentIsDefault = $defaultContent ? $content->equals( $defaultContent ) : $content->isEmpty();
|
|
|
|
|
// Adapted from ApiQueryRevisionsBase::extractAllSlotInfo.
|
|
|
|
|
// The preloaded content fills the main slot.
|
|
|
|
|
$pageInfo['preloadcontent']['contentmodel'] = $content->getModel();
|
|
|
|
|
$pageInfo['preloadcontent']['contentformat'] = $content->getDefaultFormat();
|
|
|
|
|
ApiResult::setContentValue( $pageInfo['preloadcontent'], 'content', $content->serialize() );
|
|
|
|
|
// If the preloaded content generated from these parameters is the same as
|
|
|
|
|
// the default page content, the user should be discouraged from saving the page
|
|
|
|
|
// (e.g. by disabling the save button until changes are made, or displaying a warning).
|
|
|
|
|
$pageInfo['preloadisdefault'] = $contentIsDefault;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( $this->fld_editintro ) {
|
2023-06-16 21:24:56 +00:00
|
|
|
// Use $page as the context page in every processed message (T300184)
|
|
|
|
|
$localizerWithPage = new class( $this, $page ) implements MessageLocalizer {
|
2023-05-19 15:17:55 +00:00
|
|
|
private MessageLocalizer $base;
|
|
|
|
|
private PageReference $page;
|
|
|
|
|
|
|
|
|
|
public function __construct( MessageLocalizer $base, PageReference $page ) {
|
|
|
|
|
$this->base = $base;
|
|
|
|
|
$this->page = $page;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @inheritDoc
|
|
|
|
|
*/
|
|
|
|
|
public function msg( $key, ...$params ) {
|
|
|
|
|
return $this->base->msg( $key, ...$params )->page( $this->page );
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$styleParamMap = [
|
|
|
|
|
'lessframes' => IntroMessageBuilder::LESS_FRAMES,
|
|
|
|
|
'moreframes' => IntroMessageBuilder::MORE_FRAMES,
|
|
|
|
|
];
|
|
|
|
|
// If we got here, there is exactly one page and revision in the query
|
|
|
|
|
$revId = array_key_first( $this->getPageSet()->getLiveRevisionIDs() );
|
|
|
|
|
$revRecord = $revId ? $this->revisionLookup->getRevisionById( $revId ) : null;
|
|
|
|
|
|
|
|
|
|
$messages = $this->introMessageBuilder->getIntroMessages(
|
|
|
|
|
$styleParamMap[ $this->params['editintrostyle'] ],
|
|
|
|
|
$this->params['editintroskip'] ?? [],
|
2023-06-16 21:24:56 +00:00
|
|
|
$localizerWithPage,
|
2023-05-19 15:17:55 +00:00
|
|
|
$title->toPageIdentity(),
|
|
|
|
|
$revRecord,
|
|
|
|
|
$this->getAuthority(),
|
|
|
|
|
$this->params['editintrocustom'],
|
|
|
|
|
// Maybe expose these as parameters in the future, but for now it doesn't seem worth it:
|
|
|
|
|
null,
|
|
|
|
|
false
|
|
|
|
|
);
|
|
|
|
|
ApiResult::setIndexedTagName( $messages, 'ei' );
|
|
|
|
|
ApiResult::setArrayType( $messages, 'kvp', 'key' );
|
|
|
|
|
|
|
|
|
|
$pageInfo['editintro'] = $messages;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-22 07:00:38 +00:00
|
|
|
if ( $this->fld_displaytitle ) {
|
2021-09-28 18:47:20 +00:00
|
|
|
$pageInfo['displaytitle'] = $this->displaytitles[$pageid] ??
|
2023-06-16 21:24:56 +00:00
|
|
|
htmlspecialchars( $this->titleFormatter->getPrefixedText( $page ), ENT_NOQUOTES );
|
2010-07-22 07:00:38 +00:00
|
|
|
}
|
2010-07-22 08:48:34 +00:00
|
|
|
|
2019-03-29 20:12:24 +00:00
|
|
|
if ( $this->fld_varianttitles && isset( $this->variantTitles[$pageid] ) ) {
|
|
|
|
|
$pageInfo['varianttitles'] = $this->variantTitles[$pageid];
|
2017-10-18 19:42:42 +00:00
|
|
|
}
|
|
|
|
|
|
2020-12-10 23:39:12 +00:00
|
|
|
if ( $this->fld_linkclasses && isset( $this->linkClasses[$pageid] ) ) {
|
|
|
|
|
$pageInfo['linkclasses'] = $this->linkClasses[$pageid];
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-29 20:14:40 +00:00
|
|
|
if ( $this->params['testactions'] ) {
|
2018-09-17 11:23:36 +00:00
|
|
|
$limit = $this->getMain()->canApiHighLimits() ? self::LIMIT_SML2 : self::LIMIT_SML1;
|
2015-01-29 20:14:40 +00:00
|
|
|
if ( $this->countTestedActions >= $limit ) {
|
|
|
|
|
return null; // force a continuation
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-27 15:04:24 +00:00
|
|
|
$detailLevel = $this->params['testactionsdetail'];
|
|
|
|
|
$errorFormatter = $this->getErrorFormatter();
|
|
|
|
|
if ( $errorFormatter->getFormat() === 'bc' ) {
|
|
|
|
|
// Eew, no. Use a more modern format here.
|
|
|
|
|
$errorFormatter = $errorFormatter->newWithFormat( 'plaintext' );
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$pageInfo['actions'] = [];
|
2023-10-29 21:37:26 +00:00
|
|
|
if ( $this->params['testactionsautocreate'] ) {
|
|
|
|
|
$pageInfo['wouldautocreate'] = [];
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-29 20:14:40 +00:00
|
|
|
foreach ( $this->params['testactions'] as $action ) {
|
|
|
|
|
$this->countTestedActions++;
|
2018-09-27 15:04:24 +00:00
|
|
|
|
2023-10-29 21:37:26 +00:00
|
|
|
$shouldAutoCreate = $this->tempUserCreator->shouldAutoCreate( $this->getUser(), $action );
|
|
|
|
|
|
|
|
|
|
if ( $shouldAutoCreate ) {
|
|
|
|
|
$authority = $this->userFactory->newTempPlaceholder();
|
|
|
|
|
} else {
|
|
|
|
|
$authority = $this->getAuthority();
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-27 15:04:24 +00:00
|
|
|
if ( $detailLevel === 'boolean' ) {
|
2023-10-29 21:37:26 +00:00
|
|
|
$pageInfo['actions'][$action] = $authority->authorizeRead( $action, $page );
|
2018-09-27 15:04:24 +00:00
|
|
|
} else {
|
2021-01-11 15:26:02 +00:00
|
|
|
$status = new PermissionStatus();
|
|
|
|
|
if ( $detailLevel === 'quick' ) {
|
2023-10-29 21:37:26 +00:00
|
|
|
$authority->probablyCan( $action, $page, $status );
|
2021-01-11 15:26:02 +00:00
|
|
|
} else {
|
2023-10-29 21:37:26 +00:00
|
|
|
$authority->definitelyCan( $action, $page, $status );
|
2021-01-11 15:26:02 +00:00
|
|
|
}
|
|
|
|
|
$this->addBlockInfoToStatus( $status );
|
|
|
|
|
$pageInfo['actions'][$action] = $errorFormatter->arrayFromStatus( $status );
|
2018-09-27 15:04:24 +00:00
|
|
|
}
|
2023-04-27 19:22:02 +00:00
|
|
|
|
2023-10-29 21:37:26 +00:00
|
|
|
if ( $this->params['testactionsautocreate'] ) {
|
|
|
|
|
$pageInfo['wouldautocreate'][$action] = $shouldAutoCreate;
|
2023-04-27 19:22:02 +00:00
|
|
|
}
|
|
|
|
|
}
|
2015-01-29 20:14:40 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-13 14:44:19 +00:00
|
|
|
return $pageInfo;
|
|
|
|
|
}
|
2006-09-26 01:44:13 +00:00
|
|
|
|
2009-02-13 14:44:19 +00:00
|
|
|
/**
|
|
|
|
|
* Get information about protections and put it in $protections
|
|
|
|
|
*/
|
2010-02-24 14:45:19 +00:00
|
|
|
private function getProtectionInfo() {
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->protections = [];
|
2009-02-13 14:44:19 +00:00
|
|
|
$db = $this->getDB();
|
2007-05-19 20:26:08 +00:00
|
|
|
|
2009-02-13 14:44:19 +00:00
|
|
|
// Get normal protections for existing titles
|
2010-02-24 14:45:19 +00:00
|
|
|
if ( count( $this->titles ) ) {
|
2009-12-02 12:28:27 +00:00
|
|
|
$this->resetQueryParams();
|
2012-06-17 16:46:21 +00:00
|
|
|
$this->addTables( 'page_restrictions' );
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->addFields( [ 'pr_page', 'pr_type', 'pr_level',
|
|
|
|
|
'pr_expiry', 'pr_cascade' ] );
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->addWhereFld( 'pr_page', array_keys( $this->titles ) );
|
2009-02-13 15:36:32 +00:00
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
$res = $this->select( __METHOD__ );
|
2010-06-20 18:48:34 +00:00
|
|
|
foreach ( $res as $row ) {
|
2023-06-16 21:24:56 +00:00
|
|
|
/** @var PageReference $page */
|
|
|
|
|
$page = $this->titles[$row->pr_page];
|
2016-02-17 09:09:32 +00:00
|
|
|
$a = [
|
2009-02-13 15:36:32 +00:00
|
|
|
'type' => $row->pr_type,
|
|
|
|
|
'level' => $row->pr_level,
|
2017-01-11 19:04:41 +00:00
|
|
|
'expiry' => ApiResult::formatExpiry( $row->pr_expiry )
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2010-02-24 14:45:19 +00:00
|
|
|
if ( $row->pr_cascade ) {
|
2015-01-16 19:00:07 +00:00
|
|
|
$a['cascade'] = true;
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2023-06-16 21:24:56 +00:00
|
|
|
$this->protections[$page->getNamespace()][$page->getDBkey()][] = $a;
|
2012-06-17 16:46:21 +00:00
|
|
|
}
|
2009-02-13 14:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get protections for missing titles
|
2010-02-24 14:45:19 +00:00
|
|
|
if ( count( $this->missing ) ) {
|
2009-02-13 15:36:32 +00:00
|
|
|
$this->resetQueryParams();
|
2020-12-11 15:57:35 +00:00
|
|
|
$lb = $this->linkBatchFactory->newLinkBatch( $this->missing );
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->addTables( 'protected_titles' );
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->addFields( [ 'pt_title', 'pt_namespace', 'pt_create_perm', 'pt_expiry' ] );
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->addWhere( $lb->constructSet( 'pt', $db ) );
|
|
|
|
|
$res = $this->select( __METHOD__ );
|
2010-06-20 18:48:34 +00:00
|
|
|
foreach ( $res as $row ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->protections[$row->pt_namespace][$row->pt_title][] = [
|
2009-02-13 15:36:32 +00:00
|
|
|
'type' => 'create',
|
|
|
|
|
'level' => $row->pt_create_perm,
|
2017-01-11 19:04:41 +00:00
|
|
|
'expiry' => ApiResult::formatExpiry( $row->pt_expiry )
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2009-02-13 15:36:32 +00:00
|
|
|
}
|
2009-02-13 14:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
2014-12-26 22:13:50 +00:00
|
|
|
// Separate good and missing titles into files and other pages
|
|
|
|
|
// and populate $this->restrictionTypes
|
2016-02-17 09:09:32 +00:00
|
|
|
$images = $others = [];
|
2023-06-16 21:24:56 +00:00
|
|
|
foreach ( $this->everything as $page ) {
|
|
|
|
|
if ( $page->getNamespace() === NS_FILE ) {
|
|
|
|
|
$images[] = $page->getDBkey();
|
2010-02-24 14:45:19 +00:00
|
|
|
} else {
|
2023-06-16 21:24:56 +00:00
|
|
|
$others[] = $page;
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2014-12-26 22:13:50 +00:00
|
|
|
// Applicable protection types
|
2023-06-16 21:24:56 +00:00
|
|
|
$this->restrictionTypes[$page->getNamespace()][$page->getDBkey()] =
|
|
|
|
|
array_values( $this->restrictionStore->listApplicableRestrictionTypes( $page ) );
|
2010-06-13 01:23:12 +00:00
|
|
|
}
|
2009-02-13 14:44:19 +00:00
|
|
|
|
2022-04-21 19:35:30 +00:00
|
|
|
[ $blNamespace, $blTitle ] = $this->linksMigration->getTitleFields( 'templatelinks' );
|
|
|
|
|
$queryInfo = $this->linksMigration->getQueryInfo( 'templatelinks' );
|
2022-04-08 16:47:27 +00:00
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( count( $others ) ) {
|
2009-02-13 14:44:19 +00:00
|
|
|
// Non-images: check templatelinks
|
2020-12-11 15:57:35 +00:00
|
|
|
$lb = $this->linkBatchFactory->newLinkBatch( $others );
|
2009-02-13 14:44:19 +00:00
|
|
|
$this->resetQueryParams();
|
2022-04-13 22:45:03 +00:00
|
|
|
$this->addTables( array_merge( [ 'page_restrictions', 'page' ], $queryInfo['tables'] ) );
|
2022-05-12 08:57:24 +00:00
|
|
|
// templatelinks must use PRIMARY index and not the tl_target_id.
|
|
|
|
|
$this->addOption( 'USE INDEX', [ 'templatelinks' => 'PRIMARY' ] );
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->addFields( [ 'pr_type', 'pr_level', 'pr_expiry',
|
2013-11-14 12:53:20 +00:00
|
|
|
'page_title', 'page_namespace',
|
2022-04-08 16:47:27 +00:00
|
|
|
$blNamespace, $blTitle ] );
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->addWhere( $lb->constructSet( 'tl', $db ) );
|
|
|
|
|
$this->addWhere( 'pr_page = page_id' );
|
|
|
|
|
$this->addWhere( 'pr_page = tl_from' );
|
|
|
|
|
$this->addWhereFld( 'pr_cascade', 1 );
|
2022-04-13 22:45:03 +00:00
|
|
|
$this->addJoinConds( $queryInfo['joins'] );
|
2010-01-11 15:55:52 +00:00
|
|
|
|
|
|
|
|
$res = $this->select( __METHOD__ );
|
2010-06-20 18:48:34 +00:00
|
|
|
foreach ( $res as $row ) {
|
2022-04-08 16:47:27 +00:00
|
|
|
$this->protections[$row->$blNamespace][$row->$blTitle][] = [
|
2009-02-13 14:44:19 +00:00
|
|
|
'type' => $row->pr_type,
|
|
|
|
|
'level' => $row->pr_level,
|
2017-01-11 19:04:41 +00:00
|
|
|
'expiry' => ApiResult::formatExpiry( $row->pr_expiry ),
|
2022-04-13 19:07:13 +00:00
|
|
|
'source' => $this->titleFormatter->formatTitle( $row->page_namespace, $row->page_title ),
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2008-09-25 15:55:09 +00:00
|
|
|
}
|
2009-02-13 14:44:19 +00:00
|
|
|
}
|
2007-06-18 02:00:23 +00:00
|
|
|
|
2010-01-11 15:55:52 +00:00
|
|
|
if ( count( $images ) ) {
|
2009-02-13 14:44:19 +00:00
|
|
|
// Images: check imagelinks
|
|
|
|
|
$this->resetQueryParams();
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->addTables( [ 'page_restrictions', 'page', 'imagelinks' ] );
|
|
|
|
|
$this->addFields( [ 'pr_type', 'pr_level', 'pr_expiry',
|
|
|
|
|
'page_title', 'page_namespace', 'il_to' ] );
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->addWhere( 'pr_page = page_id' );
|
|
|
|
|
$this->addWhere( 'pr_page = il_from' );
|
|
|
|
|
$this->addWhereFld( 'pr_cascade', 1 );
|
|
|
|
|
$this->addWhereFld( 'il_to', $images );
|
|
|
|
|
|
|
|
|
|
$res = $this->select( __METHOD__ );
|
2010-06-20 18:48:34 +00:00
|
|
|
foreach ( $res as $row ) {
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->protections[NS_FILE][$row->il_to][] = [
|
2009-02-13 14:44:19 +00:00
|
|
|
'type' => $row->pr_type,
|
|
|
|
|
'level' => $row->pr_level,
|
2017-01-11 19:04:41 +00:00
|
|
|
'expiry' => ApiResult::formatExpiry( $row->pr_expiry ),
|
2022-04-13 19:07:13 +00:00
|
|
|
'source' => $this->titleFormatter->formatTitle( $row->page_namespace, $row->page_title ),
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
* API: BREAKING CHANGE: (bug 11430) Return fewer results than the limit in some cases to prevent running out of memory
* This means queries could possibly return fewer results than the limit and still set a query-continue
* Add iicontinue, rvcontinue, cicontinue, incontinue, amfrom to faciliate query-continue for these modules
* Implemented by blocking additions to the ApiResult object if they would make it too large
** Important things like query-continue values and warnings are exempt from this check
** RSS feeds and exported XML are also exempted (size-checking them would be too messy)
** Result size is checked against $wgAPIMaxResultSize, which defaults to 8 MB
For those who really care, per-file details follow:
ApiResult.php:
* Introduced ApiResult::$mSize which keeps track of the result size.
* Introduced ApiResult::size() which calculates an array's size
(which is the sum of the strlen()s of its elements).
* ApiResult::addValue() now checks that the result size stays below
$wgAPIMaxResultSize. If the item won't fit, it won't be added and addValue()
will return false. Callers should check the return value and set a
query-continue if it's false.
* Closed the back door that is ApiResult::getData(): callers can't manipulate
the data array directly anymore so they can't bypass the result size limit.
* Added ApiResult::setIndexedTagName_internal() which will call
setIndexedTagName() on an array already in the result. This is needed for the
'new' order of adding results, which means addValue()ing one result at a time
until you hit the limit or run out, then calling this function to set the tag
name.
* Added ApiResult::disableSizeCheck() and enableSizeCheck() which disable and
enable size checking in addValue(). This is used for stuff like query-continue
elements and warnings which shouldn't count towards the result size.
* Added ApiResult::unsetValue() which removes an element from the result and
decreases $mSize.
ApiBase.php:
* Like ApiResult::getData(), ApiBase::getResultData() no longer returns a
reference.
* Use ApiResult::disableSizeCheck() in ApiBase::setWarning()
ApiQueryBase.php:
* Added ApiQueryBase::addPageSubItem(), which adds page subitems one item
at a time.
* addPageSubItem() and addPageSubItems() now return whether the subitem
fit in the result.
* Use ApiResult::disableSizeCheck() in setContinueEnumParameter()
ApiMain.php:
* Use ApiResult::disableSizeCheck() in ApiMain::substituteResultWithError()
* Use getParameter() rather than $mRequest to obtain requestid
DefaultSettings.php:
* Added $wgAPIMaxResultSize, with a default value of 8 MB
ApiQuery*.php:
* Added results one at a time, and set a query-continue if the result is full.
ApiQueryLangLinks.php and friends:
* Migrated from addPageSubItems() to addPageSubItem(). This eliminates the
need for $lastId.
ApiQueryAllLinks.php, ApiQueryWatchlist.php, ApiQueryAllimages.php, ApiQuerySearch.php:
* Renamed $data to something more appropriate ($pageids, $ids or $titles)
ApiQuerySiteinfo.php:
* Abuse siprop as a query-continue parameter and set it to all props that
couldn't be processed.
ApiQueryRandom.php:
* Doesn't do continuations, because the result is supposed to be random.
* Be smart enough to not run the second query if the results of the first
didn't fit.
ApiQueryImageInfo.php, ApiQueryRevisions.php, ApiQueryCategoryInfo.php, ApiQueryInfo.php:
* Added continue parameter which basically skips the first so many items
ApiQueryBacklinks.php:
* Throw the result in a big array first and addValue() that one element at a time if necessary
** This is necessary because the results aren't retrieved in order
* Introduced $this->pageMap to map namespace and title to page ID
* Rewritten extractRowInfo() and extractRedirRowInfo() a little
* Declared all private member variables explicitly
ApiQueryDeletedrevs.php:
* Use a pagemap just like in Backlinks
* Introduce fake page IDs and keep track of them so we know where to add what
** This doesn't change the output format, because the fake page IDs start at 0 and are consecutive
ApiQueryAllmessages.php:
* Add amfrom to facilitate query-continue
ApiQueryUsers.php:
* Rewrite: put the getOtherUsersInfo() code in execute()
2009-02-05 14:30:59 +00:00
|
|
|
}
|
2006-10-01 20:17:16 +00:00
|
|
|
}
|
2009-02-13 14:44:19 +00:00
|
|
|
}
|
2007-09-03 20:17:53 +00:00
|
|
|
|
2009-02-13 14:44:19 +00:00
|
|
|
/**
|
|
|
|
|
* Get talk page IDs (if requested) and subject page IDs (if requested)
|
2010-02-24 14:45:19 +00:00
|
|
|
* and put them in $talkids and $subjectids
|
2009-02-13 14:44:19 +00:00
|
|
|
*/
|
2010-02-24 14:45:19 +00:00
|
|
|
private function getTSIDs() {
|
2016-02-17 09:09:32 +00:00
|
|
|
$getTitles = $this->talkids = $this->subjectids = [];
|
2020-12-11 15:57:35 +00:00
|
|
|
$nsInfo = $this->namespaceInfo;
|
2010-07-22 08:48:34 +00:00
|
|
|
|
2023-06-16 21:24:56 +00:00
|
|
|
/** @var PageReference $page */
|
|
|
|
|
foreach ( $this->everything as $page ) {
|
|
|
|
|
if ( $nsInfo->isTalk( $page->getNamespace() ) ) {
|
2010-02-24 14:45:19 +00:00
|
|
|
if ( $this->fld_subjectid ) {
|
2023-06-16 21:24:56 +00:00
|
|
|
$getTitles[] = $nsInfo->getSubjectPage( TitleValue::newFromPage( $page ) );
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
|
|
|
|
} elseif ( $this->fld_talkid ) {
|
2023-06-16 21:24:56 +00:00
|
|
|
$getTitles[] = $nsInfo->getTalkPage( TitleValue::newFromPage( $page ) );
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2009-02-13 14:44:19 +00:00
|
|
|
}
|
2019-01-09 16:24:36 +00:00
|
|
|
if ( $getTitles === [] ) {
|
2009-02-13 14:44:19 +00:00
|
|
|
return;
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2010-07-23 07:33:40 +00:00
|
|
|
|
2010-07-22 08:48:34 +00:00
|
|
|
$db = $this->getDB();
|
2009-11-19 17:57:27 +00:00
|
|
|
|
2009-02-13 14:44:19 +00:00
|
|
|
// Construct a custom WHERE clause that matches
|
|
|
|
|
// all titles in $getTitles
|
2020-12-11 15:57:35 +00:00
|
|
|
$lb = $this->linkBatchFactory->newLinkBatch( $getTitles );
|
2009-02-13 14:44:19 +00:00
|
|
|
$this->resetQueryParams();
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->addTables( 'page' );
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->addFields( [ 'page_title', 'page_namespace', 'page_id' ] );
|
2010-01-11 15:55:52 +00:00
|
|
|
$this->addWhere( $lb->constructSet( 'page', $db ) );
|
|
|
|
|
$res = $this->select( __METHOD__ );
|
2010-06-20 18:48:34 +00:00
|
|
|
foreach ( $res as $row ) {
|
2018-08-05 17:58:51 +00:00
|
|
|
if ( $nsInfo->isTalk( $row->page_namespace ) ) {
|
|
|
|
|
$this->talkids[$nsInfo->getSubject( $row->page_namespace )][$row->page_title] =
|
|
|
|
|
(int)( $row->page_id );
|
2010-02-24 14:45:19 +00:00
|
|
|
} else {
|
2018-08-05 17:58:51 +00:00
|
|
|
$this->subjectids[$nsInfo->getTalk( $row->page_namespace )][$row->page_title] =
|
|
|
|
|
(int)( $row->page_id );
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2007-09-03 20:17:53 +00:00
|
|
|
}
|
2006-09-26 01:44:13 +00:00
|
|
|
}
|
2010-07-23 07:33:40 +00:00
|
|
|
|
2010-07-22 08:48:34 +00:00
|
|
|
private function getDisplayTitle() {
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->displaytitles = [];
|
2010-07-23 07:33:40 +00:00
|
|
|
|
2010-07-22 10:18:41 +00:00
|
|
|
$pageIds = array_keys( $this->titles );
|
2010-07-23 07:33:40 +00:00
|
|
|
|
2019-01-09 16:24:36 +00:00
|
|
|
if ( $pageIds === [] ) {
|
2010-07-22 08:48:34 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->resetQueryParams();
|
|
|
|
|
$this->addTables( 'page_props' );
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->addFields( [ 'pp_page', 'pp_value' ] );
|
2010-07-22 08:48:34 +00:00
|
|
|
$this->addWhereFld( 'pp_page', $pageIds );
|
|
|
|
|
$this->addWhereFld( 'pp_propname', 'displaytitle' );
|
|
|
|
|
$res = $this->select( __METHOD__ );
|
2010-07-23 07:33:40 +00:00
|
|
|
|
2010-07-22 08:48:34 +00:00
|
|
|
foreach ( $res as $row ) {
|
|
|
|
|
$this->displaytitles[$row->pp_page] = $row->pp_value;
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-09-26 01:44:13 +00:00
|
|
|
|
2020-12-10 23:39:12 +00:00
|
|
|
/**
|
|
|
|
|
* Fetch the set of extra link classes associated with links to the
|
|
|
|
|
* set of titles ("link colours"), as they would appear on the
|
|
|
|
|
* given context page.
|
|
|
|
|
* @param ?LinkTarget $context_title The page context in which link
|
|
|
|
|
* colors are determined.
|
|
|
|
|
*/
|
|
|
|
|
private function getLinkClasses( ?LinkTarget $context_title = null ) {
|
|
|
|
|
if ( $this->titles === [] ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// For compatibility with legacy GetLinkColours hook:
|
|
|
|
|
// $pagemap maps from page id to title (as prefixed db key)
|
|
|
|
|
// $classes maps from title (prefixed db key) to a space-separated
|
|
|
|
|
// list of link classes ("link colours").
|
|
|
|
|
// The hook should not modify $pagemap, and should only append to
|
|
|
|
|
// $classes (being careful to maintain space separation).
|
|
|
|
|
$classes = [];
|
|
|
|
|
$pagemap = [];
|
2023-06-16 21:24:56 +00:00
|
|
|
foreach ( $this->titles as $pageId => $page ) {
|
|
|
|
|
$pdbk = $this->titleFormatter->getPrefixedDBkey( $page );
|
2020-12-10 23:39:12 +00:00
|
|
|
$pagemap[$pageId] = $pdbk;
|
2023-06-16 21:24:56 +00:00
|
|
|
$classes[$pdbk] = isset( $this->pageIsRedir[$pageId] ) && $this->pageIsRedir[$pageId] ? 'mw-redirect' : '';
|
2020-12-10 23:39:12 +00:00
|
|
|
}
|
|
|
|
|
// legacy hook requires a real Title, not a LinkTarget
|
|
|
|
|
$context_title = $this->titleFactory->newFromLinkTarget(
|
|
|
|
|
$context_title ?? $this->titleFactory->newMainPage()
|
|
|
|
|
);
|
|
|
|
|
$this->getHookRunner()->onGetLinkColours(
|
|
|
|
|
$pagemap, $classes, $context_title
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// This API class expects the class list to be:
|
|
|
|
|
// (a) indexed by pageid, not title, and
|
|
|
|
|
// (b) a proper array of strings (possibly zero-length),
|
|
|
|
|
// not a single space-separated string (possibly the empty string)
|
|
|
|
|
$this->linkClasses = [];
|
2023-06-16 21:24:56 +00:00
|
|
|
foreach ( $this->titles as $pageId => $page ) {
|
|
|
|
|
$pdbk = $this->titleFormatter->getPrefixedDBkey( $page );
|
2020-12-10 23:39:12 +00:00
|
|
|
$this->linkClasses[$pageId] = preg_split(
|
|
|
|
|
'/\s+/', $classes[$pdbk] ?? '', -1, PREG_SPLIT_NO_EMPTY
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-10-18 19:42:42 +00:00
|
|
|
private function getVariantTitles() {
|
2019-01-09 16:24:36 +00:00
|
|
|
if ( $this->titles === [] ) {
|
2017-10-18 19:42:42 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$this->variantTitles = [];
|
2023-06-16 21:24:56 +00:00
|
|
|
foreach ( $this->titles as $pageId => $page ) {
|
2017-10-18 19:42:42 +00:00
|
|
|
$this->variantTitles[$pageId] = isset( $this->displaytitles[$pageId] )
|
|
|
|
|
? $this->getAllVariants( $this->displaytitles[$pageId] )
|
2023-06-16 21:24:56 +00:00
|
|
|
: $this->getAllVariants( $this->titleFormatter->getText( $page ), $page->getNamespace() );
|
2017-10-18 19:42:42 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function getAllVariants( $text, $ns = NS_MAIN ) {
|
|
|
|
|
$result = [];
|
2021-07-03 21:22:48 +00:00
|
|
|
foreach ( $this->languageConverter->getVariants() as $variant ) {
|
|
|
|
|
$convertTitle = $this->languageConverter->autoConvert( $text, $variant );
|
2017-10-18 19:42:42 +00:00
|
|
|
if ( $ns !== NS_MAIN ) {
|
2021-07-03 21:22:48 +00:00
|
|
|
$convertNs = $this->languageConverter->convertNamespace( $ns, $variant );
|
2017-10-18 19:42:42 +00:00
|
|
|
$convertTitle = $convertNs . ':' . $convertTitle;
|
|
|
|
|
}
|
|
|
|
|
$result[$variant] = $convertTitle;
|
|
|
|
|
}
|
|
|
|
|
return $result;
|
|
|
|
|
}
|
|
|
|
|
|
2009-11-19 17:57:27 +00:00
|
|
|
/**
|
2010-07-14 19:00:54 +00:00
|
|
|
* Get information about watched status and put it in $this->watched
|
2012-06-18 20:33:19 +00:00
|
|
|
* and $this->notificationtimestamps
|
2009-12-02 12:28:27 +00:00
|
|
|
*/
|
2010-02-24 14:45:19 +00:00
|
|
|
private function getWatchedInfo() {
|
2011-10-26 23:27:01 +00:00
|
|
|
$user = $this->getUser();
|
2009-11-19 17:57:27 +00:00
|
|
|
|
2021-06-28 19:04:55 +00:00
|
|
|
if ( !$user->isRegistered() || count( $this->everything ) == 0
|
2021-01-11 15:26:02 +00:00
|
|
|
|| !$this->getAuthority()->isAllowed( 'viewmywatchlist' )
|
2013-06-13 18:02:55 +00:00
|
|
|
) {
|
2009-11-19 17:57:27 +00:00
|
|
|
return;
|
2010-02-24 14:45:19 +00:00
|
|
|
}
|
2009-11-19 17:57:27 +00:00
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->watched = [];
|
2020-12-14 22:29:18 +00:00
|
|
|
$this->watchlistExpiries = [];
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->notificationtimestamps = [];
|
2009-11-19 17:57:27 +00:00
|
|
|
|
2020-12-14 22:29:18 +00:00
|
|
|
/** @var WatchedItem[] $items */
|
|
|
|
|
$items = $this->watchedItemStore->loadWatchedItemsBatch( $user, $this->everything );
|
|
|
|
|
|
|
|
|
|
foreach ( $items as $item ) {
|
2021-03-25 03:08:22 +00:00
|
|
|
$nsId = $item->getTarget()->getNamespace();
|
|
|
|
|
$dbKey = $item->getTarget()->getDBkey();
|
2009-11-19 17:57:27 +00:00
|
|
|
|
2020-12-14 22:29:18 +00:00
|
|
|
if ( $this->fld_watched ) {
|
|
|
|
|
$this->watched[$nsId][$dbKey] = true;
|
|
|
|
|
|
|
|
|
|
$expiry = $item->getExpiry( TS_ISO_8601 );
|
|
|
|
|
if ( $expiry ) {
|
|
|
|
|
$this->watchlistExpiries[$nsId][$dbKey] = $expiry;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( $this->fld_notificationtimestamp ) {
|
|
|
|
|
$this->notificationtimestamps[$nsId][$dbKey] = $item->getNotificationTimestamp();
|
2012-06-18 20:33:19 +00:00
|
|
|
}
|
2016-03-18 13:43:26 +00:00
|
|
|
}
|
2009-11-19 17:57:27 +00:00
|
|
|
}
|
|
|
|
|
|
2013-01-23 20:40:57 +00:00
|
|
|
/**
|
|
|
|
|
* Get the count of watchers and put it in $this->watchers
|
|
|
|
|
*/
|
|
|
|
|
private function getWatcherInfo() {
|
|
|
|
|
if ( count( $this->everything ) == 0 ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-11 15:26:02 +00:00
|
|
|
$canUnwatchedpages = $this->getAuthority()->isAllowed( 'unwatchedpages' );
|
2022-04-13 15:28:26 +00:00
|
|
|
$unwatchedPageThreshold =
|
|
|
|
|
$this->getConfig()->get( MainConfigNames::UnwatchedPageThreshold );
|
2014-01-24 02:51:11 +00:00
|
|
|
if ( !$canUnwatchedpages && !is_int( $unwatchedPageThreshold ) ) {
|
2013-01-23 20:40:57 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->showZeroWatchers = $canUnwatchedpages;
|
|
|
|
|
|
2016-01-26 20:12:37 +00:00
|
|
|
$countOptions = [];
|
2013-01-23 20:40:57 +00:00
|
|
|
if ( !$canUnwatchedpages ) {
|
2016-01-26 20:12:37 +00:00
|
|
|
$countOptions['minimumWatchers'] = $unwatchedPageThreshold;
|
2013-01-23 20:40:57 +00:00
|
|
|
}
|
|
|
|
|
|
2020-12-11 15:57:35 +00:00
|
|
|
$this->watchers = $this->watchedItemStore->countWatchersMultiple(
|
2016-01-26 20:12:37 +00:00
|
|
|
$this->everything,
|
|
|
|
|
$countOptions
|
|
|
|
|
);
|
2013-01-23 20:40:57 +00:00
|
|
|
}
|
|
|
|
|
|
2016-01-09 03:14:12 +00:00
|
|
|
/**
|
|
|
|
|
* Get the count of watchers who have visited recent edits and put it in
|
|
|
|
|
* $this->visitingwatchers
|
|
|
|
|
*
|
|
|
|
|
* Based on InfoAction::pageCounts
|
|
|
|
|
*/
|
|
|
|
|
private function getVisitingWatcherInfo() {
|
|
|
|
|
$config = $this->getConfig();
|
|
|
|
|
$db = $this->getDB();
|
|
|
|
|
|
2021-01-11 15:26:02 +00:00
|
|
|
$canUnwatchedpages = $this->getAuthority()->isAllowed( 'unwatchedpages' );
|
2022-04-13 15:28:26 +00:00
|
|
|
$unwatchedPageThreshold = $config->get( MainConfigNames::UnwatchedPageThreshold );
|
2016-01-09 03:14:12 +00:00
|
|
|
if ( !$canUnwatchedpages && !is_int( $unwatchedPageThreshold ) ) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->showZeroWatchers = $canUnwatchedpages;
|
|
|
|
|
|
2016-03-15 10:39:22 +00:00
|
|
|
$titlesWithThresholds = [];
|
2016-01-09 03:14:12 +00:00
|
|
|
if ( $this->titles ) {
|
2020-12-11 15:57:35 +00:00
|
|
|
$lb = $this->linkBatchFactory->newLinkBatch( $this->titles );
|
2016-01-09 03:14:12 +00:00
|
|
|
|
|
|
|
|
// Fetch last edit timestamps for pages
|
|
|
|
|
$this->resetQueryParams();
|
2016-02-17 09:09:32 +00:00
|
|
|
$this->addTables( [ 'page', 'revision' ] );
|
|
|
|
|
$this->addFields( [ 'page_namespace', 'page_title', 'rev_timestamp' ] );
|
|
|
|
|
$this->addWhere( [
|
2016-01-09 03:14:12 +00:00
|
|
|
'page_latest = rev_id',
|
|
|
|
|
$lb->constructSet( 'page', $db ),
|
2016-02-17 09:09:32 +00:00
|
|
|
] );
|
|
|
|
|
$this->addOption( 'GROUP BY', [ 'page_namespace', 'page_title' ] );
|
2016-01-09 03:14:12 +00:00
|
|
|
$timestampRes = $this->select( __METHOD__ );
|
|
|
|
|
|
2022-04-13 15:28:26 +00:00
|
|
|
$age = $config->get( MainConfigNames::WatchersMaxAge );
|
2016-02-17 09:09:32 +00:00
|
|
|
$timestamps = [];
|
2016-01-09 03:14:12 +00:00
|
|
|
foreach ( $timestampRes as $row ) {
|
|
|
|
|
$revTimestamp = wfTimestamp( TS_UNIX, (int)$row->rev_timestamp );
|
2019-09-15 15:12:06 +00:00
|
|
|
$timestamps[$row->page_namespace][$row->page_title] = (int)$revTimestamp - $age;
|
2016-01-09 03:14:12 +00:00
|
|
|
}
|
2016-03-15 10:39:22 +00:00
|
|
|
$titlesWithThresholds = array_map(
|
2023-06-16 21:24:56 +00:00
|
|
|
static function ( PageReference $target ) use ( $timestamps ) {
|
2016-03-15 10:39:22 +00:00
|
|
|
return [
|
|
|
|
|
$target, $timestamps[$target->getNamespace()][$target->getDBkey()]
|
|
|
|
|
];
|
|
|
|
|
},
|
|
|
|
|
$this->titles
|
|
|
|
|
);
|
2016-01-09 03:14:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( $this->missing ) {
|
2016-03-15 10:39:22 +00:00
|
|
|
$titlesWithThresholds = array_merge(
|
|
|
|
|
$titlesWithThresholds,
|
|
|
|
|
array_map(
|
2023-06-16 21:24:56 +00:00
|
|
|
static function ( PageReference $target ) {
|
2016-03-15 10:39:22 +00:00
|
|
|
return [ $target, null ];
|
|
|
|
|
},
|
|
|
|
|
$this->missing
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
}
|
2020-12-11 15:57:35 +00:00
|
|
|
$this->visitingwatchers = $this->watchedItemStore->countVisitingWatchersMultiple(
|
2016-03-15 10:39:22 +00:00
|
|
|
$titlesWithThresholds,
|
|
|
|
|
!$canUnwatchedpages ? $unwatchedPageThreshold : null
|
|
|
|
|
);
|
2016-01-09 03:14:12 +00:00
|
|
|
}
|
|
|
|
|
|
2010-07-23 07:17:56 +00:00
|
|
|
public function getCacheMode( $params ) {
|
2015-07-06 16:07:45 +00:00
|
|
|
// Other props depend on something about the current user
|
2016-02-17 09:09:32 +00:00
|
|
|
$publicProps = [
|
2010-07-23 07:17:56 +00:00
|
|
|
'protection',
|
|
|
|
|
'talkid',
|
|
|
|
|
'subjectid',
|
2021-06-08 05:16:45 +00:00
|
|
|
'associatedpage',
|
2010-07-23 07:17:56 +00:00
|
|
|
'url',
|
|
|
|
|
'preload',
|
|
|
|
|
'displaytitle',
|
2017-10-18 19:42:42 +00:00
|
|
|
'varianttitles',
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2015-07-06 16:07:45 +00:00
|
|
|
if ( array_diff( (array)$params['prop'], $publicProps ) ) {
|
|
|
|
|
return 'private';
|
2010-07-23 07:17:56 +00:00
|
|
|
}
|
2015-07-06 16:07:45 +00:00
|
|
|
|
|
|
|
|
// testactions also depends on the current user
|
|
|
|
|
if ( $params['testactions'] ) {
|
|
|
|
|
return 'private';
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-23 07:17:56 +00:00
|
|
|
return 'public';
|
|
|
|
|
}
|
|
|
|
|
|
2008-01-28 19:05:26 +00:00
|
|
|
public function getAllowedParams() {
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
|
|
|
|
'prop' => [
|
2022-06-05 23:18:50 +00:00
|
|
|
ParamValidator::PARAM_ISMULTI => true,
|
|
|
|
|
ParamValidator::PARAM_TYPE => [
|
2008-03-25 15:31:24 +00:00
|
|
|
'protection',
|
|
|
|
|
'talkid',
|
2010-07-23 07:17:56 +00:00
|
|
|
'watched', # private
|
2013-01-23 20:40:57 +00:00
|
|
|
'watchers', # private
|
2016-01-09 03:14:12 +00:00
|
|
|
'visitingwatchers', # private
|
2012-06-18 20:33:19 +00:00
|
|
|
'notificationtimestamp', # private
|
2008-09-25 15:55:09 +00:00
|
|
|
'subjectid',
|
2021-06-08 05:16:45 +00:00
|
|
|
'associatedpage',
|
2008-09-25 15:55:09 +00:00
|
|
|
'url',
|
2010-07-23 07:17:56 +00:00
|
|
|
'readable', # private
|
2010-07-22 08:48:34 +00:00
|
|
|
'preload',
|
2023-05-19 15:17:55 +00:00
|
|
|
'preloadcontent', # private: checks current user's permissions
|
|
|
|
|
'editintro', # private: checks current user's permissions
|
2010-07-22 08:48:34 +00:00
|
|
|
'displaytitle',
|
2017-10-18 19:42:42 +00:00
|
|
|
'varianttitles',
|
2020-12-10 23:39:12 +00:00
|
|
|
'linkclasses', # private: stub length (and possibly hook colors)
|
2010-07-23 07:33:40 +00:00
|
|
|
// If you add more properties here, please consider whether they
|
2010-07-23 07:17:56 +00:00
|
|
|
// need to be added to getCacheMode()
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
|
2022-06-06 01:24:41 +00:00
|
|
|
EnumDef::PARAM_DEPRECATED_VALUES => [
|
2018-09-27 15:04:24 +00:00
|
|
|
'readable' => true, // Since 1.32
|
2023-05-19 15:17:55 +00:00
|
|
|
'preload' => true, // Since 1.41
|
2018-09-27 15:04:24 +00:00
|
|
|
],
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
2020-12-10 23:39:12 +00:00
|
|
|
'linkcontext' => [
|
2022-06-05 23:18:50 +00:00
|
|
|
ParamValidator::PARAM_TYPE => 'title',
|
|
|
|
|
ParamValidator::PARAM_DEFAULT => $this->titleFactory->newMainPage()->getPrefixedText(),
|
2020-12-10 23:39:12 +00:00
|
|
|
TitleDef::PARAM_RETURN_OBJECT => true,
|
|
|
|
|
],
|
2016-02-17 09:09:32 +00:00
|
|
|
'testactions' => [
|
2022-06-05 23:18:50 +00:00
|
|
|
ParamValidator::PARAM_TYPE => 'string',
|
|
|
|
|
ParamValidator::PARAM_ISMULTI => true,
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
2018-09-27 15:04:24 +00:00
|
|
|
'testactionsdetail' => [
|
2022-06-05 23:18:50 +00:00
|
|
|
ParamValidator::PARAM_TYPE => [ 'boolean', 'full', 'quick' ],
|
|
|
|
|
ParamValidator::PARAM_DEFAULT => 'boolean',
|
2018-09-27 15:04:24 +00:00
|
|
|
ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
|
|
|
|
|
],
|
2023-04-27 19:22:02 +00:00
|
|
|
'testactionsautocreate' => false,
|
2023-05-19 15:17:55 +00:00
|
|
|
'preloadcustom' => [
|
|
|
|
|
// This should be a valid and existing page title, but we don't want to validate it here,
|
|
|
|
|
// because it's usually someone else's fault. It could emit a warning in the future.
|
|
|
|
|
ParamValidator::PARAM_TYPE => 'string',
|
|
|
|
|
ApiBase::PARAM_HELP_MSG_INFO => [ [ 'preloadcontentonly' ] ],
|
|
|
|
|
],
|
|
|
|
|
'preloadparams' => [
|
|
|
|
|
ParamValidator::PARAM_ISMULTI => true,
|
|
|
|
|
ApiBase::PARAM_HELP_MSG_INFO => [ [ 'preloadcontentonly' ] ],
|
|
|
|
|
],
|
|
|
|
|
'preloadnewsection' => [
|
|
|
|
|
ParamValidator::PARAM_TYPE => 'boolean',
|
|
|
|
|
ParamValidator::PARAM_DEFAULT => false,
|
|
|
|
|
ApiBase::PARAM_HELP_MSG_INFO => [ [ 'preloadcontentonly' ] ],
|
|
|
|
|
],
|
|
|
|
|
'editintrostyle' => [
|
|
|
|
|
ParamValidator::PARAM_TYPE => [ 'lessframes', 'moreframes' ],
|
|
|
|
|
ParamValidator::PARAM_DEFAULT => 'moreframes',
|
|
|
|
|
ApiBase::PARAM_HELP_MSG_INFO => [ [ 'editintroonly' ] ],
|
|
|
|
|
],
|
|
|
|
|
'editintroskip' => [
|
|
|
|
|
ParamValidator::PARAM_TYPE => 'string',
|
|
|
|
|
ParamValidator::PARAM_ISMULTI => true,
|
|
|
|
|
ApiBase::PARAM_HELP_MSG_INFO => [ [ 'editintroonly' ] ],
|
|
|
|
|
],
|
|
|
|
|
'editintrocustom' => [
|
|
|
|
|
// This should be a valid and existing page title, but we don't want to validate it here,
|
|
|
|
|
// because it's usually someone else's fault. It could emit a warning in the future.
|
|
|
|
|
ParamValidator::PARAM_TYPE => 'string',
|
|
|
|
|
ApiBase::PARAM_HELP_MSG_INFO => [ [ 'editintroonly' ] ],
|
|
|
|
|
],
|
2016-02-17 09:09:32 +00:00
|
|
|
'continue' => [
|
2014-09-18 17:38:23 +00:00
|
|
|
ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
|
2016-02-17 09:09:32 +00:00
|
|
|
],
|
|
|
|
|
];
|
2007-06-18 02:00:23 +00:00
|
|
|
}
|
|
|
|
|
|
2014-10-28 17:17:02 +00:00
|
|
|
protected function getExamplesMessages() {
|
2019-11-30 11:55:36 +00:00
|
|
|
$title = Title::newMainPage()->getPrefixedText();
|
|
|
|
|
$mp = rawurlencode( $title );
|
|
|
|
|
|
2016-02-17 09:09:32 +00:00
|
|
|
return [
|
2019-11-30 11:55:36 +00:00
|
|
|
"action=query&prop=info&titles={$mp}"
|
2014-09-18 17:38:23 +00:00
|
|
|
=> 'apihelp-query+info-example-simple',
|
2019-11-30 11:55:36 +00:00
|
|
|
"action=query&prop=info&inprop=protection&titles={$mp}"
|
2014-09-18 17:38:23 +00:00
|
|
|
=> 'apihelp-query+info-example-protection',
|
2016-02-17 09:09:32 +00:00
|
|
|
];
|
2006-09-26 01:44:13 +00:00
|
|
|
}
|
2006-10-01 21:20:55 +00:00
|
|
|
|
2011-07-17 16:51:11 +00:00
|
|
|
public function getHelpUrls() {
|
2017-04-04 22:52:57 +00:00
|
|
|
return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Info';
|
2011-07-17 16:51:11 +00:00
|
|
|
}
|
2006-09-26 01:44:13 +00:00
|
|
|
}
|
2024-09-25 16:17:29 +00:00
|
|
|
|
|
|
|
|
/** @deprecated class alias since 1.43 */
|
|
|
|
|
class_alias( ApiQueryInfo::class, 'ApiQueryInfo' );
|