Jack Phoenix has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/332684 )
Change subject: Use the PHP wfTimestamp() function instead of the DBMS-specific UNIX_TIMESTAMP function for converting timestamps ...................................................................... Use the PHP wfTimestamp() function instead of the DBMS-specific UNIX_TIMESTAMP function for converting timestamps This'll allow us to eventually support non-MySQL/MariaDB DBMSes properly. Change-Id: I6e4531c3c1f567067085b6a6c2766a1405c7c379 --- M PollClass.php M SpecialAdminPoll.php M SpecialViewPoll.php 3 files changed, 9 insertions(+), 11 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PollNY refs/changes/84/332684/1 diff --git a/PollClass.php b/PollClass.php index 89e1a45..31bdcb1 100644 --- a/PollClass.php +++ b/PollClass.php @@ -124,7 +124,7 @@ array( 'poll_text', 'poll_vote_count', 'poll_id', 'poll_status', 'poll_user_id', 'poll_user_name', 'poll_image', - 'UNIX_TIMESTAMP(poll_date) AS timestamp' + 'poll_date' ), array( 'poll_page_id' => $pageID ), __METHOD__, @@ -140,7 +140,7 @@ $poll['votes'] = $row->poll_vote_count; $poll['id'] = $row->poll_id; $poll['status'] = $row->poll_status; - $poll['timestamp'] = $row->timestamp; + $poll['timestamp'] = wfTimestamp( TS_UNIX, $row->poll_date ); $poll['choices'] = self::getPollChoices( $row->poll_id, $row->poll_vote_count ); } return $poll; @@ -344,7 +344,7 @@ array( 'poll_question', 'page' ), array( 'page_title', 'poll_id', 'poll_vote_count', 'poll_image', - 'UNIX_TIMESTAMP(poll_date) AS poll_date' + 'poll_date' ), /* WHERE */array( 'poll_status' => 1 ), __METHOD__, @@ -354,7 +354,7 @@ foreach( $res as $row ) { $polls[] = array( 'title' => $row->page_title, - 'timestamp' => $row->poll_date, + 'timestamp' => wfTimestamp( TS_UNIX, $row->poll_date ), 'image' => $row->poll_image, 'choices' => self::getPollChoices( $row->poll_id, $row->poll_vote_count ) ); diff --git a/SpecialAdminPoll.php b/SpecialAdminPoll.php index 9012512..2182aac 100644 --- a/SpecialAdminPoll.php +++ b/SpecialAdminPoll.php @@ -121,8 +121,7 @@ $res = $dbr->select( array( 'poll_question', 'page' ), array( - 'poll_id', 'poll_user_id', - 'UNIX_TIMESTAMP(poll_date) AS poll_time', 'poll_status', + 'poll_id', 'poll_user_id', 'poll_date', 'poll_status', 'poll_vote_count', 'poll_user_name', 'poll_text', 'poll_page_id', 'page_id' ), @@ -164,7 +163,7 @@ $user_id = $row->poll_user_id; $avatar = new wAvatar( $user_id, 'm' ); $poll_title = $row->poll_text; - $poll_date = $row->poll_time; + $poll_date = wfTimestamp( TS_UNIX, $row->poll_date ); $poll_answers = $row->poll_vote_count; $rowId = "poll-row-{$x}"; $title = Title::makeTitle( NS_POLL, $poll_title ); diff --git a/SpecialViewPoll.php b/SpecialViewPoll.php index 19db778..a4ea6cf 100644 --- a/SpecialViewPoll.php +++ b/SpecialViewPoll.php @@ -106,9 +106,8 @@ $res = $dbr->select( array( 'poll_question', 'page' ), array( - 'poll_user_id', 'UNIX_TIMESTAMP(poll_date) AS poll_time', - 'poll_vote_count', 'poll_user_name', 'poll_text', - 'poll_page_id', 'page_id' + 'poll_user_id', 'poll_date', 'poll_vote_count', + 'poll_user_name', 'poll_text', 'poll_page_id', 'page_id' ), $where, __METHOD__, @@ -147,7 +146,7 @@ $user_id = $row->poll_user_id; $avatar = new wAvatar( $user_id, 'm' ); $poll_title = $row->poll_text; - $poll_date = $row->poll_time; + $poll_date = wfTimestamp( TS_UNIX, $row->poll_date ); $poll_answers = $row->poll_vote_count; $row_id = "poll-row-{$x}"; $title = Title::makeTitle( NS_POLL, $poll_title ); -- To view, visit https://gerrit.wikimedia.org/r/332684 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6e4531c3c1f567067085b6a6c2766a1405c7c379 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PollNY Gerrit-Branch: master Gerrit-Owner: Jack Phoenix <j...@countervandalism.net> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits