Index: trunk/extensions/Wikidata/patches/OmegaWiki.diff |
— | — | @@ -38,41 +38,6 @@ |
39 | 39 | } |
40 | 40 | |
41 | 41 | function do_populate_parent_id() { |
42 | | -Index: includes/Article.php |
43 | | -=================================================================== |
44 | | -+++ includes/Article.php (working copy) |
45 | | -@@ -725,10 +725,29 @@ |
46 | | - public function view() { |
47 | | - global $wgUser, $wgOut, $wgRequest, $wgContLang; |
48 | | - global $wgEnableParserCache, $wgStylePath, $wgParser; |
49 | | -- global $wgUseTrackbacks; |
50 | | -+ global $wgUseTrackbacks, $wgNamespaceRobotPolicies, $wgArticleRobotPolicies, $wgTitle; |
51 | | -+ global $wgDefaultRobotPolicy; |
52 | | - |
53 | | - wfProfileIn( __METHOD__ ); |
54 | | - |
55 | | -+ global $wdHandlerClasses, $wdHandlerPath; |
56 | | -+ $ns = $this->mTitle->getNamespace(); |
57 | | -+ if( array_key_exists( $ns, $wdHandlerClasses ) ) { |
58 | | -+ $handlerClass = $wdHandlerClasses[ $ns ]; |
59 | | -+ $handlerFile = $wdHandlerPath . $handlerClass . '.php'; |
60 | | -+ if( file_exists( $handlerFile ) ) { |
61 | | -+ require_once $handlerFile; |
62 | | -+ $handlerInstance = new $handlerClass(); |
63 | | -+ $handlerInstance->view(); |
64 | | -+ return; |
65 | | -+ } else { |
66 | | -+ $wgOut->showErrorPage( 'namespace_handler_not_found', 'namespace_handler_not_found_error', |
67 | | -+ $handlerFile, $wgContLang->getFormattedNsText( $ns ) ); |
68 | | -+ } |
69 | | -+ } |
70 | | -+ |
71 | | -+ $parserCache = ParserCache::singleton(); |
72 | | -+ |
73 | | - # Get variables from query string |
74 | | - $oldid = $this->getOldID(); |
75 | | - $parserCache = ParserCache::singleton(); |
76 | 42 | Index: includes/SearchEngine.php |
77 | 43 | =================================================================== |
78 | 44 | --- includes/SearchEngine.php (revision 53499) |
— | — | @@ -146,24 +111,7 @@ |
147 | 112 | + if( array_key_exists( $index, $wdHandlerClasses ) ) return false; |
148 | 113 | return !( $index < NS_MAIN || ($index == NS_FILE && !$wgAllowImageMoving) || $index == NS_CATEGORY ); |
149 | 114 | } |
150 | | - |
151 | | -Index: includes/SkinTemplate.php |
152 | | -=================================================================== |
153 | | -+++ includes/SkinTemplate.php (working copy) |
154 | | -@@ -749,10 +749,11 @@ |
155 | | - wfProfileIn( __METHOD__ . '-live' ); |
156 | | - if ( $this->mTitle->exists() ) { |
157 | | - |
158 | | -+ wfRunHooks( 'GetHistoryLinkTrail', array( &$trail ) ); |
159 | | - $content_actions['history'] = array( |
160 | | - 'class' => ($action == 'history') ? 'selected' : false, |
161 | | - 'text' => wfMsg( 'history_short' ), |
162 | | -- 'href' => $this->mTitle->getLocalUrl( 'action=history' ), |
163 | | -+ 'href' => $this->mTitle->getLocalUrl( 'action=history' . $trail ), |
164 | | - 'rel' => 'archives', |
165 | | - ); |
166 | | - |
| 115 | + |
167 | 116 | Index: includes/DefaultSettings.php |
168 | 117 | =================================================================== |
169 | 118 | --- includes/DefaultSettings.php (revision 53499) |
— | — | @@ -208,36 +156,4 @@ |
209 | 157 | /* |
210 | 158 | * Setup page variables. |
211 | 159 | */ |
212 | | -Index: includes/Skin.php |
213 | | -=================================================================== |
214 | | -+++ includes/Skin.php (working copy) |
215 | | -@@ -1650,6 +1650,10 @@ |
216 | | - function editUrlOptions() { |
217 | | - global $wgArticle; |
218 | | - |
219 | | -+ $trail = ''; |
220 | | -+ wfRunHooks( 'GetEditLinkTrail', array( &$trail ) ); |
221 | | -+ # FIXME: $trail should be appended to $return but that is now an array. |
222 | | -+ |
223 | | - $options = array( 'action' => 'edit' ); |
224 | | - |
225 | | - if( $this->mRevisionId && ! $wgArticle->isCurrent() ) { |
226 | | -@@ -1749,6 +1753,10 @@ |
227 | | - } |
228 | | - |
229 | | - function historyLink() { |
230 | | -+ $trail = ''; |
231 | | -+ wfRunHooks( 'GetHistoryLinkTrail', array( &$trail ) ); |
232 | | -+ # FIXME: $trail should be appended to $return but that is now an array. |
233 | | -+ |
234 | | - return $this->link( |
235 | | - $this->mTitle, |
236 | | - wfMsgHtml( 'history' ), |
237 | | -@@ -2086,4 +2094,4 @@ |
238 | | - public function commonPrintStylesheet() { |
239 | | - return true; |
240 | | - } |
241 | | --} |
242 | | -\ No newline at end of file |
243 | | -+} |
| 160 | + |
Index: trunk/extensions/Wikidata/App.php |
— | — | @@ -23,12 +23,17 @@ |
24 | 24 | $wgHooks['BeforePageDisplay'][] = 'addWikidataHeader'; |
25 | 25 | $wgHooks['SkinTemplateTabs'][] = 'modifyTabs'; |
26 | 26 | $wgHooks['GetPreferences'][] = 'wfWikiDataGetPreferences'; |
27 | | -$wgAutoloadClasses['ApiWikiData'] = $dir . '/extensions/Wikidata/includes/api/ApiWikiData.php'; |
28 | | -$wgAutoloadClasses['ApiWikiDataFormatBase'] = $dir . '/extensions/Wikidata/includes/api/ApiWikiDataFormatBase.php'; |
29 | | -$wgAutoloadClasses['ApiWikiDataFormatXml'] = $dir . '/extensions/Wikidata/includes/api/ApiWikiDataFormatXml.php'; |
| 27 | +$wgHooks['ArticleFromTitle'][] = 'efWikidataOverrideArticle'; |
| 28 | +$wgAutoloadClasses['WikidataArticle'] = $dir . 'includes/WikidataArticle.php'; |
| 29 | +$wgAutoloadClasses['ApiWikiData'] = $dir . 'includes/api/ApiWikiData.php'; |
| 30 | +$wgAutoloadClasses['ApiWikiDataFormatBase'] = $dir . 'includes/api/ApiWikiDataFormatBase.php'; |
| 31 | +$wgAutoloadClasses['ApiWikiDataFormatXml'] = $dir . 'includes/api/ApiWikiDataFormatXml.php'; |
30 | 32 | $wgAPIModules['wikidata'] = 'ApiWikiData'; |
31 | 33 | $wgExtensionMessagesFiles['Wikidata'] = $dir . 'SpecialLanguages.i18n.php'; |
32 | 34 | |
| 35 | +# FIXME: Rename this to make Wikidata more agnostic. |
| 36 | +$wgAutoloadClasses['OmegaWiki'] = $dir . 'OmegaWiki/OmegaWiki.php'; |
| 37 | + |
33 | 38 | # FIXME: These should be modified to make Wikidata more reusable. |
34 | 39 | $wgAvailableRights[] = 'editwikidata-uw'; |
35 | 40 | $wgAvailableRights[] = 'wikidata-copy'; |
— | — | @@ -231,3 +236,12 @@ |
232 | 237 | ); |
233 | 238 | return true; |
234 | 239 | } |
| 240 | + |
| 241 | +function efWikidataOverrideArticle( &$title, &$article ) { |
| 242 | + global $wdHandlerClasses; |
| 243 | + $ns = $title->getNamespace(); |
| 244 | + if ( array_key_exists( $ns, $wdHandlerClasses ) ) { |
| 245 | + $article = new WikidataArticle( $title ); |
| 246 | + } |
| 247 | + return true; |
| 248 | +} |
Index: trunk/extensions/Wikidata/includes/WikidataArticle.php |
— | — | @@ -0,0 +1,17 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +class WikidataArticle extends Article { |
| 5 | + |
| 6 | + public function view() { |
| 7 | + wfProfileIn( __METHOD__ ); |
| 8 | + |
| 9 | + global $wdHandlerClasses; |
| 10 | + $ns = $this->mTitle->getNamespace(); |
| 11 | + $handlerClass = $wdHandlerClasses[ $ns ]; |
| 12 | + $handlerInstance = new $handlerClass(); |
| 13 | + $handlerInstance->view(); |
| 14 | + |
| 15 | + wfProfileOut( __METHOD__ ); |
| 16 | + } |
| 17 | + |
| 18 | +} |