Index: trunk/phase3/RELEASE-NOTES-1.19 |
— | — | @@ -27,6 +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 | 33 | |
32 | 34 | === New features in 1.19 === |
33 | 35 | * BREAKING CHANGE: action=watch / action=unwatch now requires a token. |
Index: trunk/phase3/includes/Collation.php |
— | — | @@ -26,7 +26,18 @@ |
27 | 27 | case 'uca-default': |
28 | 28 | return new IcuCollation( 'root' ); |
29 | 29 | default: |
30 | | - throw new MWException( __METHOD__.": unknown collation type \"$collationName\"" ); |
| 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\"" ); |
| 41 | + } |
31 | 42 | } |
32 | 43 | } |
33 | 44 | |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -4731,6 +4731,9 @@ |
4732 | 4732 | * |
4733 | 4733 | * After you change this, you must run maintenance/updateCollation.php to fix |
4734 | 4734 | * the sort keys in the database. |
| 4735 | + * |
| 4736 | + * Extensions can define there own collations by subclassing Collation |
| 4737 | + * and using the class name as the value of this variable. |
4735 | 4738 | */ |
4736 | 4739 | $wgCategoryCollation = 'uppercase'; |
4737 | 4740 | |