jenkins-bot has submitted this change and it was merged.

Change subject: Remove student profile and all links to it
......................................................................


Remove student profile and all links to it

Remove Special:Student, the special page for student profiles, as
well as the links to them that appear at Special:Students and a few
places.

Bug: 82735
Change-Id: I3dd5a0e3c0cc04ba7c618136b51d0d361ce45abb
---
M EducationProgram.hooks.php
M EducationProgram.php
M i18n/en.json
M includes/UserRolesMessage.php
M includes/rows/Student.php
D includes/specials/SpecialStudent.php
6 files changed, 4 insertions(+), 219 deletions(-)

Approvals:
  AndyRussG: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/EducationProgram.hooks.php b/EducationProgram.hooks.php
index 2c53d5e..7194500 100644
--- a/EducationProgram.hooks.php
+++ b/EducationProgram.hooks.php
@@ -490,39 +490,6 @@
        }
 
        /**
-        * Show link to Special:Student/user on Special:Contributions/user
-        *
-        * @param int $id id of the user whose contributions are displayed
-        * @param Title $title
-        * @param array &$tools
-        */
-       public static function onContributionsToolLinks( $id, $title, &$tools ) 
{
-
-               $studentRoleObj = Students::singleton()
-                       ->selectRow( null, array( 'user_id' => $id ) );
-
-               if ( !$studentRoleObj ) {
-                       return;
-               }
-
-               // temporary check due to DB corruption; TODO remove when this 
is
-               // no longer needed
-               if ( count( $studentRoleObj->getCourses( array( 'id') ) ) === 0 
) {
-                       return;
-               }
-
-               if ( $studentRoleObj ) {
-
-                       $userName = \User::newFromId( $id )->getName();
-
-                       $tools[] = \Linker::link(
-                                       \SpecialPage::getTitleFor( 'Student', 
$userName ),
-                                       wfMessage( 'ep-student-view-profile' 
)->escaped()
-                       );
-               }
-       }
-
-       /**
         * Register Echo notification types and categories. (Just hands off to 
the
         * NotificationsManager for the actual work.)
         *
diff --git a/EducationProgram.php b/EducationProgram.php
index 7f41f4d..70fec93 100644
--- a/EducationProgram.php
+++ b/EducationProgram.php
@@ -152,7 +152,6 @@
 $wgAutoloadClasses['EducationProgram\SpecialManageCourses']            = $dir 
. '/includes/specials/SpecialManageCourses.php';
 $wgAutoloadClasses['EducationProgram\SpecialOAProfile']                        
= $dir . '/includes/specials/SpecialOAProfile.php';
 $wgAutoloadClasses['EducationProgram\SpecialOAs']                              
        = $dir . '/includes/specials/SpecialOAs.php';
-$wgAutoloadClasses['EducationProgram\SpecialStudent']                          
= $dir . '/includes/specials/SpecialStudent.php';
 $wgAutoloadClasses['EducationProgram\SpecialStudentActivity']          = $dir 
. '/includes/specials/SpecialStudentActivity.php';
 $wgAutoloadClasses['EducationProgram\SpecialStudents']                         
        = $dir . '/includes/specials/SpecialStudents.php';
 $wgAutoloadClasses['EducationProgram\VerySpecialPage']                         
        = $dir . '/includes/specials/VerySpecialPage.php';
@@ -223,17 +222,14 @@
 $wgSpecialPages['Disenroll']                                           = 
'EducationProgram\SpecialDisenroll';
 $wgSpecialPages['MyCourses']                                           = 
'EducationProgram\SpecialMyCourses';
 $wgSpecialPages['Institutions']                                        = 
'EducationProgram\SpecialInstitutions';
-//$wgSpecialPages['EducationProgram']                          = 
'EducationProgram\SpecialEducationProgram';
 $wgSpecialPages['OnlineAmbassadors']                           = 
'EducationProgram\SpecialOAs';
 $wgSpecialPages['OnlineAmbassadorProfile']                     = 
'EducationProgram\SpecialOAProfile';
-$wgSpecialPages['Student']                                                     
= 'EducationProgram\SpecialStudent';
 $wgSpecialPages['StudentActivity']                                     = 
'EducationProgram\SpecialStudentActivity';
 $wgSpecialPages['Students']                                            = 
'EducationProgram\SpecialStudents';
 $wgSpecialPages['ManageCourses']                                       = 
'EducationProgram\SpecialManageCourses';
 
 $wgSpecialPageGroups['MyCourses']                                      = 
'education';
 $wgSpecialPageGroups['Institutions']                           = 'education';
-$wgSpecialPageGroups['Student']                                        = 
'education';
 $wgSpecialPageGroups['Students']                                       = 
'education';
 $wgSpecialPageGroups['Courses']                                        = 
'education';
 //$wgSpecialPageGroups['EducationProgram']                     = 'education';
@@ -273,7 +269,6 @@
 $wgHooks['NewRevisionFromEditComplete'][]                      = 
'EducationProgram\Hooks::onNewRevisionFromEditComplete';
 $wgHooks['NamespaceIsMovable'][]                                       = 
'EducationProgram\Hooks::onNamespaceIsMovable';
 $wgHooks['SpecialContributionsBeforeMainOutput'][]     = 
'EducationProgram\Hooks::onSpecialContributionsBeforeMainOutput';
-$wgHooks['ContributionsToolLinks'][]                           = 
'EducationProgram\Hooks::onContributionsToolLinks';
 $wgHooks['BeforeCreateEchoEvent'][]                            = 
'EducationProgram\Hooks::onBeforeCreateEchoEvent';
 $wgHooks['EchoGetDefaultNotifiedUsers'][]                      = 
'EducationProgram\Hooks::onEchoGetDefaultNotifiedUsers';
 $wgHooks['PageContentSaveComplete'][]                          = 
'EducationProgram\Hooks::onPageContentSaveComplete';
diff --git a/i18n/en.json b/i18n/en.json
index 61aa568..12dd7ca 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -682,7 +682,7 @@
     "ep-user-roles-message-main-online": "[[$1|$2]] {{GENDER:$2|is an online 
volunteer}} for {{PLURAL:$4|$3}}.",
     "ep-user-roles-message-main-campus": "[[$1|$2]] {{GENDER:$2|is a campus 
volunteer}} for {{PLURAL:$4|$3}}.",
     "ep-user-roles-message-course-link-for-list": "[[$1|$2]] ([[$3|course 
talk]])",
-    "ep-user-roles-message-main-many-student": "[[$1|$2]] {{GENDER:$2|is a 
student}} in [[$4|$3 {{PLURAL:$3|course|courses}}]].",
+    "ep-user-roles-message-main-many-student": "[[$1|$2]] {{GENDER:$2|is a 
student}} in $3 {{PLURAL:$3|course|courses}}.",
     "ep-user-roles-message-main-many-instructor": "[[$1|$2]] {{GENDER:$2|is an 
instructor}} for $3 {{PLURAL:$3|course|courses}}.",
     "ep-user-roles-message-main-many-online": "[[$1|$2]] {{GENDER:$2|is an 
online volunteer}} for $3 {{PLURAL:$3|course|courses}}.",
     "ep-user-roles-message-main-many-campus": "[[$1|$2]] {{GENDER:$2|is a 
campus volunteer}} for $3 {{PLURAL:$3|course|courses}}.",
@@ -711,4 +711,4 @@
     "ep-online-add-notification-title": "You have been {{GENDER:$1|added}} as 
an online volunteer to [[$2|$3]] by [[User:$1|$1]].",
     "ep-online-add-notification-title-email-subject": "You have been 
{{GENDER:$1|added}} as an online volunteer to $2 by $1.",
     "ep-online-add-notification-title-email-body": "You have been 
{{GENDER:$1|added}} as an online volunteer to $2 by $1."
-}
\ No newline at end of file
+}
diff --git a/includes/UserRolesMessage.php b/includes/UserRolesMessage.php
index c584fbf..4bbe492 100644
--- a/includes/UserRolesMessage.php
+++ b/includes/UserRolesMessage.php
@@ -226,13 +226,6 @@
                                $mainRoleCoursesCount
                        );
 
-                       // If we're talking about a student role, include a 
link to the
-                       // student's profile.
-                       if ( $mainRole === 'student' ) {
-                               $mainMessageParams[] =
-                                       \SpecialPage::getTitleFor( 'Student', 
$userName );
-                       }
-
                        $mainMessageHTML = $this->out->msg(
                                
$this->messageKeysForRoles[$mainRole]['main-many'],
                                $mainMessageParams
@@ -278,4 +271,4 @@
                // close enclosing div
                $this->out->addHTML( Html::closeElement( 'div' ) );
        }
-}
\ No newline at end of file
+}
diff --git a/includes/rows/Student.php b/includes/rows/Student.php
index 91cfa13..990a426 100644
--- a/includes/rows/Student.php
+++ b/includes/rows/Student.php
@@ -104,11 +104,7 @@
                return Utils::getToolLinks(
                        $userId,
                        $userName,
-                       $context,
-                       array( \Linker::link(
-                               \SpecialPage::getTitleFor( 'Student', $userName 
),
-                               $context->msg( 'ep-student-view-profile' 
)->escaped()
-                       ) )
+                       $context
                );
        }
 
diff --git a/includes/specials/SpecialStudent.php 
b/includes/specials/SpecialStudent.php
deleted file mode 100644
index d94680b..0000000
--- a/includes/specials/SpecialStudent.php
+++ /dev/null
@@ -1,166 +0,0 @@
-<?php
-
-namespace EducationProgram;
-use User, IORMRow, Html, Linker;
-
-/**
- * Shows the info for a single student.
- *
- * @since 0.1
- *
- * @ingroup EducationProgram
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class SpecialStudent extends VerySpecialPage {
-       /**
-        * Constructor.
-        *
-        * @since 0.1
-        */
-       public function __construct() {
-               parent::__construct( 'Student', '', false );
-       }
-
-       /**
-        * Main method.
-        *
-        * @since 0.1
-        *
-        * @param string $subPage
-        */
-       public function execute( $subPage ) {
-               parent::execute( $subPage );
-
-               $out = $this->getOutput();
-
-               if ( trim( $subPage ) === '' ) {
-                       $this->getOutput()->redirect( 
\SpecialPage::getTitleFor( 'Students' )->getLocalURL() );
-               }
-               else {
-                       $this->startCache( 3600 );
-
-                       $this->displayNavigation();
-
-                       $student = false;
-                       $user = User::newFromName( $subPage );
-
-                       if ( $user !== false && $user->getId() !== 0 ) {
-                               $student = $this->getCachedValue(
-                                       function( $userId ) {
-
-                                               $cachableStudent = 
Students::singleton()->
-                                                       selectRow( null, array( 
'user_id' => $userId ) );
-
-                                               // This page displays info 
about a student's enrollment
-                                               // status. The following will 
query the database to get
-                                               // that info, but we won't 
bother saving it to the
-                                               // corresponding DB field in 
the Students table.
-                                               
$cachableStudent->loadSummaryFields( 'active_enroll' );
-
-                                               return $cachableStudent;
-                                       },
-                                       $user->getId()
-                               );
-                       }
-
-                       if ( $student === false ) {
-                               $out->addWikiMsg( 'ep-student-none', 
$this->subPage );
-                       }
-                       else {
-                               $out->setPageTitle( $this->msg( 
'ep-student-title', $student->getName() ) );
-                               $this->addCachedHTML( array( $this, 
'getPageHTML' ), $student );
-                       }
-               }
-       }
-
-       /**
-        * Builds the HTML for the page and returns it.
-        *
-        * @since 0.1
-        *
-        * @param Student $student
-        *
-        * @return string
-        */
-       public function getPageHTML( Student $student ) {
-               $courseIds = array_map(
-                       function( Course $course ) {
-                               return $course->getId();
-                       },
-                       $student->getCourses( 'id' )
-               );
-
-               $html = $this->getSummary( $student );
-
-               if ( $courseIds === array() ) {
-                       // TODO: high
-               }
-               else {
-                       $html .= Html::element( 'h2', array(), $this->msg( 
'ep-student-courses' )->text() );
-
-                       $html .= CoursePager::getPager( $this->getContext(), 
array( 'id' => $courseIds ) );
-                       $this->getOutput()->addModules( 
CoursePager::getModules() );
-
-                       $pager = new ArticleTable(
-                               $this->getContext(),
-                               array( 'user_id' => $this->getUser()->getId() ),
-                               $courseIds,
-                               array( $this->getUser()->getId() )
-                       );
-
-                       $this->getOutput()->addModules( 
ArticleTable::getModules() );
-
-                       $pager->setShowStudents( false );
-
-                       if ( $pager->getNumRows() ) {
-                               $html .= Html::element( 'h2', array(), 
$this->msg( 'ep-student-articles' )->text() );
-
-                               $html .=
-                                       $pager->getFilterControl() .
-                                               $pager->getNavigationBar() .
-                                               $pager->getBody() .
-                                               $pager->getNavigationBar() .
-                                               
$pager->getMultipleItemControl();
-                       }
-               }
-
-               return $html;
-       }
-
-       /**
-        * @see SpecialCachedPage::getCacheKey
-        * @return array
-        */
-       protected function getCacheKey() {
-               $values = $this->getRequest()->getValues();
-
-               $values[] = $this->getUser()->getId();
-               $values[] = $this->subPage;
-
-               return array_merge( $values, parent::getCacheKey() );
-       }
-
-       /**
-        * Gets the summary data.
-        *
-        * @since 0.1
-        *
-        * @param Student $student
-        *
-        * @return array
-        */
-       protected function getSummaryData( IORMRow $student ) {
-               $stats = array();
-
-               $id = $student->getUser()->getId();
-               $stats['user'] = Linker::userLink( $id, $student->getName() ) . 
Linker::userToolLinks( $id, $student->getName() );
-
-               $stats['first-enroll'] = htmlspecialchars( 
$this->getLanguage()->timeanddate( $student->getField( 'first_enroll' ), true ) 
);
-               $stats['last-active'] = htmlspecialchars( 
$this->getLanguage()->timeanddate( $student->getField( 'last_active' ), true ) 
);
-               $stats['active-enroll'] = $this->msg( $student->getField( 
'active_enroll' ) ? 'ep-student-actively-enrolled' : 
'ep-student-no-active-enroll' )->escaped();
-
-               return $stats;
-       }
-}

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I3dd5a0e3c0cc04ba7c618136b51d0d361ce45abb
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/EducationProgram
Gerrit-Branch: master
Gerrit-Owner: Ragesoss <[email protected]>
Gerrit-Reviewer: Adamw <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to