Merge "Silence warnings about deprecation by ContentHandler."
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 13 Oct 2012 00:03:31 +0000 (00:03 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 13 Oct 2012 00:03:31 +0000 (00:03 +0000)
1  2 
includes/EditPage.php
includes/Title.php
includes/WikiPage.php

diff --combined includes/EditPage.php
@@@ -381,6 -381,7 +381,6 @@@ class EditPage 
                $this->isCssSubpage         = $this->mTitle->isCssSubpage();
                $this->isJsSubpage          = $this->mTitle->isJsSubpage();
                $this->isWrongCaseCssJsPage = $this->isWrongCaseCssJsPage();
 -              $this->isNew                = !$this->mTitle->exists() || $this->section == 'new';
  
                # Show applicable editing introductions
                if ( $this->formtype == 'initial' || $this->firsttime ) {
  
                # Section edit can come from either the form or a link
                $this->section = $request->getVal( 'wpSection', $request->getVal( 'section' ) );
 +              $this->isNew = !$this->mTitle->exists() || $this->section == 'new';
  
                if ( $request->wasPosted() ) {
                        # These fields need to be checked for encoding.
         * @param $def_text string
         * @return mixed string on success, $def_text for invalid sections
         * @private
-        * @deprecated since 1.21
+        * @deprecated since 1.21, get WikiPage::getContent() instead.
         */
        function getContent( $def_text = false ) {
-               wfDeprecated( __METHOD__, '1.21' );
+               ContentHandler::deprecated( __METHOD__, '1.21' );
  
                if ( $def_text !== null && $def_text !== false && $def_text !== '' ) {
                        $def_content = $this->toEditContent( $def_text );
         * Use this method before edit() to preload some text into the edit box
         *
         * @param $text string
-        * @deprecated since 1.21
+        * @deprecated since 1.21, use setPreloadedContent() instead.
         */
        public function setPreloadedText( $text ) {
-               wfDeprecated( __METHOD__, "1.21" );
+               ContentHandler::deprecated( __METHOD__, "1.21" );
  
                $content = $this->toEditContent( $text );
  
         * @since 1.21
         */
        public function setPreloadedContent( Content $content ) {
 -              $this->mPreloadedContent = $content;
 +              $this->mPreloadContent = $content;
        }
  
        /**
         * @deprecated since 1.21, use getPreloadedContent() instead
         */
        protected function getPreloadedText( $preload ) {
-               wfDeprecated( __METHOD__, "1.21" );
+               ContentHandler::deprecated( __METHOD__, "1.21" );
  
                $content = $this->getPreloadedContent( $preload );
                $text = $this->toEditText( $content );
         * @deprecated since 1.21, use mergeChangesIntoContent() instead
         */
        function mergeChangesInto( &$editText ){
-               wfDebug( __METHOD__, "1.21" );
+               ContentHandler::deprecated( __METHOD__, "1.21" );
  
                $editContent = $this->toEditContent( $editText );
  
diff --combined includes/Title.php
@@@ -387,6 -387,8 +387,8 @@@ class Title 
         * @deprecated since 1.21, use Content::getRedirectTarget instead.
         */
        public static function newFromRedirect( $text ) {
+               ContentHandler::deprecated( __METHOD__, '1.21' );
                $content = ContentHandler::makeContent( $text, null, CONTENT_MODEL_WIKITEXT );
                return $content->getRedirectTarget();
        }
         * @deprecated since 1.21, use Content::getUltimateRedirectTarget instead.
         */
        public static function newFromRedirectRecurse( $text ) {
+               ContentHandler::deprecated( __METHOD__, '1.21' );
                $content = ContentHandler::makeContent( $text, null, CONTENT_MODEL_WIKITEXT );
                return $content->getUltimateRedirectTarget();
        }
         * @deprecated since 1.21, use Content::getRedirectChain instead.
         */
        public static function newFromRedirectArray( $text ) {
+               ContentHandler::deprecated( __METHOD__, '1.21' );
                $content = ContentHandler::makeContent( $text, null, CONTENT_MODEL_WIKITEXT );
                return $content->getRedirectChain();
        }
  
                $linkCache = LinkCache::singleton();
                $cached = $linkCache->getGoodLinkFieldObj( $this, 'redirect' );
 -              if ( $cached === null ) { # check the assumption that the cache actually knows about this title
 -                      # XXX: this does apparently happen, see https://bugzilla.wikimedia.org/show_bug.cgi?id=37209
 -                      #      as a stop gap, perhaps log this, but don't throw an exception?
 -                      throw new MWException( "LinkCache doesn't currently know about this title: " . $this->getPrefixedDBkey() );
 +              if ( $cached === null ) { 
 +                      // TODO: check the assumption that the cache actually knows about this title
 +                      // and handle this, such as get the title from the database.
 +                      // See https://bugzilla.wikimedia.org/show_bug.cgi?id=37209
                }
  
                $this->mRedirect = (bool)$cached;
diff --combined includes/WikiPage.php
@@@ -631,7 -631,8 +631,8 @@@ class WikiPage extends Page implements 
         * @deprecated as of 1.21, getContent() should be used instead.
         */
        public function getText( $audience = Revision::FOR_PUBLIC, User $user = null ) { #@todo: deprecated, replace usage!
-               wfDeprecated( __METHOD__, '1.21' );
+               ContentHandler::deprecated( __METHOD__, '1.21' );
                $this->loadLastEdit();
                if ( $this->mLastRevision ) {
                        return $this->mLastRevision->getText( $audience, $user );
         * @deprecated as of 1.21, getContent() should be used instead.
         */
        public function getRawText() {
-               wfDeprecated( __METHOD__, '1.21' );
+               ContentHandler::deprecated( __METHOD__, '1.21' );
  
                return $this->getText( Revision::RAW );
        }
         * @deprecated since 1.21: use ContentHandler::getUndoContent() instead.
         */
        public function getUndoText( Revision $undo, Revision $undoafter = null ) {
-               wfDeprecated( __METHOD__, '1.21' );
+               ContentHandler::deprecated( __METHOD__, '1.21' );
  
                $this->loadLastEdit();
  
         * @deprecated since 1.21, use replaceSectionContent() instead
         */
        public function replaceSection( $section, $text, $sectionTitle = '', $edittime = null ) {
-               wfDeprecated( __METHOD__, '1.21' );
+               ContentHandler::deprecated( __METHOD__, '1.21' );
  
                if ( strval( $section ) == '' ) { //NOTE: keep condition in sync with condition in replaceSectionContent!
                        // Whole-page edit; let the whole text through
         * @deprecated since 1.21: use doEditContent() instead.
         */
        public function doEdit( $text, $summary, $flags = 0, $baseRevId = false, $user = null ) {
-               wfDeprecated( __METHOD__, '1.21' );
+               ContentHandler::deprecated( __METHOD__, '1.21' );
  
                $content = ContentHandler::makeContent( $text, $this->getTitle() );
  
                $hook_args = array( &$this, &$user, &$content, &$summary,
                                                        $flags & EDIT_MINOR, null, null, &$flags, &$status );
  
 -              if ( !wfRunHooks( 'ArticleContentSave', $hook_args )
 +              if ( !wfRunHooks( 'PageContentSave', $hook_args )
                        || !ContentHandler::runLegacyHooks( 'ArticleSave', $hook_args ) ) {
  
                        wfDebug( __METHOD__ . ": ArticleSave or ArticleSaveContent hook aborted save!\n" );
                                                                $flags & EDIT_MINOR, null, null, &$flags, $revision );
  
                        ContentHandler::runLegacyHooks( 'ArticleInsertComplete', $hook_args );
 -                      wfRunHooks( 'ArticleContentInsertComplete', $hook_args );
 +                      wfRunHooks( 'PageContentInsertComplete', $hook_args );
                }
  
                # Do updates right now unless deferral was requested
                                                        $flags & EDIT_MINOR, null, null, &$flags, $revision, &$status, $baseRevId );
  
                ContentHandler::runLegacyHooks( 'ArticleSaveComplete', $hook_args );
 -              wfRunHooks( 'ArticleContentSaveComplete', $hook_args );
 +              wfRunHooks( 'PageContentSaveComplete', $hook_args );
  
                # Promote user to any groups they meet the criteria for
                $user->addAutopromoteOnceGroups( 'onEdit' );
         * @deprecated in 1.21: use prepareContentForEdit instead.
         */
        public function prepareTextForEdit( $text, $revid = null, User $user = null ) {
-               wfDeprecated( __METHOD__, '1.21' );
+               ContentHandler::deprecated( __METHOD__, '1.21' );
                $content = ContentHandler::makeContent( $text, $this->getTitle() );
                return $this->prepareContentForEdit( $content, $revid , $user );
        }
         * @deprecated since 1.21, use doEditContent() instead.
         */
        public function doQuickEdit( $text, User $user, $comment = '', $minor = 0 ) {
-               wfDeprecated( __METHOD__, "1.21" );
+               ContentHandler::deprecated( __METHOD__, "1.21" );
  
                $content = ContentHandler::makeContent( $text, $this->getTitle() );
                return $this->doQuickEditContent( $content, $user, $comment , $minor );
        public static function getAutosummary( $oldtext, $newtext, $flags ) {
                # NOTE: stub for backwards-compatibility. assumes the given text is wikitext. will break horribly if it isn't.
  
-               wfDeprecated( __METHOD__, '1.21' );
+               ContentHandler::deprecated( __METHOD__, '1.21' );
  
                $handler = ContentHandler::getForModelID( CONTENT_MODEL_WIKITEXT );
                $oldContent = is_null( $oldtext ) ? null : $handler->unserializeContent( $oldtext );