| Index: trunk/extensions/EducationProgram/EducationProgram.php |
| — | — | @@ -29,8 +29,8 @@ |
| 30 | 30 | die( 'Not an entry point.' ); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | | -if ( version_compare( $wgVersion, '1.18c', '<' ) ) { // Needs to be 1.18c because version_compare() works in confusing ways. |
| 34 | | - die( '<b>Error:</b> Education Program requires MediaWiki 1.18 or above.' ); |
| | 33 | +if ( version_compare( $wgVersion, '1.19c', '<' ) ) { // Needs to be 1.19c because version_compare() works in confusing ways. |
| | 34 | + die( '<b>Error:</b> Education Program requires MediaWiki 1.19 or above.' ); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | if ( !array_key_exists( 'CountryNames', $wgAutoloadClasses ) ) { // No version constant to check against :/ |
| — | — | @@ -177,45 +177,12 @@ |
| 178 | 178 | $wgLogTypes[] = 'campus'; |
| 179 | 179 | $wgLogTypes[] = 'instructor'; |
| 180 | 180 | |
| 181 | | -if ( array_key_exists( 'LogFormatter', $wgAutoloadLocalClasses ) ) { |
| 182 | | - $wgLogActionsHandlers['institution/*'] = 'EPLogFormatter'; |
| 183 | | - $wgLogActionsHandlers['course/*'] = 'EPLogFormatter'; |
| 184 | | - $wgLogActionsHandlers['student/*'] = 'EPLogFormatter'; |
| 185 | | - $wgLogActionsHandlers['online/*'] = 'EPLogFormatter'; |
| 186 | | - $wgLogActionsHandlers['campus/*'] = 'EPLogFormatter'; |
| 187 | | - $wgLogActionsHandlers['instructor/*'] = 'EPLogFormatter'; |
| 188 | | -} |
| 189 | | -else { |
| 190 | | - // Compatibility with MediaWiki 1.18. |
| 191 | | - foreach ( array( 'institution', 'course' ) as $type ) { |
| 192 | | - foreach ( array( 'add', 'remove', 'update' ) as $action ) { |
| 193 | | - $wgLogActionsHandlers[$type . '/' . $action] = 'EPHooks::formatLogEntry'; |
| 194 | | - } |
| 195 | | - } |
| 196 | | - |
| 197 | | - foreach ( array( 'instructor', 'ambassador' ) as $type ) { |
| 198 | | - foreach ( array( 'add', 'remove', 'selfadd', 'selfremove' ) as $action ) { |
| 199 | | - $wgLogActionsHandlers[$type . '/' . $action] = 'EPHooks::formatLogEntry'; |
| 200 | | - } |
| 201 | | - } |
| 202 | | - |
| 203 | | - $wgLogActionsHandlers['student/enroll'] = 'EPHooks::formatLogEntry'; |
| 204 | | - $wgLogActionsHandlers['student/remove'] = 'EPHooks::formatLogEntry'; |
| 205 | | - |
| 206 | | - // Compatibility with MediaWiki 1.18. |
| 207 | | - $wgLogNames['institution'] = 'log-name-institution'; |
| 208 | | - $wgLogNames['course'] = 'log-name-course'; |
| 209 | | - $wgLogNames['student'] = 'log-name-student'; |
| 210 | | - $wgLogNames['ambassador'] = 'log-name-ambassador'; |
| 211 | | - $wgLogNames['instructor'] = 'log-name-instructor'; |
| 212 | | - |
| 213 | | - // Compatibility with MediaWiki 1.18. |
| 214 | | - $wgLogHeaders['institution'] = 'log-header-institution'; |
| 215 | | - $wgLogHeaders['course'] = 'log-header-course'; |
| 216 | | - $wgLogHeaders['student'] = 'log-header-student'; |
| 217 | | - $wgLogHeaders['ambassador'] = 'log-header-ambassador'; |
| 218 | | - $wgLogHeaders['instructor'] = 'log-header-instructor'; |
| 219 | | -} |
| | 181 | +$wgLogActionsHandlers['institution/*'] = 'EPLogFormatter'; |
| | 182 | +$wgLogActionsHandlers['course/*'] = 'EPLogFormatter'; |
| | 183 | +$wgLogActionsHandlers['student/*'] = 'EPLogFormatter'; |
| | 184 | +$wgLogActionsHandlers['online/*'] = 'EPLogFormatter'; |
| | 185 | +$wgLogActionsHandlers['campus/*'] = 'EPLogFormatter'; |
| | 186 | +$wgLogActionsHandlers['instructor/*'] = 'EPLogFormatter'; |
| 220 | 187 | |
| 221 | 188 | // Rights |
| 222 | 189 | $wgAvailableRights[] = 'ep-org'; // Manage orgs |
| Index: trunk/extensions/EducationProgram/includes/EPUtils.php |
| — | — | @@ -25,35 +25,21 @@ |
| 26 | 26 | $user = array_key_exists( 'user', $info ) ? $info['user'] : $GLOBALS['wgUser']; |
| 27 | 27 | |
| 28 | 28 | if ( $info !== false ) { |
| 29 | | - if ( class_exists( 'ManualLogEntry' ) ) { |
| 30 | | - $logEntry = new ManualLogEntry( $info['type'], $info['subtype'] ); |
| | 29 | + $logEntry = new ManualLogEntry( $info['type'], $info['subtype'] ); |
| 31 | 30 | |
| 32 | | - $logEntry->setPerformer( $user ); |
| 33 | | - $logEntry->setTarget( $info['title'] ); |
| 34 | | - |
| 35 | | - if ( array_key_exists( 'comment', $info ) ) { |
| 36 | | - $logEntry->setComment( $info['comment'] ); |
| 37 | | - } |
| 38 | | - |
| 39 | | - if ( array_key_exists( 'parameters', $info ) ) { |
| 40 | | - $logEntry->setParameters( $info['parameters'] ); |
| 41 | | - } |
| 42 | | - |
| 43 | | - $logid = $logEntry->insert(); |
| 44 | | - $logEntry->publish( $logid ); |
| | 31 | + $logEntry->setPerformer( $user ); |
| | 32 | + $logEntry->setTarget( $info['title'] ); |
| | 33 | + |
| | 34 | + if ( array_key_exists( 'comment', $info ) ) { |
| | 35 | + $logEntry->setComment( $info['comment'] ); |
| 45 | 36 | } |
| 46 | | - else { |
| 47 | | - // Compatibility with MediaWiki 1.18. |
| 48 | | - $log = new LogPage( $info['type'] ); |
| 49 | | - |
| 50 | | - $log->addEntry( |
| 51 | | - $info['subtype'], |
| 52 | | - $info['title'], |
| 53 | | - array_key_exists( 'comment', $info ) ? $info['comment'] : '', |
| 54 | | - array_key_exists( 'parameters', $info ) ? $info['parameters'] : array(), |
| 55 | | - $user |
| 56 | | - ); |
| | 37 | + |
| | 38 | + if ( array_key_exists( 'parameters', $info ) ) { |
| | 39 | + $logEntry->setParameters( $info['parameters'] ); |
| 57 | 40 | } |
| | 41 | + |
| | 42 | + $logid = $logEntry->insert(); |
| | 43 | + $logEntry->publish( $logid ); |
| 58 | 44 | } |
| 59 | 45 | } |
| 60 | 46 | |
| Index: trunk/extensions/EducationProgram/EducationProgram.hooks.php |
| — | — | @@ -116,39 +116,6 @@ |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | | - * Handles formatting of log entries for MediaWiki 1.18.x. |
| 121 | | - * |
| 122 | | - * @since 0.1 |
| 123 | | - * |
| 124 | | - * @param string $type |
| 125 | | - * @param string $action |
| 126 | | - * @param Title $title |
| 127 | | - * @param boolean|null $forUI |
| 128 | | - * @param array $params |
| 129 | | - * |
| 130 | | - * @return string |
| 131 | | - */ |
| 132 | | - public static function formatLogEntry( $type, $action, Title $title, $forUI, array $params ) { |
| 133 | | - global $wgContLang, $wgLang; |
| 134 | | - |
| 135 | | - $message = wfMessage( 'logentry-' . $type . '-' . $action ); |
| 136 | | - |
| 137 | | - $message = call_user_func_array( |
| 138 | | - array( $message, 'params' ), |
| 139 | | - array_merge( |
| 140 | | - array( |
| 141 | | - '', // User link in the new system |
| 142 | | - '#', // User name for gender in the new system |
| 143 | | - Message::rawParam( $forUI ? Linker::link( $title ) : $title->getPrefixedText() ) |
| 144 | | - ), |
| 145 | | - $params |
| 146 | | - ) |
| 147 | | - ); |
| 148 | | - |
| 149 | | - return $message->inLanguage( $forUI === null ? $wgContLang : $wgLang )->text(); |
| 150 | | - } |
| 151 | | - |
| 152 | | - /** |
| 153 | 120 | * Called to determine the class to handle the article rendering, based on title. |
| 154 | 121 | * @see https://www.mediawiki.org/wiki/Manual:Hooks/ArticleFromTitle |
| 155 | 122 | * |