Index: trunk/phase3/maintenance/parserTests.inc |
— | — | @@ -1050,8 +1050,7 @@ |
1051 | 1051 | } |
1052 | 1052 | |
1053 | 1053 | $art = new Article( $title ); |
1054 | | - $art->doEdit( $text, '', EDIT_NEW | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY, |
1055 | | - false, null, false, false, '', true ); |
| 1054 | + $art->insertNewArticle( $text, '', false, false ); |
1056 | 1055 | |
1057 | 1056 | $this->teardownGlobals(); |
1058 | 1057 | } |
Index: trunk/phase3/maintenance/addwiki.php |
— | — | @@ -132,8 +132,7 @@ |
133 | 133 | $wgArticle = new Article( $wgTitle ); |
134 | 134 | $ucsite = ucfirst( $site ); |
135 | 135 | |
136 | | - $wgArticle->doEdit( $this->getFirstArticle( $ucsite, $name ), '', EDIT_NEW | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY, |
137 | | - false, null, false, false, '', true ); |
| 136 | + $wgArticle->insertNewArticle( $this->getFirstArticle( $ucsite, $name ), '', false, false ); |
138 | 137 | |
139 | 138 | $this->output( "Adding to dblists\n" ); |
140 | 139 | |
Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -660,7 +660,7 @@ |
661 | 661 | $editPage: EditPage object |
662 | 662 | |
663 | 663 | 'EditPage::attemptSave': called before an article is |
664 | | -saved, that is before Article::doEdit() is called |
| 664 | +saved, that is before insertNewArticle() is called |
665 | 665 | $editpage_Obj: the current EditPage object |
666 | 666 | |
667 | 667 | 'EditPage::importFormData': allow extensions to read additional data |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -1945,33 +1945,71 @@ |
1946 | 1946 | } |
1947 | 1947 | |
1948 | 1948 | /** |
1949 | | - * @deprecated use Article::doEdit() |
| 1949 | + * This function is not deprecated until somebody fixes the core not to use |
| 1950 | + * it. Nevertheless, use Article::doEdit() instead. |
1950 | 1951 | */ |
1951 | 1952 | function insertNewArticle( $text, $summary, $isminor, $watchthis, $suppressRC = false, $comment = false, $bot = false ) { |
1952 | | - wfDeprecated( __METHOD__ ); |
1953 | 1953 | $flags = EDIT_NEW | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY | |
1954 | 1954 | ( $isminor ? EDIT_MINOR : 0 ) | |
1955 | 1955 | ( $suppressRC ? EDIT_SUPPRESS_RC : 0 ) | |
1956 | 1956 | ( $bot ? EDIT_FORCE_BOT : 0 ); |
1957 | 1957 | |
1958 | | - $this->doEdit( $text, $summary, $flags, false, null, $watchthis, $comment, '', true ); |
| 1958 | + # If this is a comment, add the summary as headline |
| 1959 | + if ( $comment && $summary != "" ) { |
| 1960 | + $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $summary ) . "\n\n" . $text; |
| 1961 | + } |
| 1962 | + $this->doEdit( $text, $summary, $flags ); |
| 1963 | + |
| 1964 | + $dbw = wfGetDB( DB_MASTER ); |
| 1965 | + if ( $watchthis ) { |
| 1966 | + if ( !$this->mTitle->userIsWatching() ) { |
| 1967 | + $dbw->begin(); |
| 1968 | + $this->doWatch(); |
| 1969 | + $dbw->commit(); |
| 1970 | + } |
| 1971 | + } else { |
| 1972 | + if ( $this->mTitle->userIsWatching() ) { |
| 1973 | + $dbw->begin(); |
| 1974 | + $this->doUnwatch(); |
| 1975 | + $dbw->commit(); |
| 1976 | + } |
| 1977 | + } |
| 1978 | + $this->doRedirect( $this->isRedirect( $text ) ); |
1959 | 1979 | } |
1960 | 1980 | |
1961 | 1981 | /** |
1962 | 1982 | * @deprecated use Article::doEdit() |
1963 | 1983 | */ |
1964 | 1984 | function updateArticle( $text, $summary, $minor, $watchthis, $forceBot = false, $sectionanchor = '' ) { |
1965 | | - wfDeprecated( __METHOD__ ); |
1966 | 1985 | $flags = EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY | |
1967 | 1986 | ( $minor ? EDIT_MINOR : 0 ) | |
1968 | 1987 | ( $forceBot ? EDIT_FORCE_BOT : 0 ); |
1969 | 1988 | |
1970 | | - $status = $this->doEdit( $text, $summary, $flags, false, null, $watchthis, false, $sectionanchor, true ); |
| 1989 | + $status = $this->doEdit( $text, $summary, $flags ); |
1971 | 1990 | |
1972 | 1991 | if ( !$status->isOK() ) { |
1973 | 1992 | return false; |
1974 | 1993 | } |
1975 | 1994 | |
| 1995 | + $dbw = wfGetDB( DB_MASTER ); |
| 1996 | + if ( $watchthis ) { |
| 1997 | + if ( !$this->mTitle->userIsWatching() ) { |
| 1998 | + $dbw->begin(); |
| 1999 | + $this->doWatch(); |
| 2000 | + $dbw->commit(); |
| 2001 | + } |
| 2002 | + } else { |
| 2003 | + if ( $this->mTitle->userIsWatching() ) { |
| 2004 | + $dbw->begin(); |
| 2005 | + $this->doUnwatch(); |
| 2006 | + $dbw->commit(); |
| 2007 | + } |
| 2008 | + } |
| 2009 | + |
| 2010 | + $extraQuery = ''; // Give extensions a chance to modify URL query on update |
| 2011 | + wfRunHooks( 'ArticleUpdateBeforeRedirect', array( $this, &$sectionanchor, &$extraQuery ) ); |
| 2012 | + |
| 2013 | + $this->doRedirect( $this->isRedirect( $text ), $sectionanchor, $extraQuery ); |
1976 | 2014 | return true; |
1977 | 2015 | } |
1978 | 2016 | |
— | — | @@ -2026,11 +2064,6 @@ |
2027 | 2065 | * |
2028 | 2066 | * @param $baseRevId the revision ID this edit was based off, if any |
2029 | 2067 | * @param $user Optional user object, $wgUser will be used if not passed |
2030 | | - * @param $watchthis Watch the page if true, unwatch the page if false, do nothing if null |
2031 | | - * @param $comment Boolean: whether the edit is a new section |
2032 | | - * @param $sectionanchor The section anchor for the page; used for redirecting the user back to the page |
2033 | | - * after the edit is successfully committed |
2034 | | - * @param $redirect If true, redirect the user back to the page after the edit is successfully committed |
2035 | 2068 | * |
2036 | 2069 | * @return Status object. Possible errors: |
2037 | 2070 | * edit-hook-aborted: The ArticleSave hook aborted the edit but didn't set the fatal flag of $status |
— | — | @@ -2047,8 +2080,7 @@ |
2048 | 2081 | * |
2049 | 2082 | * Compatibility note: this function previously returned a boolean value indicating success/failure |
2050 | 2083 | */ |
2051 | | - public function doEdit( $text, $summary, $flags = 0, $baseRevId = false, $user = null , $watchthis = null, |
2052 | | - $comment = false, $sectionanchor = '', $redirect = false) { |
| 2084 | + public function doEdit( $text, $summary, $flags = 0, $baseRevId = false, $user = null ) { |
2053 | 2085 | global $wgUser, $wgDBtransactions, $wgUseAutomaticEditSummaries; |
2054 | 2086 | |
2055 | 2087 | # Low-level sanity check |
— | — | @@ -2066,13 +2098,8 @@ |
2067 | 2099 | |
2068 | 2100 | $flags = $this->checkFlags( $flags ); |
2069 | 2101 | |
2070 | | - # If this is a comment, add the summary as headline |
2071 | | - if ( $comment && $summary != "" ) { |
2072 | | - $text = wfMsgForContent( 'newsectionheaderdefaultlevel', $summary ) . "\n\n" . $text; |
2073 | | - } |
2074 | | - |
2075 | 2102 | if ( !wfRunHooks( 'ArticleSave', array( &$this, &$user, &$text, &$summary, |
2076 | | - $flags & EDIT_MINOR, &$watchthis, null, &$flags, &$status) ) ) |
| 2103 | + $flags & EDIT_MINOR, null, null, &$flags, &$status ) ) ) |
2077 | 2104 | { |
2078 | 2105 | wfDebug( __METHOD__ . ": ArticleSave hook aborted save!\n" ); |
2079 | 2106 | wfProfileOut( __METHOD__ ); |
— | — | @@ -2277,7 +2304,7 @@ |
2278 | 2305 | Article::onArticleCreate( $this->mTitle ); |
2279 | 2306 | |
2280 | 2307 | wfRunHooks( 'ArticleInsertComplete', array( &$this, &$user, $text, $summary, |
2281 | | - $flags & EDIT_MINOR, &$watchthis, null, &$flags, $revision ) ); |
| 2308 | + $flags & EDIT_MINOR, null, null, &$flags, $revision ) ); |
2282 | 2309 | } |
2283 | 2310 | |
2284 | 2311 | # Do updates right now unless deferral was requested |
— | — | @@ -2289,39 +2316,9 @@ |
2290 | 2317 | $status->value['revision'] = $revision; |
2291 | 2318 | |
2292 | 2319 | wfRunHooks( 'ArticleSaveComplete', array( &$this, &$user, $text, $summary, |
2293 | | - $flags & EDIT_MINOR, &$watchthis, null, &$flags, $revision, &$status, $baseRevId, |
2294 | | - &$redirect) ); |
| 2320 | + $flags & EDIT_MINOR, null, null, &$flags, $revision, &$status, $baseRevId ) ); |
2295 | 2321 | |
2296 | | - # Watch or unwatch the page |
2297 | | - if ( $watchthis === true ) { |
2298 | | - if ( !$this->mTitle->userIsWatching() ) { |
2299 | | - $dbw->begin(); |
2300 | | - $this->doWatch(); |
2301 | | - $dbw->commit(); |
2302 | | - } |
2303 | | - } elseif ( $watchthis === false ) { |
2304 | | - if ( $this->mTitle->userIsWatching() ) { |
2305 | | - $dbw->begin(); |
2306 | | - $this->doUnwatch(); |
2307 | | - $dbw->commit(); |
2308 | | - } |
2309 | | - } |
2310 | | - |
2311 | | - # Give extensions a chance to modify URL query on update |
2312 | | - $extraQuery = ''; |
2313 | | - |
2314 | | - wfRunHooks( 'ArticleUpdateBeforeRedirect', array( $this, &$sectionanchor, &$extraQuery ) ); |
2315 | | - |
2316 | | - if ( $redirect ) { |
2317 | | - if ( $sectionanchor || $extraQuery ) { |
2318 | | - $this->doRedirect( $this->isRedirect( $text ), $sectionanchor, $extraQuery ); |
2319 | | - } else { |
2320 | | - $this->doRedirect( $this->isRedirect( $text ) ); |
2321 | | - } |
2322 | | - } |
2323 | | - |
2324 | 2322 | wfProfileOut( __METHOD__ ); |
2325 | | - |
2326 | 2323 | return $status; |
2327 | 2324 | } |
2328 | 2325 | |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -904,20 +904,11 @@ |
905 | 905 | |
906 | 906 | $isComment = ( $this->section == 'new' ); |
907 | 907 | |
908 | | - $flags = EDIT_NEW | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY | |
909 | | - ( $this->minoredit ? EDIT_MINOR : 0 ) | |
910 | | - ( $bot ? EDIT_FORCE_BOT : 0 ); |
911 | | - $status = $this->mArticle->doEdit( $this->textbox1, $this->summary, $flags, |
912 | | - false, null, $this->watchthis, $isComment, '', true ); |
| 908 | + $this->mArticle->insertNewArticle( $this->textbox1, $this->summary, |
| 909 | + $this->minoredit, $this->watchthis, false, $isComment, $bot ); |
913 | 910 | |
914 | | - if ( $status->isOK() ) { |
915 | | - wfProfileOut( __METHOD__ ); |
916 | | - return self::AS_SUCCESS_NEW_ARTICLE; |
917 | | - } else { |
918 | | - $result = $status->getErrorsArray(); |
919 | | - } |
920 | 911 | wfProfileOut( __METHOD__ ); |
921 | | - return self::AS_END; |
| 912 | + return self::AS_SUCCESS_NEW_ARTICLE; |
922 | 913 | } |
923 | 914 | |
924 | 915 | # Article exists. Check for edit conflict. |
— | — | @@ -1059,20 +1050,14 @@ |
1060 | 1051 | return self::AS_MAX_ARTICLE_SIZE_EXCEEDED; |
1061 | 1052 | } |
1062 | 1053 | |
1063 | | - // Update the article here |
1064 | | - $flags = EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY | |
1065 | | - ( $this->minoredit ? EDIT_MINOR : 0 ) | |
1066 | | - ( $bot ? EDIT_FORCE_BOT : 0 ); |
1067 | | - $status = $this->mArticle->doEdit( $text, $this->summary, $flags, |
1068 | | - false, null, $this->watchthis, false, $sectionanchor, true ); |
1069 | | - |
1070 | | - if ( $status->isOK() ) |
| 1054 | + # update the article here |
| 1055 | + if ( $this->mArticle->updateArticle( $text, $this->summary, $this->minoredit, |
| 1056 | + $this->watchthis, $bot, $sectionanchor ) ) |
1071 | 1057 | { |
1072 | 1058 | wfProfileOut( __METHOD__ ); |
1073 | 1059 | return self::AS_SUCCESS_UPDATE; |
1074 | 1060 | } else { |
1075 | 1061 | $this->isConflict = true; |
1076 | | - $result = $status->getErrorsArray(); |
1077 | 1062 | } |
1078 | 1063 | wfProfileOut( __METHOD__ ); |
1079 | 1064 | return self::AS_END; |
Index: trunk/phase3/includes/api/ApiEditPage.php |
— | — | @@ -333,13 +333,12 @@ |
334 | 334 | |
335 | 335 | case EditPage::AS_END: |
336 | 336 | // This usually means some kind of race condition |
337 | | - // or DB weirdness occurred. |
338 | | - if ( is_array( $result ) && count( $result ) > 0 ) { |
339 | | - $this->dieUsageMsg( array( 'unknownerror', $result[0][0] ) ); |
340 | | - } |
| 337 | + // or DB weirdness occurred. Fall through to throw an unknown |
| 338 | + // error. |
341 | 339 | |
342 | | - // Unknown error, but no specific error message |
343 | | - // Fall through |
| 340 | + // This needs fixing higher up, as Article::doEdit should be |
| 341 | + // used rather than Article::updateArticle, so that specific |
| 342 | + // error conditions can be returned |
344 | 343 | default: |
345 | 344 | $this->dieUsageMsg( array( 'unknownerror', $retval ) ); |
346 | 345 | } |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -2413,6 +2413,10 @@ |
2414 | 2414 | * This clears some fields in this object, and clears any associated |
2415 | 2415 | * keys in the "bad links" section of the link cache. |
2416 | 2416 | * |
| 2417 | + * - This is called from Article::insertNewArticle() to allow |
| 2418 | + * loading of the new page_id. It's also called from |
| 2419 | + * Article::doDeleteArticle() |
| 2420 | + * |
2417 | 2421 | * @param $newid \type{\int} the new Article ID |
2418 | 2422 | */ |
2419 | 2423 | public function resetArticleID( $newid ) { |
Index: trunk/extensions/YouTubeAuthSub/YouTubeAuthSub_body.php |
— | — | @@ -56,8 +56,10 @@ |
57 | 57 | } |
58 | 58 | } |
59 | 59 | $content = "{{YoutubeVideo|{$wgRequest->getVal('id')}|{$title}|{$keywords}|{$description}|{$category}}}"; |
60 | | - $a->doEdit( $content, wfMsg('youtubeauthsub_summary'), EDIT_NEW |
61 | | - | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY, false, null, false, false, '', true ); |
| 60 | + $a->insertNewArticle($content, |
| 61 | + wfMsg('youtubeauthsub_summary'), |
| 62 | + false, |
| 63 | + false); |
62 | 64 | $wgOut->redirect(''); |
63 | 65 | } |
64 | 66 | $wgOut->addWikiText(wfMsg('youtubeauthsub_viewpage', $descTitle->getFullText()) ); |
Property changes on: trunk/extensions/DataTransclusion/tests/fetchWebData.php |
___________________________________________________________________ |
Deleted: svn:mergeinfo |
Property changes on: trunk/extensions/DataTransclusion/tests/fetchRecord.php |
___________________________________________________________________ |
Deleted: svn:mergeinfo |
Property changes on: trunk/extensions/DataTransclusion/XmlDataTransclusionSource.php |
___________________________________________________________________ |
Deleted: svn:mergeinfo |
Property changes on: trunk/extensions/DataTransclusion/OpenLibrarySource.php |
___________________________________________________________________ |
Deleted: svn:mergeinfo |
Index: trunk/extensions/SpamDiffTool/SpamDiffTool_body.php |
— | — | @@ -55,15 +55,13 @@ |
56 | 56 | if ( $wgUser->getID() > 0 ) |
57 | 57 | $watch = $wgUser->isWatched( $sb ); |
58 | 58 | if ( $insert ) { |
59 | | - $a->doEdit( $text, wfMsgForContent( 'spamdifftool_summary' ), EDIT_NEW |
60 | | - | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY, false, null, $watch, false, '', true ); |
| 59 | + $a->insertNewArticle( $text, wfMsgForContent( 'spamdifftool_summary' ), false, $watch ); |
61 | 60 | } else { |
62 | | - $a->doEdit( $text, wfMsgForContent( 'spamdifftool_summary' ), EDIT_UPDATE |
63 | | - | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY, false, null, $watch, false, '', true ); |
| 61 | + $a->updateArticle( $text, wfMsgForContent( 'spamdifftool_summary' ), false, $watch ); |
64 | 62 | } |
65 | 63 | $returnto = $wgRequest->getVal( 'returnto' ); |
66 | 64 | if ( $returnto != null && $returnto != '' ) |
67 | | - $wgOut->redirect( $wgScript . "?" . urldecode( $returnto ) ); // clear the redirect set by doEdit |
| 65 | + $wgOut->redirect( $wgScript . "?" . urldecode( $returnto ) ); // clear the redirect set by updateArticle |
68 | 66 | return; |
69 | 67 | } |
70 | 68 | $vals = $wgRequest->getValues(); |
Property changes on: trunk/extensions/JS2Support/ResourceLoaderOutputPage.php |
___________________________________________________________________ |
Deleted: svn:mergeinfo |
Property changes on: trunk/extensions/JS2Support/mwResourceLoader.php |
___________________________________________________________________ |
Deleted: svn:mergeinfo |
Index: trunk/extensions/SpamBlacklist/cleanup.php |
— | — | @@ -35,7 +35,6 @@ |
36 | 36 | } |
37 | 37 | $dbw = wfGetDB( DB_MASTER ); |
38 | 38 | $dbw->begin(); |
39 | | - $article = new Article( $title ); |
40 | 39 | if ( !$rev ) { |
41 | 40 | // Didn't find a non-spammy revision, delete the page |
42 | 41 | /* |
— | — | @@ -45,14 +44,14 @@ |
46 | 45 | */ |
47 | 46 | // Too scary, blank instead |
48 | 47 | print "All revisions are spam, blanking...\n"; |
49 | | - $article->doEdit( '', "All revisions matched the spam blacklist ($match), blanking", |
50 | | - EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY, false, null, false, false, |
51 | | - '', true ); |
| 48 | + $article = new Article( $title ); |
| 49 | + $article->updateArticle( '', "All revisions matched the spam blacklist ($match), blanking", |
| 50 | + false, false ); |
52 | 51 | |
53 | 52 | } else { |
54 | 53 | // Revert to this revision |
55 | | - $article->doEdit( $rev->getText(), "Cleaning up links to $match", EDIT_UPDATE |
56 | | - | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY, false, null, false, false, '', true ); |
| 54 | + $article = new Article( $title ); |
| 55 | + $article->updateArticle( $rev->getText(), "Cleaning up links to $match", false, false ); |
57 | 56 | } |
58 | 57 | $dbw->commit(); |
59 | 58 | wfDoUpdates(); |
Property changes on: trunk/extensions/Translate/groups/MantisBT/MantisBT.yml |
___________________________________________________________________ |
Deleted: svn:mergeinfo |
Index: trunk/extensions/Postcomment/Postcomment.php |
— | — | @@ -194,11 +194,9 @@ |
195 | 195 | |
196 | 196 | if ($update) { |
197 | 197 | //echo "trying to update article"; |
198 | | - $article->doEdit( $text, '', EDIT_UPDATE | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
199 | | - | EDIT_MINOR, false, null, $watch, false, '', true ); |
| 198 | + $article->updateArticle($text, "", true, $watch); |
200 | 199 | } else { |
201 | 200 | //echo "inserting new article"; |
202 | | - $article->doEdit( $text, $summary, EDIT_NEW | EDIT_DEFER_UPDATES | EDIT_AUTOSUMMARY |
203 | | - | EDIT_MINOR | EDIT_FORCE_BOT, false, null, $watch, false, '', true ); |
| 201 | + $article->insertNewArticle($text, "", true, $watch, false, false, true); |
204 | 202 | } |
205 | 203 | } |
Index: trunk/extensions/DynamicPageList/DPL.php |
— | — | @@ -1137,8 +1137,7 @@ |
1138 | 1138 | $wgArticle = $articleX = new Article( $titleX ); |
1139 | 1139 | $permission_errors = $articleX->mTitle->getUserPermissionsErrors( 'edit', $wgUser ); |
1140 | 1140 | if ( count( $permission_errors ) == 0 ) { |
1141 | | - $articleX->doEdit( $text, $summary, EDIT_UPDATE | EDIT_DEFER_UPDATES |
1142 | | - | EDIT_AUTOSUMMARY, false, null, $titleX->userIsWatching(), false, '', true ); |
| 1141 | + $articleX->updateArticle( $text, $summary, false, $titleX->userIsWatching() ); |
1143 | 1142 | return ''; |
1144 | 1143 | } else { |
1145 | 1144 | $wgOut->showPermissionsErrorPage( $permission_errors ); |