Mattflaschen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/106458


Change subject: Remove Special:GettingStarted and notifications
......................................................................

Remove Special:GettingStarted and notifications

* Productize test version from OB6
* Remove almost all references to the special page
* Remove all Echo notifications
* Change GettingStarted to be officially an API extension
* Remove dead code and minor fm

Change-Id: Iab6b347c6e3b1810291e2f8206fc2534dc787d02
---
D GettingStarted.alias.php
M GettingStarted.i18n.php
M GettingStarted.php
M Hooks.php
M README
D SpecialGettingStarted.php
D resources/ext.gettingstarted.js
D resources/ext.gettingstarted.showSeparatePage.accountCreation.js
D resources/ext.gettingstarted.specialPage.js
M resources/ext.gettingstarted.taskToolbar.js
10 files changed, 13 insertions(+), 610 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GettingStarted 
refs/changes/58/106458/1

diff --git a/GettingStarted.alias.php b/GettingStarted.alias.php
deleted file mode 100644
index f2e47d7..0000000
--- a/GettingStarted.alias.php
+++ /dev/null
@@ -1,115 +0,0 @@
-<?php
-/**
- * Aliases for GettingStarted's Special page.
- *
- * @file
- * @ingroup Extensions
- */
-// @codingStandardsIgnoreFile
-
-$specialPageAliases = array();
-
-/** English (English) */
-$specialPageAliases['en'] = array(
-       'GettingStarted' => array( 'GettingStarted', 'Getting Started' ),
-);
-
-/** Arabic (العربية) */
-$specialPageAliases['ar'] = array(
-       'GettingStarted' => array( 'البدء' ),
-);
-
-/** German (Deutsch) */
-$specialPageAliases['de'] = array(
-       'GettingStarted' => array( 'Anfangen' ),
-);
-
-/** Zazaki (Zazaki) */
-$specialPageAliases['diq'] = array(
-       'GettingStarted' => array( 'ŞoSerterin' ),
-);
-
-/** Esperanto (Esperanto) */
-$specialPageAliases['eo'] = array(
-       'GettingStarted' => array( 'Komencado', 'Komencante' ),
-);
-
-/** Persian (فارسی) */
-$specialPageAliases['fa'] = array(
-       'GettingStarted' => array( 'شروع‌کردن' ),
-);
-
-/** Galician (galego) */
-$specialPageAliases['gl'] = array(
-       'GettingStarted' => array( 'Primeiros_pasos' ),
-);
-
-/** Hungarian (magyar) */
-$specialPageAliases['hu'] = array(
-       'GettingStarted' => array( 'Első_lépések' ),
-);
-
-/** Indonesian (Bahasa Indonesia) */
-$specialPageAliases['id'] = array(
-       'GettingStarted' => array( 'Mulai' ),
-);
-
-/** Korean (한국어) */
-$specialPageAliases['ko'] = array(
-       'GettingStarted' => array( '시작하기' ),
-);
-
-/** Luxembourgish (Lëtzebuergesch) */
-$specialPageAliases['lb'] = array(
-       'GettingStarted' => array( 'Fir_unzefänken' ),
-);
-
-/** Minangkabau (Baso Minangkabau) */
-$specialPageAliases['min'] = array(
-       'GettingStarted' => array( 'Mamulai' ),
-);
-
-/** Macedonian (македонски) */
-$specialPageAliases['mk'] = array(
-       'GettingStarted' => array( 'КакоДаПочнете' ),
-);
-
-/** Malayalam (മലയാളം) */
-$specialPageAliases['ml'] = array(
-       'GettingStarted' => array( 'തുടങ്ങുക' ),
-);
-
-/** Low Saxon (Netherlands) (Nedersaksies) */
-$specialPageAliases['nds-nl'] = array(
-       'GettingStarted' => array( 'An_de_slag' ),
-);
-
-/** Dutch (Nederlands) */
-$specialPageAliases['nl'] = array(
-       'GettingStarted' => array( 'AanDeSlag' ),
-);
-
-/** Norwegian Nynorsk (norsk nynorsk) */
-$specialPageAliases['nn'] = array(
-       'GettingStarted' => array( 'Kom_i_gang' ),
-);
-
-/** vèneto (vèneto) */
-$specialPageAliases['vec'] = array(
-       'GettingStarted' => array( 'ParScominsiar' ),
-);
-
-/** Vietnamese (Tiếng Việt) */
-$specialPageAliases['vi'] = array(
-       'GettingStarted' => array( 'Bắt_đầu' ),
-);
-
-/** Simplified Chinese (中文(简体)‎) */
-$specialPageAliases['zh-hans'] = array(
-       'GettingStarted' => array( '入门' ),
-);
-
-/** Traditional Chinese (中文(繁體)‎) */
-$specialPageAliases['zh-hant'] = array(
-       'GettingStarted' => array( '入門指南' ),
-);
\ No newline at end of file
diff --git a/GettingStarted.i18n.php b/GettingStarted.i18n.php
index 34337ef..9786c39 100644
--- a/GettingStarted.i18n.php
+++ b/GettingStarted.i18n.php
@@ -12,26 +12,13 @@
  */
 $messages['en'] = array(
        'gettingstarted' => "Getting started",
-       'gettingstarted-desc' => 'Adds a [[Special:GettingStarted|welcome 
page]] for new users (shown after account creation)',
-       'gettingstarted-welcomesiteuser' => "Welcome to $1, $2!",
-       'gettingstarted-welcomesiteuseranon' => "Getting started",
-       'gettingstarted-welcome-back-site-user' => "Welcome back, $2",
-       'gettingstarted-task-header' => 'Thanks for joining {{SITENAME}}! Here 
are some ways you can get involved.
-
-Choose an option below, and you will see a random page that needs help.',
-       'gettingstarted-return' => "← No thanks, return to the page I was 
reading",
+       // TODO (mattflaschen, 2013-01-08): Placeholder
+       'gettingstarted-desc' => 'Helps new users become editors',
        'gettingstarted-project-link' => '{{ns:Project}}:GettingStarted',
        // Change tags
        'tag-gettingstarted_edit' => 'new editor 
