r112407 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112406‎ | r112407 | r112408 >
Date:19:40, 25 February 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixed error when viewing old rev and some cleanup
Modified paths:
  • /trunk/extensions/EducationProgram/actions/EPViewAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPCourses.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrgs.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPPageTable.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/actions/EPViewAction.php
@@ -48,7 +48,7 @@
4949 $currentObject = $this->table->get( $name, 'id' );
5050
5151 if ( $currentObject !== false ) {
52 - $rev = EPRevision::selectRow( null, array(
 52+ $rev = EPRevisions::singleton()->selectRow( null, array(
5353 'id' => $this->getRequest()->getInt( 'revid' ),
5454 'object_id' => $currentObject->getField( 'id' )
5555 ) );
Index: trunk/extensions/EducationProgram/includes/EPOrgs.php
@@ -13,6 +13,19 @@
1414 */
1515 class EPOrgs extends EPPageTable {
1616
 17+ protected static $info = array(
 18+ 'ns' => EP_NS_INSTITUTION,
 19+ 'actions' => array(
 20+ 'view' => false,
 21+ 'edit' => 'ep-org',
 22+ 'history' => false,
 23+ ),
 24+ 'edit-right' => 'ep-org',
 25+ 'identifier' => 'name',
 26+ 'list' => 'Institutions',
 27+ 'log-type' => 'institution',
 28+ );
 29+
1730 /**
1831 * (non-PHPdoc)
1932 * @see DBTable::getDBTable()
Index: trunk/extensions/EducationProgram/includes/EPPageTable.php
@@ -13,47 +13,18 @@
1414 */
1515 abstract class EPPageTable extends DBTable {
1616
17 - // TODO
18 - protected static $info = array(
19 - 'EPCourses' => array(
20 - 'ns' => EP_NS_COURSE,
21 - 'actions' => array(
22 - 'view' => false,
23 - 'edit' => 'ep-course',
24 - 'history' => false,
25 - 'enroll' => 'ep-enroll',
26 - ),
27 - 'edit-right' => 'ep-course',
28 - 'identifier' => 'name',
29 - 'list' => 'Courses',
30 - 'log-type' => 'course',
31 - ),
32 - 'EPOrgs' => array(
33 - 'ns' => EP_NS_INSTITUTION,
34 - 'actions' => array(
35 - 'view' => false,
36 - 'edit' => 'ep-org',
37 - 'history' => false,
38 - ),
39 - 'edit-right' => 'ep-org',
40 - 'identifier' => 'name',
41 - 'list' => 'Institutions',
42 - 'log-type' => 'institution',
43 - ),
44 - );
45 -
4617 public function getIdentifierField() {
47 - return self::$info[get_called_class()]['identifier'];
 18+ return static::$info['identifier'];
4819 }
4920
5021 public function getEditRight() {
51 - return self::$info[get_called_class()]['edit-right'];
 22+ return static::$info['edit-right'];
5223 }
5324
5425 public static function getTitleFor( $identifierValue ) {
5526 return Title::newFromText(
5627 $identifierValue,
57 - self::$info[get_called_class()]['ns']
 28+ static::$info['ns']
5829 );
5930 }
6031
@@ -79,7 +50,7 @@
8051 }
8152
8253 public function getListPage() {
83 - return self::$info[get_called_class()]['list'];
 54+ return static::$info['list'];
8455 }
8556
8657 /**
@@ -117,13 +88,13 @@
11889 */
11990 public function getLogInfoForTitle( Title $title ) {
12091 return array(
121 - 'type' => self::$info[get_called_class()]['log-type'],
 92+ 'type' => static::$info['log-type'],
12293 'title' => $title,
12394 );
12495 }
12596
12697 public static function getTypeForNS( $ns ) {
127 - foreach ( self::$info as $type => $info ) {
 98+ foreach ( static::$info as $type => $info ) {
12899 if ( $info['ns'] === $ns ) {
129100 return $type;
130101 }
@@ -146,7 +117,7 @@
147118
148119 LogEventsList::showLogExtract(
149120 $out,
150 - array( self::$info[get_called_class()]['log-type'] ),
 121+ array( static::$info['log-type'] ),
151122 $context->getTitle(),
152123 '',
153124 array(
Index: trunk/extensions/EducationProgram/includes/EPCourses.php
@@ -13,6 +13,20 @@
1414 */
1515 class EPCourses extends EPPageTable {
1616
 17+ protected static $info = array(
 18+ 'ns' => EP_NS_COURSE,
 19+ 'actions' => array(
 20+ 'view' => false,
 21+ 'edit' => 'ep-course',
 22+ 'history' => false,
 23+ 'enroll' => 'ep-enroll',
 24+ ),
 25+ 'edit-right' => 'ep-course',
 26+ 'identifier' => 'name',
 27+ 'list' => 'Courses',
 28+ 'log-type' => 'course',
 29+ );
 30+
1731 /**
1832 * (non-PHPdoc)
1933 * @see DBTable::getDBTable()

Status & tagging log