Index: trunk/extensions/CentralNotice/CentralNotice.php |
— | — | @@ -61,10 +61,7 @@ |
62 | 62 | |
63 | 63 | // Domain to set global cookies for. |
64 | 64 | // Example: '.wikipedia.org' |
65 | | -// This setting is currently shared with CentralAuth extension. |
66 | | -if ( !isset( $wgCentralAuthCookieDomain )) { |
67 | | - $wgCentralAuthCookieDomain = ''; |
68 | | -} |
| 65 | +$wgNoticeCookieDomain = ''; |
69 | 66 | |
70 | 67 | $wgExtensionFunctions[] = 'efCentralNoticeSetup'; |
71 | 68 | |
Index: trunk/extensions/CentralNotice/SpecialHideBanners.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | } |
7 | 7 | |
8 | 8 | /** |
9 | | - * Unlisted Special Page to set cookies for hiding banners across all wikis. |
| 9 | + * Unlisted Special Page which sets a cookie for hiding banners across all languages of a project. |
10 | 10 | */ |
11 | 11 | class SpecialHideBanners extends UnlistedSpecialPage { |
12 | 12 | function __construct() { |
— | — | @@ -27,9 +27,14 @@ |
28 | 28 | } |
29 | 29 | |
30 | 30 | function setHideCookie() { |
31 | | - global $wgCentralAuthCookieDomain, $wgCookieSecure, $wgCookieHttpOnly; |
| 31 | + global $wgNoticeCookieDomain, $wgCookieSecure, $wgCookieHttpOnly; |
32 | 32 | $exp = time() + 86400 * 14; // Cookie expires after 2 weeks |
| 33 | + if ( is_callable( 'CentralAuthUser', 'getCookieDomain' ) ) { |
| 34 | + $cookieDomain = CentralAuthUser::getCookieDomain(); |
| 35 | + } else { |
| 36 | + $cookieDomain = $wgNoticeCookieDomain; |
| 37 | + } |
33 | 38 | // Hide banners for this domain |
34 | | - setcookie( 'hidesnmessage', '1', $exp, '/', $wgCentralAuthCookieDomain, $wgCookieSecure, $wgCookieHttpOnly ); |
| 39 | + setcookie( 'hidesnmessage', '1', $exp, '/', $cookieDomain, $wgCookieSecure, $wgCookieHttpOnly ); |
35 | 40 | } |
36 | 41 | } |