Index: trunk/extensions/CategoryMultisortChinese/CategoryMultisortChinese.hooks.php |
— | — | @@ -16,12 +16,27 @@ |
17 | 17 | } |
18 | 18 | } |
19 | 19 | |
| 20 | + function onCategoryMultisortSortkeys_loadData() { |
| 21 | + $file = dirname( __FILE__ ) . '/CategoryMultisortChinese.dat'; |
| 22 | + |
| 23 | + if ( file_exists( $file ) ) { |
| 24 | + $data = unserialize( file_get_contents( $file ) ); |
| 25 | + if ( $data ) { |
| 26 | + return $data; |
| 27 | + } |
| 28 | + } |
| 29 | + |
| 30 | + $data = new CategoryMultisortChineseData(); |
| 31 | + file_put_contents( $file, serialize( $data ) ); |
| 32 | + return $data; |
| 33 | + } |
| 34 | + |
20 | 35 | function onCategoryMultisortSortkeys( $parser, $category, &$categoryMultisorts ) { |
21 | 36 | global $wgContLang; |
22 | 37 | |
23 | 38 | static $data = null; |
24 | 39 | if ( is_null( $data ) ) { |
25 | | - $data = new CategoryMultisortChineseData(); |
| 40 | + $data = $this->onCategoryMultisortSortkeys_loadData(); |
26 | 41 | } |
27 | 42 | |
28 | 43 | $title = $parser->getTitle(); |