From 6a3260fe266a0f63eec2e7819c1d1237c4e543e1 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 18 Oct 2007 14:55:48 +0000 Subject: [PATCH] Revert r26670 [LiquidThreads-related patches] for now: * Adds five undocumented hooks * Unclear purpose for change to SpecialPage * Big search-and-replace in EditPage for title usage which seems to still leave things inconsistent; a bit confused what all that's mean to be doing. --- includes/ChangesList.php | 3 - includes/EditPage.php | 100 +++++++++++++++------------------- includes/Linker.php | 7 --- includes/OutputPage.php | 3 - includes/Parser.php | 2 +- includes/SpecialPage.php | 7 +-- includes/SpecialWatchlist.php | 6 -- includes/Title.php | 6 +- includes/Wiki.php | 5 -- 9 files changed, 48 insertions(+), 91 deletions(-) diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 617e12e196..8d0f95086f 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -176,9 +176,6 @@ class ChangesList { global $wgContLang; $articlelink .= $wgContLang->getDirMark(); - wfRunHooks('ChangesListInsertArticleLink', - array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched)); - $s .= ' '.$articlelink; } diff --git a/includes/EditPage.php b/includes/EditPage.php index 276d7c4c2a..ad5c759f26 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -42,14 +42,10 @@ class EditPage { # extensions should take care to _append_ to the present value public $editFormPageTop; // Before even the preview public $editFormTextTop; - public $editFormTextBeforeContent; public $editFormTextAfterWarn; public $editFormTextAfterTools; public $editFormTextBottom; - public $didSave = false; - public $suppressIntro = false; - /** * @todo document * @param $article @@ -62,7 +58,6 @@ class EditPage { # Placeholders for text injection by hooks (empty per default) $this->editFormPageTop = $this->editFormTextTop = - $this->editFormTextBeforeContent = $this->editFormTextAfterWarn = $this->editFormTextAfterTools = $this->editFormTextBottom = ""; @@ -83,10 +78,10 @@ class EditPage { wfProfileIn( __METHOD__ ); $text = ''; - if( !$this->mArticle->getTitle()->exists() ) { - if ( $this->mArticle->getTitle()->getNamespace() == NS_MEDIAWIKI ) { + if( !$this->mTitle->exists() ) { + if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { # If this is a system message, get the default text. - $text = wfMsgWeirdKey ( $this->mArticle->getTitle()->getText() ) ; + $text = wfMsgWeirdKey ( $this->mTitle->getText() ) ; } else { # If requested, preload some text. $text = $this->getPreloadedText( $preload ); @@ -323,9 +318,9 @@ class EditPage { return; } - $permErrors = $this->mArticle->getTitle()->getUserPermissionsErrors('edit', $wgUser); - if( !$this->mArticle->getTitle()->exists() ) - $permErrors += array_diff( $this->mArticle->getTitle()->getUserPermissionsErrors('create', $wgUser), $permErrors ); + $permErrors = $this->mTitle->getUserPermissionsErrors('edit', $wgUser); + if( !$this->mTitle->exists() ) + $permErrors += array_diff( $this->mTitle->getUserPermissionsErrors('create', $wgUser), $permErrors ); # Ignore some permissions errors. $remove = array(); @@ -377,8 +372,8 @@ class EditPage { $this->isConflict = false; // css / js subpages of user pages get a special treatment - $this->isCssJsSubpage = $this->mArticle->getTitle()->isCssJsSubpage(); - $this->isValidCssJsSubpage = $this->mArticle->getTitle()->isValidCssJsSubpage(); + $this->isCssJsSubpage = $wgTitle->isCssJsSubpage(); + $this->isValidCssJsSubpage = $wgTitle->isValidCssJsSubpage(); /* Notice that we can't use isDeleted, because it returns true if article is ever deleted * no matter it's current state @@ -390,7 +385,7 @@ class EditPage { * deletes. This is done on every preview and save request. Move it further down * to only perform it on saves */ - if ( $this->mArticle->getTitle()->isDeleted() ) { + if ( $this->mTitle->isDeleted() ) { $this->lastDelete = $this->getLastDelete(); if ( !is_null($this->lastDelete) ) { $deletetime = $this->lastDelete->log_timestamp; @@ -405,7 +400,7 @@ class EditPage { if( $this->formtype == 'initial' || $this->firsttime ) $this->showIntro(); - if( $this->mArticle->getTitle()->isTalkPage() ) { + if( $this->mTitle->isTalkPage() ) { $wgOut->addWikiText( wfMsg( 'talkpagetext' ) ); } @@ -431,8 +426,8 @@ class EditPage { wfProfileOut( $fname ); return; } - if( !$this->mArticle->getID() ) - wfRunHooks( 'EditFormPreloadText', array( &$this->textbox1, &$this->mArticle->mTitle ) ); + if( !$this->mTitle->getArticleId() ) + wfRunHooks( 'EditFormPreloadText', array( &$this->textbox1, &$this->mTitle ) ); } $this->showEditForm(); @@ -447,7 +442,6 @@ class EditPage { */ private function previewOnOpen() { global $wgRequest, $wgUser; - $title = $this->mArticle->getTitle(); if( $wgRequest->getVal( 'preview' ) == 'yes' ) { // Explicit override from request return true; @@ -457,10 +451,10 @@ class EditPage { } elseif( $this->section == 'new' ) { // Nothing *to* preview for new sections return false; - } elseif( ( $wgRequest->getVal( 'preload' ) !== '' || $title->exists() ) && $wgUser->getOption( 'previewonfirst' ) ) { + } elseif( ( $wgRequest->getVal( 'preload' ) !== '' || $this->mTitle->exists() ) && $wgUser->getOption( 'previewonfirst' ) ) { // Standard preference behaviour return true; - } elseif( !$title->exists() && $title->getNamespace() == NS_CATEGORY ) { + } elseif( !$this->mTitle->exists() && $this->mTitle->getNamespace() == NS_CATEGORY ) { // Categories are special return true; } else { @@ -537,7 +531,7 @@ class EditPage { $this->watchthis = $request->getCheck( 'wpWatchthis' ); # Don't force edit summaries when a user is editing their own user or talk page - if( ( $this->mArticle->getTitle()->mNamespace == NS_USER || $this->mArticle->getTitle()->mNamespace == NS_USER_TALK ) && $this->mArticle->getTitle()->getText() == $wgUser->getName() ) { + if( ( $this->mTitle->mNamespace == NS_USER || $this->mTitle->mNamespace == NS_USER_TALK ) && $this->mTitle->getText() == $wgUser->getName() ) { $this->allowBlankSummary = true; } else { $this->allowBlankSummary = $request->getBool( 'wpIgnoreBlankSummary' ); @@ -593,8 +587,7 @@ class EditPage { */ private function showIntro() { global $wgOut, $wgUser; - if ( $this->suppressIntro ) return; - if( !$this->showCustomIntro() && !$this->mArticle->getTitle()->exists() ) { + if( !$this->showCustomIntro() && !$this->mTitle->exists() ) { if( $wgUser->isLoggedIn() ) { $wgOut->addWikiText( wfMsg( 'newarticletext' ) ); } else { @@ -655,7 +648,7 @@ class EditPage { wfProfileOut( $fname ); return false; } - if ( $wgFilterCallback && $wgFilterCallback( $this->mArticle->getTitle(), $this->textbox1, $this->section ) ) { + if ( $wgFilterCallback && $wgFilterCallback( $this->mTitle, $this->textbox1, $this->section ) ) { # Error messages or other handling should be performed by the filter function wfProfileOut( $fname ); wfProfileOut( "$fname-checks" ); @@ -727,11 +720,11 @@ class EditPage { wfProfileOut( "$fname-checks" ); # If article is new, insert it. - $aid = $this->mArticle->getTitle()->getArticleID( GAID_FOR_UPDATE ); + $aid = $this->mTitle->getArticleID( GAID_FOR_UPDATE ); if ( 0 == $aid ) { // Late check for create permission, just in case *PARANOIA* - if ( !$this->mArticle->getTitle()->userCan( 'create' ) ) { + if ( !$this->mTitle->userCan( 'create' ) ) { wfDebug( "$fname: no create permission\n" ); $this->noCreatePermission(); wfProfileOut( $fname ); @@ -748,7 +741,6 @@ class EditPage { $isComment=($this->section=='new'); $this->mArticle->insertNewArticle( $this->textbox1, $this->summary, $this->minoredit, $this->watchthis, false, $isComment); - $this->didSave = true; wfProfileOut( $fname ); return false; @@ -886,7 +878,6 @@ class EditPage { # update the article here if( $this->mArticle->updateArticle( $text, $this->summary, $this->minoredit, $this->watchthis, '', $sectionanchor ) ) { - $this->didSave = true; wfProfileOut( $fname ); return false; } else { @@ -906,8 +897,8 @@ class EditPage { $this->textbox1 = $this->getContent(false); if ($this->textbox1 === false) return false; - if ( !$this->mArticle->exists() && $this->mArticle->getTitle()->getNamespace() == NS_MEDIAWIKI ) - $this->textbox1 = wfMsgWeirdKey( $this->mArticle->getTitle()->getText() ); + if ( !$this->mArticle->exists() && $this->mArticle->mTitle->getNamespace() == NS_MEDIAWIKI ) + $this->textbox1 = wfMsgWeirdKey( $this->mArticle->mTitle->getText() ); wfProxyCheck(); return true; } @@ -1016,12 +1007,12 @@ class EditPage { } } - if( $this->mArticle->getTitle()->getNamespace() == NS_MEDIAWIKI ) { + if( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { # Show a warning if editing an interface message $wgOut->addWikiText( wfMsg( 'editinginterface' ) ); - } elseif( $this->mArticle->getTitle()->isProtected( 'edit' ) ) { + } elseif( $this->mTitle->isProtected( 'edit' ) ) { # Is the title semi-protected? - if( $this->mArticle->getTitle()->isSemiProtected() ) { + if( $this->mTitle->isSemiProtected() ) { $notice = wfMsg( 'semiprotectedpagewarning' ); if( wfEmptyMsg( 'semiprotectedpagewarning', $notice ) || $notice == '-' ) $notice = ''; @@ -1031,9 +1022,9 @@ class EditPage { } $wgOut->addWikiText( $notice ); } - if ( $this->mArticle->getTitle()->isCascadeProtected() ) { + if ( $this->mTitle->isCascadeProtected() ) { # Is this page under cascading protection from some source pages? - list($cascadeSources, /* $restrictions */) = $this->mArticle->getTitle()->getCascadeProtectionSources(); + list($cascadeSources, /* $restrictions */) = $this->mTitle->getCascadeProtectionSources(); if ( count($cascadeSources) > 0 ) { # Explain, and list the titles responsible $notice = wfMsgExt( 'cascadeprotectedwarning', array('parsemag'), count($cascadeSources) ) . "\n"; @@ -1099,10 +1090,10 @@ class EditPage { if( $wgUser->getOption( 'watchdefault' ) ) { # Watch all edits $this->watchthis = true; - } elseif( $wgUser->getOption( 'watchcreations' ) && !$this->mArticle->getTitle()->exists() ) { + } elseif( $wgUser->getOption( 'watchcreations' ) && !$this->mTitle->exists() ) { # Watch creations $this->watchthis = true; - } elseif( $this->mArticle->getTitle()->userIsWatching() ) { + } elseif( $this->mTitle->userIsWatching() ) { # Already watched $this->watchthis = true; } @@ -1134,12 +1125,12 @@ class EditPage { if( $this->section == 'new' ) { $commentsubject="\n
\n
"; $editsummary = ''; - $subjectpreview = $summarytext && $this->preview ? "
".wfMsg('subject-preview').':'.$sk->commentBlock( $this->summary, $this->mArticle->getTitle() )."
\n" : ''; + $subjectpreview = $summarytext && $this->preview ? "
".wfMsg('subject-preview').':'.$sk->commentBlock( $this->summary, $this->mTitle )."
\n" : ''; $summarypreview = ''; } else { $commentsubject = ''; $editsummary="\n
\n
"; - $summarypreview = $summarytext && $this->preview ? "
".wfMsg('summary-preview').':'.$sk->commentBlock( $this->summary, $this->mArticle->getTitle() )."
\n" : ''; + $summarypreview = $summarytext && $this->preview ? "
".wfMsg('summary-preview').':'.$sk->commentBlock( $this->summary, $this->mTitle )."
\n" : ''; $subjectpreview = ''; } @@ -1212,7 +1203,6 @@ END $recreate {$commentsubject} {$subjectpreview} -{$this->editFormTextBeforeContent}