Faidon Liambotis has uploaded a new change for review. https://gerrit.wikimedia.org/r/130332
Change subject: Revert "Assign token to all users and instrument TrackedPageContentSaveComplete" ...................................................................... Revert "Assign token to all users and instrument TrackedPageContentSaveComplete" Reverted in 1.24wmf1/2 already because of #64573, but this revert is for a different breakage: Varnish generally ignores MediaWiki's Vary: Cookie instruction and caches the page once, but this does not happen if the Cookie value contains a Cookie that contains the value "session" or "Token". This token value did just that and inadvertently broke the site in a spectacular way. This reverts commit 99286bb24e86185fa7a0759588ec09ee74b2cd8c. Change-Id: I978282c1a83620b8522399fea9008d0379dce6df --- M GettingStarted.php M Hooks.php D resources/ext.gettingstarted.assignToken.js 3 files changed, 4 insertions(+), 46 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GettingStarted refs/changes/32/130332/1 diff --git a/GettingStarted.php b/GettingStarted.php index 5e9702d..77cf165 100644 --- a/GettingStarted.php +++ b/GettingStarted.php @@ -253,13 +253,6 @@ ), ) + $gettingStartedModuleInfo; -$wgResourceModules[ 'ext.gettingstarted.assignToken' ] = array( - 'scripts' => 'ext.gettingstarted.assignToken.js', - 'dependencies' => array( - 'ext.gettingstarted.user' - ), -) + $gettingStartedModuleInfo; - $wgDefaultUserOptions[ GettingStarted\Hooks::INTRO_OPTION ] = true; $wgHooks[ 'BeforePageDisplay' ][] = 'GettingStarted\Hooks::onBeforePageDisplay'; @@ -275,4 +268,3 @@ // Extension:CentralAuth's hook $wgHooks[ 'CentralAuthPostLoginRedirect' ][] = 'GettingStarted\Hooks::onCentralAuthPostLoginRedirect'; $wgHooks[ 'ResourceLoaderTestModules' ][] = 'GettingStarted\Hooks::onResourceLoaderTestModules'; -$wgHooks[ 'PageContentSaveComplete' ][] = 'GettingStarted\Hooks::onPageContentSaveComplete'; \ No newline at end of file diff --git a/Hooks.php b/Hooks.php index 21cd710..c172b3c 100644 --- a/Hooks.php +++ b/Hooks.php @@ -26,10 +26,8 @@ */ protected static $openTask = null; - // This is used unprefixed and with a custom path for legacy reasons. - const OPENTASK_COOKIE_NAME = 'openTask'; - - const USER_TOKEN_COOKIE_NAME = 'gettingStartedUserToken'; + // There is used unprefixed and with a custom path for legacy reasons. + const COOKIE_NAME = 'openTask'; protected static $COOKIE_OPTIONS = array( 'prefix' => '', @@ -74,7 +72,7 @@ return; } - $cookie = $request->getCookie( self::OPENTASK_COOKIE_NAME, '' ); + $cookie = $request->getCookie( self::COOKIE_NAME, '' ); $tasks = FormatJson::decode( $cookie, true ); if ( !is_array( $tasks ) ) { $tasks = array(); @@ -257,9 +255,6 @@ public static function onBeforePageDisplay( OutputPage $out, \Skin $skin ) { $user = $out->getUser(); - // Assign token; will support anonymous signup invite experiment - $out->addModules( 'ext.gettingstarted.assignToken' ); - if ( self::shouldLoadToolbar( $out, $user ) ) { // Uses addModuleStyles since no-JS code must load it this way // and this avoids double-loading. @@ -402,7 +397,7 @@ global $wgRequest; // Set expiration time in the past to expire. Uses -1 day like User.php. - $wgRequest->response()->setcookie( self::OPENTASK_COOKIE_NAME, '', time() - 86400, self::$COOKIE_OPTIONS ); + $wgRequest->response()->setcookie( self::COOKIE_NAME, '', time() - 86400, self::$COOKIE_OPTIONS ); return true; } @@ -448,29 +443,5 @@ 'localBasePath' => __DIR__, 'remoteExtPath' => 'GettingStarted', ); - } - - /** - * Log server-side event on successful page edit. - * @see https://www.mediawiki.org/wiki/Manual:Hooks/PageContentSaveComplete - * @see https://meta.wikimedia.org/wiki/Schema:PageContentSaveComplete - */ - public static function onPageContentSaveComplete( $article, $user, $content, $summary, - $isMinor, $isWatch, $section, $flags, $revision, $status, $baseRevId ) { - - global $wgRequest; - - $revId = $revision->getId(); - $event = array( - 'revId' => $revId, - ); - - $token = $wgRequest->getCookie( self::USER_TOKEN_COOKIE_NAME ); - if ( $token !== null ) { - $event['token'] = $token; - } - - \EventLogging::logEvent( 'TrackedPageContentSaveComplete', 7872558, $event ); - return true; } } diff --git a/resources/ext.gettingstarted.assignToken.js b/resources/ext.gettingstarted.assignToken.js deleted file mode 100644 index 367085e..0000000 --- a/resources/ext.gettingstarted.assignToken.js +++ /dev/null @@ -1,5 +0,0 @@ -( function ( mw ) { - // Assign token to all users, if they don't already have one; currently used for - // TrackedContentPageSaveComplete. - mw.gettingStarted.user.getToken(); -}( mediaWiki ) ); -- To view, visit https://gerrit.wikimedia.org/r/130332 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I978282c1a83620b8522399fea9008d0379dce6df Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/GettingStarted Gerrit-Branch: master Gerrit-Owner: Faidon Liambotis <fai...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits