Merge "(bug 44247) Do not write to storage if read-only mode is on"

This commit is contained in:
jenkins-bot 2013-05-14 21:16:32 +00:00 committed by Gerrit Code Review
commit 6d6f4b7fc2
2 changed files with 10 additions and 1 deletions

View file

@ -177,7 +177,7 @@ class EchoNotificationController {
global $wgEchoBackend;
$eventIDs = array_filter( (array)$eventIDs, 'is_numeric' );
if ( !$eventIDs ) {
if ( !$eventIDs || wfReadOnly() ) {
return;
}
$wgEchoBackend->markRead( $user, $eventIDs );
@ -191,6 +191,10 @@ class EchoNotificationController {
public static function markAllRead( $user ) {
global $wgEchoBackend, $wgEchoMaxNotificationCount;
if ( wfReadOnly() ) {
return false;
}
$notificationCount = self::getNotificationCount( $user );
// Only update all the unread notifications if it isn't a huge number.
// TODO: Implement batched jobs it's over the maximum.

View file

@ -72,6 +72,11 @@ class EchoEvent {
public static function create( $info = array() ) {
global $wgEchoNotifications;
// Do not create event and notifications if write access is locked
if ( wfReadOnly() ) {
throw new ReadOnlyError();
}
$obj = new EchoEvent;
static $validFields = array( 'type', 'variant', 'agent', 'title', 'extra' );