r114104 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r114103‎ | r114104 | r114105 >
Date:18:01, 18 March 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixed logging of enrollment
Modified paths:
  • /trunk/extensions/EducationProgram/includes/EPRoleObject.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEnroll.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/specials/SpecialEnroll.php
@@ -247,8 +247,12 @@
248248
249249 $success = $student->save();
250250
251 - $success = $success && $student->associateWithCourses( array( $course ) );
 251+ $revAction = new EPRevisionAction();
 252+ $revAction->setUser( $this->getUser() );
 253+ $revAction->setComment( '' ); // TODO?
252254
 255+ $success = $success && $student->associateWithCourses( array( $course ), $revAction );
 256+
253257 return $success;
254258 }
255259
Index: trunk/extensions/EducationProgram/includes/EPRoleObject.php
@@ -140,10 +140,11 @@
141141 * @since 0.1
142142 *
143143 * @param array $courses
 144+ * @param EPRevisionAction|null $revAction
144145 *
145146 * @return bool Success indicator
146147 */
147 - public function associateWithCourses( array /* of EPCourse */ $courses ) {
 148+ public function associateWithCourses( array /* of EPCourse */ $courses, EPRevisionAction $revAction = null ) {
148149 $success = true;
149150
150151 $courseIds = array();
@@ -151,7 +152,14 @@
152153 foreach ( $courses as /* EPCourse */ $course ) {
153154 $courseIds[] = $course->getId();
154155 $course->setUpdateSummaries( false );
155 - $success = $course->enlistUsers( $this->getField( 'user_id' ), $this->getRoleName() ) !== false && $success;
 156+
 157+ $success = $course->enlistUsers(
 158+ $this->getField( 'user_id' ),
 159+ $this->getRoleName(),
 160+ true,
 161+ $revAction
 162+ ) !== false && $success;
 163+
156164 $course->setUpdateSummaries( true );
157165 }
158166

Status & tagging log