From 2c488a0ebae1b142c5f12ff7de45bd17e04c0e52 Mon Sep 17 00:00:00 2001 From: daniel Date: Tue, 28 Aug 2012 16:02:13 +0200 Subject: [PATCH] Replace usage of doEdit() with doEditContent() Change-Id: I2c423744bd91044c37bbec53b35729bd1c09901b --- docs/hooks.txt | 14 +++++++------- includes/filerepo/file/LocalFile.php | 5 +++-- includes/installer/Installer.php | 8 ++++++-- maintenance/edit.php | 3 ++- maintenance/importSiteScripts.php | 3 ++- maintenance/importTextFile.php | 3 ++- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 1d455108b8..5fe3cf0185 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -478,7 +478,7 @@ $summary: Edit summary/comment $isMinor: Whether or not the edit was marked as minor $isWatch: (No longer used) $section: (No longer used) -$flags: Flags passed to Article::doEdit() +$flags: Flags passed to WikiPage::doEditContent() $revision: New Revision of the article 'ArticleContentInsertComplete': After a new article is created @@ -489,7 +489,7 @@ $summary: Edit summary/comment $isMinor: Whether or not the edit was marked as minor $isWatch: (No longer used) $section: (No longer used) -$flags: Flags passed to Article::doEdit() +$flags: Flags passed to WikiPage::doEditContent() $revision: New Revision of the article 'ArticleMergeComplete': after merging to article using Special:Mergehistory @@ -566,9 +566,9 @@ $summary: Edit summary/comment $isMinor: Whether or not the edit was marked as minor $isWatch: (No longer used) $section: (No longer used) -$flags: Flags passed to Article::doEdit() +$flags: Flags passed to WikiPage::doEditContent() $revision: New Revision of the article -$status: Status object about to be returned by doEdit() +$status: Status object about to be returned by doEditContent() $baseRevId: the rev ID (or false) this edit was based on 'ArticleContentSaveComplete': After an article has been updated @@ -579,9 +579,9 @@ $summary: Edit summary/comment $isMinor: Whether or not the edit was marked as minor $isWatch: (No longer used) $section: (No longer used) -$flags: Flags passed to Article::doEdit() +$flags: Flags passed to WikiPage::doEditContent() $revision: New Revision of the article -$status: Status object about to be returned by doEdit() +$status: Status object about to be returned by doEditContent() $baseRevId: the rev ID (or false) this edit was based on 'ArticleUndelete': When one or more revisions of an article are restored @@ -860,7 +860,7 @@ pages $editPage: EditPage object 'EditPage::attemptSave': called before an article is -saved, that is before Article::doEdit() is called +saved, that is before WikiPage::doEditContent() is called $editpage_Obj: the current EditPage object 'EditPage::importFormData': allow extensions to read additional data diff --git a/includes/filerepo/file/LocalFile.php b/includes/filerepo/file/LocalFile.php index 5a55e43f1a..7f97a9830e 100644 --- a/includes/filerepo/file/LocalFile.php +++ b/includes/filerepo/file/LocalFile.php @@ -1175,8 +1175,9 @@ class LocalFile extends File { } else { # New file; create the description page. # There's already a log entry, so don't make a second RC entry - # Squid and file cache for the description page are purged by doEdit. - $wikiPage->doEdit( $pageText, $comment, EDIT_NEW | EDIT_SUPPRESS_RC, false, $user ); + # Squid and file cache for the description page are purged by doEditContent. + $content = ContentHandler::makeContent( $pageText, $descTitle ); + $wikiPage->doEditContent( $content, $comment, EDIT_NEW | EDIT_SUPPRESS_RC, false, $user ); } wfProfileOut( __METHOD__ . '-edit' ); diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index d87f294e32..bac85cd5ce 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -1585,8 +1585,12 @@ abstract class Installer { $status = Status::newGood(); try { $page = WikiPage::factory( Title::newMainPage() ); - $page->doEdit( wfMsgForContent( 'mainpagetext' ) . "\n\n" . - wfMsgForContent( 'mainpagedocfooter' ), + $content = new WikitextContent ( + wfMsgForContent( 'mainpagetext' ) . "\n\n" . + wfMsgForContent( 'mainpagedocfooter' ) + ); + + $page->doEditContent( $content, '', EDIT_NEW, false, diff --git a/maintenance/edit.php b/maintenance/edit.php index 13b3c49181..70c834c5d1 100644 --- a/maintenance/edit.php +++ b/maintenance/edit.php @@ -68,10 +68,11 @@ class EditCLI extends Maintenance { # Read the text $text = $this->getStdin( Maintenance::STDIN_ALL ); + $content = ContentHandler::makeContent( $text, $wgTitle ); # Do the edit $this->output( "Saving... " ); - $status = $page->doEdit( $text, $summary, + $status = $page->doEditContent( $content, $summary, ( $minor ? EDIT_MINOR : 0 ) | ( $bot ? EDIT_FORCE_BOT : 0 ) | ( $autoSummary ? EDIT_AUTOSUMMARY : 0 ) | diff --git a/maintenance/importSiteScripts.php b/maintenance/importSiteScripts.php index b4a1bacf7f..23a86f480e 100644 --- a/maintenance/importSiteScripts.php +++ b/maintenance/importSiteScripts.php @@ -65,7 +65,8 @@ class ImportSiteScripts extends Maintenance { $text = Http::get( $url ); $wikiPage = WikiPage::factory( $title ); - $wikiPage->doEdit( $text, "Importing from $url", 0, false, $user ); + $content = ContentHandler::makeContent( $text, $wikiPage->getTitle() ); + $wikiPage->doEditContent( $content, "Importing from $url", 0, false, $user ); } } diff --git a/maintenance/importTextFile.php b/maintenance/importTextFile.php index 5623fb06c2..d6805b7609 100644 --- a/maintenance/importTextFile.php +++ b/maintenance/importTextFile.php @@ -56,7 +56,8 @@ if ( count( $args ) < 1 || isset( $options['help'] ) ) { echo( "\nPerforming edit..." ); $page = WikiPage::factory( $title ); - $page->doEdit( $text, $comment, $flags, false, $user ); + $content = ContentHandler::makeContent( $text, $title ); + $page->doEditContent( $content, $comment, $flags, false, $user ); echo( "done.\n" ); } else { -- 2.20.1