X-Git-Url: https://git.cyclocoop.org/%27.WWW_URL.%27admin/?a=blobdiff_plain;f=includes%2FEditPage.php;h=1f526cce3e09b665f005dcc762e1162530b8f01f;hb=58852d882752b46a1c2b79d2476489dfbc978f5f;hp=5979ed4d456a8147593bec09062a9f10adac4cc8;hpb=7201be76e70a1193cc8a1b4d06bcdc35a81c047c;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/EditPage.php b/includes/EditPage.php
index 5979ed4d45..1f526cce3e 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -1,6 +1,22 @@
getOption( 'watchcreations' ) && !$this->mTitle->exists() ) {
# Watch creations
$this->watchthis = true;
- } elseif ( $this->mTitle->userIsWatching() ) {
+ } elseif ( $wgUser->isWatched( $this->mTitle ) ) {
# Already watched
$this->watchthis = true;
}
@@ -968,7 +984,6 @@ class EditPage {
$bot = $wgUser->isAllowed( 'bot' ) && $this->bot;
$status = $this->internalAttemptSave( $resultDetails, $bot );
// FIXME: once the interface for internalAttemptSave() is made nicer, this should use the message in $status
-
if ( $status->value == self::AS_SUCCESS_UPDATE || $status->value == self::AS_SUCCESS_NEW_ARTICLE ) {
$this->didSave = true;
}
@@ -1039,8 +1054,15 @@ class EditPage {
$permission = $this->mTitle->isTalkPage() ? 'createtalk' : 'createpage';
throw new PermissionsError( $permission );
+ default:
+ // We don't recognize $status->value. The only way that can happen
+ // is if an extension hook aborted from inside ArticleSave.
+ // Render the status object into $this->hookError
+ // FIXME this sucks, we should just use the Status object throughout
+ $this->hookError = '
' . $status->getWikitext() .
+ '
';
+ return true;
}
- return false;
}
/**
@@ -1427,8 +1449,17 @@ class EditPage {
wfProfileOut( __METHOD__ );
return $status;
} else {
- $this->isConflict = true;
- $doEditStatus->value = self::AS_END; // Destroys data doEdit() put in $status->value but who cares
+ // Failure from doEdit()
+ // Show the edit conflict page for certain recognized errors from doEdit(),
+ // but don't show it for errors from extension hooks
+ $errors = $doEditStatus->getErrorsArray();
+ if ( in_array( $errors[0][0], array( 'edit-gone-missing', 'edit-conflict',
+ 'edit-already-exists' ) ) )
+ {
+ $this->isConflict = true;
+ // Destroys data doEdit() put in $status->value but who cares
+ $doEditStatus->value = self::AS_END;
+ }
wfProfileOut( __METHOD__ );
return $doEditStatus;
}
@@ -1439,7 +1470,7 @@ class EditPage {
*/
protected function commitWatch() {
global $wgUser;
- if ( $this->watchthis xor $this->mTitle->userIsWatching() ) {
+ if ( $wgUser->isLoggedIn() && $this->watchthis != $wgUser->isWatched( $this->mTitle ) ) {
$dbw = wfGetDB( DB_MASTER );
$dbw->begin( __METHOD__ );
if ( $this->watchthis ) {
@@ -2383,7 +2414,16 @@ HTML
'' );
}
+ /**
+ * Get the copyright warning
+ *
+ * Renamed to getCopyrightWarning(), old name kept around for backwards compatibility
+ */
protected function getCopywarn() {
+ return self::getCopyrightWarning( $this->mTitle );
+ }
+
+ public static function getCopyrightWarning( $title ) {
global $wgRightsText;
if ( $wgRightsText ) {
$copywarnMsg = array( 'copyrightwarning',
@@ -2394,7 +2434,7 @@ HTML
'[[' . wfMsgForContent( 'copyrightpage' ) . ']]' );
}
// Allow for site and per-namespace customization of contribution/copyright notice.
- wfRunHooks( 'EditPageCopyrightWarning', array( $this->mTitle, &$copywarnMsg ) );
+ wfRunHooks( 'EditPageCopyrightWarning', array( $title, &$copywarnMsg ) );
return "\n" .
call_user_func_array( "wfMsgNoTrans", $copywarnMsg ) . "\n
";