Page MenuHomePhabricator

Deprecate $wgTitle completely
Open, Needs TriagePublic

Description

See parent task. This is a bug against core, bugs for extensions, if needed, should be subtasks of this one.

See also T25307: Send $wgTitle to the fiery pit from whence it came

Current usages in core:

$ ack --php '\$wgTitle\b' includes/ languages/ maintenance/
includes/api/ApiEditPage.php
350:		global $wgTitle, $wgRequest;
354:		// Some functions depend on $wgTitle == $ep->mTitle
356:		$wgTitle = $titleObj;

includes/api/ApiParse.php
79:		// The parser needs $wgTitle to be set, apparently the
81:		// TODO: Does this still need $wgTitle?
82:		global $wgParser, $wgTitle;
108:				$wgTitle = $titleObj;
166:				$wgTitle = $titleObj;
198:			$wgTitle = $titleObj;

includes/cache/MessageCache.php
1129:		global $wgTitle;
1147:			$title = $wgTitle;
1149:		// Sometimes $wgTitle isn't set either...
1151:			# It's not uncommon having a null $wgTitle in scripts. See r80898

includes/context/RequestContext.php
179:			global $wgTitle; # fallback to $wg till we can improve this
180:			$this->title = $wgTitle;

includes/EditPage.php
465:	 * If not set, $wgTitle will be returned. This behavior might change in
472:			global $wgTitle;
473:			return $wgTitle;

includes/Linker.php
841:		global $wgTitle;
856:			$title = $wgTitle;

includes/MediaWiki.php
63:	 * @return Title Title object to be $wgTitle
172:		global $wgTitle;
206:			// Bug 32276: allowing the skin to generate output with $wgTitle or
214:			// still use $wgTitle.
217:			$wgTitle = $badTitle;
269:							$wgTitle = $target;
753:		global $wgTitle;
760:			// Set a dummy title, because $wgTitle == null might break things
765:			$wgTitle = $title;
777:		$wgTitle = $title;
792:		// Note: Do this after $wgTitle is setup, otherwise the hooks run from

includes/parser/Parser.php
57: * @warning $wgUser or $wgTitle or $wgRequest or $wgLang. Keep them away!
4629:			global $wgTitle;
4631:			$this->startParse( $wgTitle, new ParserOptions, self::OT_PREPROCESS, true );
4706:	 * @param Title|null $title Title object or null to use $wgTitle
4719:			global $wgTitle;
4720:			$title = $wgTitle;
4735:	 * $parser->getTitle() and $parser->getOptions() not $wgTitle or $wgOut->mParserOptions
5506:		global $wgTitle; # not generally used but removes an ugly failure mode
5509:		$this->startParse( $wgTitle, new ParserOptions, self::OT_PLAIN, true );

includes/session/SessionProvider.php
144:	 *  before $wgUser, $wgLang, $wgOut, $wgParser, $wgTitle, and corresponding

includes/Setup.php
824: * @var Title $wgTitle
826:$wgTitle = null;

includes/specialpage/SpecialPageFactory.php
587:	 * Also saves the current $wgTitle, $wgOut, $wgRequest, $wgUser and $wgLang
599:		global $wgTitle, $wgOut, $wgRequest, $wgUser, $wgLang;
604:			'title' => $wgTitle,
619:		$wgTitle = $title;
634:		$wgTitle = $glob['title'];

In extensions:

