Index: trunk/extensions/Wikidata/patches/EditPageHandlerClassSupport.diff |
— | — | @@ -0,0 +1,28 @@ |
| 2 | +Index: EditPage.php |
| 3 | +=================================================================== |
| 4 | +--- EditPage.php (revision 19773) |
| 5 | +@@ -342,6 +342,23 @@ |
| 6 | + wfProfileOut( $fname ); |
| 7 | + return; |
| 8 | + } |
| 9 | ++ |
| 10 | ++ global $wgWikiDataHandlerClasses, $wgWikiDataHandlerPath; |
| 11 | ++ $namespaceId = $this->mTitle->getNamespace(); |
| 12 | ++ if( array_key_exists( $namespaceId, $wgWikiDataHandlerClasses ) ) { |
| 13 | ++ $handlerClass = $wgWikiDataHandlerClasses[ $namespaceId ]; |
| 14 | ++ $handlerFile = $wgWikiDataHandlerPath . $handlerClass . '.php'; |
| 15 | ++ if( file_exists( $handlerFile ) ) { |
| 16 | ++ require_once $handlerFile; |
| 17 | ++ $handlerInstance = new $handlerClass(); |
| 18 | ++ $handlerInstance->edit(); |
| 19 | ++ return; |
| 20 | ++ } else { |
| 21 | ++ $wgOut->showErrorPage( 'namespace_handler_not_found', 'namespace_handler_not_found_error', |
| 22 | ++ $handlerFile, $wgContLang->getFormattedNsText( $namespaceId ) ); |
| 23 | ++ } |
| 24 | ++ } |
| 25 | ++ |
| 26 | + if ( wfReadOnly() ) { |
| 27 | + wfDebug( "$fname: read-only mode is engaged\n" ); |
| 28 | + if( $this->save || $this->preview ) { |
Index: trunk/extensions/Wikidata/patches/ArticleHandlerClassSupport.diff |
— | — | @@ -0,0 +1,35 @@ |
| 2 | +Index: includes/Article.php |
| 3 | +=================================================================== |
| 4 | +--- includes/Article.php (revision 19783) |
| 5 | +@@ -604,13 +604,28 @@ |
| 6 | + function view() { |
| 7 | + global $wgUser, $wgOut, $wgRequest, $wgContLang; |
| 8 | + global $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol, $wgParser; |
| 9 | +- global $wgUseTrackbacks, $wgNamespaceRobotPolicies; |
| 10 | ++ global $wgUseTrackbacks, $wgNamespaceRobotPolicies, $wgTitle; |
| 11 | + $sk = $wgUser->getSkin(); |
| 12 | + |
| 13 | + wfProfileIn( __METHOD__ ); |
| 14 | + |
| 15 | ++ global $wgWikiDataHandlerClasses, $wgWikiDataHandlerPath; |
| 16 | ++ $namespaceId = $this->mTitle->getNamespace(); |
| 17 | ++ if( array_key_exists( $namespaceId, $wgWikiDataHandlerClasses ) ) { |
| 18 | ++ $handlerClass = $wgWikiDataHandlerClasses[ $namespaceId ]; |
| 19 | ++ $handlerFile = $wgWikiDataHandlerPath . $handlerClass . '.php'; |
| 20 | ++ if( file_exists( $handlerFile ) ) { |
| 21 | ++ require_once $handlerFile; |
| 22 | ++ $handlerInstance = new $handlerClass(); |
| 23 | ++ $handlerInstance->view(); |
| 24 | ++ return; |
| 25 | ++ } else { |
| 26 | ++ $wgOut->showErrorPage( 'namespace_handler_not_found', 'namespace_handler_not_found_error', |
| 27 | ++ $handlerFile, $wgContLang->getFormattedNsText( $namespaceId ) ); |
| 28 | ++ } |
| 29 | ++ } |
| 30 | ++ |
| 31 | + $parserCache =& ParserCache::singleton(); |
| 32 | +- $ns = $this->mTitle->getNamespace(); # shortcut |
| 33 | + |
| 34 | + # Get variables from query string |
| 35 | + $oldid = $this->getOldID(); |
Index: trunk/extensions/Wikidata/patches/README.txt |
— | — | @@ -0,0 +1,75 @@ |
| 2 | +This is a set of patches that will allow you to run the Wikidata extension on |
| 3 | +MediaWiki trunk r19772 (i.e. outside of the Wikidata branch). This enables the |
| 4 | +extension to be gradually upgraded to the latest version of MediaWiki. |
| 5 | + |
| 6 | +Currently the API is not working, however when the code is in a state where when |
| 7 | +it is run on latest trunk the API stuff will essentially "fix itself". |
| 8 | + |
| 9 | +The following will also need to be added to LocalSettings.php on OmegaWiki (to |
| 10 | +replace the database namespace manager). $wgNamespaceAliases will begin |
| 11 | +working when the core code reaches r21720. |
| 12 | + |
| 13 | +$wgExtraNamespaces = array( |
| 14 | + 16 => 'Expression', |
| 15 | + 17 => 'Expression_talk', |
| 16 | + 22 => 'Portal', |
| 17 | + 23 => 'Portal_talk', |
| 18 | + 24 => 'DefinedMeaning', |
| 19 | + 25 => 'DefinedMeaning_talk', |
| 20 | + 26 => 'Search', |
| 21 | + 27 => 'Search_talk', |
| 22 | + 28 => 'NeedsTranslationTo', |
| 23 | + 29 => 'NeedsTranslationTo_talk', |
| 24 | + 30 => 'Partner', |
| 25 | + 31 => 'Partner_talk' |
| 26 | +); |
| 27 | + |
| 28 | +$wgNamespaceAliases = array( |
| 29 | + 4 => 'Development_wiki', |
| 30 | + 5 => 'Development_wiki_talk', |
| 31 | + 16 => 'GEMET', |
| 32 | + 17 => 'GEMET_talk', |
| 33 | + 16 => 'WiktionaryZ', |
| 34 | + 17 => 'WiktionaryZ_talk', |
| 35 | +); |
| 36 | + |
| 37 | +$wgNamespacesWithSubpages = array( |
| 38 | + 0 => 0, |
| 39 | + 1 => 1, |
| 40 | + 2 => 1, |
| 41 | + 3 => 1, |
| 42 | + 4 => 0, |
| 43 | + 5 => 1, |
| 44 | + 6 => 0, |
| 45 | + 7 => 1, |
| 46 | + 8 => 0, |
| 47 | + 9 => 1, |
| 48 | + 10 => 0, |
| 49 | + 11 => 1, |
| 50 | + 12 => 0, |
| 51 | + 13 => 1, |
| 52 | + 14 => 0, |
| 53 | + 15 => 1, |
| 54 | + 16 => 0, |
| 55 | + 17 => 1, |
| 56 | + 22 => 0, |
| 57 | + 23 => 1, |
| 58 | + 24 => 0, |
| 59 | + 25 => 1, |
| 60 | + 26 => 0, |
| 61 | + 27 => 1, |
| 62 | + 28 => 0, |
| 63 | + 29 => 1, |
| 64 | + 30 => 0, |
| 65 | + 31 => 1, |
| 66 | +); |
| 67 | + |
| 68 | +$wgMetaNamespace = 'Meta'; |
| 69 | + |
| 70 | +$wgWikiDataHandlerPath = "$IP/extensions/Wikidata/OmegaWiki/"; |
| 71 | +$wgWikiDataHandlerClasses = array( |
| 72 | + 28 => 'NeedsTranslationTo', |
| 73 | + 24 => 'DefinedMeaning', |
| 74 | + 16 => 'OmegaWiki', |
| 75 | + 26 => 'Search' |
| 76 | +); |
Index: trunk/extensions/Wikidata/patches/DefaultGoPrefix.diff |
— | — | @@ -0,0 +1,74 @@ |
| 2 | +Index: includes/SearchEngine.php |
| 3 | +=================================================================== |
| 4 | +--- includes/SearchEngine.php (revision 19784) |
| 5 | +@@ -49,7 +49,7 @@ |
| 6 | + * @private |
| 7 | + */ |
| 8 | + function getNearMatch( $searchterm ) { |
| 9 | +- global $wgContLang; |
| 10 | ++ global $wgContLang, $wgDefaultGoPrefix; |
| 11 | + |
| 12 | + $allSearchTerms = array($searchterm); |
| 13 | + |
| 14 | +@@ -68,6 +68,10 @@ |
| 15 | + return $title; |
| 16 | + } |
| 17 | + |
| 18 | ++ if( !empty( $wgDefaultGoPrefix ) && $title->getNamespace == NS_MAIN ) { |
| 19 | ++ $term = $wgDefaultGoPrefix . $term; |
| 20 | ++ } |
| 21 | ++ |
| 22 | + # Now try all lower case (i.e. first letter capitalized) |
| 23 | + # |
| 24 | + $title = Title::newFromText( $wgContLang->lc( $term ) ); |
| 25 | +Index: includes/DefaultSettings.php |
| 26 | +=================================================================== |
| 27 | +--- includes/DefaultSettings.php (revision 19784) |
| 28 | +@@ -2476,5 +2476,11 @@ |
| 29 | + * |
| 30 | + */ |
| 31 | + $wgCustomHandlerPath = array('*'=>"{$IP}/extensions/"); |
| 32 | ++ |
| 33 | ++/* |
| 34 | ++ * Prefix to be added before "Go" searches, e.g. point to a different |
| 35 | ++ * namespace. |
| 36 | ++ */ |
| 37 | ++$wgDefaultGoPrefix = ''; |
| 38 | + |
| 39 | + ?> |
| 40 | +Index: includes/SearchEngine.php |
| 41 | +=================================================================== |
| 42 | +--- includes/SearchEngine.php (revision 49948) |
| 43 | +@@ -63,15 +63,24 @@ |
| 44 | + $title = Title::newFromText( $term ); |
| 45 | + if (is_null($title)) |
| 46 | + return NULL; |
| 47 | ++ if ( $title->exists() ) { |
| 48 | ++ return $title; |
| 49 | ++ } |
| 50 | + |
| 51 | +- if ( $title->getNamespace() == NS_SPECIAL || $title->exists() ) { |
| 52 | ++ if ( $title->getNamespace() == NS_SPECIAL ) { |
| 53 | + return $title; |
| 54 | + } |
| 55 | + |
| 56 | +- if(!empty($wgDefaultGoPrefix) && $title->getNamespace() == NS_MAIN ) { |
| 57 | +- $term=$wgDefaultGoPrefix.$term; |
| 58 | +- } |
| 59 | +- |
| 60 | ++ if( !empty($wgDefaultGoPrefix) && $title->getNamespace() == NS_MAIN ) { |
| 61 | ++ # if no NS was specified in the query : search the "Expression:" NS |
| 62 | ++ $term = $wgDefaultGoPrefix . $term; |
| 63 | ++ |
| 64 | ++ $title = Title::newFromText( $term ); |
| 65 | ++ if( $title->exists() ) { |
| 66 | ++ return $title; |
| 67 | ++ } |
| 68 | ++ } |
| 69 | ++ |
| 70 | + # Now try all lower case (i.e. first letter capitalized) |
| 71 | + # |
| 72 | + $title = Title::newFromText( $wgContLang->lc( $term ) ); |
Index: trunk/extensions/Wikidata/patches/LinkTrail.diff |
— | — | @@ -0,0 +1,58 @@ |
| 2 | +Index: includes/SkinTemplate.php |
| 3 | +=================================================================== |
| 4 | +--- includes/SkinTemplate.php (revision 22407) |
| 5 | +@@ -631,6 +631,7 @@ |
| 6 | + */ |
| 7 | + function buildContentActionUrls () { |
| 8 | + global $wgContLang, $wgOut; |
| 9 | ++ |
| 10 | + $fname = 'SkinTemplate::buildContentActionUrls'; |
| 11 | + wfProfileIn( $fname ); |
| 12 | + |
| 13 | +@@ -691,10 +692,11 @@ |
| 14 | + wfProfileIn( "$fname-live" ); |
| 15 | + if ( $this->mTitle->getArticleId() ) { |
| 16 | + |
| 17 | ++ wfRunHooks( 'GetHistoryLinkTrail', array( &$trail ) ); |
| 18 | + $content_actions['history'] = array( |
| 19 | + 'class' => ($action == 'history') ? 'selected' : false, |
| 20 | + 'text' => wfMsg('history_short'), |
| 21 | +- 'href' => $this->mTitle->getLocalUrl( 'action=history') |
| 22 | ++ 'href' => $this->mTitle->getLocalUrl( 'action=history' . $trail ) |
| 23 | + ); |
| 24 | + |
| 25 | + if ( $this->mTitle->getNamespace() !== NS_MEDIAWIKI && $wgUser->isAllowed( 'protect' ) ) { |
| 26 | +Index: includes/Skin.php |
| 27 | +=================================================================== |
| 28 | +--- includes/Skin.php (revision 22407) |
| 29 | +@@ -1242,11 +1242,12 @@ |
| 30 | + */ |
| 31 | + function editUrlOptions() { |
| 32 | + global $wgArticle; |
| 33 | +- |
| 34 | ++ $trail = ''; |
| 35 | ++ wfRunHooks( 'GetEditLinkTrail', array( &$trail ) ); |
| 36 | + if( $this->mRevisionId && ! $wgArticle->isCurrent() ) { |
| 37 | +- return "action=edit&oldid=" . intval( $this->mRevisionId ); |
| 38 | ++ return 'action=edit' . $trail . '&oldid=' . intval( $this->mRevisionId ); |
| 39 | + } else { |
| 40 | +- return "action=edit"; |
| 41 | ++ return 'action=edit' . $trail; |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | +@@ -1318,9 +1319,10 @@ |
| 46 | + |
| 47 | + function historyLink() { |
| 48 | + global $wgTitle; |
| 49 | +- |
| 50 | ++ $trail = ''; |
| 51 | ++ wfRunHooks( 'GetHistoryLinkTrail', array( &$trail ) ); |
| 52 | + return $this->makeKnownLinkObj( $wgTitle, |
| 53 | +- wfMsg( 'history' ), 'action=history' ); |
| 54 | ++ wfMsg( 'history' ), 'action=history' . $trail ); |
| 55 | + } |
| 56 | + |
| 57 | + function whatLinksHere() { |
Index: trunk/extensions/Wikidata/patches/PageHistoryHandlerClassSupport.diff |
— | — | @@ -0,0 +1,27 @@ |
| 2 | +Index: includes/PageHistory.php |
| 3 | +=================================================================== |
| 4 | +--- includes/PageHistory.php (revision 19783) |
| 5 | +@@ -59,6 +59,22 @@ |
| 6 | + $fname = 'PageHistory::history'; |
| 7 | + wfProfileIn( $fname ); |
| 8 | + |
| 9 | ++ global $wgWikiDataHandlerClasses, $wgWikiDataHandlerPath; |
| 10 | ++ $namespaceId = $this->mTitle->getNamespace(); |
| 11 | ++ if( array_key_exists( $namespaceId, $wgWikiDataHandlerClasses ) ) { |
| 12 | ++ $handlerClass = $wgWikiDataHandlerClasses[ $namespaceId ]; |
| 13 | ++ $handlerFile = $wgWikiDataHandlerPath . $handlerClass . '.php'; |
| 14 | ++ if( file_exists( $handlerFile ) ) { |
| 15 | ++ require_once $handlerFile; |
| 16 | ++ $handlerInstance = new $handlerClass(); |
| 17 | ++ $handlerInstance->history(); |
| 18 | ++ return; |
| 19 | ++ } else { |
| 20 | ++ $wgOut->showErrorPage( 'namespace_handler_not_found', 'namespace_handler_not_found_error', |
| 21 | ++ $handlerFile, $wgContLang->getFormattedNsText( $namespaceId ) ); |
| 22 | ++ } |
| 23 | ++ } |
| 24 | ++ |
| 25 | + /* |
| 26 | + * Setup page variables. |
| 27 | + */ |
Index: trunk/extensions/Wikidata/patches/PreventMovingHandlerNamespaces.diff |
— | — | @@ -0,0 +1,15 @@ |
| 2 | +Index: includes/Namespace.php |
| 3 | +=================================================================== |
| 4 | +--- includes/Namespace.php (revision 31817) |
| 5 | +@@ -175,7 +175,9 @@ |
| 6 | + * @return bool |
| 7 | + */ |
| 8 | + function isMovable() { |
| 9 | +- return $this->isMovable; |
| 10 | ++ #return $this->isMovable; |
| 11 | ++ # FIXME: This means that classes with custom handlers are assumed to never be movable |
| 12 | ++ return $this->isMovable && empty($this->handlerClass); |
| 13 | + } |
| 14 | + |
| 15 | + /** |