Aude has submitted this change and it was merged.
Change subject: Revert "(bug 47610) Keep default settings out of globals."
......................................................................
Revert "(bug 47610) Keep default settings out of globals."
This reverts commit 60aad29318d3b7df846fc7c1841f24e7c92f0034
Reverting in order to implement an alternative solution.
Please merge the revert only together with the new solution,
which I will submit as a follow-up to this revert.
Change-Id: I7054bfaf0ee8bb15f9caa7ed80f83a9182bb8fbb
---
M DataModel/DataModel/Entity/EntityId.php
M Query/WikibaseQuery.php
M client/WikibaseClient.php
M client/config/WikibaseClient.default.php
M lib/WikibaseLib.php
M lib/config/WikibaseLib.default.php
M lib/config/WikibaseLib.experimental.php
M lib/includes/Settings.php
M repo/Wikibase.php
M repo/config/Wikibase.default.php
M repo/includes/content/EntityHandler.php
M repo/tests/phpunit/includes/content/EntityHandlerTest.php
12 files changed, 266 insertions(+), 333 deletions(-)
Approvals:
Aude: Verified; Looks good to me, approved
diff --git a/DataModel/DataModel/Entity/EntityId.php
b/DataModel/DataModel/Entity/EntityId.php
index 3dcd8d9..d7f4a46 100644
--- a/DataModel/DataModel/Entity/EntityId.php
+++ b/DataModel/DataModel/Entity/EntityId.php
@@ -88,8 +88,7 @@
// TODO: fix dependency on global state
// Either the prefix or the needed option should be
passe din the constructor.
- $prefixes = Settings::get( 'entityPrefixes' );
- foreach ( $prefixes as $prefix => $type ) {
+ foreach ( Settings::get( 'entityPrefixes' ) as $prefix
=> $type ) {
$prefixMap[$type] = $prefix;
}
}
diff --git a/Query/WikibaseQuery.php b/Query/WikibaseQuery.php
index 6349f98..73535b9 100644
--- a/Query/WikibaseQuery.php
+++ b/Query/WikibaseQuery.php
@@ -94,13 +94,7 @@
// @codeCoverageIgnoreEnd
};
-$wgHooks['WikibaseDefaultSettings'][] = function( array &$settings ) {
- $settings['entityPrefixes']['y'] = 'query';
- $settings['entityNamespaces'][CONTENT_MODEL_WIKIBASE_QUERY] =
WB_NS_QUERY;
-
- return true;
-};
-
+$wgWBSettings['entityPrefixes']['y'] = 'query';
define( 'CONTENT_MODEL_WIKIBASE_QUERY', "wikibase-query" );
@@ -111,6 +105,9 @@
$wgExtraNamespaces[WB_NS_QUERY] = 'Query';
$wgExtraNamespaces[WB_NS_QUERY_TALK] = 'Query_talk';
+$wgWBRepoSettings['entityNamespaces'][CONTENT_MODEL_WIKIBASE_QUERY] =
WB_NS_QUERY;
+
+
$wgAutoloadClasses['Wikibase\HistoryQueryAction'] = __DIR__ .
'/Query/HistoryQueryAction.php';
$wgAutoloadClasses['Wikibase\EditQueryAction'] =
__DIR__ . '/Query/EditQueryAction.php';
$wgAutoloadClasses['Wikibase\ViewQueryAction'] =
__DIR__ . '/Query/ViewQueryAction.php';
diff --git a/client/WikibaseClient.php b/client/WikibaseClient.php
index 9dff8f7..ba013d1 100644
--- a/client/WikibaseClient.php
+++ b/client/WikibaseClient.php
@@ -39,8 +39,6 @@
define( 'WBC_VERSION', '0.4 alpha'
. ( defined( 'WB_EXPERIMENTAL_FEATURES' ) && WB_EXPERIMENTAL_FEATURES ?
'/experimental' : '' ) );
-define( 'WBC_DIR', __DIR__ );
-
$wgExtensionCredits['wikibase'][] = array(
'path' => __DIR__,
'name' => 'Wikibase Client',
@@ -146,7 +144,7 @@
$wgWBClientStores['DirectSqlStore'] = 'Wikibase\DirectSqlStore';
-$wgWBClientSettings = array();
+include_once( $dir . 'config/WikibaseClient.default.php' );
if ( defined( 'WB_EXPERIMENTAL_FEATURES' ) && WB_EXPERIMENTAL_FEATURES ) {
include_once( $dir . 'config/WikibaseClient.experimental.php' );
diff --git a/client/config/WikibaseClient.default.php
b/client/config/WikibaseClient.default.php
index 5494f38..617979e 100644
--- a/client/config/WikibaseClient.default.php
+++ b/client/config/WikibaseClient.default.php
@@ -29,157 +29,156 @@
* @licence GNU GPL v2+
*/
+if ( !defined( 'WBC_VERSION' ) ) {
+ die( 'Not an entry point.' );
+}
-return call_user_func( function() {
- global $wgScriptPath, $wgArticlePath, $wgLanguageCode, $wgDBname;
+global $wgScriptPath, $wgArticlePath, $wgLanguageCode, $wgDBname;
- $defaults = array(
- 'namespaces' => array(), // by default, include all namespaces;
deprecated as of 0.4
- 'excludeNamespaces' => array(),
- 'repoUrl' => '//www.wikidata.org',
- 'repoScriptPath' => $wgScriptPath,
- 'repoArticlePath' => $wgArticlePath,
- 'sort' => 'code',
- 'sortPrepend' => array(),
- 'alwaysSort' => false,
- 'siteGlobalID' => $wgDBname,
- // @todo would be great to just get this from the sites stuff
- // but we will need to make sure the caching works good enough
- 'siteLocalID' => $wgLanguageCode,
- 'siteGroup' => 'wikipedia',
- 'injectRecentChanges' => true,
- 'showExternalRecentChanges' => true,
- 'defaultClientStore' => null,
- 'repoDatabase' => null, // note: "false" means "local"!
- // default for repo items in main namespace
- 'repoNamespaces' => array(
- 'wikibase-item' => '',
- 'wikibase-property' => 'Property'
- ),
- 'allowDataTransclusion' => true,
- 'enableSiteLinkWidget' => false,
+$wgWBClientSettings = array(
+ 'namespaces' => array(), // by default, include all namespaces;
deprecated as of 0.4
+ 'excludeNamespaces' => array(),
+ 'repoUrl' => '//www.wikidata.org',
+ 'repoScriptPath' => $wgScriptPath,
+ 'repoArticlePath' => $wgArticlePath,
+ 'sort' => 'code',
+ 'sortPrepend' => array(),
+ 'alwaysSort' => false,
+ 'siteGlobalID' => $wgDBname,
+ // @todo would be great to just get this from the sites stuff
+ // but we will need to make sure the caching works good enough
+ 'siteLocalID' => $wgLanguageCode,
+ 'siteGroup' => 'wikipedia',
+ 'injectRecentChanges' => true,
+ 'showExternalRecentChanges' => true,
+ 'defaultClientStore' => null,
+ 'repoDatabase' => null, // note: "false" means "local"!
+ // default for repo items in main namespace
+ 'repoNamespaces' => array(
+ 'wikibase-item' => '',
+ 'wikibase-property' => 'Property'
+ ),
+ 'allowDataTransclusion' => true,
+ 'enableSiteLinkWidget' => false,
+);
- /**
- * @todo this is a bit wikimedia-specific and need to find a
better place for this stuff,
- * such as mediawiki-config, mediawiki messages for custom
orders, or somewhere.
- *
- * alphabetic and alphabetic revised come from:
- *
http://meta.wikimedia.org/w/index.php?title=MediaWiki:Interwiki_config-sorting_order-native-languagename
- *
http://meta.wikimedia.org/w/index.php?title=MediaWiki:Interwiki_config-sorting_order-native-languagename-firstword
(revised)
- * and from pywikipedia for alphabetic_sr
- */
- 'interwikiSortOrders' => array(
- 'alphabetic' => array(
- 'ace', 'kbd', 'af', 'ak', 'als', 'am', 'ang', 'ab',
'ar', 'an', 'arc',
- 'roa-rup', 'frp', 'as', 'ast', 'gn', 'av', 'ay', 'az',
'bm', 'bn', 'bjn',
- 'zh-min-nan', 'nan', 'map-bms', 'ba', 'be', 'be-x-old',
'bh', 'bcl', 'bi',
- 'bg', 'bar', 'bo', 'bs', 'br', 'bxr', 'ca', 'cv',
'ceb', 'cs', 'ch',
- 'cbk-zam', 'ny', 'sn', 'tum', 'cho', 'co', 'cy', 'da',
'dk', 'pdc', 'de',
- 'dv', 'nv', 'dsb', 'dz', 'mh', 'et', 'el', 'eml', 'en',
'myv', 'es', 'eo',
- 'ext', 'eu', 'ee', 'fa', 'hif', 'fo', 'fr', 'fy', 'ff',
'fur', 'ga', 'gv',
- 'gag', 'gd', 'gl', 'gan', 'ki', 'glk', 'gu', 'got',
'hak', 'xal', 'ko', 'ha',
- 'haw', 'hy', 'hi', 'ho', 'hsb', 'hr', 'io', 'ig',
'ilo', 'bpy', 'id', 'ia',
- 'ie', 'iu', 'ik', 'os', 'xh', 'zu', 'is', 'it', 'he',
'jv', 'kl', 'kn', 'kr',
- 'pam', 'krc', 'ka', 'ks', 'csb', 'kk', 'kw', 'rw',
'rn', 'sw', 'kv', 'kg',
- 'ht', 'ku', 'kj', 'ky', 'mrj', 'lad', 'lbe', 'lez',
'lo', 'ltg', 'la', 'lv',
- 'lb', 'lt', 'lij', 'li', 'ln', 'jbo', 'lg', 'lmo',
'hu', 'mk', 'mg', 'ml',
- 'mt', 'mi', 'mr', 'xmf', 'arz', 'mzn', 'ms', 'min',
'cdo', 'mwl', 'mdf', 'mo',
- 'mn', 'mus', 'my', 'nah', 'na', 'fj', 'nl', 'nds-nl',
'cr', 'ne', 'new', 'ja',
- 'nap', 'ce', 'frr', 'pih', 'no', 'nb', 'nn', 'nrm',
'nov', 'ii', 'oc', 'mhr',
- 'or', 'om', 'ng', 'hz', 'uz', 'pa', 'pi', 'pfl', 'pag',
'pnb', 'pap', 'ps',
- 'koi', 'km', 'pcd', 'pms', 'tpi', 'nds', 'pl',
'tokipona', 'tp', 'pnt', 'pt',
- 'aa', 'kaa', 'crh', 'ty', 'ksh', 'ro', 'rmy', 'rm',
'qu', 'rue', 'ru', 'sah',
- 'se', 'sm', 'sa', 'sg', 'sc', 'sco', 'stq', 'st',
'nso', 'tn', 'sq', 'scn',
- 'si', 'simple', 'sd', 'ss', 'sk', 'sl', 'cu', 'szl',
'so', 'ckb', 'srn', 'sr',
- 'sh', 'su', 'fi', 'sv', 'tl', 'ta', 'shi', 'kab',
'roa-tara', 'tt', 'te', 'tet',
- 'th', 'ti', 'tg', 'to', 'chr', 'chy', 've', 'tr', 'tk',
'tw', 'udm', 'bug',
- 'uk', 'ur', 'ug', 'za', 'vec', 'vep', 'vi', 'vo',
'fiu-vro', 'wa', 'zh-classical',
- 'vls', 'war', 'wo', 'wuu', 'ts', 'yi', 'yo', 'zh-yue',
'diq', 'zea', 'bat-smg',
- 'zh', 'zh-tw', 'zh-cn'
- ),
- 'alphabetic_revised' => array(
- 'ace', 'kbd', 'af', 'ak', 'als', 'am', 'ang', 'ab',
'ar', 'an', 'arc', 'roa-rup',
- 'frp', 'as', 'ast', 'gn', 'av', 'ay', 'az', 'bjn',
'id', 'ms', 'bm', 'bn',
- 'zh-min-nan', 'nan', 'map-bms', 'jv', 'su', 'ba',
'min', 'be', 'be-x-old', 'bh',
- 'bcl', 'bi', 'bar', 'bo', 'bs', 'br', 'bug', 'bg',
'bxr', 'ca', 'ceb', 'cv', 'cs',
- 'ch', 'cbk-zam', 'ny', 'sn', 'tum', 'cho', 'co', 'cy',
'da', 'dk', 'pdc', 'de',
- 'dv', 'nv', 'dsb', 'na', 'dz', 'mh', 'et', 'el', 'eml',
'en', 'myv', 'es', 'eo',
- 'ext', 'eu', 'ee', 'fa', 'hif', 'fo', 'fr', 'fy', 'ff',
'fur', 'ga', 'gv', 'sm',
- 'gag', 'gd', 'gl', 'gan', 'ki', 'glk', 'gu', 'got',
'hak', 'xal', 'ko', 'ha', 'haw',
- 'hy', 'hi', 'ho', 'hsb', 'hr', 'io', 'ig', 'ilo',
'bpy', 'ia', 'ie', 'iu', 'ik',
- 'os', 'xh', 'zu', 'is', 'it', 'he', 'kl', 'kn', 'kr',
'pam', 'ka', 'ks', 'csb',
- 'kk', 'kw', 'rw', 'ky', 'rn', 'mrj', 'sw', 'kv', 'kg',
'ht', 'ku', 'kj', 'lad',
- 'lbe', 'lez', 'lo', 'la', 'ltg', 'lv', 'to', 'lb',
'lt', 'lij', 'li', 'ln', 'jbo',
- 'lg', 'lmo', 'hu', 'mk', 'mg', 'ml', 'krc', 'mt', 'mi',
'mr', 'xmf', 'arz', 'mzn',
- 'cdo', 'mwl', 'koi', 'mdf', 'mo', 'mn', 'mus', 'my',
'nah', 'fj', 'nl', 'nds-nl',
- 'cr', 'ne', 'new', 'ja', 'nap', 'ce', 'frr', 'pih',
'no', 'nb', 'nn', 'nrm', 'nov',
- 'ii', 'oc', 'mhr', 'or', 'om', 'ng', 'hz', 'uz', 'pa',
'pi', 'pfl', 'pag', 'pnb',
- 'pap', 'ps', 'km', 'pcd', 'pms', 'nds', 'pl', 'pnt',
'pt', 'aa', 'kaa', 'crh', 'ty',
- 'ksh', 'ro', 'rmy', 'rm', 'qu', 'ru', 'rue', 'sah',
'se', 'sa', 'sg', 'sc', 'sco',
- 'stq', 'st', 'nso', 'tn', 'sq', 'scn', 'si', 'simple',
'sd', 'ss', 'sk', 'sl',
- 'cu', 'szl', 'so', 'ckb', 'srn', 'sr', 'sh', 'fi',
'sv', 'tl', 'ta', 'shi',
- 'kab', 'roa-tara', 'tt', 'te', 'tet', 'th', 'vi', 'ti',
'tg', 'tpi', 'tokipona',
- 'tp', 'chr', 'chy', 've', 'tr', 'tk', 'tw', 'udm',
'uk', 'ur', 'ug', 'za',
- 'vec', 'vep', 'vo', 'fiu-vro', 'wa', 'zh-classical',
'vls', 'war', 'wo', 'wuu',
- 'ts', 'yi', 'yo', 'zh-yue', 'diq', 'zea', 'bat-smg',
'zh', 'zh-tw', 'zh-cn'
- ),
- 'alphabetic_sr' => array(
- 'ace', 'kbd', 'af', 'ak', 'als', 'am', 'ang', 'ab',
'ar', 'an', 'arc',
- 'roa-rup', 'frp', 'arz', 'as', 'ast', 'gn', 'av', 'ay',
'az', 'bjn', 'id',
- 'ms', 'bg', 'bm', 'zh-min-nan', 'nan', 'map-bms', 'jv',
'su', 'ba', 'be',
- 'be-x-old', 'bh', 'bcl', 'bi', 'bn', 'bo', 'bar', 'bs',
'bpy', 'br', 'bug',
- 'bxr', 'ca', 'ceb', 'ch', 'cbk-zam', 'sn', 'tum', 'ny',
'cho', 'chr', 'co',
- 'cy', 'cv', 'cs', 'da', 'dk', 'pdc', 'de', 'nv', 'dsb',
'na', 'dv', 'dz',
- 'mh', 'et', 'el', 'eml', 'en', 'myv', 'es', 'eo',
'ext', 'eu', 'ee', 'fa',
- 'hif', 'fo', 'fr', 'fy', 'ff', 'fur', 'ga', 'gv', 'sm',
'gag', 'gd', 'gl',
- 'gan', 'ki', 'glk', 'got', 'gu', 'ha', 'hak', 'xal',
'haw', 'he', 'hi', 'ho',
- 'hsb', 'hr', 'hy', 'io', 'ig', 'ii', 'ilo', 'ia', 'ie',
'iu', 'ik', 'os',
- 'xh', 'zu', 'is', 'it', 'ja', 'ka', 'kl', 'kr', 'pam',
'krc', 'csb', 'kk',
- 'kw', 'rw', 'ky', 'mrj', 'rn', 'sw', 'km', 'kn', 'ko',
'kv', 'kg', 'ht',
- 'ks', 'ku', 'kj', 'lad', 'lbe', 'la', 'ltg', 'lv',
'to', 'lb', 'lez', 'lt',
- 'lij', 'li', 'ln', 'lo', 'jbo', 'lg', 'lmo', 'hu',
'mk', 'mg', 'mt', 'mi',
- 'min', 'cdo', 'mwl', 'ml', 'mdf', 'mo', 'mn', 'mr',
'mus', 'my', 'mzn', 'nah',
- 'fj', 'ne', 'nl', 'nds-nl', 'cr', 'new', 'nap', 'ce',
'frr', 'pih', 'no', 'nb',
- 'nn', 'nrm', 'nov', 'oc', 'mhr', 'or', 'om', 'ng',
'hz', 'uz', 'pa', 'pfl',
- 'pag', 'pap', 'koi', 'pi', 'pcd', 'pms', 'nds', 'pnb',
'pl', 'pt', 'pnt',
- 'ps', 'aa', 'kaa', 'crh', 'ty', 'ksh', 'ro', 'rmy',
'rm', 'qu', 'ru', 'rue',
- 'sa', 'sah', 'se', 'sg', 'sc', 'sco', 'sd', 'stq',
'st', 'nso', 'tn', 'sq',
- 'si', 'scn', 'simple', 'ss', 'sk', 'sl', 'cu', 'szl',
'so', 'ckb', 'srn',
- 'sr', 'sh', 'fi', 'sv', 'ta', 'shi', 'tl', 'kab',
'roa-tara', 'tt', 'te',
- 'tet', 'th', 'ti', 'vi', 'tg', 'tokipona', 'tp', 'tpi',
'chy', 've', 'tr',
- 'tk', 'tw', 'udm', 'uk', 'ur', 'ug', 'za', 'vec',
'vep', 'vo', 'fiu-vro',
- 'wa', 'vls', 'war', 'wo', 'wuu', 'ts', 'xmf', 'yi',
'yo', 'diq', 'zea', 'zh',
- 'zh-tw', 'zh-cn', 'zh-classical', 'zh-yue', 'bat-smg'
- ),
- 'alphabetic_fy' => array(
- 'aa', 'ab', 'ace', 'af', 'ay', 'ak', 'als',
'am', 'an', 'ang', 'ar', 'arc',
- 'arz', 'as', 'ast', 'av', 'az', 'ba', 'bar',
'bat-smg', 'bcl', 'be', 'be-x-old',
- 'bg', 'bh', 'bi', 'bjn', 'bm', 'bn', 'bo',
'bpy', 'br', 'bs', 'bug', 'bxr',
- 'ca', 'cbk-zam', 'cdo', 'ce', 'ceb', 'ch',
'chy', 'cho', 'chr', 'cy', 'ckb',
- 'co', 'cr', 'crh', 'cs', 'csb', 'cu', 'cv',
'da', 'de', 'diq', 'dk', 'dsb', 'dv',
- 'dz', 'ee', 'el', 'eml', 'en', 'eo', 'es',
'et', 'eu', 'ext', 'fa', 'ff', 'fi',
- 'fy', 'fiu-vro', 'fj', 'fo', 'fr', 'frp',
'frr', 'fur', 'ga', 'gag', 'gan', 'gd',
- 'gl', 'glk', 'gn', 'got', 'gu', 'gv', 'ha',
'hak', 'haw', 'he', 'hi', 'hy',
- 'hif', 'ho', 'hr', 'hsb', 'ht', 'hu', 'hz',
'ia', 'id', 'ie', 'ig', 'ii', 'yi',
- 'ik', 'ilo', 'io', 'yo', 'is', 'it', 'iu',
'ja', 'jbo', 'jv', 'ka', 'kaa', 'kab',
- 'kbd', 'kg', 'ki', 'ky', 'kj', 'kk', 'kl',
'km', 'kn', 'ko', 'koi', 'kr', 'krc',
- 'ks', 'ksh', 'ku', 'kv', 'kw', 'la', 'lad',
'lb', 'lbe', 'lez', 'lg', 'li',
- 'lij', 'lmo', 'ln', 'lo', 'lt', 'ltg', 'lv',
'map-bms', 'mdf', 'mg', 'mh', 'mhr',
- 'mi', 'my', 'min', 'myv', 'mk', 'ml', 'mn',
'mo', 'mr', 'mrj', 'ms', 'mt', 'mus',
- 'mwl', 'mzn', 'na', 'nah', 'nan', 'nap', 'nds',
'nds-nl', 'ne', 'new', 'ng', 'ny',
- 'nl', 'nn', 'no', 'nov', 'nrm', 'nso', 'nv',
'oc', 'om', 'or', 'os', 'pa', 'pag',
- 'pam', 'pap', 'pcd', 'pdc', 'pfl', 'pi', 'pih',
'pl', 'pms', 'pnb', 'pnt', 'ps',
- 'pt', 'qu', 'rm', 'rmy', 'rn', 'ro', 'roa-rup',
'roa-tara', 'ru', 'rue', 'rw',
- 'sa', 'sah', 'sc', 'scn', 'sco', 'sd', 'se',
'sg', 'sh', 'shi', 'si', 'simple',
- 'sk', 'sl', 'sm', 'sn', 'so', 'sq', 'sr',
'srn', 'ss', 'st', 'stq', 'su', 'sv',
- 'sw', 'szl', 'ta', 'te', 'tet', 'tg', 'th',
'ti', 'ty', 'tk', 'tl', 'tn', 'to',
- 'tokipona', 'tp', 'tpi', 'tr', 'ts', 'tt',
'tum', 'tw', 'udm', 'ug', 'uk', 'ur',
- 'uz', 've', 'vec', 'vep', 'vi', 'vls', 'vo',
'wa', 'war', 'wo', 'wuu', 'xal',
- 'xh', 'xmf', 'za', 'zea', 'zh', 'zh-classical',
'zh-cn', 'zh-yue', 'zh-min-nan',
- 'zh-tw', 'zu'
- ),
- ),
- );
-
- return $defaults;
-} );
+/**
+ * @todo this is a bit wikimedia-specific and need to find a better place for
this stuff,
+ * such as mediawiki-config, mediawiki messages for custom orders, or
somewhere.
+ *
+ * alphabetic and alphabetic revised come from:
+ *
http://meta.wikimedia.org/w/index.php?title=MediaWiki:Interwiki_config-sorting_order-native-languagename
+ *
http://meta.wikimedia.org/w/index.php?title=MediaWiki:Interwiki_config-sorting_order-native-languagename-firstword
(revised)
+ * and from pywikipedia for alphabetic_sr
+ */
+$wgWBClientSettings['interwikiSortOrders'] = array(
+ 'alphabetic' => array(
+ 'ace', 'kbd', 'af', 'ak', 'als', 'am', 'ang', 'ab', 'ar', 'an', 'arc',
+ 'roa-rup', 'frp', 'as', 'ast', 'gn', 'av', 'ay', 'az', 'bm', 'bn',
'bjn',
+ 'zh-min-nan', 'nan', 'map-bms', 'ba', 'be', 'be-x-old', 'bh', 'bcl',
'bi',
+ 'bg', 'bar', 'bo', 'bs', 'br', 'bxr', 'ca', 'cv', 'ceb', 'cs', 'ch',
+ 'cbk-zam', 'ny', 'sn', 'tum', 'cho', 'co', 'cy', 'da', 'dk', 'pdc',
'de',
+ 'dv', 'nv', 'dsb', 'dz', 'mh', 'et', 'el', 'eml', 'en', 'myv', 'es',
'eo',
+ 'ext', 'eu', 'ee', 'fa', 'hif', 'fo', 'fr', 'fy', 'ff', 'fur', 'ga',
'gv',
+ 'gag', 'gd', 'gl', 'gan', 'ki', 'glk', 'gu', 'got', 'hak', 'xal',
'ko', 'ha',
+ 'haw', 'hy', 'hi', 'ho', 'hsb', 'hr', 'io', 'ig', 'ilo', 'bpy', 'id',
'ia',
+ 'ie', 'iu', 'ik', 'os', 'xh', 'zu', 'is', 'it', 'he', 'jv', 'kl',
'kn', 'kr',
+ 'pam', 'krc', 'ka', 'ks', 'csb', 'kk', 'kw', 'rw', 'rn', 'sw', 'kv',
'kg',
+ 'ht', 'ku', 'kj', 'ky', 'mrj', 'lad', 'lbe', 'lez', 'lo', 'ltg', 'la',
'lv',
+ 'lb', 'lt', 'lij', 'li', 'ln', 'jbo', 'lg', 'lmo', 'hu', 'mk', 'mg',
'ml',
+ 'mt', 'mi', 'mr', 'xmf', 'arz', 'mzn', 'ms', 'min', 'cdo', 'mwl',
'mdf', 'mo',
+ 'mn', 'mus', 'my', 'nah', 'na', 'fj', 'nl', 'nds-nl', 'cr', 'ne',
'new', 'ja',
+ 'nap', 'ce', 'frr', 'pih', 'no', 'nb', 'nn', 'nrm', 'nov', 'ii', 'oc',
'mhr',
+ 'or', 'om', 'ng', 'hz', 'uz', 'pa', 'pi', 'pfl', 'pag', 'pnb', 'pap',
'ps',
+ 'koi', 'km', 'pcd', 'pms', 'tpi', 'nds', 'pl', 'tokipona', 'tp',
'pnt', 'pt',
+ 'aa', 'kaa', 'crh', 'ty', 'ksh', 'ro', 'rmy', 'rm', 'qu', 'rue', 'ru',
'sah',
+ 'se', 'sm', 'sa', 'sg', 'sc', 'sco', 'stq', 'st', 'nso', 'tn', 'sq',
'scn',
+ 'si', 'simple', 'sd', 'ss', 'sk', 'sl', 'cu', 'szl', 'so', 'ckb',
'srn', 'sr',
+ 'sh', 'su', 'fi', 'sv', 'tl', 'ta', 'shi', 'kab', 'roa-tara', 'tt',
'te', 'tet',
+ 'th', 'ti', 'tg', 'to', 'chr', 'chy', 've', 'tr', 'tk', 'tw', 'udm',
'bug',
+ 'uk', 'ur', 'ug', 'za', 'vec', 'vep', 'vi', 'vo', 'fiu-vro', 'wa',
'zh-classical',
+ 'vls', 'war', 'wo', 'wuu', 'ts', 'yi', 'yo', 'zh-yue', 'diq', 'zea',
'bat-smg',
+ 'zh', 'zh-tw', 'zh-cn'
+ ),
+ 'alphabetic_revised' => array(
+ 'ace', 'kbd', 'af', 'ak', 'als', 'am', 'ang', 'ab', 'ar', 'an', 'arc',
'roa-rup',
+ 'frp', 'as', 'ast', 'gn', 'av', 'ay', 'az', 'bjn', 'id', 'ms', 'bm',
'bn',
+ 'zh-min-nan', 'nan', 'map-bms', 'jv', 'su', 'ba', 'min', 'be',
'be-x-old', 'bh',
+ 'bcl', 'bi', 'bar', 'bo', 'bs', 'br', 'bug', 'bg', 'bxr', 'ca', 'ceb',
'cv', 'cs',
+ 'ch', 'cbk-zam', 'ny', 'sn', 'tum', 'cho', 'co', 'cy', 'da', 'dk',
'pdc', 'de',
+ 'dv', 'nv', 'dsb', 'na', 'dz', 'mh', 'et', 'el', 'eml', 'en', 'myv',
'es', 'eo',
+ 'ext', 'eu', 'ee', 'fa', 'hif', 'fo', 'fr', 'fy', 'ff', 'fur', 'ga',
'gv', 'sm',
+ 'gag', 'gd', 'gl', 'gan', 'ki', 'glk', 'gu', 'got', 'hak', 'xal',
'ko', 'ha', 'haw',
+ 'hy', 'hi', 'ho', 'hsb', 'hr', 'io', 'ig', 'ilo', 'bpy', 'ia', 'ie',
'iu', 'ik',
+ 'os', 'xh', 'zu', 'is', 'it', 'he', 'kl', 'kn', 'kr', 'pam', 'ka',
'ks', 'csb',
+ 'kk', 'kw', 'rw', 'ky', 'rn', 'mrj', 'sw', 'kv', 'kg', 'ht', 'ku',
'kj', 'lad',
+ 'lbe', 'lez', 'lo', 'la', 'ltg', 'lv', 'to', 'lb', 'lt', 'lij', 'li',
'ln', 'jbo',
+ 'lg', 'lmo', 'hu', 'mk', 'mg', 'ml', 'krc', 'mt', 'mi', 'mr', 'xmf',
'arz', 'mzn',
+ 'cdo', 'mwl', 'koi', 'mdf', 'mo', 'mn', 'mus', 'my', 'nah', 'fj',
'nl', 'nds-nl',
+ 'cr', 'ne', 'new', 'ja', 'nap', 'ce', 'frr', 'pih', 'no', 'nb', 'nn',
'nrm', 'nov',
+ 'ii', 'oc', 'mhr', 'or', 'om', 'ng', 'hz', 'uz', 'pa', 'pi', 'pfl',
'pag', 'pnb',
+ 'pap', 'ps', 'km', 'pcd', 'pms', 'nds', 'pl', 'pnt', 'pt', 'aa',
'kaa', 'crh', 'ty',
+ 'ksh', 'ro', 'rmy', 'rm', 'qu', 'ru', 'rue', 'sah', 'se', 'sa', 'sg',
'sc', 'sco',
+ 'stq', 'st', 'nso', 'tn', 'sq', 'scn', 'si', 'simple', 'sd', 'ss',
'sk', 'sl',
+ 'cu', 'szl', 'so', 'ckb', 'srn', 'sr', 'sh', 'fi', 'sv', 'tl', 'ta',
'shi',
+ 'kab', 'roa-tara', 'tt', 'te', 'tet', 'th', 'vi', 'ti', 'tg', 'tpi',
'tokipona',
+ 'tp', 'chr', 'chy', 've', 'tr', 'tk', 'tw', 'udm', 'uk', 'ur', 'ug',
'za',
+ 'vec', 'vep', 'vo', 'fiu-vro', 'wa', 'zh-classical', 'vls', 'war',
'wo', 'wuu',
+ 'ts', 'yi', 'yo', 'zh-yue', 'diq', 'zea', 'bat-smg', 'zh', 'zh-tw',
'zh-cn'
+ ),
+ 'alphabetic_sr' => array(
+ 'ace', 'kbd', 'af', 'ak', 'als', 'am', 'ang', 'ab', 'ar', 'an', 'arc',
+ 'roa-rup', 'frp', 'arz', 'as', 'ast', 'gn', 'av', 'ay', 'az', 'bjn',
'id',
+ 'ms', 'bg', 'bm', 'zh-min-nan', 'nan', 'map-bms', 'jv', 'su', 'ba',
'be',
+ 'be-x-old', 'bh', 'bcl', 'bi', 'bn', 'bo', 'bar', 'bs', 'bpy', 'br',
'bug',
+ 'bxr', 'ca', 'ceb', 'ch', 'cbk-zam', 'sn', 'tum', 'ny', 'cho', 'chr',
'co',
+ 'cy', 'cv', 'cs', 'da', 'dk', 'pdc', 'de', 'nv', 'dsb', 'na', 'dv',
'dz',
+ 'mh', 'et', 'el', 'eml', 'en', 'myv', 'es', 'eo', 'ext', 'eu', 'ee',
'fa',
+ 'hif', 'fo', 'fr', 'fy', 'ff', 'fur', 'ga', 'gv', 'sm', 'gag', 'gd',
'gl',
+ 'gan', 'ki', 'glk', 'got', 'gu', 'ha', 'hak', 'xal', 'haw', 'he',
'hi', 'ho',
+ 'hsb', 'hr', 'hy', 'io', 'ig', 'ii', 'ilo', 'ia', 'ie', 'iu', 'ik',
'os',
+ 'xh', 'zu', 'is', 'it', 'ja', 'ka', 'kl', 'kr', 'pam', 'krc', 'csb',
'kk',
+ 'kw', 'rw', 'ky', 'mrj', 'rn', 'sw', 'km', 'kn', 'ko', 'kv', 'kg',
'ht',
+ 'ks', 'ku', 'kj', 'lad', 'lbe', 'la', 'ltg', 'lv', 'to', 'lb', 'lez',
'lt',
+ 'lij', 'li', 'ln', 'lo', 'jbo', 'lg', 'lmo', 'hu', 'mk', 'mg', 'mt',
'mi',
+ 'min', 'cdo', 'mwl', 'ml', 'mdf', 'mo', 'mn', 'mr', 'mus', 'my',
'mzn', 'nah',
+ 'fj', 'ne', 'nl', 'nds-nl', 'cr', 'new', 'nap', 'ce', 'frr', 'pih',
'no', 'nb',
+ 'nn', 'nrm', 'nov', 'oc', 'mhr', 'or', 'om', 'ng', 'hz', 'uz', 'pa',
'pfl',
+ 'pag', 'pap', 'koi', 'pi', 'pcd', 'pms', 'nds', 'pnb', 'pl', 'pt',
'pnt',
+ 'ps', 'aa', 'kaa', 'crh', 'ty', 'ksh', 'ro', 'rmy', 'rm', 'qu', 'ru',
'rue',
+ 'sa', 'sah', 'se', 'sg', 'sc', 'sco', 'sd', 'stq', 'st', 'nso', 'tn',
'sq',
+ 'si', 'scn', 'simple', 'ss', 'sk', 'sl', 'cu', 'szl', 'so', 'ckb',
'srn',
+ 'sr', 'sh', 'fi', 'sv', 'ta', 'shi', 'tl', 'kab', 'roa-tara', 'tt',
'te',
+ 'tet', 'th', 'ti', 'vi', 'tg', 'tokipona', 'tp', 'tpi', 'chy', 've',
'tr',
+ 'tk', 'tw', 'udm', 'uk', 'ur', 'ug', 'za', 'vec', 'vep', 'vo',
'fiu-vro',
+ 'wa', 'vls', 'war', 'wo', 'wuu', 'ts', 'xmf', 'yi', 'yo', 'diq',
'zea', 'zh',
+ 'zh-tw', 'zh-cn', 'zh-classical', 'zh-yue', 'bat-smg'
+ ),
+ 'alphabetic_fy' => array(
+ 'aa', 'ab', 'ace', 'af', 'ay', 'ak', 'als', 'am', 'an', 'ang',
'ar', 'arc',
+ 'arz', 'as', 'ast', 'av', 'az', 'ba', 'bar', 'bat-smg', 'bcl',
'be', 'be-x-old',
+ 'bg', 'bh', 'bi', 'bjn', 'bm', 'bn', 'bo', 'bpy', 'br', 'bs',
'bug', 'bxr',
+ 'ca', 'cbk-zam', 'cdo', 'ce', 'ceb', 'ch', 'chy', 'cho', 'chr',
'cy', 'ckb',
+ 'co', 'cr', 'crh', 'cs', 'csb', 'cu', 'cv', 'da', 'de', 'diq',
'dk', 'dsb', 'dv',
+ 'dz', 'ee', 'el', 'eml', 'en', 'eo', 'es', 'et', 'eu', 'ext',
'fa', 'ff', 'fi',
+ 'fy', 'fiu-vro', 'fj', 'fo', 'fr', 'frp', 'frr', 'fur', 'ga',
'gag', 'gan', 'gd',
+ 'gl', 'glk', 'gn', 'got', 'gu', 'gv', 'ha', 'hak', 'haw', 'he',
'hi', 'hy',
+ 'hif', 'ho', 'hr', 'hsb', 'ht', 'hu', 'hz', 'ia', 'id', 'ie',
'ig', 'ii', 'yi',
+ 'ik', 'ilo', 'io', 'yo', 'is', 'it', 'iu', 'ja', 'jbo', 'jv',
'ka', 'kaa', 'kab',
+ 'kbd', 'kg', 'ki', 'ky', 'kj', 'kk', 'kl', 'km', 'kn', 'ko',
'koi', 'kr', 'krc',
+ 'ks', 'ksh', 'ku', 'kv', 'kw', 'la', 'lad', 'lb', 'lbe', 'lez',
'lg', 'li',
+ 'lij', 'lmo', 'ln', 'lo', 'lt', 'ltg', 'lv', 'map-bms', 'mdf',
'mg', 'mh', 'mhr',
+ 'mi', 'my', 'min', 'myv', 'mk', 'ml', 'mn', 'mo', 'mr', 'mrj',
'ms', 'mt', 'mus',
+ 'mwl', 'mzn', 'na', 'nah', 'nan', 'nap', 'nds', 'nds-nl', 'ne',
'new', 'ng', 'ny',
+ 'nl', 'nn', 'no', 'nov', 'nrm', 'nso', 'nv', 'oc', 'om', 'or',
'os', 'pa', 'pag',
+ 'pam', 'pap', 'pcd', 'pdc', 'pfl', 'pi', 'pih', 'pl', 'pms',
'pnb', 'pnt', 'ps',
+ 'pt', 'qu', 'rm', 'rmy', 'rn', 'ro', 'roa-rup', 'roa-tara',
'ru', 'rue', 'rw',
+ 'sa', 'sah', 'sc', 'scn', 'sco', 'sd', 'se', 'sg', 'sh', 'shi',
'si', 'simple',
+ 'sk', 'sl', 'sm', 'sn', 'so', 'sq', 'sr', 'srn', 'ss', 'st',
'stq', 'su', 'sv',
+ 'sw', 'szl', 'ta', 'te', 'tet', 'tg', 'th', 'ti', 'ty', 'tk',
'tl', 'tn', 'to',
+ 'tokipona', 'tp', 'tpi', 'tr', 'ts', 'tt', 'tum', 'tw', 'udm',
'ug', 'uk', 'ur',
+ 'uz', 've', 'vec', 'vep', 'vi', 'vls', 'vo', 'wa', 'war', 'wo',
'wuu', 'xal',
+ 'xh', 'xmf', 'za', 'zea', 'zh', 'zh-classical', 'zh-cn',
'zh-yue', 'zh-min-nan',
+ 'zh-tw', 'zu'
+ ),
+);
diff --git a/lib/WikibaseLib.php b/lib/WikibaseLib.php
index 9b6a18b..a1f75b4 100644
--- a/lib/WikibaseLib.php
+++ b/lib/WikibaseLib.php
@@ -79,8 +79,6 @@
define( 'WBL_VERSION', '0.4 alpha'
. ( defined( 'WB_EXPERIMENTAL_FEATURES' ) && WB_EXPERIMENTAL_FEATURES ?
'/experimental' : '' ) );
-define( 'WBL_DIR', __DIR__ );
-
$wgExtensionCredits['wikibase'][] = array(
'path' => __DIR__,
'name' => 'WikibaseLib',
@@ -169,9 +167,8 @@
// Resource Loader Modules:
$wgResourceModules = array_merge( $wgResourceModules, include( __DIR__ .
"/resources/Resources.php" ) );
-$wgWBSettings = array();
-$wgValueFormatters['wikibase-entityid'] = 'Wikibase\Lib\EntityIdFormatter';
+include_once( __DIR__ . '/config/WikibaseLib.default.php' );
if ( defined( 'WB_EXPERIMENTAL_FEATURES' ) && WB_EXPERIMENTAL_FEATURES ) {
include_once( __DIR__ . '/config/WikibaseLib.experimental.php' );
diff --git a/lib/config/WikibaseLib.default.php
b/lib/config/WikibaseLib.default.php
index 6a4aa3a..7ec0fa5 100644
--- a/lib/config/WikibaseLib.default.php
+++ b/lib/config/WikibaseLib.default.php
@@ -29,65 +29,65 @@
* @licence GNU GPL v2+
*/
-return call_user_func( function() {
+if ( !defined( 'WBL_VERSION' ) ) {
+ die( 'Not an entry point.' );
+}
- $defaults = array(
+$wgWBSettings = array();
- // alternative: application/vnd.php.serialized
- 'serializationFormat' => CONTENT_FORMAT_JSON,
+// alternative: application/vnd.php.serialized
+$wgWBSettings['serializationFormat'] = CONTENT_FORMAT_JSON;
- // whether changes get recorded to wb_changes
- 'useChangesTable' => true,
+// whether changes get recorded to wb_changes
+$wgWBSettings['useChangesTable'] = true;
- 'entityPrefixes' => array(
- 'q' => \Wikibase\Item::ENTITY_TYPE,
- 'p' => \Wikibase\Property::ENTITY_TYPE,
- ),
+$wgWBSettings['entityPrefixes'] = array(
+ 'q' => \Wikibase\Item::ENTITY_TYPE,
+ 'p' => \Wikibase\Property::ENTITY_TYPE,
+);
- 'siteLinkGroup' => 'wikipedia',
+$wgWBSettings['siteLinkGroup'] = 'wikipedia';
- // local by default. Set to something LBFactory understands.
- 'changesDatabase' => false,
+// local by default. Set to something LBFactory understands.
+$wgWBSettings['changesDatabase'] = false;
- // JSON is more robust against version differences between repo
and client,
- // but only once the client can cope with the JSON form of the
change.
- 'changesAsJson' => true,
+// JSON is more robust against version differences between repo and client,
+// but only once the client can cope with the JSON form of the change.
+$wgWBSettings['changesAsJson'] = true;
- // list of logical database names of local client wikis.
- // may contain mappings from site-id to db-name.
- 'localClientDatabases' => array(),
+// list of logical database names of local client wikis.
+// may contain mappings from site-id to db-name.
+$wgWBSettings['localClientDatabases'] = array();
- 'dispatchBatchChunkFactor' => 3,
- 'dispatchBatchCacheFactor' => 3,
+$wgWBSettings['dispatchBatchChunkFactor'] = 3;
+$wgWBSettings['dispatchBatchCacheFactor'] = 3;
- 'changeHandlers' => array(
- 'wikibase-item~add' => 'Wikibase\ItemChange',
- 'wikibase-property~add' => 'Wikibase\EntityChange',
- 'wikibase-query~add' => 'Wikibase\EntityChange',
+$wgWBSettings['changeHandlers'] = array(
+ 'wikibase-item~add' => 'Wikibase\ItemChange',
+ 'wikibase-property~add' => 'Wikibase\EntityChange',
+ 'wikibase-query~add' => 'Wikibase\EntityChange',
- 'wikibase-item~update' => 'Wikibase\ItemChange',
- 'wikibase-property~update' => 'Wikibase\EntityChange',
- 'wikibase-query~update' => 'Wikibase\EntityChange',
+ 'wikibase-item~update' => 'Wikibase\ItemChange',
+ 'wikibase-property~update' => 'Wikibase\EntityChange',
+ 'wikibase-query~update' => 'Wikibase\EntityChange',
- 'wikibase-item~remove' => 'Wikibase\ItemChange',
- 'wikibase-property~remove' => 'Wikibase\EntityChange',
- 'wikibase-query~remove' => 'Wikibase\EntityChange',
+ 'wikibase-item~remove' => 'Wikibase\ItemChange',
+ 'wikibase-property~remove' => 'Wikibase\EntityChange',
+ 'wikibase-query~remove' => 'Wikibase\EntityChange',
- 'wikibase-item~refresh' => 'Wikibase\ItemChange',
- 'wikibase-property~refresh' => 'Wikibase\EntityChange',
- 'wikibase-query~refresh' => 'Wikibase\EntityChange',
+ 'wikibase-item~refresh' => 'Wikibase\ItemChange',
+ 'wikibase-property~refresh' => 'Wikibase\EntityChange',
+ 'wikibase-query~refresh' => 'Wikibase\EntityChange',
- 'wikibase-item~restore' => 'Wikibase\ItemChange',
- 'wikibase-property~restore' => 'Wikibase\EntityChange',
- 'wikibase-query~restore' => 'Wikibase\EntityChange',
- ),
+ 'wikibase-item~restore' => 'Wikibase\ItemChange',
+ 'wikibase-property~restore' => 'Wikibase\EntityChange',
+ 'wikibase-query~restore' => 'Wikibase\EntityChange',
+);
- 'dataTypes' => array(
- 'wikibase-item',
- 'commonsMedia',
- 'string',
- ),
- );
+$wgWBSettings['dataTypes'] = array(
+ 'wikibase-item',
+ 'commonsMedia',
+ 'string',
+);
- return $defaults;
-} );
+$wgValueFormatters['wikibase-entityid'] = 'Wikibase\Lib\EntityIdFormatter';
\ No newline at end of file
diff --git a/lib/config/WikibaseLib.experimental.php
b/lib/config/WikibaseLib.experimental.php
index 7a237c6..cd8c6ef 100644
--- a/lib/config/WikibaseLib.experimental.php
+++ b/lib/config/WikibaseLib.experimental.php
@@ -33,19 +33,16 @@
die( 'Not an entry point.' );
}
-global $wgHooks;
+global $wgWBSettings, $wgAutoloadClasses, $wgHooks;
-$wgHooks['WikibaseDefaultSettings'][] = function( array &$settings ) {
- $settings['dataTypes'] = array_merge( $settings['dataTypes'], array(
- 'geo-coordinate',
- 'quantity',
- 'monolingual-text',
- 'multilingual-text',
- 'time',
- ) );
+$wgWBSettings['dataTypes'] = array_merge( $wgWBSettings['dataTypes'], array(
+ 'geo-coordinate',
+ 'quantity',
+ 'monolingual-text',
+ 'multilingual-text',
+ 'time',
+) );
- return true;
-};
$wgHooks['UnitTestsList'][] = function( array &$files ) {
// @codeCoverageIgnoreStart
diff --git a/lib/includes/Settings.php b/lib/includes/Settings.php
index b306b1e..35de02a 100644
--- a/lib/includes/Settings.php
+++ b/lib/includes/Settings.php
@@ -30,7 +30,6 @@
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
- * @author Daniel Kinzler
*/
class Settings extends SettingsArray {
@@ -45,65 +44,22 @@
static $instance = null;
if ( $instance === null ) {
- $instance = new static();
- $instance->initFromGlobals();
+ $settings = array();
+
+ if ( defined( 'WB_VERSION' ) ) {
+ $settings = array_merge( $settings,
$GLOBALS['wgWBRepoSettings'] );
+ }
+
+ if ( defined( 'WBC_VERSION' ) ) {
+ $settings = array_merge( $settings,
$GLOBALS['wgWBClientSettings'] );
+ }
+
+ $settings = array_merge( $settings,
$GLOBALS['wgWBSettings'] );
+
+ $instance = new static( $settings );
}
return $instance;
- }
-
- protected static function loadDefaults( $path ) {
- $defaults = include( $path );
-
- if ( !is_array( $defaults ) ) {
- throw new \MWException( "Defaults file not found:
$path" );
- }
-
- return $defaults;
- }
-
- /**
- * Initializes this Settings object from the global configuration
variables.
- * Default settings are loaded from the appropriate files.
- * The hook WikibaseDefaultSettings can be used to manipulate the
defaults.
- *
- * @since 0.4
- */
- public function initFromGlobals() {
- $settings = array();
-
- // load appropriate defaults -------------------
- if ( defined( 'WBL_VERSION' ) ) {
- $settings = array_merge( $settings, self::loadDefaults(
WBL_DIR . '/config/WikibaseLib.default.php' ) );
- }
-
- if ( defined( 'WB_VERSION' ) ) {
- $settings = array_merge( $settings, self::loadDefaults(
WB_DIR . '/config/Wikibase.default.php' ) );
- }
-
- if ( defined( 'WBC_VERSION' ) ) {
- $settings = array_merge( $settings, self::loadDefaults(
WBC_DIR . '/config/WikibaseClient.default.php' ) );
- }
-
- wfRunHooks( 'WikibaseDefaultSettings', array( &$settings ) );
-
- // merge appropriate settings -------------------
- if ( defined( 'WBL_VERSION' ) ) {
- $settings = array_merge( $settings,
$GLOBALS['wgWBSettings'] );
- }
-
- if ( defined( 'WB_VERSION' ) ) {
- $settings = array_merge( $settings,
$GLOBALS['wgWBRepoSettings'] );
- }
-
- if ( defined( 'WBC_VERSION' ) ) {
- $settings = array_merge( $settings,
$GLOBALS['wgWBClientSettings'] );
- }
-
- // store
- foreach ( $settings as $key => $value ) {
- $this[$key] = $value;
- }
}
/**
diff --git a/repo/Wikibase.php b/repo/Wikibase.php
index 1aebb92..a2555d8 100755
--- a/repo/Wikibase.php
+++ b/repo/Wikibase.php
@@ -55,8 +55,6 @@
define( 'WB_VERSION', '0.4 alpha'
. ( defined( 'WB_EXPERIMENTAL_FEATURES' ) && WB_EXPERIMENTAL_FEATURES ?
'/experimental' : '' ) );
-define( 'WB_DIR', __DIR__ );
-
$wgExtensionCredits['wikibase'][] = array(
'path' => __DIR__,
'name' => 'Wikibase Repository',
@@ -148,6 +146,7 @@
// Hooks
$wgHooks['BeforePageDisplay'][]
= 'Wikibase\RepoHooks::onBeforePageDisplay';
+$wgHooks['WikibaseDefaultSettings'][] =
'Wikibase\RepoHooks::onWikibaseDefaultSettings';
$wgHooks['LoadExtensionSchemaUpdates'][] =
'Wikibase\RepoHooks::onSchemaUpdate';
$wgHooks['UnitTestsList'][] =
'Wikibase\RepoHooks::registerUnitTests';
$wgHooks['NamespaceIsMovable'][] =
'Wikibase\RepoHooks::onNamespaceIsMovable';
@@ -182,7 +181,7 @@
$wgWBStores['sqlstore'] = 'Wikibase\SqlStore';
-$wgWBRepoSettings = array();
+include_once( __DIR__ . '/config/Wikibase.default.php' );
if ( defined( 'WB_EXPERIMENTAL_FEATURES' ) && WB_EXPERIMENTAL_FEATURES ) {
include_once( __DIR__ . '/config/Wikibase.experimental.php' );
diff --git a/repo/config/Wikibase.default.php b/repo/config/Wikibase.default.php
index da4768c..ffb2828 100644
--- a/repo/config/Wikibase.default.php
+++ b/repo/config/Wikibase.default.php
@@ -29,50 +29,50 @@
* @licence GNU GPL v2+
*/
-return call_user_func( function() {
+if ( !defined( 'WB_VERSION' ) ) {
+ die( 'Not an entry point.' );
+}
- $defaults = array(
+$dir = __DIR__ . '/';
- // Set API in debug mode
- // do not turn on in production!
- 'apiInDebug' => false,
+$wgWBRepoSettings = array();
- // Additional settings for API when debugging is on to
- // facilitate testing.
- 'apiDebugWithPost' => false,
- 'apiDebugWithRights' => false,
- 'apiDebugWithTokens' => false,
+// Set API in debug mode
+// do not turn on in production!
+$wgWBRepoSettings['apiInDebug'] = false;
- 'defaultStore' => 'sqlstore',
+// Additional settings for API when debugging is on to
+// facilitate testing.
+$wgWBRepoSettings['apiDebugWithPost'] = false;
+$wgWBRepoSettings['apiDebugWithRights'] = false;
+$wgWBRepoSettings['apiDebugWithTokens'] = false;
- 'idBlacklist' => array(
- 1,
- 23,
- 42,
- 1337,
- 9001,
- 31337,
- 720101010,
- ),
+$wgWBRepoSettings['defaultStore'] = 'sqlstore';
- // Allow the TermIndex table to work without the
term_search_key field,
- // for sites that can not easily roll out schema changes on
large tables.
- // This means that all searches will use exact matching
- // (depending on the database's collation).
- 'withoutTermSearchKey' => false,
+$wgWBRepoSettings['idBlacklist'] = array(
+ 1,
+ 23,
+ 42,
+ 1337,
+ 9001,
+ 31337,
+ 720101010,
+);
- 'entityNamespaces' => array(),
+// Allow the TermIndex table to work without the term_search_key field,
+// for sites that can not easily roll out schema changes on large tables.
+// This means that all searches will use exact matching
+// (depending on the database's collation).
+$wgWBRepoSettings['withoutTermSearchKey'] = false;
- // These are used for multilanguage strings that should have a
soft length constraint
- 'multilang-limits' => array(
- 'length' => 250,
- ),
+$wgWBRepoSettings['entityNamespaces'] = array();
- 'multilang-truncate-length' => 32,
+// These are used for multilanguage strings that should have a soft length
constraint
+$wgWBRepoSettings['multilang-limits'] = array(
+ 'length' => 250,
+);
- // Should the page names (titles) be normalized against the
external site
- 'normalizeItemByTitlePageNames' => false,
- );
+$wgWBRepoSettings['multilang-truncate-length'] = 32;
- return $defaults;
-} );
+// Should the page names (titles) be normalized against the external site
+$wgWBRepoSettings['normalizeItemByTitlePageNames'] = false;
diff --git a/repo/includes/content/EntityHandler.php
b/repo/includes/content/EntityHandler.php
index f8fa10a..3f9bf0d 100644
--- a/repo/includes/content/EntityHandler.php
+++ b/repo/includes/content/EntityHandler.php
@@ -139,16 +139,10 @@
*
* @since 0.1
*
- * @return int
+ * @return integer
*/
final public function getEntityNamespace() {
- $ns = NamespaceUtils::getEntityNamespace( $this->getModelID() );
-
- if ( $ns === false ) {
- throw new MWException( "No namespace found for entity
model " . $this->getModelID() );
- }
-
- return $ns;
+ return NamespaceUtils::getEntityNamespace( $this->getModelID()
);
}
/**
diff --git a/repo/tests/phpunit/includes/content/EntityHandlerTest.php
b/repo/tests/phpunit/includes/content/EntityHandlerTest.php
index fb085a2..f6f7f6c 100644
--- a/repo/tests/phpunit/includes/content/EntityHandlerTest.php
+++ b/repo/tests/phpunit/includes/content/EntityHandlerTest.php
@@ -118,14 +118,11 @@
public function testCanBeUsedOn() {
$handler = $this->getHandler();
- $ns = $handler->getEntityNamespace();
- $title = \Title::makeTitle( $ns, "1234" );
- $this->assertTrue( $handler->canBeUsedOn( $title ),
+ $this->assertTrue( $handler->canBeUsedOn( \Title::makeTitle(
$handler->getEntityNamespace(), "1234" ) ),
'It should be possible
to create this kind of entity in the respective entity namespace!'
);
- $title = \Title::makeTitle( NS_MEDIAWIKI, "Foo" );
- $this->assertFalse( $handler->canBeUsedOn( $title ),
+ $this->assertFalse( $handler->canBeUsedOn( \Title::makeTitle(
NS_MEDIAWIKI, "Foo" ) ),
'It should be
impossible to create an entity outside the respective entity namespace!'
);
}
--
To view, visit https://gerrit.wikimedia.org/r/63845
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7054bfaf0ee8bb15f9caa7ed80f83a9182bb8fbb
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Jeroen De Dauw <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits