mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AJAXPoll
synced 2024-11-27 16:30:32 +00:00
Merge "Avoid writing to DB if poll-show-results-before-voting has not changed."
This commit is contained in:
commit
9bbb470237
|
@ -60,7 +60,7 @@ class AJAXPoll {
|
||||||
|
|
||||||
$row = $dbw->selectRow(
|
$row = $dbw->selectRow(
|
||||||
[ 'ajaxpoll_info' ],
|
[ 'ajaxpoll_info' ],
|
||||||
[ 'COUNT(poll_id) AS count' ],
|
[ 'poll_show_results_before_voting' ],
|
||||||
[ 'poll_id' => $id ],
|
[ 'poll_id' => $id ],
|
||||||
__METHOD__
|
__METHOD__
|
||||||
);
|
);
|
||||||
|
@ -76,7 +76,7 @@ class AJAXPoll {
|
||||||
|
|
||||||
$readonly = MediaWikiServices::getInstance()->getReadOnlyMode()->getReason();
|
$readonly = MediaWikiServices::getInstance()->getReadOnlyMode()->getReason();
|
||||||
if ( !$readonly ) {
|
if ( !$readonly ) {
|
||||||
if ( empty( $row->count ) ) {
|
if ( $row === false ) {
|
||||||
$dbw->insert(
|
$dbw->insert(
|
||||||
'ajaxpoll_info',
|
'ajaxpoll_info',
|
||||||
[
|
[
|
||||||
|
@ -96,7 +96,7 @@ class AJAXPoll {
|
||||||
// @see https://phabricator.wikimedia.org/T163625
|
// @see https://phabricator.wikimedia.org/T163625
|
||||||
[ 'IGNORE' ]
|
[ 'IGNORE' ]
|
||||||
);
|
);
|
||||||
} else {
|
} elseif ( $row->poll_show_results_before_voting !== $showResultsBeforeVoting ) {
|
||||||
$dbw->update(
|
$dbw->update(
|
||||||
'ajaxpoll_info',
|
'ajaxpoll_info',
|
||||||
[
|
[
|
||||||
|
|
Loading…
Reference in a new issue