r108969 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108968‎ | r108969 | r108970 >
Date:12:29, 15 January 2012
Author:jeroendedauw
Status:ok
Tags:
Comment:
added 1.18 compat to logging stuff
Modified paths:
  • /trunk/extensions/EducationProgram/includes/EPDBObject.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrg.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/includes/EPOrg.php
@@ -70,9 +70,9 @@
7171
7272 /**
7373 * (non-PHPdoc)
74 - * @see EPDBObject::createLogEntry()
 74+ * @see EPDBObject::getLogInfo()
7575 */
76 - protected function createLogEntry( $subType ) {
 76+ protected function getLogInfo( $subType ) {
7777 return array(
7878 'type' => 'institution',
7979 'title' => $this->getTitle(),
Index: trunk/extensions/EducationProgram/includes/EPDBObject.php
@@ -458,22 +458,35 @@
459459 */
460460 protected function log( $subType ) {
461461 if ( $this->log ) {
462 - if ( class_exists( 'ManualLogEntry' ) ) {
463 - $info = $this->getLogInfo( $subType );
464 -
465 - if ( $info !== false ) {
 462+ $info = $this->getLogInfo( $subType );
 463+ $user = array_key_exists( 'user', $info ) ? $info['user'] : $GLOBALS['wgUser'];
 464+
 465+ if ( $info !== false ) {
 466+ if ( false && class_exists( 'ManualLogEntry' ) ) {
466467 $logEntry = new ManualLogEntry( $info['type'], $subType );
467 -
468 - $logEntry->setPerformer( array_key_exists( 'user', $info ) ? $info['user'] : $GLOBALS['wgUser'] );
 468+
 469+ $logEntry->setPerformer( $user );
469470 $logEntry->setTarget( $info['title'] );
470 -
 471+
 472+ if ( array_key_exists( 'comment', $info ) ) {
 473+ $logEntry->setComment( $info['comment'] );
 474+ }
 475+
471476 $logid = $logEntry->insert();
472477 $logEntry->publish( $logid );
473478 }
 479+ else {
 480+ $log = new LogPage( $info['type'] );
 481+
 482+ $log->addEntry(
 483+ $subType,
 484+ $info['title'],
 485+ array_key_exists( 'comment', $info ) ? $info['comment'] : '',
 486+ array(),
 487+ $user
 488+ );
 489+ }
474490 }
475 - else {
476 - // TODO
477 - }
478491 }
479492 }
480493

Follow-up revisions

RevisionCommit summaryAuthorDate
r108973Follow up to r108969; more compat stuffjeroendedauw13:26, 15 January 2012

Status & tagging log