r106680 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106679‎ | r106680 | r106681 >
Date:20:08, 19 December 2011
Author:jeroendedauw
Status:deferred (Comments)
Tags:educationprogram 
Comment:
Follow up to r106673; rem dead code and fix obtaining of caller class name, which is not what __class__ does in methods called using static::
Modified paths:
  • /trunk/extensions/EducationProgram/includes/EPCourse.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPDBObject.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPMentor.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrg.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPStudent.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPTerm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/includes/EPStudent.php
@@ -18,28 +18,6 @@
1919 *
2020 * @since 0.1
2121 *
22 - * @return string
23 - */
24 - public static function getDBTable() {
25 - return 'ep_students';
26 - }
27 -
28 - /**
29 - * @see parent::getFieldTypes
30 - *
31 - * @since 0.1
32 - *
33 - * @return string
34 - */
35 - protected static function getFieldPrefix() {
36 - return 'student_';
37 - }
38 -
39 - /**
40 - * @see parent::getFieldTypes
41 - *
42 - * @since 0.1
43 - *
4422 * @return array
4523 */
4624 protected static function getFieldTypes() {
Index: trunk/extensions/EducationProgram/includes/EPOrg.php
@@ -18,28 +18,6 @@
1919 *
2020 * @since 0.1
2121 *
22 - * @return string
23 - */
24 - public static function getDBTable() {
25 - return 'ep_orgs';
26 - }
27 -
28 - /**
29 - * @see parent::getFieldTypes
30 - *
31 - * @since 0.1
32 - *
33 - * @return string
34 - */
35 - protected static function getFieldPrefix() {
36 - return 'org_';
37 - }
38 -
39 - /**
40 - * @see parent::getFieldTypes
41 - *
42 - * @since 0.1
43 - *
4422 * @return array
4523 */
4624 protected static function getFieldTypes() {
Index: trunk/extensions/EducationProgram/includes/EPTerm.php
@@ -19,28 +19,6 @@
2020 *
2121 * @since 0.1
2222 *
23 - * @return string
24 - */
25 - public static function getDBTable() {
26 - return 'ep_terms';
27 - }
28 -
29 - /**
30 - * @see parent::getFieldTypes
31 - *
32 - * @since 0.1
33 - *
34 - * @return string
35 - */
36 - protected static function getFieldPrefix() {
37 - return 'term_';
38 - }
39 -
40 - /**
41 - * @see parent::getFieldTypes
42 - *
43 - * @since 0.1
44 - *
4523 * @return array
4624 */
4725 protected static function getFieldTypes() {
Index: trunk/extensions/EducationProgram/includes/EPDBObject.php
@@ -48,11 +48,11 @@
4949 */
5050 public static function getDBTable() {
5151 global $egEPDBObjects;
52 - if ( array_key_exists( __CLASS__, $egEPDBObjects ) ) {
53 - return $egEPDBObjects[__CLASS__]['table'];
 52+ if ( array_key_exists( get_called_class(), $egEPDBObjects ) ) {
 53+ return $egEPDBObjects[get_called_class()]['table'];
5454 }
5555 else {
56 - throw new MWException( 'Class "' . __CLASS__ . '" not found in $egEPDBObjects' );
 56+ throw new MWException( 'Class "' . get_called_class() . '" not found in $egEPDBObjects' );
5757 }
5858 }
5959
@@ -66,11 +66,11 @@
6767 */
6868 protected static function getFieldPrefix() {
6969 global $egEPDBObjects;
70 - if ( array_key_exists( __CLASS__, $egEPDBObjects ) ) {
71 - return $egEPDBObjects[__CLASS__]['prefix'];
 70+ if ( array_key_exists( get_called_class(), $egEPDBObjects ) ) {
 71+ return $egEPDBObjects[get_called_class()]['prefix'];
7272 }
7373 else {
74 - throw new MWException( 'Class "' . __CLASS__ . '" not found in $egEPDBObjects' );
 74+ throw new MWException( 'Class "' . get_called_class() . '" not found in $egEPDBObjects' );
7575 }
7676 }
7777
Index: trunk/extensions/EducationProgram/includes/EPCourse.php
@@ -19,28 +19,6 @@
2020 *
2121 * @since 0.1
2222 *
23 - * @return string
24 - */
25 - public static function getDBTable() {
26 - return 'ep_courses';
27 - }
28 -
29 - /**
30 - * @see parent::getFieldTypes
31 - *
32 - * @since 0.1
33 - *
34 - * @return string
35 - */
36 - protected static function getFieldPrefix() {
37 - return 'course_';
38 - }
39 -
40 - /**
41 - * @see parent::getFieldTypes
42 - *
43 - * @since 0.1
44 - *
4523 * @return array
4624 */
4725 protected static function getFieldTypes() {
Index: trunk/extensions/EducationProgram/includes/EPMentor.php
@@ -18,28 +18,6 @@
1919 *
2020 * @since 0.1
2121 *
22 - * @return string
23 - */
24 - public static function getDBTable() {
25 - return 'ep_mentors';
26 - }
27 -
28 - /**
29 - * @see parent::getFieldTypes
30 - *
31 - * @since 0.1
32 - *
33 - * @return string
34 - */
35 - protected static function getFieldPrefix() {
36 - return 'mentor_';
37 - }
38 -
39 - /**
40 - * @see parent::getFieldTypes
41 - *
42 - * @since 0.1
43 - *
4422 * @return array
4523 */
4624 protected static function getFieldTypes() {

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r106673work on special:editCourse and added support for joins to the dbobject classjeroendedauw19:07, 19 December 2011

Comments

#Comment by Nikerabbit (talk | contribs)   08:19, 20 December 2011

Didn't know get_called_class. Seems to be new stuff.

#Comment by Jeroen De Dauw (talk | contribs)   14:45, 20 December 2011

Yeah, since 5.3.

Status & tagging log