Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -27,8 +27,8 @@ |
28 | 28 | was removed in about 1.5. |
29 | 29 | * LogPageValidTypes, LogPageLogName, LogPageLogHeader and LogPageActionText |
30 | 30 | hooks have been removed. |
31 | | -* $wgCategoryCollation can now use a class name as its value, in order for |
32 | | - extensions to be able to define new collations |
| 31 | +* New hook "Collation::factory" to allow extensions to create custom |
| 32 | + category collations. |
33 | 33 | |
34 | 34 | === New features in 1.19 === |
35 | 35 | * BREAKING CHANGE: action=watch / action=unwatch now requires a token. |
Index: trunk/phase3/includes/Collation.php |
— | — | @@ -27,17 +27,16 @@ |
28 | 28 | return new IcuCollation( 'root' ); |
29 | 29 | default: |
30 | 30 | # Provide a mechanism for extensions to hook in. |
31 | | - if ( class_exists( $collationName ) ) { |
32 | | - $collationObject = new $collationName; |
33 | | - if ( $collationObject instanceof Collation ) { |
34 | | - return $collationObject; |
35 | | - } else { |
36 | | - throw new MWException( __METHOD__.": collation type \"$collationName\"" |
37 | | - . " is not a subclass of Collation." ); |
38 | | - } |
39 | | - } else { |
40 | | - throw new MWException( __METHOD__.": unknown collation type \"$collationName\"" ); |
| 31 | + |
| 32 | + $collationObject = null; |
| 33 | + wfRunHooks( 'Collation::factory', array( $collationName, &$collationObject ) ); |
| 34 | + |
| 35 | + if ( $collationObject instanceof Collation ) { |
| 36 | + return $collationObject; |
41 | 37 | } |
| 38 | + |
| 39 | + // If all else fails... |
| 40 | + throw new MWException( __METHOD__.": unknown collation type \"$collationName\"" ); |
42 | 41 | } |
43 | 42 | } |
44 | 43 | |