Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -73,9 +73,9 @@ |
74 | 74 | $wgAutoloadClasses['ApiEnlist'] = dirname( __FILE__ ) . '/api/ApiEnlist.php'; |
75 | 75 | $wgAutoloadClasses['ApiRefreshEducation'] = dirname( __FILE__ ) . '/api/ApiRefreshEducation.php'; |
76 | 76 | |
| 77 | +// $wgAutoloadClasses['DBDataObject'] = dirname( __FILE__ ) . '/includes/DBDataObject.php'; |
77 | 78 | $wgAutoloadClasses['EPCourse'] = dirname( __FILE__ ) . '/includes/EPCourse.php'; |
78 | 79 | $wgAutoloadClasses['EPCoursePager'] = dirname( __FILE__ ) . '/includes/EPCoursePager.php'; |
79 | | -$wgAutoloadClasses['DBDataObject'] = dirname( __FILE__ ) . '/includes/DBDataObject.php'; |
80 | 80 | $wgAutoloadClasses['EPInstructor'] = dirname( __FILE__ ) . '/includes/EPInstructor.php'; |
81 | 81 | $wgAutoloadClasses['EPLogFormatter'] = dirname( __FILE__ ) . '/includes/EPLogFormatter.php'; |
82 | 82 | $wgAutoloadClasses['EPOrg'] = dirname( __FILE__ ) . '/includes/EPOrg.php'; |
— | — | @@ -151,15 +151,15 @@ |
152 | 152 | $wgSpecialPageGroups['OnlineAmbassadorProfile'] = 'education'; |
153 | 153 | |
154 | 154 | // 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_' ); |
164 | 164 | |
165 | 165 | define( 'EP_STUDENT', 0 ); |
166 | 166 | define( 'EP_INSTRUCTOR', 1 ); |
Index: trunk/extensions/EducationProgram/includes/DBDataObject.php |
— | — | @@ -17,9 +17,9 @@ |
18 | 18 | * * loadSummaryFields |
19 | 19 | * * getSummaryFields |
20 | 20 | * |
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_' ); |
24 | 24 | * |
25 | 25 | * Main instance methods: |
26 | 26 | * * getField(s) |
— | — | @@ -96,12 +96,12 @@ |
97 | 97 | * @return string |
98 | 98 | */ |
99 | 99 | 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']; |
103 | 103 | } |
104 | 104 | 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' ); |
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
— | — | @@ -114,12 +114,12 @@ |
115 | 115 | * @return string |
116 | 116 | */ |
117 | 117 | 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']; |
121 | 121 | } |
122 | 122 | 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' ); |
124 | 124 | } |
125 | 125 | } |
126 | 126 | |
— | — | @@ -681,7 +681,7 @@ |
682 | 682 | * Takes in a field and returns an it's prefixed version, ready for db usage. |
683 | 683 | * If the field needs to be prefixed for another table, provide an array in the form |
684 | 684 | * array( 'tablename', 'fieldname' ) |
685 | | - * Where table name is registered in $egDBDataObjects. |
| 685 | + * Where table name is registered in $wgDBDataObjects. |
686 | 686 | * |
687 | 687 | * @since 0.1 |
688 | 688 | * |
— | — | @@ -694,7 +694,7 @@ |
695 | 695 | static $prefixes = false; |
696 | 696 | |
697 | 697 | if ( $prefixes === false ) { |
698 | | - foreach ( $GLOBALS['egDBDataObjects'] as $classInfo ) { |
| 698 | + foreach ( $GLOBALS['wgDBDataObjects'] as $classInfo ) { |
699 | 699 | $prefixes[$classInfo['table']] = $classInfo['prefix']; |
700 | 700 | } |
701 | 701 | } |