r101107 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101106‎ | r101107 | r101108 >
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/wmf/1.18wmf1/includes/WebResponse.php (modified) (history)

Diff [purge]

Index: branches/wmf/1.18wmf1/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/wmf/1.18wmf1/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/sqlite/includes/WebResponse.php:r58211-58321
139147 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,93818-93822,93847,93858,93891,93935-93936,93977,94058,94062,94068,94107,94155,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,97810,98578,98598,98656,98990,99304,99308,99349,99694,100219,100221,100223,100226,100239,100242

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