r111262 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111261‎ | r111262 | r111263 >
Date:21:29, 11 February 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
var rename and comment out inclusion of dbdataobject
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/DBDataObject.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -73,9 +73,9 @@
7474 $wgAutoloadClasses['ApiEnlist'] = dirname( __FILE__ ) . '/api/ApiEnlist.php';
7575 $wgAutoloadClasses['ApiRefreshEducation'] = dirname( __FILE__ ) . '/api/ApiRefreshEducation.php';
7676
 77+// $wgAutoloadClasses['DBDataObject'] = dirname( __FILE__ ) . '/includes/DBDataObject.php';
7778 $wgAutoloadClasses['EPCourse'] = dirname( __FILE__ ) . '/includes/EPCourse.php';
7879 $wgAutoloadClasses['EPCoursePager'] = dirname( __FILE__ ) . '/includes/EPCoursePager.php';
79 -$wgAutoloadClasses['DBDataObject'] = dirname( __FILE__ ) . '/includes/DBDataObject.php';
8080 $wgAutoloadClasses['EPInstructor'] = dirname( __FILE__ ) . '/includes/EPInstructor.php';
8181 $wgAutoloadClasses['EPLogFormatter'] = dirname( __FILE__ ) . '/includes/EPLogFormatter.php';
8282 $wgAutoloadClasses['EPOrg'] = dirname( __FILE__ ) . '/includes/EPOrg.php';
@@ -151,15 +151,15 @@
152152 $wgSpecialPageGroups['OnlineAmbassadorProfile'] = 'education';
153153
154154 // DB object classes
155 -$egDBDataObjects = array();
156 -$egDBDataObjects['EPRevision'] = array( 'table' => 'ep_revisions', 'prefix' => 'rev_' );
157 -$egDBDataObjects['EPOrg'] = array( 'table' => 'ep_orgs', 'prefix' => 'org_' );
158 -$egDBDataObjects['EPCourse'] = array( 'table' => 'ep_courses', 'prefix' => 'course_' );
159 -$egDBDataObjects['EPStudent'] = array( 'table' => 'ep_students', 'prefix' => 'student_' );
160 -$egDBDataObjects['EPOA'] = array( 'table' => 'ep_oas', 'prefix' => 'oa_' );
161 -$egDBDataObjects['EPCA'] = array( 'table' => 'ep_cas', 'prefix' => 'ca_' );
162 -$egDBDataObjects['EPArticle'] = array( 'table' => 'ep_articles', 'prefix' => 'article_' );
163 -$egDBDataObjects[] = array( 'table' => 'ep_users_per_course', 'prefix' => 'upc_' );
 155+$wgDBDataObjects = array();
 156+$wgDBDataObjects['EPRevision'] = array( 'table' => 'ep_revisions', 'prefix' => 'rev_' );
 157+$wgDBDataObjects['EPOrg'] = array( 'table' => 'ep_orgs', 'prefix' => 'org_' );
 158+$wgDBDataObjects['EPCourse'] = array( 'table' => 'ep_courses', 'prefix' => 'course_' );
 159+$wgDBDataObjects['EPStudent'] = array( 'table' => 'ep_students', 'prefix' => 'student_' );
 160+$wgDBDataObjects['EPOA'] = array( 'table' => 'ep_oas', 'prefix' => 'oa_' );
 161+$wgDBDataObjects['EPCA'] = array( 'table' => 'ep_cas', 'prefix' => 'ca_' );
 162+$wgDBDataObjects['EPArticle'] = array( 'table' => 'ep_articles', 'prefix' => 'article_' );
 163+$wgDBDataObjects[] = array( 'table' => 'ep_users_per_course', 'prefix' => 'upc_' );
164164
165165 define( 'EP_STUDENT', 0 );
166166 define( 'EP_INSTRUCTOR', 1 );
Index: trunk/extensions/EducationProgram/includes/DBDataObject.php
@@ -17,9 +17,9 @@
1818 * * loadSummaryFields
1919 * * getSummaryFields
2020 *
21 - * Deriving classes must register their table and field prefix in $egDBDataObjects.
22 - * Syntax: $egDBDataObjects['DrivingClassName'] = array( 'table' => 'table_name', 'prefix' => 'fieldprefix_' );
23 - * Example: $egDBDataObjects['EPOrg'] = array( 'table' => 'ep_orgs', 'prefix' => 'org_' );
 21+ * Deriving classes must register their table and field prefix in $wgDBDataObjects.
 22+ * Syntax: $wgDBDataObjects['DrivingClassName'] = array( 'table' => 'table_name', 'prefix' => 'fieldprefix_' );
 23+ * Example: $wgDBDataObjects['EPOrg'] = array( 'table' => 'ep_orgs', 'prefix' => 'org_' );
2424 *
2525 * Main instance methods:
2626 * * getField(s)
@@ -96,12 +96,12 @@
9797 * @return string
9898 */
9999 public static function getDBTable() {
100 - global $egDBDataObjects;
101 - if ( array_key_exists( get_called_class(), $egDBDataObjects ) ) {
102 - return $egDBDataObjects[get_called_class()]['table'];
 100+ global $wgDBDataObjects;
 101+ if ( array_key_exists( get_called_class(), $wgDBDataObjects ) ) {
 102+ return $wgDBDataObjects[get_called_class()]['table'];
103103 }
104104 else {
105 - throw new MWException( 'Class "' . get_called_class() . '" not found in $egDBDataObjects' );
 105+ throw new MWException( 'Class "' . get_called_class() . '" not found in $wgDBDataObjects' );
106106 }
107107 }
108108
@@ -114,12 +114,12 @@
115115 * @return string
116116 */
117117 protected static function getFieldPrefix() {
118 - global $egDBDataObjects;
119 - if ( array_key_exists( get_called_class(), $egDBDataObjects ) ) {
120 - return $egDBDataObjects[get_called_class()]['prefix'];
 118+ global $wgDBDataObjects;
 119+ if ( array_key_exists( get_called_class(), $wgDBDataObjects ) ) {
 120+ return $wgDBDataObjects[get_called_class()]['prefix'];
121121 }
122122 else {
123 - throw new MWException( 'Class "' . get_called_class() . '" not found in $egDBDataObjects' );
 123+ throw new MWException( 'Class "' . get_called_class() . '" not found in $wgDBDataObjects' );
124124 }
125125 }
126126
@@ -681,7 +681,7 @@
682682 * Takes in a field and returns an it's prefixed version, ready for db usage.
683683 * If the field needs to be prefixed for another table, provide an array in the form
684684 * array( 'tablename', 'fieldname' )
685 - * Where table name is registered in $egDBDataObjects.
 685+ * Where table name is registered in $wgDBDataObjects.
686686 *
687687 * @since 0.1
688688 *
@@ -694,7 +694,7 @@
695695 static $prefixes = false;
696696
697697 if ( $prefixes === false ) {
698 - foreach ( $GLOBALS['egDBDataObjects'] as $classInfo ) {
 698+ foreach ( $GLOBALS['wgDBDataObjects'] as $classInfo ) {
699699 $prefixes[$classInfo['table']] = $classInfo['prefix'];
700700 }
701701 }

Status & tagging log