$ ack 'wgTitle\b' --php
AbuseFilter/includes/AbuseFilter.class.php
881:		global $wgUser, $wgTitle, $wgRequest;
886:		$oldWgTitle = $wgTitle;
888:		if ( !$wgTitle ) {
889:			$wgTitle = SpecialPage::getTitleFor( 'AbuseFilter' );
976:		// Bug 53498: If we screwed around with $wgTitle, reset it so the title
979:		// title from $wgTitle.
980:		if ( $wgTitle !== $oldWgTitle ) {
981:			$wgTitle = $oldWgTitle;

AdvancedMeta/AdvancedMeta.php
145:		global $wgTitle, $wgUser, $wgRequest;
165:				$meta = $this->getMetaByArticleID( $wgTitle->getArticleID() );
168:				if ( empty( $meta ) || $wgTitle->getArticleID() == '0' ) {
202:				<br /><strong>Keywords:</strong> <small>" . wfMessage( 'ameta-keywordsadd', count( $addedkeywords ) )->text() . "<a href='javascript:;' title='" . wfMsg( 'ameta-keywordsmodify' ) . "'>" . htmlspecialchars( str_replace( "$1", $wgTitle, $addedkeywords ) ) . "</a>
309:		global $wgTitle, $wgArticleRobotPolicies, $wgDefaultRobotPolicy;
311:		$articleid = $wgTitle->getPrefixedText();
312:		$addedkeywords = wfMsg( 'globalkeywords' ) == '&lt;globalkeywords&gt;' ? '' : wfMsg( 'globalkeywords' , $wgTitle );
313:		$meta = $this->getMetaByArticleID( $wgTitle->getArticleID() );
321:		if ( !in_array( $wgTitle->getnamespace(), $this->indexedPages ) ) {
365:		global $wgTitle;
367:		$meta = $this->getMetaByArticleID( $wgTitle->getArticleID() );
414:		global $wgUser, $wgTitle;
416:		//$ns = $wgTitle->getNamespace();
420:		//        if ($wgTitle->isRedirect()) {

Agora/test/vector/template/template_files/index(1).php
119:              || ns === 2 && /\.(js|css)$/.test(wgTitle) // User scripts
1661:          && (   wgNamespaceNumber == 14 && v == wgTitle
1759:          || wgNamespaceNumber == 14 && this.currentCategory == wgTitle
2015:              || wgNamespaceNumber == 14 && titles[i] == wgTitle

Agora/test/vector/template/template_files/load(9).php
397:    if ( mw.config.get( 'wgNamespaceNumber' ) === 4 && mw.config.get( 'wgTitle' ) === 'Upload' && mw.config.get( 'wgAction' ) === 'view' ) {

AJAXPoll/AJAXPoll_body.php
283:		global $wgTitle, $wgUser, $wgLang, $wgUseAjax;
345:		if ( is_object( $wgTitle ) ) {
426:					'action' => $wgTitle->getLocalURL(),

ApprovedRevs/ApprovedRevs.hooks.php
495:		global $wgTitle;
496:		$approvedRevID = ApprovedRevs::getApprovedRevID( $wgTitle );
497:		$latestRevID = $wgTitle->getLatestRevID();

ApprovedRevs/maintenance/approveAllPages.php
41:		global $wgTitle;
55:			// some extensions, like Semantic Forms, need $wgTitle
57:			$wgTitle = $title;

AuthorProtect/AuthorProtect.php
41:	 * Extensions like ConfirmAccount do some weird stuff to $wgTitle during the UserGetRights hook
42:	 * So this delays the hook's execution to a point where $wgTitle is set
61:		global $wgTitle;
65:		if ( self::userIsAuthor( $wgTitle ) && $user->isLoggedIn() ) {

BlueSpiceExtensions/TopMenuBarCustomizer/TopMenuBarCustomizer.class.php
230:	 * @global Title $wgTitle
235:		global $wgTitle, $wgServer, $wgScriptPath;;
271:					if( $oTitle->equals($wgTitle) ) {

BlueSpiceExtensions/WidgetBar/WidgetBar.class.php
176:		global $wgTitle;
179:		if ( $wgTitle->userCan( 'read' ) == false ) {
180:			if ( $wgTitle->getNamespace() == -1 && $oUser->isLoggedIn() ) {

Cargo/CargoUtils.php
342:			global $wgTitle;
343:			$title = $wgTitle;

Cargo/formats/CargoTemplateFormat.php
52:		global $wgTitle;
53:		if ( $wgTitle != null && $wgTitle->isSpecialPage() ) {

Collection/Collection.hooks.php
338:			$onclick = "collectionCall('AddCategory', ['addcategory', wgTitle]); return false;";
347:				$onclick = "collectionCall('AddArticle', ['removearticle', wgNamespaceNumber, wgTitle, " .
355:				$onclick = "collectionCall('RemoveArticle', ['addarticle', wgNamespaceNumber, wgTitle, " .

Configure/scripts/findSettings.php
54:				'wgTitle', 'wgArticle', 'wgContLang', 'wgLang', 'wgOut', 'wgParser', 'wgMessageCache',

DataTransfer/includes/DT_PageStructure.php
62:		global $wgParser, $wgTitle;
82:					$fieldValue = $wgParser->parse( "__NOTOC__ __NOEDITSECTION__\n" . $fieldValue, $wgTitle, new ParserOptions() )->getText();
123:				$freeText = $wgParser->parse( "__NOTOC__ __NOEDITSECTION__\n" . $freeText, $wgTitle, new ParserOptions() )->getText();

DonationInterface/gateway_forms/Form.php
878:		global $wgRequest, $wgTitle;
914:		return wfAppendQuery( $wgTitle->getLocalURL(), $query_array );

DonationInterface/tests/DonationInterfaceTestCase.php
331:			'wgTitle' => Title::newFromText( 'nonsense is apparently fine' ),

ErrorHandler/ErrorHandler.php
212:		global $wgTitle;
215:		if( $wgTitle instanceof Title )

ExtTab/includes/ET_AjaxAccess.php
16:			global $wgTitle, $smwgIQRunningNumber;
19:			$wgTitle = Title::newFromText( $title );
20:			$revision = Revision::newFromTitle( $wgTitle );
26:				$html = $wgParser->parse( $revision->getText(), $wgTitle, $popts )->getText();

Flow/tests/phpunit/ContainerTest.php
13:		$this->setMwGlobals( 'wgTitle', \Title::newMainPage() );

GoogleMaps/GoogleMaps.php
67:		$wgTitle;
110:		$wgTitle );

Lingo/LingoMessageLog.php
56:		global $wgTitle, $wgUser;
82:			$ret = $parser->parse( $ret, $wgTitle, ParserOptions::newFromUser( $wgUser ) );

LiquidThreads/api/ApiThreadAction.php
45:		global $wgTitle;
46:		if ( !$wgTitle instanceof Title ) {
47:			$wgTitle = Title::newFromText( 'LiquidThreads has a bug' );

LiquidThreads/classes/ThreadHistoryPager.php
64:		global $wgLang, $wgTitle;
72:					$wgTitle,

LiquidThreads/classes/View.php
381:		global $wgOut, $wgRequest, $wgTitle;
384:		$oldTitle = $wgTitle;
387:		$wgTitle = $this->title;
410:		$wgTitle = $oldTitle;
2386:		global $wgParser, $wgTitle;
2388:		$title = $wgTitle ? $wgTitle : $user->getUserPage();

LiquidThreads/migrateDatabase.php
12:$wgTitle = SpecialPage::getTitleFor( 'LiquidThreads' );

MaintenanceShell/includes/SpecialMaintenanceShell.php
119:		global $wgMaintenanceShellPath, $IP, $wgTitle;
161:			$wgTitle = null;

Maps/tests/evilMediaWikiBootstrap.php
50:$wgTitle = null;

MassEditRegex/MassEditRegex.special.php
505:		global $wgTitle;
506:		if ( !$wgTitle->isSpecial( 'MassEditRegex' ) ) return true;

MassMessage/tests/ApiMassMessageTest.php
17:		global $wgTitle;
23:		$wgTitle = Title::newMainPage(); // So HTMLForm doesn't throw a shit

MobileFrontend/tests/phpunit/MobileContextTest.php
251:			'wgTitle' => null,
562:		$this->setMwGlobals( 'wgTitle', null );

News/NewsRenderer.php
420:			$output = $this->templateparser->parse( $text, $GLOBALS['wgTitle'], $this->templateoptions, true );
596:		if (!$title) $title = $GLOBALS['wgTitle'];

OfflineImportLexicon/OfflineImportLexicon.php
60:	global $IP, $wgScriptPath, $wgExtensionAssetsPath, $wgTitle;
61:    if($wgTitle->getDBkey() == 'OfflineImportLexicon'){
77:                global $wgTitle;
78:                $check = $wgTitle->getNamespace() == -1 && $wgTitle->getDBkey() == 'OfflineImportLexicon';

PageDisqus/PageDisqus.body.php
6:		global $wgPageDisqusShortname, $wgPageDisqusExclude, $wgTitle, $wgRequest;
21:				if ( preg_match( '/' . $excluded . '/', $wgTitle->getFullText() ) ) {
34:			var disqus_title = "' . $wgTitle->getText() . '";
44:		global $wgPageDisqusShortname, $wgPageDisqusExclude, $wgTitle, $wgRequest;
52:				if ( preg_match( '/' . $excluded . '/', $wgTitle->getFullText() ) ) {

PagedTiffHandler/tests/PagedTiffHandlerTest.php
46:		global $wgTitle;
47:		$wgTitle = Title::newFromText( 'PagedTiffHandler_UnitTest' );

PageSchemas/PageSchemas.classes.php
137:		global $wgTitle, $wgPageSchemasHandlerClasses;
139:		if ( is_null( $wgTitle ) || $wgTitle->getNamespace() != NS_CATEGORY ) {

PageSchemas/PS_Tabs.php
24:		global $wgTitle, $wgRequest;
26:		if ( $wgUser->isAllowed( 'edit' ) && $wgTitle->userCan( 'edit' ) ) {

PageSchemas/specials/PS_EditSchema.php
627:		global $wgRequest, $wgOut, $wgUser, $wgTitle;
632:		if ( !is_null( $category ) && ( !$wgUser->isAllowed( 'edit' ) || !$wgTitle->userCan( 'edit' ) ) ) {

ParserHooks/tests/evilMediaWikiBootstrap.php
50:$wgTitle = null;

ParserHooks/vendor/mediawiki/validator/tests/evilMediaWikiBootstrap.php
50:$wgTitle = null;

ProofreadPage/ProofreadPage.body.php
195:		global $wgTitle;
196:		if ( !isset( $wgTitle ) ) {
209:		global $wgTitle;
212:		$in_index_namespace = $wgTitle->inNamespace( self::getIndexNamespaceId() );

Push/includes/Push_Tab.php
108:		global $wgOut, $wgUser, $wgTitle, $wgSitename, $egPushTargets;
127:			Html::hidden( 'pageName', $wgTitle->getFullText(), array( 'id' => 'pageName' ) ) .
217:		global $wgTitle;
236:						'href' => $url . '/index.php?title=' . $wgTitle->getFullText(),
240:					wfMsgExt( 'push-remote-page-link', 'parsemag', $wgTitle->getFullText(), $name )
295:		global $wgOut, $wgUser, $wgTitle;
301:				array( $wgTitle->getFullText() ),
302:				array( $wgTitle->getFullText() => true )
364:		global $wgOut, $wgTitle, $egPushIncFiles, $wgScript;
366:		$allFiles = self::getImagesForPages( array( $wgTitle->getFullText() ) );

Push/specials/Push_Body.php
432:		return version_compare( $GLOBALS['wgVersion'], '1.18', '>' ) ? parent::getPageTitle() : $GLOBALS['wgTitle'];

RandomFeaturedUser/RandomFeaturedUser.php
159:			global $wgTitle, $wgOut;
162:				$p->parse( $about, $wgTitle, $wgOut->parserOptions(), false )->getText();

Ratings/allrating/RatingsAllRating.php
92:		$parameters['page'] = $parameters['page'] === false ? $GLOBALS['wgTitle'] : Title::newFromText( $parameters['page'] );

Ratings/starrating/RatingsStars.php
92:		$parameters['page'] = $parameters['page'] === false ? $GLOBALS['wgTitle'] : Title::newFromText( $parameters['page'] );

Ratings/votesummary/RatingsVoteSummary.php
80:		$parameters['page'] = $parameters['page'] === false ? $GLOBALS['wgTitle'] : Title::newFromText( $parameters['page'] );

RPED/RPED.hooks.php
22:		, $wgTitle, $wgRequest, $wgRPEDBrokenLinkStyle, $wgRPEDExcludeNamespaced;
24:		if ( $wgTitle->getNamespace () == -1 ) {

SecurePoll/cli/dumpComments.php
16:$wgTitle = Title::newFromText( 'Special:SecurePoll' );

SecurePoll/cli/dumpVoteCsv.php
16:$wgTitle = Title::newFromText( 'Special:SecurePoll' );

SecurePoll/cli/tally.php
13:$wgTitle = Title::newFromText( 'Special:SecurePoll' );

SecurePoll/includes/entities/Entity.php
169:		global $wgParser, $wgTitle;
171:		if ( $wgTitle ) {
172:			$title = $wgTitle;

ShoutWikiAds/ShoutWikiAds.class.php
28:		global $wgAdConfig, $wgTitle, $wgUser, $wgRequest;
34:		list( $alias, /*..*/ ) = SpecialPageFactory::resolveAlias( $wgTitle->getDBkey() );
35:		if( $wgTitle instanceof Title &&
95:		global $wgAdConfig, $wgTitle;
96:		$namespace = $wgTitle->getNamespace();

SideBarMenu/extensions/Validator/tests/evilMediaWikiBootstrap.php
50:$wgTitle = null;

SimpleSecurity/SimpleSecurity_body.php
109:		global $wgUser, $wgTitle;
110:		$title = $wgTitle;
182:		global $wgGroupPermissions, $wgOut, $wgTitle, $wgRequest, $wgPageRestrictions;
185:		if ( !is_object( $wgTitle ) ) return true;
186:		$title = $wgTitle;

SocialProfile/UserBoard/UserBoardClass.php
268:		global $wgUser, $wgOut, $wgTitle;
307:			$message_text = $parser->parse( $row->ub_message, $wgTitle, $wgOut->parserOptions(), true );
360:		global $wgUser, $wgTitle;
418:		} elseif ( $wgUser->getName() == $wgTitle->getText() ) {

StarterWiki/maintenance/createWikiDBFromStarter.php
30:$wgTitle = Title::newFromText( "StarterWiki Database Creator" );

SubPageList/extensions/Validator/tests/evilMediaWikiBootstrap.php
50:$wgTitle = null;

SubPageList/tests/evilMediaWikiBootstrap.php
50:$wgTitle = null;

TitleIcon/TitleIcon.class.php
77:			$GLOBALS['wgTitle'], new ParserOptions())->getText();

Validator/tests/evilMediaWikiBootstrap.php
50:$wgTitle = null;

VisualEditor/ApiVisualEditor.php
324:				global $wgTitle; // FIXME NOOOOOOOOES
325:				$wgTitle = $title;

Wikibase/repo/Wikibase.hooks.php
745:		global $wgLang, $wgTitle;
749:			$title = $wgTitle;

Wikidata/extensions/PropertySuggester/tests/evilMediaWikiBootstrap.php
56:$wgTitle = null;

Wikidata/extensions/Wikibase/repo/Wikibase.hooks.php
824:		global $wgLang, $wgTitle;
830:			$title = $wgTitle;

WikidataBuildResources/extensions/PropertySuggester/tests/evilMediaWikiBootstrap.php
56:$wgTitle = null;

WikidataBuildResources/extensions/Wikibase/repo/Wikibase.hooks.php
771:		global $wgLang, $wgTitle;
775:			$title = $wgTitle;

WikiLexicalData/OmegaWiki/DefinedMeaning.php
18:			$wgOut, $wgTitle, $wgRequest;
23:		$titleText = $wgTitle->getText();
106:			$wgOut, $wgTitle;
110:		$definedMeaningId = $this->getDefinedMeaningIdFromTitle( $wgTitle->getText() );
143:		global $wgOut, $wgTitle ;
145:		$definedMeaningId = $this->getDefinedMeaningIdFromTitle( $wgTitle->getText() );
171:			$wgTitle;
175:		$definedMeaningId = $this->getDefinedMeaningIdFromTitle( $wgTitle->getText() );
192:		global $wgTitle;
193:		return $wgTitle->getFullText() ;
219:			$wgTitle;
220:		return $this->getDefinedMeaningIdFromTitle( $wgTitle->getText() );
231:		global $wgTitle, $wdShowCopyPanel;
256:		$titleText = $wgTitle->getPrefixedURL();

WikiLexicalData/OmegaWiki/DefinedMeaningModel.php
278:# 			$wgTitle, $wgUser, $wgRequest;
300:		# Title::touchArray(array($wgTitle));
304:		# RecentChange::notifyEdit($now, $wgTitle, false, $wgUser, $summary, 0, $now, false, '', 0, 0, 0);

WikiLexicalData/OmegaWiki/forms.php
229:		$wgTitle;
235:					'<input type="hidden" name="title" value="' . $wgTitle->getNsText() . ':' . htmlspecialchars( $wgTitle->getText() ) . '"/>';
265:		$wgTitle;
271:					'<input type="hidden" name="title" value="' . $wgTitle->getNsText() . ':' . htmlspecialchars( $wgTitle->getText() ) . '"/>';

WikiLexicalData/OmegaWiki/Search.php
20:			$wgOut, $wgTitle;
24:		$spelling = $wgTitle->getText();

Wikilog/maintenance/wikilogImportDocumentation.php
72:		global $wgTitle, $wgWikilogDocumentationXML;
73:		$wgTitle = Title::newFromText( "Wikilog documentation import script" );

Wikilog/WikilogItemPager.php
96:		global $wgOut, $wgParser, $wgTitle;
103:			$wgParser->startExternalParse( $wgTitle, $popt, Parser::OT_HTML );
218:		global $wgTitle, $wgParser, $wgOut;
223:			$output = $wgParser->parse( $text, $wgTitle, $popts, true, false );

WikiObjectModel/includes/apis/WOM_OutputProcessor.php
160:		global $wgTitle, $wgUser;
161:		$wgTitle = $title;
316:		if ( wfRunHooks ( 'womGetExtraOutputObjects', array ( $wgTitle, &$wom ) ) ) {

WikiObjectModel/includes/apis/WOM_SetObjectModel.php
25:		// Some functions depend on $wgTitle == $ep->mTitle
26:		global $wgTitle;
27:		$wgTitle = $titleObj;

WYSIWYG/WYSIWYG/CKeditor.body.php
223:    global $wgUseTeX, $wgUser, $wgTitle, $wgFCKEditorIsCompatible;
233:    if (is_object($wgTitle) && in_array($wgTitle->getNamespace(), $this->getExcludedNamespaces())) {
551://    global $wgOut, $wgTitle, $wgScriptPath, $wgContLang, $wgUser;
571://    if (in_array($wgTitle->getNamespace(), $this->getExcludedNamespaces())) {
608://    $skin->mTitle = & $wgTitle;

WYSIWYG/WYSIWYG/CKeditorParser.body.php
557:          global $wgTitle;
559:                  $wgTitle && $wgTitle->getNamespace() == SF_NS_FORM &&
1175:   * @global Title $wgTitle
1181:    //global $wgTitle, $wgRequest;
1186:      ($wgTitle && (defined('SMW_NS_PROPERTY') && $wgTitle->getNamespace() == SMW_NS_PROPERTY) ||
1187:      $wgTitle->getNamespace() == NS_CATEGORY )) {

WYSIWYG/WYSIWYG/CKeditorSajax.body.php
20:	global $wgExtensionFunctions, $wgTitle;
31:	$originalLink = $parser->parse( '[[File:' . $term . ']]', $wgTitle, $options )->getText();
280:	global $wgTitle;
283:        $wgTitle = Title::newFromText($title);
291:        $resultText = $parser->parse( $wiki, $wgTitle, $options )->getText();

WYSIWYG/WYSIWYG/tests/testcases/TestWYSIWYGparser.php
60:        global $wgTitle;
61:        $wgTitle = $this->title;

YotpoReviews/YotpoReviews.body.php
17:		global $wgTitle, $wgLogo, $wgServer, $wgYotpoAppKey;
48:		$data_product_id = $wgTitle->getDBKey();
49:		$data_name = $wgTitle->getText();
50:		$data_url = $wgTitle->getFullURL();

Details

Related Gerrit Patches:
mediawiki/core : masterMake Parser not depend on $wgTitle

Event Timeline

MaxSem created this task.Feb 28 2017, 10:33 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 28 2017, 10:33 PM

Change 340431 had a related patch set uploaded (by MaxSem):
[mediawiki/core] Make Parser not depend on $wgTitle

https://gerrit.wikimedia.org/r/340431

MaxSem updated the task description. (Show Details)Mar 1 2017, 12:51 AM

Updated - Phalanx is an archived extension, see T176665

Dinoguy1000 updated the task description. (Show Details)Apr 18 2018, 11:38 PM
Restricted Application added a project: Product-Analytics. · View Herald TranscriptApr 18 2018, 11:38 PM
Izno added a subscriber: Izno.Aug 31 2018, 10:21 PM
This comment was removed by Izno.

Change 340431 abandoned by MaxSem:
Make Parser not depend on $wgTitle

https://gerrit.wikimedia.org/r/340431