r71752 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71751‎ | r71752 | r71753 >
Date:21:04, 26 August 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Followup r71744, r69807 Use getId/getName and store both

Commented out cookie stuff
Modified paths:
  • /trunk/extensions/SimpleSurvey/SimpleSurvey.classes.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SimpleSurvey/SimpleSurvey.classes.php
@@ -71,18 +71,19 @@
7272 global $wgRequest, $wgUser;
7373 $dbw = wfGetDb( DB_MASTER );
7474 $now = $dbw->timestamp();
75 - $cookieID = $wgRequest->getCookie( "vitals-survey" );
 75+ /*$cookieID = $wgRequest->getCookie( "vitals-survey" );
7676 if ( $cookieID == null ) {
7777 $cookieID = self::generateRandomCookieID();
7878 $wgRequest->response()->setcookie( "vitals-survey", $cookieID );
79 - }
 79+ }*/
8080
8181 foreach ( $survey['questions'] as $question => $config ) {
8282 $dbw->insert(
8383 'prefswitch_survey',
8484 array_merge(
8585 array(
86 - 'pss_user' => $cookieID,
 86+ 'pss_user' => $wgUser->getId(),
 87+ 'pss_user_text' => $wgUser->getName(),
8788 'pss_timestamp' => $now,
8889 'pss_name' => $name,
8990 'pss_question' => $question,
@@ -97,17 +98,15 @@
9899 $dbw->insert(
99100 'prefswitch_survey',
100101 array(
101 - 'pss_user' => $cookieID,
 102+ 'pss_user' => $wgUser->getId(),
 103+ 'pss_user_text' => $wgUser->getName(),
102104 'pss_timestamp' => $now,
103105 'pss_name' => $name,
104106 'pss_question' => "logged_in",
105 - 'pss_answer' => $wgUser->isLoggedIn() ? "yes":"no",
 107+ 'pss_answer' => $wgUser->isLoggedIn() ? "yes" : "no",
106108 'pss_answer_data' => wfGetIP(),
107109 ),
108110 __METHOD__
109111 );
110 -
111 -
112 -
113112 }
114113 }
\ No newline at end of file

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r69807Simple Survey classes, building off and modifying PrefSwitch in Usability Ini...nimishg18:22, 23 July 2010
r71744Followup r69807...reedy20:27, 26 August 2010

Comments

#Comment by Catrope (talk | contribs)   15:53, 15 September 2010

This breaks the feature allowing for multiple surveys per IP, although I agree it wasn't implemented very nicely. I'll look into fixing this (and consolidating it with ArticleAssessment's anon_token) later.

#Comment by Reedy (talk | contribs)   21:42, 11 October 2010

Does this need to stay fixme after bug 25401?

#Comment by Catrope (talk | contribs)   14:55, 12 October 2010

It doesn't, sorry about that.

Status & tagging log