r101106 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101105‎ | r101106 | r101107 >
Date:01:02, 28 October 2011
Author:demon
Status:ok
Tags:
Comment:
MFT r94211,r94216: setcookie() tweaks for overriding the path, etc.
Modified paths:
  • /branches/REL1_18/phase3/includes/WebResponse.php (modified) (history)

Diff [purge]

Index: branches/REL1_18/phase3/includes/WebResponse.php
@@ -43,29 +43,37 @@
4444 * @param $name String: name of cookie
4545 * @param $value String: value to give cookie
4646 * @param $expire Int: number of seconds til cookie expires
 47+ * @param $prefix String: Prefix to use, if not $wgCookiePrefix (use '' for no prefix)
 48+ * @param @domain String: Cookie domain to use, if not $wgCookieDomain
4749 */
48 - public function setcookie( $name, $value, $expire = 0 ) {
 50+ public function setcookie( $name, $value, $expire = 0, $prefix = null, $domain = null ) {
4951 global $wgCookiePath, $wgCookiePrefix, $wgCookieDomain;
5052 global $wgCookieSecure,$wgCookieExpiration, $wgCookieHttpOnly;
5153 if ( $expire == 0 ) {
5254 $expire = time() + $wgCookieExpiration;
5355 }
 56+ if( $prefix === null ) {
 57+ $prefix = $wgCookiePrefix;
 58+ }
 59+ if( $domain === null ) {
 60+ $domain = $wgCookieDomain;
 61+ }
5462 $httpOnlySafe = wfHttpOnlySafe() && $wgCookieHttpOnly;
5563 wfDebugLog( 'cookie',
5664 'setcookie: "' . implode( '", "',
5765 array(
58 - $wgCookiePrefix . $name,
 66+ $prefix . $name,
5967 $value,
6068 $expire,
6169 $wgCookiePath,
62 - $wgCookieDomain,
 70+ $domain,
6371 $wgCookieSecure,
6472 $httpOnlySafe ) ) . '"' );
65 - setcookie( $wgCookiePrefix . $name,
 73+ setcookie( $prefix . $name,
6674 $value,
6775 $expire,
6876 $wgCookiePath,
69 - $wgCookieDomain,
 77+ $domain,
7078 $wgCookieSecure,
7179 $httpOnlySafe );
7280 }
@@ -127,7 +135,7 @@
128136 * @param $value String: value to give cookie
129137 * @param $expire Int: number of seconds til cookie expires
130138 */
131 - public function setcookie( $name, $value, $expire = 0 ) {
 139+ public function setcookie( $name, $value, $expire = 0, $prefix = null, $domain = null ) {
132140 $this->cookies[$name] = $value;
133141 }
134142
Property changes on: branches/REL1_18/phase3/includes/WebResponse.php
___________________________________________________________________
Added: svn:mergeinfo
135143 Merged /branches/new-installer/phase3/includes/WebResponse.php:r43664-66004
136144 Merged /branches/wmf-deployment/includes/WebResponse.php:r53381
137145 Merged /branches/REL1_15/phase3/includes/WebResponse.php:r51646
138146 Merged /branches/wmf/1.18wmf1/includes/WebResponse.php:r98962,98971,99004,99065
139147 Merged /branches/sqlite/includes/WebResponse.php:r58211-58321
140148 Merged /trunk/phase3/includes/WebResponse.php:r92580,92634,92713,92762,92765,92791,92854,92884,92886-92887,92894,92898,92907,92932,92958,93141,93149,93151,93233-93234,93258,93266,93303,93516-93518,93726,93818-93822,93847,93858,93891,93935-93936,93977,94058,94062,94068,94107,94155,94199,94211,94216,94235,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94995-94997,95023,95042,95072-95073,95155,95327,95332,95410,95422,95426,95442,95468,95601,95812,96178,96182,96437-96438,97291,97806,97815,97895,98069,98193-98194,98210,98212,98235,98237,98298,98374,98379,98411,98426,98502,98610,98612,98656,98676,98703,98707,98713,98716,98718-98720,98755-98756,98760-98761,98774,98812,98880,98884,98927,98963,98975,98990,98997,99081-99082,99102,99104,99118,99126,99135-99136,99138,99172,99250,99252,99254,99304,99308,99318,99323,99349,99370-99371,99630,99632,99680,99694,99700,99897,99910,99914,99931,99952,100021,100115,100219,100221,100223,100226,100239,100242,100347,100510,100572,100592

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r94211Allow overriding $wgCookiePrefix and $wgCookieDomain in WebResponse::setcooki...demon23:27, 10 August 2011
r94216Followup r94211...reedy00:17, 11 August 2011

Status & tagging log