Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -194,6 +194,7 @@ |
195 | 195 | $wgHooks['CanonicalNamespaces'][] = 'EPHooks::onCanonicalNamespaces'; |
196 | 196 | $wgHooks['TitleIsAlwaysKnown'][] = 'EPHooks::onTitleIsAlwaysKnown'; |
197 | 197 | $wgHooks['AbortMove'][] = 'EPHooks::onAbortMove'; |
| 198 | +$wgHooks['NewRevisionFromEditComplete'][] = 'EPHooks::onNewRevisionFromEditComplete'; |
198 | 199 | |
199 | 200 | // Actions |
200 | 201 | $wgActions['epremarticle'] = 'EPRemoveArticleAction'; |
Index: trunk/extensions/EducationProgram/specials/SpecialStudentActivity.php |
— | — | @@ -167,7 +167,7 @@ |
168 | 168 | } |
169 | 169 | break; |
170 | 170 | case 'last_active': |
171 | | - $value = htmlspecialchars( $this->getLanguage()->date( $value ) ); |
| 171 | + $value = htmlspecialchars( $this->getLanguage()->timeanddate( $value ) ); |
172 | 172 | break; |
173 | 173 | case 'last_course': |
174 | 174 | if ( array_key_exists( $value, $this->courseNames ) ) { |
Index: trunk/extensions/EducationProgram/EducationProgram.hooks.php |
— | — | @@ -381,5 +381,35 @@ |
382 | 382 | |
383 | 383 | return $allowed; |
384 | 384 | } |
| 385 | + |
| 386 | + /** |
| 387 | + * Called when a revision was inserted due to an edit. |
| 388 | + * @see https://www.mediawiki.org/wiki/Manual:Hooks/NewRevisionFromEditComplete |
| 389 | + * |
| 390 | + * @since 0.1 |
| 391 | + * |
| 392 | + * @param weirdStuffButProbablyWikiPage $article |
| 393 | + * @param Revision $rev |
| 394 | + * @param integer $baseID |
| 395 | + * @param User $user |
| 396 | + * |
| 397 | + * @return true |
| 398 | + */ |
| 399 | + public static function onNewRevisionFromEditComplete( $article, Revision $rev, $baseID, User $user ) { |
| 400 | + if ( $article->getTitle()->inNamespaces( NS_MAIN, NS_TALK ) ) { |
| 401 | + $studentId = EPStudents::singleton()->selectFieldsRow( 'id', array( 'user_id' => $user->getId() ) ); |
| 402 | + |
| 403 | + if ( $studentId !== false ) { |
| 404 | + $student = EPStudent::newFromUserId( $user->getId() ); |
| 405 | + $student->setFields( array( |
| 406 | + 'id' => $studentId, |
| 407 | + 'last_active' => wfTimestampNow() |
| 408 | + ) ); |
| 409 | + $student->save(); |
| 410 | + } |
| 411 | + } |
| 412 | + |
| 413 | + return true; |
| 414 | + } |
385 | 415 | |
386 | 416 | } |