[[{{MediaWiki:gettingstarted-project-link}}|getting started]]',
+       // XXX (mattflaschen, 2013-01-08): - Now inaccurate; needs new text
        'tag-gettingstarted_edit-description' => 'Edit of a page that the user 
chose from the task list in [[Special:GettingStarted|Getting started]]',
-
-       // Main text of the special page
-       'gettingstarted-task-copyedit-main-description' => 'Fix Spelling & 
Grammar',
-       'gettingstarted-task-copyedit-secondary-description' => 'The easiest 
way to get started!',
-       'gettingstarted-task-clarify-main-description' => 'Improve Clarity',
-       'gettingstarted-task-clarify-secondary-description' => 'Simplify or 
reword sentences.',
-       'gettingstarted-task-addlinks-main-description' => 'Add Links',
-       'gettingstarted-task-addlinks-secondary-description' => 'Connect 
{{SITENAME}} pages together.',
 
        // Toolbar above page, when they have chosen a task and been redirected
 
@@ -71,24 +58,6 @@
        'guidedtour-tour-gettingstarted-click-save-title' => 'You are almost 
finished!',
        'guidedtour-tour-gettingstarted-click-save-description' => 'Click 
"{{int:savearticle}}" and your changes will be visible.',
 
-       // Notifications
-       'notification-gettingstarted-link-text-get-started' => 'Get started',
-       'notification-gettingstarted-start-editing' => '{{SITENAME}} is a free 
encyclopedia written by people like you. [[Special:GettingStarted|Get started]] 
by making your first edit!',
-       'notification-gettingstarted-start-editing-email-subject' => 'Get 
started with editing {{SITENAME}}',
-       'notification-gettingstarted-start-editing-text-email-body' => 
'{{SITENAME}} is a free encyclopedia written by people like you. Get started by 
making your first edit!
-
-Visit $2 for a list of easy ways to improve pages.
-
-$3',
-       'notification-gettingstarted-start-editing-text-email-batch-body' => 
'Get started with {{SITENAME}} editing by visiting $2',
-       'notification-gettingstarted-continue-editing' => 'Nice work! You have 
already made your first edits to {{SITENAME}}. If you are looking for more to 
do, here are some [[Special:GettingStarted|easy ways to help]].',
-       'notification-gettingstarted-continue-editing-email-subject' => 'Easy 
ways to improve {{SITENAME}}',
-       'notification-gettingstarted-continue-editing-text-email-body' => 'Nice 
work! You have already made your first edits to {{SITENAME}}.
-
-If you are looking for more to do, there is a list of easy ways to help at $2
-
-$3',
-       'notification-gettingstarted-continue-editing-text-email-batch-body' => 
'Looking for more to do? Visit $2 for a list of easy ways to help.',
        // Post-signup Call To Action, see 
https://commons.wikimedia.org/wiki/File:Direct-to-page_onboarding_workflow_overview.pdf
        'gettingstarted-cta-close' => 'Close',
        'gettingstarted-cta-heading' => 'Help {{SITENAME}}',
diff --git a/GettingStarted.php b/GettingStarted.php
index 0082184..cf2d8e4 100644
--- a/GettingStarted.php
+++ b/GettingStarted.php
@@ -1,7 +1,7 @@
 <?php
 if ( !defined( 'MEDIAWIKI' ) ) die( 'Invalid entry point.' );
 
