[MediaWiki-commits] [Gerrit] Fix handling of the specialSiteLinkGroups setting - change (mediawiki...Wikibase)
Hoo man has uploaded a new change for review. https://gerrit.wikimedia.org/r/150195 Change subject: Fix handling of the specialSiteLinkGroups setting .. Fix handling of the specialSiteLinkGroups setting Also add some documentation. Change-Id: I5004ee8e823ed0cd245793c61d54246a4805e618 --- M docs/options.wiki M lib/includes/modules/SitesModule.php M lib/resources/wikibase.ui.SiteLinksEditTool.js M repo/i18n/en.json M repo/i18n/qqq.json M repo/includes/View/SiteLinksView.php M repo/includes/api/GetEntities.php M repo/includes/api/LinkTitles.php M repo/includes/api/ModifyEntity.php M repo/includes/api/SiteLinkTargetProvider.php M repo/tests/phpunit/includes/View/SiteLinksViewTest.php M repo/tests/phpunit/includes/api/SiteLinkTargetProviderTest.php 12 files changed, 157 insertions(+), 63 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/95/150195/1 diff --git a/docs/options.wiki b/docs/options.wiki index e839424..4621249 100644 --- a/docs/options.wiki +++ b/docs/options.wiki @@ -10,6 +10,7 @@ ;changesDatabase: The database that changes are recorded to for processing by clients. This must be set to a symbolic database identifier that MediaWiki's LBFactory class understands; codefalse/code means that the wiki's own database shall be used. '''Note''' that on the client, this setting should usually be the same as the coderepoDatabase/code setting. ;siteLinkGroups: The site groups to use in sitelinks. Must correspond to a value used to give the site group in the MediaWiki codesites/code table. Default is array( wikipedia ). This defines which groups of sites can be linked to Wikibase items. '''Note''' that this setting replaces the old ''siteLinkGroup'' setting, which only allowed for a single group. +;specialSiteLinkGroups: This maps one or more site groups into a single special group. This is useful if sites from multiple site groups should be shown in a single special section on item pages, instead of one section per site group. ;localClientDatabases: An array of locally accessible client databases, for use by the codedispatchChanges.php/code script. This setting determines which wikis changes are pushed to directly. It must be given either as an associative array, mapping global site IDs to logical database names, or, of the database names are the same as the site IDs, as a list of databases. The default is an empty array, indicating no local client databases. === Expert Settings === diff --git a/lib/includes/modules/SitesModule.php b/lib/includes/modules/SitesModule.php index 1747a1c..4abc461 100644 --- a/lib/includes/modules/SitesModule.php +++ b/lib/includes/modules/SitesModule.php @@ -41,44 +41,70 @@ foreach ( SiteSQLStore::newInstance()-getSites() as $site ) { $group = $site-getGroup(); - if ( $site-getType() === Site::TYPE_MEDIAWIKI in_array( $group, $groups ) ) { - // FIXME: quickfix to allow a custom site-name / handling for groups defined in $wgSpecialSiteLinkGroups - if ( in_array( $group, $specialGroups ) ) { - $languageNameMsg = wfMessage( 'wikibase-sitelinks-sitename-' . $site-getGlobalId() ); - $languageName = $languageNameMsg-exists() ? $languageNameMsg-parse() : $site-getGlobalId(); - $groupName = 'special'; - } else { - $languageName = Utils::fetchLanguageName( $site-getLanguageCode() ); - $groupName = $group; - } - $globalId = $site-getGlobalId(); - - // Use protocol relative URIs, as it's safe to assume that all wikis support the same protocol - list( $pageUrl, $apiUrl ) = preg_replace( - /^https?:/i, - '', - array( - $site-getPageUrl(), - $site-getFileUrl( 'api.php' ) - ) - ); - - //TODO: figure out which name ist best - //$localIds = $site-getLocalIds(); - //$name = empty( $localIds['equivalent'] ) ? $site-getGlobalId() : $localIds['equivalent'][0]; - - $sites[ $globalId ] = array( - 'shortName' = $languageName, - 'name' = $languageName, // use short name for both, for now -
[MediaWiki-commits] [Gerrit] Fix handling of the specialSiteLinkGroups setting - change (mediawiki...Wikibase)
jenkins-bot has submitted this change and it was merged. Change subject: Fix handling of the specialSiteLinkGroups setting .. Fix handling of the specialSiteLinkGroups setting Also add some documentation. Change-Id: I5004ee8e823ed0cd245793c61d54246a4805e618 --- M docs/options.wiki M lib/includes/modules/SitesModule.php M lib/resources/wikibase.ui.SiteLinksEditTool.js M repo/i18n/en.json M repo/i18n/qqq.json M repo/includes/View/SiteLinksView.php M repo/includes/api/GetEntities.php M repo/includes/api/LinkTitles.php M repo/includes/api/ModifyEntity.php M repo/includes/api/SiteLinkTargetProvider.php M repo/tests/phpunit/includes/View/SiteLinksViewTest.php M repo/tests/phpunit/includes/api/SiteLinkTargetProviderTest.php 12 files changed, 157 insertions(+), 63 deletions(-) Approvals: Hoo man: Looks good to me, approved WikidataJenkins: Verified jenkins-bot: Verified diff --git a/docs/options.wiki b/docs/options.wiki index e839424..4621249 100644 --- a/docs/options.wiki +++ b/docs/options.wiki @@ -10,6 +10,7 @@ ;changesDatabase: The database that changes are recorded to for processing by clients. This must be set to a symbolic database identifier that MediaWiki's LBFactory class understands; codefalse/code means that the wiki's own database shall be used. '''Note''' that on the client, this setting should usually be the same as the coderepoDatabase/code setting. ;siteLinkGroups: The site groups to use in sitelinks. Must correspond to a value used to give the site group in the MediaWiki codesites/code table. Default is array( wikipedia ). This defines which groups of sites can be linked to Wikibase items. '''Note''' that this setting replaces the old ''siteLinkGroup'' setting, which only allowed for a single group. +;specialSiteLinkGroups: This maps one or more site groups into a single special group. This is useful if sites from multiple site groups should be shown in a single special section on item pages, instead of one section per site group. ;localClientDatabases: An array of locally accessible client databases, for use by the codedispatchChanges.php/code script. This setting determines which wikis changes are pushed to directly. It must be given either as an associative array, mapping global site IDs to logical database names, or, of the database names are the same as the site IDs, as a list of databases. The default is an empty array, indicating no local client databases. === Expert Settings === diff --git a/lib/includes/modules/SitesModule.php b/lib/includes/modules/SitesModule.php index 1747a1c..4abc461 100644 --- a/lib/includes/modules/SitesModule.php +++ b/lib/includes/modules/SitesModule.php @@ -41,44 +41,70 @@ foreach ( SiteSQLStore::newInstance()-getSites() as $site ) { $group = $site-getGroup(); - if ( $site-getType() === Site::TYPE_MEDIAWIKI in_array( $group, $groups ) ) { - // FIXME: quickfix to allow a custom site-name / handling for groups defined in $wgSpecialSiteLinkGroups - if ( in_array( $group, $specialGroups ) ) { - $languageNameMsg = wfMessage( 'wikibase-sitelinks-sitename-' . $site-getGlobalId() ); - $languageName = $languageNameMsg-exists() ? $languageNameMsg-parse() : $site-getGlobalId(); - $groupName = 'special'; - } else { - $languageName = Utils::fetchLanguageName( $site-getLanguageCode() ); - $groupName = $group; - } - $globalId = $site-getGlobalId(); - - // Use protocol relative URIs, as it's safe to assume that all wikis support the same protocol - list( $pageUrl, $apiUrl ) = preg_replace( - /^https?:/i, - '', - array( - $site-getPageUrl(), - $site-getFileUrl( 'api.php' ) - ) - ); - - //TODO: figure out which name ist best - //$localIds = $site-getLocalIds(); - //$name = empty( $localIds['equivalent'] ) ? $site-getGlobalId() : $localIds['equivalent'][0]; - - $sites[ $globalId ] = array( - 'shortName' = $languageName, - 'name' = $languageName, // use short name for both, for now - 'id' = $globalId, -
[MediaWiki-commits] [Gerrit] Fix handling of the specialSiteLinkGroups setting - change (mediawiki...Wikibase)
Hoo man has uploaded a new change for review. https://gerrit.wikimedia.org/r/148643 Change subject: Fix handling of the specialSiteLinkGroups setting .. Fix handling of the specialSiteLinkGroups setting Also add some documentation. Change-Id: I5004ee8e823ed0cd245793c61d54246a4805e618 --- M docs/options.wiki M lib/includes/modules/SitesModule.php M lib/resources/wikibase.ui.SiteLinksEditTool.js M repo/includes/View/SiteLinksView.php M repo/includes/api/GetEntities.php M repo/includes/api/LinkTitles.php M repo/includes/api/ModifyEntity.php M repo/includes/api/SiteLinkTargetProvider.php M repo/tests/phpunit/includes/View/SiteLinksViewTest.php M repo/tests/phpunit/includes/api/SiteLinkTargetProviderTest.php 10 files changed, 96 insertions(+), 29 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase refs/changes/43/148643/1 diff --git a/docs/options.wiki b/docs/options.wiki index 5a01b47..dd7bf10 100644 --- a/docs/options.wiki +++ b/docs/options.wiki @@ -10,6 +10,7 @@ ;changesDatabase: The database that changes are recorded to for processing by clients. This must be set to a symbolic database identifier that MediaWiki's LBFactory class understands; codefalse/code means that the wiki's own database shall be used. '''Note''' that on the client, this setting should usually be the same as the coderepoDatabase/code setting. ;siteLinkGroups: The site groups to use in sitelinks. Must correspond to a value used to give the site group in the MediaWiki codesites/code table. Default is array( wikipedia ). This defines which groups of sites can be linked to Wikibase items. '''Note''' that this setting replaces the old ''siteLinkGroup'' setting, which only allowed for a single group. +;specialSiteLinkGroups: This maps one or more site groups into a single special group. This is useful if sites from multiple site groups should be shown in a signle special section on item pages, instead of one section per site group. ;localClientDatabases: An array of locally accessible client databases, for use by the codedispatchChanges.php/code script. This setting determines which wikis changes are pushed to directly. It must be given either as an associative array, mapping global site IDs to logical database names, or, of the database names are the same as the site IDs, as a list of databases. The default is an empty array, indicating no local client databases. === Expert Settings === diff --git a/lib/includes/modules/SitesModule.php b/lib/includes/modules/SitesModule.php index 1747a1c..75d91ab 100644 --- a/lib/includes/modules/SitesModule.php +++ b/lib/includes/modules/SitesModule.php @@ -41,8 +41,9 @@ foreach ( SiteSQLStore::newInstance()-getSites() as $site ) { $group = $site-getGroup(); - if ( $site-getType() === Site::TYPE_MEDIAWIKI in_array( $group, $groups ) ) { - // FIXME: quickfix to allow a custom site-name / handling for groups defined in $wgSpecialSiteLinkGroups + if ( $site-getType() === Site::TYPE_MEDIAWIKI ( in_array( $group, $groups ) || in_array( $group, $specialGroups ) ) ) { + // FIXME: quickfix to allow a custom site-name / handling for the site groups which are + // special according to the specialSiteLinkGroups setting if ( in_array( $group, $specialGroups ) ) { $languageNameMsg = wfMessage( 'wikibase-sitelinks-sitename-' . $site-getGlobalId() ); $languageName = $languageNameMsg-exists() ? $languageNameMsg-parse() : $site-getGlobalId(); diff --git a/lib/resources/wikibase.ui.SiteLinksEditTool.js b/lib/resources/wikibase.ui.SiteLinksEditTool.js index 6c636ad..94c14d3 100644 --- a/lib/resources/wikibase.ui.SiteLinksEditTool.js +++ b/lib/resources/wikibase.ui.SiteLinksEditTool.js @@ -179,7 +179,8 @@ if ( this._editableValues.length === 0 ) { var siteNameMessageKey = 'wikibase-sitelinks-sitename-columnheading'; - // FIXME: quickfix to allow a custom site-name / handling for groups defined in $wgSpecialSiteLinkGroups + // FIXME: quickfix to allow a custom site-name / handling for the site groups which are + // special according to the specialSiteLinkGroups setting if ( $siteLinksTable.data( 'wb-sitelinks-group' ) === 'special' ) { siteNameMessageKey += '-special'; } diff --git a/repo/includes/View/SiteLinksView.php b/repo/includes/View/SiteLinksView.php index d9f0632..dbb717a 100644 --- a/repo/includes/View/SiteLinksView.php +++ b/repo/includes/View/SiteLinksView.php @@ -93,9 +93,9 @@ * @return
[MediaWiki-commits] [Gerrit] Fix handling of the specialSiteLinkGroups setting - change (mediawiki...Wikibase)
jenkins-bot has submitted this change and it was merged. Change subject: Fix handling of the specialSiteLinkGroups setting .. Fix handling of the specialSiteLinkGroups setting Also add some documentation. Change-Id: I5004ee8e823ed0cd245793c61d54246a4805e618 --- M docs/options.wiki M lib/includes/modules/SitesModule.php M lib/resources/wikibase.ui.SiteLinksEditTool.js M repo/i18n/en.json M repo/i18n/qqq.json M repo/includes/View/SiteLinksView.php M repo/includes/api/GetEntities.php M repo/includes/api/LinkTitles.php M repo/includes/api/ModifyEntity.php M repo/includes/api/SiteLinkTargetProvider.php M repo/tests/phpunit/includes/View/SiteLinksViewTest.php M repo/tests/phpunit/includes/api/SiteLinkTargetProviderTest.php 12 files changed, 156 insertions(+), 62 deletions(-) Approvals: Aude: Looks good to me, approved WikidataJenkins: Verified Daniel Kinzler: Looks good to me, but someone else must approve jenkins-bot: Verified diff --git a/docs/options.wiki b/docs/options.wiki index 5a01b47..4f85b02 100644 --- a/docs/options.wiki +++ b/docs/options.wiki @@ -10,6 +10,7 @@ ;changesDatabase: The database that changes are recorded to for processing by clients. This must be set to a symbolic database identifier that MediaWiki's LBFactory class understands; codefalse/code means that the wiki's own database shall be used. '''Note''' that on the client, this setting should usually be the same as the coderepoDatabase/code setting. ;siteLinkGroups: The site groups to use in sitelinks. Must correspond to a value used to give the site group in the MediaWiki codesites/code table. Default is array( wikipedia ). This defines which groups of sites can be linked to Wikibase items. '''Note''' that this setting replaces the old ''siteLinkGroup'' setting, which only allowed for a single group. +;specialSiteLinkGroups: This maps one or more site groups into a single special group. This is useful if sites from multiple site groups should be shown in a single special section on item pages, instead of one section per site group. ;localClientDatabases: An array of locally accessible client databases, for use by the codedispatchChanges.php/code script. This setting determines which wikis changes are pushed to directly. It must be given either as an associative array, mapping global site IDs to logical database names, or, of the database names are the same as the site IDs, as a list of databases. The default is an empty array, indicating no local client databases. === Expert Settings === diff --git a/lib/includes/modules/SitesModule.php b/lib/includes/modules/SitesModule.php index 1747a1c..4abc461 100644 --- a/lib/includes/modules/SitesModule.php +++ b/lib/includes/modules/SitesModule.php @@ -41,44 +41,70 @@ foreach ( SiteSQLStore::newInstance()-getSites() as $site ) { $group = $site-getGroup(); - if ( $site-getType() === Site::TYPE_MEDIAWIKI in_array( $group, $groups ) ) { - // FIXME: quickfix to allow a custom site-name / handling for groups defined in $wgSpecialSiteLinkGroups - if ( in_array( $group, $specialGroups ) ) { - $languageNameMsg = wfMessage( 'wikibase-sitelinks-sitename-' . $site-getGlobalId() ); - $languageName = $languageNameMsg-exists() ? $languageNameMsg-parse() : $site-getGlobalId(); - $groupName = 'special'; - } else { - $languageName = Utils::fetchLanguageName( $site-getLanguageCode() ); - $groupName = $group; - } - $globalId = $site-getGlobalId(); - - // Use protocol relative URIs, as it's safe to assume that all wikis support the same protocol - list( $pageUrl, $apiUrl ) = preg_replace( - /^https?:/i, - '', - array( - $site-getPageUrl(), - $site-getFileUrl( 'api.php' ) - ) - ); - - //TODO: figure out which name ist best - //$localIds = $site-getLocalIds(); - //$name = empty( $localIds['equivalent'] ) ? $site-getGlobalId() : $localIds['equivalent'][0]; - - $sites[ $globalId ] = array( - 'shortName' = $languageName, - 'name' = $languageName, // use short name for both, for now -