r110831 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110830‎ | r110831 | r110832 >
Date:09:40, 7 February 2012
Author:maxsem
Status:ok
Tags:core 
Comment:
Follow-up r110750: move constants to a different class per CR
Modified paths:
  • /trunk/phase3/includes/FileDeleteForm.php (modified) (history)
  • /trunk/phase3/includes/WikiPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/FileDeleteForm.php
@@ -150,7 +150,7 @@
151151 try {
152152 // delete the associated article first
153153 $error = '';
154 - if ( $page->doDeleteArticleReal( $reason, $suppress, 0, false, $error, $user ) >= Page::DELETE_SUCCESS ) {
 154+ if ( $page->doDeleteArticleReal( $reason, $suppress, 0, false, $error, $user ) >= WikiPage::DELETE_SUCCESS ) {
155155 $status = $file->delete( $reason, $suppress );
156156 if( $status->isOK() ) {
157157 $dbw->commit();
Index: trunk/phase3/includes/WikiPage.php
@@ -2,9 +2,20 @@
33 /**
44 * Abstract class for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
55 */
6 -abstract class Page {
 6+abstract class Page {}
 7+
 8+/**
 9+ * Class representing a MediaWiki article and history.
 10+ *
 11+ * Some fields are public only for backwards-compatibility. Use accessors.
 12+ * In the past, this class was part of Article.php and everything was public.
 13+ *
 14+ * @internal documentation reviewed 15 Mar 2010
 15+ */
 16+class WikiPage extends Page {
717 // doDeleteArticleReal() return values. Values less than zero indicate fatal errors,
8 - // values greater than zero indicate that there were non-fatal problems.
 18+ // values greater than zero indicate that there were problems not resulting in page
 19+ // not being deleted
920
1021 /**
1122 * Delete operation aborted by hook
@@ -25,17 +36,7 @@
2637 * No revisions found to delete
2738 */
2839 const DELETE_NO_REVISIONS = 2;
29 -}
3040
31 -/**
32 - * Class representing a MediaWiki article and history.
33 - *
34 - * Some fields are public only for backwards-compatibility. Use accessors.
35 - * In the past, this class was part of Article.php and everything was public.
36 - *
37 - * @internal documentation reviewed 15 Mar 2010
38 - */
39 -class WikiPage extends Page {
4041 /**
4142 * @var Title
4243 */
@@ -1931,7 +1932,7 @@
19321933 $reason, $suppress = false, $id = 0, $commit = true, &$error = '', User $user = null
19331934 ) {
19341935 return $this->doDeleteArticleReal( $reason, $suppress, $id, $commit, $error, $user )
1935 - != Page::DELETE_SUCCESS;
 1936+ != WikiPage::DELETE_SUCCESS;
19361937 }
19371938
19381939 /**
@@ -1948,7 +1949,7 @@
19491950 * @param $commit boolean defaults to true, triggers transaction end
19501951 * @param &$error Array of errors to append to
19511952 * @param $user User The deleting user
1952 - * @return int: One of Page::DELETE_* constants
 1953+ * @return int: One of WikiPage::DELETE_* constants
19531954 */
19541955 public function doDeleteArticleReal(
19551956 $reason, $suppress = false, $id = 0, $commit = true, &$error = '', User $user = null
@@ -1959,14 +1960,14 @@
19601961 wfDebug( __METHOD__ . "\n" );
19611962
19621963 if ( ! wfRunHooks( 'ArticleDelete', array( &$this, &$user, &$reason, &$error ) ) ) {
1963 - return Page::DELETE_HOOK_ABORTED;
 1964+ return WikiPage::DELETE_HOOK_ABORTED;
19641965 }
19651966 $dbw = wfGetDB( DB_MASTER );
19661967 $t = $this->mTitle->getDBkey();
19671968 $id = $id ? $id : $this->mTitle->getArticleID( Title::GAID_FOR_UPDATE );
19681969
19691970 if ( $t === '' || $id == 0 ) {
1970 - return Page::DELETE_NO_PAGE;
 1971+ return WikiPage::DELETE_NO_PAGE;
19711972 }
19721973
19731974 // Bitfields to further suppress the content
@@ -2022,7 +2023,7 @@
20232024
20242025 if ( !$ok ) {
20252026 $dbw->rollback();
2026 - return Page::DELETE_NO_REVISIONS;
 2027+ return WikiPage::DELETE_NO_REVISIONS;
20272028 }
20282029
20292030 $this->doDeleteUpdates( $id );
@@ -2042,7 +2043,7 @@
20432044 }
20442045
20452046 wfRunHooks( 'ArticleDeleteComplete', array( &$this, &$user, $reason, $id ) );
2046 - return Page::DELETE_SUCCESS;
 2047+ return WikiPage::DELETE_SUCCESS;
20472048 }
20482049
20492050 /**

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r110750Fixed r63018: made it possible to delte half-baked images w/o descriptions, c...maxsem15:21, 6 February 2012

Status & tagging log