-$wgExtensionCredits[ 'specialpage' ][] = array(
+$wgExtensionCredits[ 'api' ][] = array(
        'path' => __FILE__,
        'name' => 'GettingStarted',
        'author' => array(
@@ -26,8 +26,6 @@
  * @var array Associative array of arrays.  The key is an internal 
non-displayed name, such as 'copyedit'
  *
  *  Each value array has:
- *  'mainDescription' - message key for main description on 
Special:GettingStarted
- *  'secondaryDescription' - message key for secondary description on 
Special:GettingStarted
  *  'toolbarDescription' - message key for primary description on toolbar
  *  'toolbarTryAnotherTitle' - message key for title text of 'Try Another' link
  *  'category' Category articles are from, e.g. 
'All_articles_needing_copy_edit'
@@ -35,24 +33,18 @@
  */
 $wgGettingStartedTasks = array(
        'copyedit' => array(
-               'mainDescription' => 
'gettingstarted-task-copyedit-main-description',
-               'secondaryDescription' => 
'gettingstarted-task-copyedit-secondary-description',
                'toolbarDescription' => 
'gettingstarted-task-copyedit-toolbar-description',
                'toolbarTryAnotherTitle' => 
'gettingstarted-task-copyedit-toolbar-try-another-title',
                'category' => 'All_articles_needing_copy_edit',
                'image' => 'Icon-pencil.png'
        ),
        'clarify' => array(
-               'mainDescription' => 
'gettingstarted-task-clarify-main-description',
-               'secondaryDescription' => 
'gettingstarted-task-clarify-secondary-description',
                'toolbarDescription' => 
'gettingstarted-task-clarify-toolbar-description',
                'toolbarTryAnotherTitle' => 
'gettingstarted-task-clarify-toolbar-try-another-title',
                'category' => 'All_Wikipedia_articles_needing_clarification',
                'image' => 'Icon-wrench.png'
        ),
        'addlinks' => array(
-               'mainDescription' => 
'gettingstarted-task-addlinks-main-description',
-               'secondaryDescription' => 
'gettingstarted-task-addlinks-secondary-description',
                'toolbarDescription' => 
'gettingstarted-task-addlinks-toolbar-description',
                'toolbarTryAnotherTitle' => 
'gettingstarted-task-addlinks-toolbar-try-another-title',
                'category' => 'All_articles_with_too_few_wikilinks',
@@ -90,7 +82,6 @@
 $wgGettingStartedRunTest = false;
 
 $wgAutoloadClasses += array(
-       'GettingStarted\SpecialGettingStarted' => __DIR__ . 
'/SpecialGettingStarted.php',
        'GettingStarted\Hooks' => __DIR__ . '/Hooks.php',
        'GettingStarted\RedisCategorySync' => __DIR__ . 
'/RedisCategorySync.php',
        'GettingStarted\PageFilter' => __DIR__ . '/PageFilter.php',
@@ -98,11 +89,6 @@
 );
 
 $wgExtensionMessagesFiles[ 'GettingStarted' ] = __DIR__ . 
'/GettingStarted.i18n.php';
-$wgExtensionMessagesFiles[ 'GettingStartedAlias' ] = __DIR__ . 
'/GettingStarted.alias.php';
-
-// Special pages
-$wgSpecialPages[ 'GettingStarted' ] = 'GettingStarted\SpecialGettingStarted';
-$wgSpecialPageGroups[ 'GettingStarted' ] = 'users';
 
 // APIs
 $wgAPIModules['gettingstartedgetpages'] = 
'GettingStarted\ApiGettingStartedGetPages';
@@ -213,11 +199,6 @@
        ),
 ) + $gettingStartedModuleInfo;
 
-// This loads on both account creation and the special page, even if JS is off
-$wgResourceModules[ 'ext.gettingstarted.styles' ] = array(
-       'styles' => 'ext.gettingstarted.css',
-) + $gettingStartedModuleInfo;
-
 // Added if this page is one of their GettingStarted tasks
 $wgResourceModules[ 'ext.gettingstarted.taskToolbar' ] = array(
        'scripts' => 'ext.gettingstarted.taskToolbar.js',
@@ -257,34 +238,12 @@
        ),
 ) + $gettingStartedModuleInfo;
 
-// This runs on both account creation and the user simply visiting the special 
page
-$wgResourceModules[ 'ext.gettingstarted' ] = array(
-       'scripts' => 'ext.gettingstarted.js',
-       'dependencies' => array(
-               'ext.gettingstarted.logging',
-       ),
-) + $gettingStartedModuleInfo;
-
-// This runs on account creation for the behavior of
-// showing the user Special:GettingStarted as the welcome new user page.
-// (As of OB6 that is the default (control) behavior.
-$wgResourceModules[ 'ext.gettingstarted.showSeparatePage.accountCreation' ] = 
array(
-       'scripts' => 'ext.gettingstarted.showSeparatePage.accountCreation.js',
-       'dependencies' => array(
-               'mediawiki.util',
-               'ext.gettingstarted',
-               'ext.gettingstarted.logging',
-       ),
-       'position' => 'top',
-) + $gettingStartedModuleInfo;
-
 // This runs on account creation for the OB6 test behavior (returnTo page with
 // special behavior), possibly displaying a Call To Action.
 $wgResourceModules[ 'ext.gettingstarted.return' ] = array(
        'scripts' => 'ext.gettingstarted.return.js',
        'styles' => 'ext.gettingstarted.return.css',
        'messages' => array(
-               'gettingstarted-welcomesiteuser', // XXX (mattflaschen, 
2012-12-12): This is a workaround until we move this into core, at which point 
it can be done server-side.
                'gettingstarted-cta-close',
                'gettingstarted-cta-heading',
                'gettingstarted-cta-text',
@@ -308,15 +267,6 @@
        'position' => 'top',
 ) + $gettingStartedModuleInfo;
 
-$wgResourceModules[ 'ext.gettingstarted.specialPage' ] = array(
-       'scripts' => 'ext.gettingstarted.specialPage.js',
-       'dependencies' => array(
-               'mediawiki.util',
-               'ext.gettingstarted.logging',
-               'ext.gettingstarted',
-       ),
-) + $gettingStartedModuleInfo;
-
 $wgDefaultUserOptions[ GettingStarted\Hooks::INTRO_OPTION ] = true;
 
 $wgHooks[ 'BeforePageDisplay' ][] = 
'GettingStarted\Hooks::onBeforePageDisplay';
@@ -327,9 +277,6 @@
 $wgHooks[ 'ListDefinedTags' ][] = 'GettingStarted\Hooks::onListDefinedTags';
 $wgHooks[ 'ResourceLoaderGetConfigVars' ][] = 
'GettingStarted\Hooks::onResourceLoaderGetConfigVars';
 $wgHooks[ 'MakeGlobalVariablesScript' ][] = 
'GettingStarted\Hooks::onMakeGlobalVariablesScript';
-$wgHooks[ 'BeforeCreateEchoEvent' ][] = 
'GettingStarted\Hooks::onBeforeCreateEchoEvent';
-$wgHooks[ 'EchoGetDefaultNotifiedUsers' ][] = 
'GettingStarted\Hooks::onEchoGetDefaultNotifiedUsers';
-$wgHooks[ 'ConfirmEmailComplete' ][] = 
'GettingStarted\Hooks::onConfirmEmailComplete';
 $wgHooks[ 'GetPreferences' ][] = 'GettingStarted\Hooks::onGetPreferences';
 // Extension:CentralAuth's hook
 $wgHooks[ 'CentralAuthPostLoginRedirect' ][] = 
'GettingStarted\Hooks::onCentralAuthPostLoginRedirect';
diff --git a/Hooks.php b/Hooks.php
index 773767a..4d34756 100644
--- a/Hooks.php
+++ b/Hooks.php
@@ -59,7 +59,6 @@
                efLogServerSideEvent( self::SCHEMA_NAME, self::SCHEMA_REV_ID, 
$event );
        }
 
-       // Must keep in sync with ext.gettingstarted.logging.js's isInTestGroup
        protected static function isInTestGroup( User $user ) {
                global $wgGettingStartedRunTest;
 
@@ -167,7 +166,6 @@
         *
         * It will load if it's a view of an existing page, and the user's 
browser
         * has a gettingstarted-* task.
-        * (In OB6 this doesn't vary with test vs. control.)
         *
         * @param OutputPage $out
         * @param User $user
@@ -200,11 +198,6 @@
         * one or two buttons.
         */
        protected static function addReturnToModules( &$out, &$skin ) {
-               // OB6: 4 kinds of pages to test, different outcomes for each.
-               // put up popup
-               // load messages
-               // which invites to offer in popup
-               // lots of logging
                $out->addModuleStyles( 'mediawiki.ui' );
 
                $out->addModules( 'ext.gettingstarted.return' );
@@ -379,51 +372,6 @@
                return true;
        }
 
-       public static function onBeforeCreateEchoEvent( &$notifications, 
&$categories, &$icons ) {
-               // Currently not used, but most notifications seem to include 
agent as a param.
-               // It will allow username to be included later with just a 
message change.
-
-               $icons['gettingstarted-contribute'] = array(
-                       'path' => 
'GettingStarted/resources/images/echo-gettingstarted-icon.png',
-               );
-
-               $defaults = array(
-                       'primary-link' => array( 'message' => 
'notification-gettingstarted-link-text-get-started', 'destination' => 'title' ),
-                       'category' => 'system',
-                       'group' => 'neutral',
-                       'title-params' => array( 'agent' ),
-                       'email-subject-params' => array( 'agent' ),
-                       'email-body-params' => array( 'agent', 'titlelink', 
'email-footer' ),
-                       'email-body-batch-params' => array( 'agent', 
'titlelink' ),
-                       'icon' => 'gettingstarted-contribute',
-               );
-
-               $notifications['gettingstarted-start-editing'] = array(
-                       'title-message' => 
'notification-gettingstarted-start-editing',
-                       'email-subject-message' => 
'notification-gettingstarted-start-editing-email-subject',
-                       'email-body-message' => 
'notification-gettingstarted-start-editing-text-email-body',
-                       'email-body-batch-message' => 
'notification-gettingstarted-start-editing-text-email-batch-body',
-               ) + $defaults;
-
-               $notifications['gettingstarted-continue-editing'] = array(
-                       'title-message' => 
'notification-gettingstarted-continue-editing',
-                       'email-subject-message' => 
'notification-gettingstarted-continue-editing-email-subject',
-                       'email-body-message' => 
'notification-gettingstarted-continue-editing-text-email-body',
-                       'email-body-batch-message' => 
'notification-gettingstarted-continue-editing-text-email-batch-body',
-               ) + $defaults;
-
-               return true;
-       }
-
-       public static function onEchoGetDefaultNotifiedUsers( $event, &$users ) 
{
-               $type = $event->getType();
-               if ( $type === 'gettingstarted-start-editing' || $type === 
'gettingstarted-continue-editing' ) {
-                       $users[$event->getAgent()->getId()] = 
$event->getAgent();
-               }
-
-               return true;
-       }
-
        /**
         * Checks if they have edited the main namespace
         *
@@ -471,29 +419,6 @@
                return $secondsSinceSignup < 
$wgGettingStartedRecentPeriodInSeconds;
        }
 
-       public static function onConfirmEmailComplete( User $user ) {
-               global $wgGettingStartedRunTest;
-
-               // Notifications are disabled entirely if the A/B test is in 
progress.
-               if ( class_exists( 'EchoEvent' ) && !$wgGettingStartedRunTest ) 
{
-                       // The goal is to only do this notification once 
per-user.
-                       // Absent a clean way to do that, this notifies them if 
they signed up with a given time duration.
-                       if ( self::isRecentSignup( $user ) ) {
-                               $type = self::hasEditedMainNamespace( $user ) ? 
'gettingstarted-continue-editing' : 'gettingstarted-start-editing';
-                               \EchoEvent::create( array(
-                                       'type' => $type,
-                                       'title' => \SpecialPage::getTitleFor( 
'GettingStarted' ),
-                                       'agent' => $user,
-                                       'extra' => array(
-                                               'notifyAgent' => true,
-                                       ),
-                               ) );
-                       }
-               }
-
-               return true;
-       }
-
        public static function onGetPreferences( User $user, array 
&$preferences ) {
                // Show tour and fade in navbar and help button
                $preferences[self::INTRO_OPTION] = array(
@@ -529,41 +454,11 @@
                        if ( array_key_exists( 'showGettingStarted', $qsParams )
                                && $qsParams['showGettingStarted'] === 'false'
                        ) {
-                       return true;
+                               return true;
                        }
                }
 
-
-               if ( self::isInTestGroup( $wgUser ) ) {
-                       // OB6: if user is in test group, allow 
CentralAuth/SUL2 redirect
-                       // to the page they were on; append something to 
returnToQuery so
-                       // GettingStarted::onBeforePageDisplay will take action.
-                       $returnToQuery = $returnToQuery . 
'&gettingStartedReturn=true';
-                       return true;
-               } else {
-
-                       // Send user to GettingStarted
-
-                       $newQueryParams = array();
-
-                       // Tell GettingStarted we arrived from creation
-                       $newQueryParams['postCreateAccount'] = 'true';
-
-                       // Provide GettingStarted the originating page so it 
can display a
-                       // [← No thanks, return to the page I was reading] 
link, by
-                       // turning the passed-in parameters back into query 
string parameters.
-                       if ( $returnTo !== '' && $returnTo !== null ) {
-                               $newQueryParams['returnto'] =  $returnTo;
-                       }
-                       if ( $returnToQuery ) {
-                               $newQueryParams['returntoquery'] =  
$returnToQuery;
-                       }
-
-                       // Redirect to Special:GettingStarted
-                       $returnTo = \SpecialPage::getTitleFor( 'GettingStarted' 
)->getPrefixedText();
-                       $returnToQuery = wfArrayToCgi( $newQueryParams );
-
-                       return true;
-               }
+               $returnToQuery = $returnToQuery . '&gettingStartedReturn=true';
+               return true;
        }
 }
diff --git a/README b/README
index b9c31d2..71646cd 100644
--- a/README
+++ b/README
@@ -2,16 +2,15 @@
 https://www.mediawiki.org/wiki/Extension:GettingStarted
 
 The GettingStarted extension
-* Creates a new special page, Special:GettingStarted,
-  that is automatically shown on signup, and users can visit it at any time.
 * Maintains lists of pages that need easy editing work based on article
   categories such as 'Category:All articles needing copy edit'
-* Special:GettingStarted presents these tasks; if the user clicks one, it shows
-  an article in that category with a taskbar that
+* Creates a new API, GettingStartedGetPages.  This can recommend an article
+  that needs work, based on the above lists
+* If the user chooses a task, it shows an article in that category with a 
taskbar
+  that
   - invites the user to fix the article,
-  - offers to show help (using GuidedTours),
+  - offers to show help (using guided tours),
   - links to another article in the same task.
-  - allows the user to choose an alternate task/category.
 
 To use:
 * Put the extension files in your extension directory
@@ -28,9 +27,7 @@
 * https://www.mediawiki.org/wiki/Extension:EventLogging - Used for logging
 * https://www.mediawiki.org/wiki/Extension:GuidedTour - Used for introductory
 tours
-* (optional) Read and write access to MediaWiki API must be enabled to avoid
-showing the GettingStarted tour repeatedly to logged in users if they
- regularly visit Special:GettingStarted.
+* Read access to the MediaWiki API is required
 * phpredis extension installed on the same machine, and Redis installed on some
 machine that can be accessed.
 
diff --git a/SpecialGettingStarted.php b/SpecialGettingStarted.php
deleted file mode 100644
index 13d8707..0000000
--- a/SpecialGettingStarted.php
+++ /dev/null
@@ -1,228 +0,0 @@
-<?php
-
-namespace GettingStarted;
-
-use Html, Linker, SpecialPage, Title;
-
-class SpecialGettingStarted extends SpecialPage {
-       public function __construct() {
-               parent::__construct( 'GettingStarted' );
-       }
-
-       /**
-        * Dispatch the user to a task.
-        * Construct a task URL and issue an HTTP 302 redirect.
-        * @param Title $title Title of task target page
-        */
-       public function sendToTask( Title $title, $taskName ) {
-               $out = $this->getOutput();
-               $request = $out->getRequest();
-               $source = $request->getVal( 'source' );
-               $query = array();
-               if ( $source !== null ) {
-                       $query['source'] = $source;
-               }
-               $url = $title->getLocalUrl( $query );
-               Hooks::setPageTask( $request, $title, 
"gettingstarted-$taskName" );
-               $out->redirect( $url, '302' );
-               return true;
-       }
-
-       /**
-        * Chooses a random article from the set of articles that are
-        * task-appropriate and returns its Title object. Returns false if the 
task
-        * name is invalid or if we failed to draw an article that meets the
-        * constraints.
-        *
-        * @param string $taskName task name
-        * @return Title|false page to send user to, or false on failure
-        */
-       public function chooseTitleForTask( $taskName ) {
-               $request = new \DerivativeRequest(
-                       $this->getRequest(),
-                       array(
-                               'action' => 'gettingstartedgetpages',
-                               'taskname' => $taskName,
-                               'excludedtitle' => $this->getRequest()->getVal( 
'exclude' ),
-                               'count' => 1,
-                       ),
-                       false // GET request
-               );
-
-               $api = new \ApiMain(
-                       $request,
-                       false // no writes
-               );
-
-               try {
-                       $api->execute();
-                       $result = $api->getResult()->getData();
-                       if ( isset( 
$result['gettingstartedgetpages']['titles'][0] ) ) {
-                               return Title::newFromText( 
$result['gettingstartedgetpages']['titles'][0] );
-                       } else {
-                               return false;
-                       }
-               } catch ( \UsageException $ex ) {
-                       return false;
-               }
-       }
-
-       /**
-        * Displays Special:GettingStarted page, unless the request is for
-        * Special:GettingStarted/task/kind in which case this sends the user
-        * to that task.
-        * If the query string contains postCreateAccount=true it indicates that
-        * CentralAuth redirected to it after account creation.
-        * If the query string parameter contains a returnto=somepage, that
-        * represents the page the user was on before creating an account, and
-        * Special:GettingStarted should style it and track user clicks on it.
-        */
-       public function execute( $parameter ) {
-               global $wgSitename;
-
-               $this->setHeaders();
-
-               $parameterInfo = explode( '/', $parameter );
-
-               // If parameters match treat as task redirect.
-               // Otherwise, ignore parameters.
-               if ( count( $parameterInfo === 2 ) && $parameterInfo[0] === 
'task' ) {
-                       $task = $parameterInfo[1];
-                       $title = self::chooseTitleForTask( $task );
-                       if ( $title === false ) {
-                               $fullTaskName = "gettingstarted-$task";
-                               efLogServerSideEvent( 
'GettingStartedNavbarNoArticle', 5483117, array(
-                                       'version' => 1,
-                                       'funnel' => $fullTaskName,
-                               ) );
-                       } else {
-                               return self::sendToTask( $title, $task );
-                       }
-               }
-
-               $user = $this->getUser();
-               $request = $this->getRequest();
-               $isPostCreate = $request->getVal( 'postCreateAccount' ) === 
'true' ? true : false;
-
-               $output = $this->getOutput();
-
-               $output->addHTML( $this->getHtmlResult() );
-
-               if ( $isPostCreate ) {
-                       // Do what Hooks::onBeforeWelcomeCreation and
-                       // SpecialUserlogin.php successfulCreation() would have 
done.
-
-                       $output->addModules( array(
-                               
'ext.gettingstarted.showSeparatePage.accountCreation',
-                       ) );
-                       // Styles are added separately so they load without 
needing JS
-                       $output->addModuleStyles( array(
-                               'mediawiki.ui',
-                               'ext.gettingstarted.styles',
-                       ) );
-
-                       $output->setPageTitle( $this->msg( 
'gettingstarted-welcomesiteuser', $wgSitename, $user->getName() ) );
-
-                       // TODO (spage, 2013-07-17) does the 
CentralAuthPostLoginRedirect
-                       // hook pass us a blank returnTo, or empty returnTo, or 
'Main_Page'
-                       // when the create account form didn't receive a 
returnto?
-                       $returnTo = Title::newFromText( $request->getVal( 
'returnto' ) );
-                       $returnToQuery = wfCgiToArray( $request->getVal( 
'returntoquery' ) );
-                       if ( $returnTo !== null ) {
-                               $returnToLink = Linker::link(
-                                       $returnTo,
-                                       $this->msg( 'gettingstarted-return' 
)->text(),
-                                       array(),
-                                       $returnToQuery
-                               );
-                               $output->addHTML( $returnToLink );
-                       }
-
-               } else {
-
-                       if( !$user->isAnon() ) {
-                               $output->setPageTitle( $this->msg( 
'gettingstarted-welcome-back-site-user', $wgSitename, $user->getName() ) );
-                       } else {
-                               $output->setPageTitle( $this->msg( 
'gettingstarted-welcomesiteuseranon', $wgSitename ) );
-                       }
-               }
-
-               // Styles are added separately so they load without needing JS
-               $output->addModuleStyles( 'ext.gettingstarted.styles' );
-
-               $output->addModules( array(
-                       'ext.gettingstarted',
-                       'ext.gettingstarted.specialPage',
-               ) );
-       }
-
-       /**
-        * Returns the main container HTML for the welcome page.
-        *
-        * TODO (spage, 2013-07-16) if the BeforeWelcomeCreation hook no
-        * longer has to incorporate this HTML into the form results page,
-        * then we can remove this and just output the HTML in execute().
-        * @return string
-        */
-       public function getHtmlResult() {
-               global $wgExtensionAssetsPath, $wgGettingStartedTasks;
-
-               $result = '';
-               $header = $this->msg( 'gettingstarted-task-header' 
)->parseAsBlock();
-
-               $result .= <<< EOF
-                       <div class="mw-gettingstarted-container">
-                               <div class="mw-gettingstarted-header">
-                                       $header
-                               </div>
-                               <div class="mw-gettingstarted-tasks">
-EOF;
-               $tasks = array();
-               foreach ( $wgGettingStartedTasks as $taskName => $task ) {
-                       $task['taskName'] = $taskName;
-                       $tasks[] = $task;
-               }
-               shuffle( $tasks );
-
-               foreach ( $tasks as $task ) {
-                       $mainDescription = $this->msg( $task['mainDescription'] 
)->text();
-                       $imgFile = wfFindFile( $task['image'] );
-                       $taskHtml = Html::rawElement( 'div', array(
-                               'class' => 'mw-gettingstarted-task-icon',
-                       ),
-                               $imgFile ?
-                                       Html::element( 'img', array(
-                                               'alt' => $mainDescription,
-                                               // wfFindFile() can fail if 
there are network problems.
-                                               // TODO (spage, 2013-08-04) 
Does Extension:GettingStarated
-                                               // document that it depends on 
these File pages locally or?
-                                               // instant commons for its 
icons?
-                                               'src' => $imgFile->getURL(),
-                                       ) )
-                                       : ''
-                       ) .
-                       Html::rawElement( 'div', array(
-                               'class' => 'mw-gettingstarted-task-text',
-                       ),
-                               Html::element( 'h4', array(), $mainDescription 
) .
-                               Html::element( 'p', array(), $this->msg( 
$task['secondaryDescription'] )->text() )
-                       );
-                       $result .= Linker::link( SpecialPage::getTitleFor( 
'GettingStarted', 'task/' . $task['taskName'] ),
-                                       $taskHtml,
-                                       array(
-                                               'title' => $mainDescription,
-                                               'data-task-name' => 
$task['taskName']
-                                       ),
-                                       array(
-                                               'source' => 
'gettingstarted-specialpage-click',
-                                       )
-                       );
-               }
-
-               $result .= <<< 'EOF'
-                               </div>
-                       </div>
-EOF;
-               return $result;
-       }
-}
diff --git a/resources/ext.gettingstarted.js b/resources/ext.gettingstarted.js
deleted file mode 100644
index d7bd200..0000000
--- a/resources/ext.gettingstarted.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// Loaded on Getting Started task selection page, regardless of whether it is
-// the actual special page, or the post-account creation version.
-//
-// TODO (mattflaschen, 2013-10-07): This distinction no longer exists.
-// Cleanup the code further.
-
-( function ( $, mw ) {
-       'use strict';
-
-       $( function () {
-               var logging = mw.gettingStarted.logging;
-
-               $( '.mw-gettingstarted-tasks' ).on( 'click', 'a', function ( 
evt ) {
-                       var $this = $( this ),
-                               fullTask = 'gettingstarted-' + $this.data( 
'taskName' );
-
-                       logging.logUnlessTimeout( {
-                               action: 'gettingstarted-specialpage-click',
-                               funnel: fullTask
-                       }, 500 ).always( function () {
-                               location.href = $this.attr( 'href' );
-                       } );
-
-                       evt.preventDefault();
-               } );
-
-       } );
-} ( jQuery, mediaWiki ) );
diff --git a/resources/ext.gettingstarted.showSeparatePage.accountCreation.js 
b/resources/ext.gettingstarted.showSeparatePage.accountCreation.js
deleted file mode 100644
index ebb6af7..0000000
--- a/resources/ext.gettingstarted.showSeparatePage.accountCreation.js
+++ /dev/null
@@ -1,17 +0,0 @@
-// Code that runs when Special:GettingStarted is shown after account creation.
-( function ( $, mw ) {
-       'use strict';
-
-       $( document ).ready( function () {
-               var
-                       state,
-                       url;
-
-               if ( history.replaceState ) {
-                       state = {}; // Currently unused
-                       url = mw.util.wikiGetlink( 'Special:GettingStarted' );
-                       history.replaceState( state, '', url );
-               }
-       } );
-
-} )( jQuery, mediaWiki );
diff --git a/resources/ext.gettingstarted.specialPage.js 
b/resources/ext.gettingstarted.specialPage.js
deleted file mode 100644
index eb3f6ae..0000000
--- a/resources/ext.gettingstarted.specialPage.js
+++ /dev/null
@@ -1,12 +0,0 @@
-// This loads when the user visits Special:GettingStarted but it is not
-// immediately after account creation.
-( function ( mw ) {
-       'use strict';
-
-       var event = {
-               action: 'gettingstarted-specialpage-impression'
-       };
-
-       mw.gettingStarted.logging.logEvent( event );
-
-} )( mediaWiki );
diff --git a/resources/ext.gettingstarted.taskToolbar.js 
b/resources/ext.gettingstarted.taskToolbar.js
index a02c566..da2de7a 100644
--- a/resources/ext.gettingstarted.taskToolbar.js
+++ b/resources/ext.gettingstarted.taskToolbar.js
@@ -100,11 +100,6 @@
                        id: 'mw-gettingstarted-toolbar'
                } );
 
-               if ( cfg.wgGettingStarted.bucket === 'test' ) {
-                       $toolbar.attr( 'class', 'mw-gettingstarted-bucket-test' 
);
-               }
-
-
                $toolbar.append( $center, $right ).hide();
 
                $( document.body ).prepend( $toolbar );

-- 
To view, visit https://gerrit.wikimedia.org/r/106458
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab6b347c6e3b1810291e2f8206fc2534dc787d02
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GettingStarted
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to