$this->addFieldsIf( 'rc_user', $this->fld_user || $this->fld_userid );
$this->addFieldsIf( 'rc_user_text', $this->fld_user );
$this->addFieldsIf( 'rc_comment', $this->fld_comment || $this->fld_parsedcomment );
- $this->addFieldsIf( 'rc_patrolled', $this->fld_patrol );
+ $this->addFieldsIf( array( 'rc_patrolled', 'rc_log_type' ), $this->fld_patrol );
$this->addFieldsIf( array( 'rc_old_len', 'rc_new_len' ), $this->fld_sizes );
$this->addFieldsIf( 'wl_notificationtimestamp', $this->fld_notificationtimestamp );
$this->addFieldsIf(
}
protected function optimalOrder() {
- return array( 'fifo' );
+ return 'fifo';
}
protected function doIsEmpty() {
if ( $init !== null ) {
self::$data[$this->type][$this->wiki][$field] = $init;
} else {
- return null;
+ return $init;
}
}
$titleObject = $parser->mTitle;
}
if ( $titleObject->areRestrictionsLoaded() || $parser->incrementExpensiveFunctionCount() ) {
- $expiry = $parser->mTitle->getRestrictionExpiry( strtolower( $type ) );
+ $expiry = $titleObject->getRestrictionExpiry( strtolower( $type ) );
// getRestrictionExpiry() returns false on invalid type; trying to
// match protectionlevel() function that returns empty string instead
if ( $expiry === false ) {
return array( 'badipaddress' );
}
- if ( ( strlen( $data['Expiry'] ) == 0 ) || ( strlen( $data['Expiry'] ) > 50 )
- || !self::parseExpiryInput( $data['Expiry'] )
+ $expiryTime = self::parseExpiryInput( $data['Expiry'] );
+
+ if (
+ // an expiry time is needed
+ ( strlen( $data['Expiry'] ) == 0 ) ||
+ // can't be a larger string as 50 (it should be a time format in any way)
+ ( strlen( $data['Expiry'] ) > 50 ) ||
+ // check, if the time could be parsed
+ !$expiryTime
) {
return array( 'ipb_expiry_invalid' );
}
+ // an expiry time should be in the future, not in the
+ // past (wouldn't make any sense) - bug T123069
+ if ( $expiryTime < wfTimestampNow() ) {
+ return array( 'ipb_expiry_old' );
+ }
+
if ( !isset( $data['DisableEmail'] ) ) {
$data['DisableEmail'] = false;
}
$block->setBlocker( $performer );
# Truncate reason for whole multibyte characters
$block->mReason = $wgContLang->truncate( $data['Reason'][0], 255 );
- $block->mExpiry = self::parseExpiryInput( $data['Expiry'] );
+ $block->mExpiry = $expiryTime;
$block->prevents( 'createaccount', $data['CreateAccount'] );
$block->prevents( 'editownusertalk', ( !$wgBlockAllowsUTEdit || $data['DisableUTEdit'] ) );
$block->prevents( 'sendemail', $data['DisableEmail'] );
"block-log-flags-hiddenname": "username hidden",
"range_block_disabled": "The administrator ability to create range blocks is disabled.",
"ipb_expiry_invalid": "Expiry time invalid.",
+ "ipb_expiry_old": "Expiry time is in the past.",
"ipb_expiry_temp": "Hidden username blocks must be permanent.",
"ipb_hide_invalid": "Unable to suppress this account; it has more than {{PLURAL:$1|one edit|$1 edits}}.",
"ipb_already_blocked": "\"$1\" is already blocked.",
"block-log-flags-hiddenname": "Used as a block log flag in [[Special:Log/block]] and in [[Special:Block]].\n\n{{Related|Block-log-flags}}",
"range_block_disabled": "Used as error message in [[Special:Block]].\n\nSee also:\n* {{msg-mw|Range block disabled}}\n* {{msg-mw|Ip range invalid}}\n* {{msg-mw|Ip range toolarge}}",
"ipb_expiry_invalid": "Used as error message in [[Special:Block]].",
+ "ipb_expiry_old": "Used as error message in [[Special:Block]], if the expiry time is in the past.\n{{Identical|protect_expiry_old}}",
"ipb_expiry_temp": "Warning message displayed on [[Special:BlockIP]] if the option \"hide username\" is selected but the expiry time is not infinite.",
"ipb_hide_invalid": "Used as error message in [[Special:Block]].\n* $1 - Number of edits (Value of [[mw:Manual:$wgHideUserContribLimit]])",
"ipb_already_blocked": "{{Identical|$1 is already blocked}}",
--- /dev/null
+<?php
+
+/**
+ * @covers JobQueueMemory
+ *
+ * @group JobQueue
+ *
+ * @licence GNU GPL v2+
+ * @author Thiemo Mättig
+ */
+class JobQueueMemoryTest extends PHPUnit_Framework_TestCase {
+
+ public function testGetAllQueuedJobs() {
+ $instance = JobQueueMemoryDouble::newInstance( array(
+ 'wiki' => null,
+ 'type' => null,
+ ) );
+ $actual = $instance->getAllQueuedJobs();
+ $this->assertEquals( new ArrayIterator(), $actual );
+ }
+
+}
+
+class JobQueueMemoryDouble extends JobQueueMemory {
+
+ public static function newInstance( array $params ) {
+ return new self( $params );
+ }
+
+}