r31912 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r31911‎ | r31912 | r31913 >
Date:12:55, 13 March 2008
Author:emil
Status:old
Tags:
Comment:
* use different memcached keys for storing tokens and categories
* no need to call time() in $wgMemc->set()
Modified paths:
  • /trunk/extensions/YouTubeAuthSub/YouTubeAuthSub.php (modified) (history)
  • /trunk/extensions/YouTubeAuthSub/YouTubeAuthSub_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/YouTubeAuthSub/YouTubeAuthSub_body.php
@@ -73,7 +73,7 @@
7474
7575 if ($wgYTAS_UseClientLogin) {
7676
77 - $key = wfMemcKey('youtube', 'authsub', $wgYTAS_User);
 77+ $key = wfMemcKey('youtube', 'authsub', 'token', $wgYTAS_User);
7878 $token = $wgMemc->get( $key );
7979 // regenerate the token
8080 if (!$token) {
@@ -96,7 +96,7 @@
9797 $wgOut->addHTML(wfMsg('youtubeauthsub_tokenerror'));
9898 return;
9999 }
100 - $wgMemc->set($key, $token, time() + 3600);
 100+ $wgMemc->set($key, $token, 3600);
101101 }
102102 }
103103 else {
Index: trunk/extensions/YouTubeAuthSub/YouTubeAuthSub.php
@@ -82,8 +82,8 @@
8383 }
8484
8585 function wfSpecialYouTubeGetCategories() {
86 - global $wgMemc, $wgYTAS_User;
87 - $key = wfMemcKey('youtube', 'authsub', $wgYTAS_User);
 86+ global $wgMemc;
 87+ $key = wfMemcKey('youtube', 'authsub', 'cats');
8888 $cats = $wgMemc->get( $key );
8989 if (!$cats) {
9090 $ch = curl_init();
@@ -102,7 +102,7 @@
103103 for ($i = 0; $i < sizeof ($matches[1]) && $i < sizeof($matches[2]); $i++) {
104104 $cats .= "<OPTION VALUE='{$matches[1][$i]}'>{$matches[2][$i]}</OPTION>";
105105 }
106 - $wgMemc->set($key, $cats, time() + 3600 * 24);
 106+ $wgMemc->set($key, $cats, 3600 * 24);
107107 }
108108 return $cats;
109109 }

Status & tagging log