Anomie has uploaded a new change for review.
https://gerrit.wikimedia.org/r/175033
Change subject: Backport bug fixes
......................................................................
Backport bug fixes
* [[gerrit:174890]] PHP 5.3 doesn't allow $this inside anonymous functions
* [[gerrit:174897]] Handle radio-range oddity when $min < 0
* [[gerrit:174898]] Fix translate log saving
Change-Id: I1e54a7e4188b002013a30cc7f9a7db1a64779e20
---
M includes/htmlform/HTMLFormRadioRangeColumnLabels.php
M includes/pages/TranslatePage.php
M includes/pages/VoterEligibilityPage.php
3 files changed, 20 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SecurePoll
refs/changes/33/175033/1
diff --git a/includes/htmlform/HTMLFormRadioRangeColumnLabels.php
b/includes/htmlform/HTMLFormRadioRangeColumnLabels.php
index 16f019b..7058305 100644
--- a/includes/htmlform/HTMLFormRadioRangeColumnLabels.php
+++ b/includes/htmlform/HTMLFormRadioRangeColumnLabels.php
@@ -14,10 +14,18 @@
return $this->getDefault();
}
+ $neg = false;
+ foreach ( $values as $k => $v ) {
+ if ( preg_match( '/^-\d+$/', $k ) ) {
+ $neg = true;
+ }
+ }
+
$ret = array();
foreach ( $values as $k => $v ) {
if ( preg_match( '/^-?\d+$/', $k ) ) {
- $ret["column$k"] = $v;
+ $key = ( $neg && $k > 0 ) ? "+$k" : $k;
+ $ret["column$key"] = $v;
}
}
return $ret;
@@ -37,8 +45,9 @@
}
for ( $i = $min; $i <= $max; $i++ ) {
- if ( !isset( $value["column$i"] ) ) {
- return $this->msg(
'securepoll-htmlform-radiorange-missing-message', $i )
+ $key = ( $min < 0 && $i > 0 ) ? "+$i" : $i;
+ if ( !isset( $value["column$key"] ) ) {
+ return $this->msg(
'securepoll-htmlform-radiorange-missing-message', $key )
->parseAsBlock();
}
}
diff --git a/includes/pages/TranslatePage.php b/includes/pages/TranslatePage.php
index 1b13238..e92fe7c 100644
--- a/includes/pages/TranslatePage.php
+++ b/includes/pages/TranslatePage.php
@@ -188,8 +188,12 @@
);
if ( $wgSecurePollUseNamespace ) {
+ // Create a new context to bypass caching
+ $context = new SecurePoll_Context;
+ $election = $context->getElection(
$this->election->getId() );
+
list( $title, $content ) =
SecurePollContentHandler::makeContentFromElection(
- $this->election, "msg/$secondary" );
+ $election, "msg/$secondary" );
$wp = WikiPage::factory( $title );
$wp->doEditContent( $content,
$wgRequest->getText( 'comment' ) );
}
diff --git a/includes/pages/VoterEligibilityPage.php
b/includes/pages/VoterEligibilityPage.php
index 31ecb71..60755fa 100644
--- a/includes/pages/VoterEligibilityPage.php
+++ b/includes/pages/VoterEligibilityPage.php
@@ -743,8 +743,9 @@
);
$form->setDisplayFormat( 'div' );
$form->setSubmitTextMsg(
'securepoll-votereligibility-edit-action' );
- $form->setSubmitCallback( function ( $formData, $form ) use (
$property ) {
- $this->saveList( $property, $formData['names'],
$formData['comment'] );
+ $that = $this;
+ $form->setSubmitCallback( function ( $formData, $form ) use (
$property, $that ) {
+ $that->saveList( $property, $formData['names'],
$formData['comment'] );
return Status::newGood();
} );
$result = $form->show();
--
To view, visit https://gerrit.wikimedia.org/r/175033
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1e54a7e4188b002013a30cc7f9a7db1a64779e20
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SecurePoll
Gerrit-Branch: wmf/1.25wmf8
Gerrit-Owner: Anomie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits