Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -153,29 +153,39 @@ |
154 | 154 | $wgLogTypes[] = 'ambassador'; |
155 | 155 | $wgLogTypes[] = 'instructor'; |
156 | 156 | |
157 | | -$wgLogActionsHandlers['institution/*'] = 'LogFormatter'; |
158 | | -$wgLogActionsHandlers['course/*'] = 'LogFormatter'; |
159 | | -$wgLogActionsHandlers['term/*'] = 'LogFormatter'; |
160 | | -$wgLogActionsHandlers['student/*'] = 'LogFormatter'; |
161 | | -$wgLogActionsHandlers['ambassador/*'] = 'LogFormatter'; |
162 | | -$wgLogActionsHandlers['instructor/*'] = 'LogFormatter'; |
| 157 | +if ( array_key_exists( 'LogFormatter', $wgAutoloadClasses ) ) { |
| 158 | + $wgLogActionsHandlers['institution/*'] = 'LogFormatter'; |
| 159 | + $wgLogActionsHandlers['course/*'] = 'LogFormatter'; |
| 160 | + $wgLogActionsHandlers['term/*'] = 'LogFormatter'; |
| 161 | + $wgLogActionsHandlers['student/*'] = 'LogFormatter'; |
| 162 | + $wgLogActionsHandlers['ambassador/*'] = 'LogFormatter'; |
| 163 | + $wgLogActionsHandlers['instructor/*'] = 'LogFormatter'; |
| 164 | +} |
| 165 | +else { |
| 166 | + // Compatibility with MediaWiki 1.18. |
| 167 | + foreach ( array( 'institution', 'course', 'term', 'student', 'ambassador', 'instructor' ) as $type ) { |
| 168 | + foreach ( array( 'add', 'remove', 'update' ) as $action ) { |
| 169 | + $wgLogActionsHandlers[$type . '/' . $action] = 'EPHooks::formatLogEntry'; |
| 170 | + } |
| 171 | + } |
| 172 | + |
| 173 | + // Compatibility with MediaWiki 1.18. |
| 174 | + $wgLogNames['institution'] = 'log-name-institution'; |
| 175 | + $wgLogNames['course'] = 'log-name-course'; |
| 176 | + $wgLogNames['term'] = 'log-name-term'; |
| 177 | + $wgLogNames['student'] = 'log-name-student'; |
| 178 | + $wgLogNames['ambassador'] = 'log-name-ambassador'; |
| 179 | + $wgLogNames['instructor'] = 'log-name-instructor'; |
| 180 | + |
| 181 | + // Compatibility with MediaWiki 1.18. |
| 182 | + $wgLogHeaders['institution'] = 'log-header-institution'; |
| 183 | + $wgLogHeaders['course'] = 'log-header-course'; |
| 184 | + $wgLogHeaders['term'] = 'log-header-term'; |
| 185 | + $wgLogHeaders['student'] = 'log-header-student'; |
| 186 | + $wgLogHeaders['ambassador'] = 'log-header-ambassador'; |
| 187 | + $wgLogHeaders['instructor'] = 'log-header-instructor'; |
| 188 | +} |
163 | 189 | |
164 | | -// Compatibility with MediaWiki 1.18. |
165 | | -$wgLogNames['institution'] = 'log-name-institution'; |
166 | | -$wgLogNames['course'] = 'log-name-course'; |
167 | | -$wgLogNames['term'] = 'log-name-term'; |
168 | | -$wgLogNames['student'] = 'log-name-student'; |
169 | | -$wgLogNames['ambassador'] = 'log-name-ambassador'; |
170 | | -$wgLogNames['instructor'] = 'log-name-instructor'; |
171 | | - |
172 | | -// Compatibility with MediaWiki 1.18. |
173 | | -$wgLogHeaders['institution'] = 'log-header-institution'; |
174 | | -$wgLogHeaders['course'] = 'log-header-course'; |
175 | | -$wgLogHeaders['term'] = 'log-header-term'; |
176 | | -$wgLogHeaders['student'] = 'log-header-student'; |
177 | | -$wgLogHeaders['ambassador'] = 'log-header-ambassador'; |
178 | | -$wgLogHeaders['instructor'] = 'log-header-instructor'; |
179 | | - |
180 | 190 | $wgAvailableRights[] = 'ep-org'; // Manage orgs |
181 | 191 | $wgAvailableRights[] = 'ep-course'; // Manage courses |
182 | 192 | $wgAvailableRights[] = 'ep-term'; // Manage terms |
Index: trunk/extensions/EducationProgram/EducationProgram.hooks.php |
— | — | @@ -136,5 +136,28 @@ |
137 | 137 | |
138 | 138 | return true; |
139 | 139 | } |
| 140 | + |
| 141 | + /** |
| 142 | + * Handles formatting of log entries for MediaWiki 1.18.x. |
| 143 | + * |
| 144 | + * @since 0.1 |
| 145 | + * |
| 146 | + * @param string $type |
| 147 | + * @param string $action |
| 148 | + * @param Title $title |
| 149 | + * @param boolean|null $forUI |
| 150 | + * @param array $params |
| 151 | + * |
| 152 | + * @return string |
| 153 | + */ |
| 154 | + public static function formatLogEntry( $type, $action, Title $title, $forUI, array $params ) { |
| 155 | + global $wgContLang, $wgLang; |
| 156 | + |
| 157 | + return wfMessage( 'logentry-' . $type . '-' . $action )->params( |
| 158 | + '', // User link in the new system |
| 159 | + '#', // User name for gender in the new system |
| 160 | + Message::rawParam( $forUI ? Linker::link( $title ) : $title->getPrefixedText() ) |
| 161 | + )->inLanguage( $forUI === null ? $wgContLang : $wgLang )->text(); |
| 162 | + } |
140 | 163 | |
141 | 164 | } |