From f87f325f578da8a21eaaf6a73e69db00f4347161 Mon Sep 17 00:00:00 2001 From: Tigerfell <43786020+Tigerfell@users.noreply.github.com> Date: Sun, 27 Oct 2019 17:22:29 +0100 Subject: [PATCH 01/17] Remove specific namespaces from general wiki config --- .../templates/default/LocalSettings.php.erb | 73 ------------------- 1 file changed, 73 deletions(-) diff --git a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb index 1cceb2ab8..ac9625580 100644 --- a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb +++ b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb @@ -272,79 +272,6 @@ $wgForceUIMsgAsContentMsg = array( 'mainpage-url', 'portal-url', 'mapfeatures-ur $wgAllowUserJs = TRUE; $wgAllowUserCss = TRUE; -# FIXME - move to specific -# DE -define('NS_LANG_DE', 200); -$wgExtraNamespaces[NS_LANG_DE] = 'DE'; -$wgNamespacesWithSubpages[NS_LANG_DE] = TRUE; -$wgContentNamespaces[] = NS_LANG_DE; -define('NS_LANG_DE_TALK', 201); -$wgExtraNamespaces[NS_LANG_DE_TALK] = 'DE_talk'; -$wgNamespacesWithSubpages[NS_LANG_DE_TALK] = TRUE; - -# FR -define('NS_LANG_FR', 202); -$wgExtraNamespaces[NS_LANG_FR] = 'FR'; -$wgNamespacesWithSubpages[NS_LANG_FR] = TRUE; -$wgContentNamespaces[] = NS_LANG_FR; -define('NS_LANG_FR_TALK', 203); -$wgExtraNamespaces[NS_LANG_FR_TALK] = 'FR_talk'; -$wgNamespacesWithSubpages[NS_LANG_FR_TALK] = TRUE; - -# ES -define('NS_LANG_ES', 204); -$wgExtraNamespaces[NS_LANG_ES] = 'ES'; -$wgNamespacesWithSubpages[NS_LANG_ES] = TRUE; -$wgContentNamespaces[] = NS_LANG_ES; -define('NS_LANG_ES_TALK', 205); -$wgExtraNamespaces[NS_LANG_ES_TALK] = 'ES_talk'; -$wgNamespacesWithSubpages[NS_LANG_ES_TALK] = TRUE; - -# IT -define('NS_LANG_IT', 206); -$wgExtraNamespaces[NS_LANG_IT] = 'IT'; -$wgNamespacesWithSubpages[NS_LANG_IT] = TRUE; -$wgContentNamespaces[] = NS_LANG_IT; -define('NS_LANG_IT_TALK', 207); -$wgExtraNamespaces[NS_LANG_IT_TALK] = 'IT_talk'; -$wgNamespacesWithSubpages[NS_LANG_IT_TALK] = TRUE; - -# NL -define('NS_LANG_NL', 208); -$wgExtraNamespaces[NS_LANG_NL] = 'NL'; -$wgNamespacesWithSubpages[NS_LANG_NL] = TRUE; -$wgContentNamespaces[] = NS_LANG_NL; -define('NS_LANG_NL_TALK', 209); -$wgExtraNamespaces[NS_LANG_NL_TALK] = 'NL_talk'; -$wgNamespacesWithSubpages[NS_LANG_NL_TALK] = TRUE; - -# RU -define('NS_LANG_RU', 210); -$wgExtraNamespaces[NS_LANG_RU] = 'RU'; -$wgNamespacesWithSubpages[NS_LANG_RU] = TRUE; -$wgContentNamespaces[] = NS_LANG_RU; -define('NS_LANG_RU_TALK', 211); -$wgExtraNamespaces[NS_LANG_RU_TALK] = 'RU_talk'; -$wgNamespacesWithSubpages[NS_LANG_RU_TALK] = TRUE; - -# JA -define('NS_LANG_JA', 212); -$wgExtraNamespaces[NS_LANG_JA] = 'JA'; -$wgNamespacesWithSubpages[NS_LANG_JA] = TRUE; -$wgContentNamespaces[] = NS_LANG_JA; -define('NS_LANG_JA_TALK', 213); -$wgExtraNamespaces[NS_LANG_JA_TALK] = 'JA_talk'; -$wgNamespacesWithSubpages[NS_LANG_JA_TALK] = TRUE; - -$wgNamespacesToBeSearchedDefault[NS_LANG_DE] = TRUE; -$wgNamespacesToBeSearchedDefault[NS_LANG_FR] = TRUE; -$wgNamespacesToBeSearchedDefault[NS_LANG_ES] = TRUE; -$wgNamespacesToBeSearchedDefault[NS_LANG_IT] = TRUE; -$wgNamespacesToBeSearchedDefault[NS_LANG_NL] = TRUE; -$wgNamespacesToBeSearchedDefault[NS_LANG_RU] = TRUE; -$wgNamespacesToBeSearchedDefault[NS_LANG_JA] = TRUE; - - # Raise expensive lua (and other function) call limits to match WP # Docs: https://www.mediawiki.org/wiki/Manual:$wgExpensiveParserFunctionLimit # Wikipedia's Config: https://noc.wikimedia.org/conf/highlight.php?file=CommonSettings.php From e3db89368e10499556c9690c6420af513af22a77 Mon Sep 17 00:00:00 2001 From: Tigerfell <43786020+Tigerfell@users.noreply.github.com> Date: Sun, 27 Oct 2019 17:24:50 +0100 Subject: [PATCH 02/17] Place namespace config in new file --- .../templates/default/LocalSettings.php.erb | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 cookbooks/wiki/templates/default/LocalSettings.php.erb diff --git a/cookbooks/wiki/templates/default/LocalSettings.php.erb b/cookbooks/wiki/templates/default/LocalSettings.php.erb new file mode 100644 index 000000000..af0273447 --- /dev/null +++ b/cookbooks/wiki/templates/default/LocalSettings.php.erb @@ -0,0 +1,78 @@ + Date: Sun, 27 Oct 2019 17:26:34 +0100 Subject: [PATCH 03/17] new "Proposal" namespace --- .../wiki/templates/default/LocalSettings.php.erb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cookbooks/wiki/templates/default/LocalSettings.php.erb b/cookbooks/wiki/templates/default/LocalSettings.php.erb index af0273447..bcef00d0e 100644 --- a/cookbooks/wiki/templates/default/LocalSettings.php.erb +++ b/cookbooks/wiki/templates/default/LocalSettings.php.erb @@ -69,6 +69,17 @@ define('NS_LANG_JA_TALK', 213); $wgExtraNamespaces[NS_LANG_JA_TALK] = 'JA_talk'; $wgNamespacesWithSubpages[NS_LANG_JA_TALK] = TRUE; +# Proposal +# namespace features a specific search weight defined at +# cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb +define('NS_PROPOSAL', 3000); +$wgExtraNamespaces[NS_PROPOSAL] = 'Proposal'; +$wgNamespacesWithSubpages[NS_PROPOSAL] = TRUE; +$wgContentNamespaces[] = NS_PROPOSAL; +define('NS_PROPOSAL_TALK', 3001); +$wgExtraNamespaces[NS_PROPOSAL_TALK] = 'Proposal talk'; +$wgNamespacesWithSubpages[NS_PROPOSAL_TALK] = TRUE; + $wgNamespacesToBeSearchedDefault[NS_LANG_DE] = TRUE; $wgNamespacesToBeSearchedDefault[NS_LANG_FR] = TRUE; $wgNamespacesToBeSearchedDefault[NS_LANG_ES] = TRUE; @@ -76,3 +87,4 @@ $wgNamespacesToBeSearchedDefault[NS_LANG_IT] = TRUE; $wgNamespacesToBeSearchedDefault[NS_LANG_NL] = TRUE; $wgNamespacesToBeSearchedDefault[NS_LANG_RU] = TRUE; $wgNamespacesToBeSearchedDefault[NS_LANG_JA] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_PROPOSAL] = TRUE; From a5a3b8b5d676e4e7c46f5124325d2ca799bee76f Mon Sep 17 00:00:00 2001 From: Tigerfell <43786020+Tigerfell@users.noreply.github.com> Date: Sun, 27 Oct 2019 17:27:40 +0100 Subject: [PATCH 04/17] Search rank for new namespace --- .../templates/default/mw-ext-CirrusSearch.inc.php.erb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb b/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb index 12fe10e5b..7f69d41bb 100644 --- a/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb +++ b/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb @@ -3,3 +3,10 @@ require_once($IP .'/extensions/CirrusSearch/CirrusSearch.php'); $wgDisableSearchUpdate = false; $wgSearchType = 'CirrusSearch'; + +<% if @mediawiki[:site] === "wiki.openstreetmap.org" %> +# setting the search weight of the main wiki's proposal namespace lower then general talk pages (0.2), but +# higher then wiki project namespace (0.1) +# Documentation at https://phabricator.wikimedia.org/source/extension-cirrussearch/browse/master/docs/settings.txt$693 +$wgCirrusSearchNamespaceWeights = array_merge ( $wgCirrusSearchNamespaceWeights, array ( NS_PROPOSAL => 0.15 )); +<% end -%> From 2f0b6f10a1269e4a0a3ae8897d6fda10dd14fb4d Mon Sep 17 00:00:00 2001 From: Tigerfell Date: Tue, 9 Mar 2021 21:54:19 +0100 Subject: [PATCH 05/17] split configuration in two, include new templates --- .../templates/default/LocalSettings.php.erb | 11 ----------- cookbooks/wiki/recipes/default.rb | 14 ++++++++++++++ .../templates/default/after_extensions.php.erb | 14 ++++++++++++++ ...lSettings.php.erb => before_extensions.php.erb} | 5 +++++ 4 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 cookbooks/wiki/templates/default/after_extensions.php.erb rename cookbooks/wiki/templates/default/{LocalSettings.php.erb => before_extensions.php.erb} (92%) diff --git a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb index f3c127e5a..035ae0acc 100644 --- a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb +++ b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb @@ -230,13 +230,6 @@ $wgGroupPermissions['*']['createaccount'] = false; $wgUploadPath = "$wgScriptPath/img_auth.php"; <% end -%> -<% if not(@mediawiki[:private_accounts]) and not(@mediawiki[:private_site]) -%> -# user group "confirmed" with identical rights as "autoconfirmed", but assigned manually by sysops -$wgGroupPermissions['confirmed'] = $wgGroupPermissions['autoconfirmed']; -$wgAddGroups['sysop'][] = 'confirmed'; -$wgRemoveGroups['sysop'][] = 'confirmed'; -<% end -%> - # Allow Subpages on Main Namespace $wgNamespacesWithSubpages[NS_MAIN] = true; @@ -273,10 +266,6 @@ $wgAllowExternalImagesFrom = array( 'http://tile.openstreetmap.org/', 'https://t $wgNoFollowDomainExceptions = array( 'www.openstreetmap.org', 'josm.openstreetmap.de', 'taginfo.openstreetmap.org', 'blog.openstreetmap.org', 'wiki.osmfoundation.org' ); -# FIXME - move to specific -# defines which links of the sidebar are translatable -$wgForceUIMsgAsContentMsg = array( 'mainpage-url', 'mapfeatures-url', 'contributors-url', 'helppage', 'blogs-url', 'shop-url', 'sitesupport-url' ); - # FIXME - move to specific $wgAllowUserJs = TRUE; $wgAllowUserCss = TRUE; diff --git a/cookbooks/wiki/recipes/default.rb b/cookbooks/wiki/recipes/default.rb index 72af19cb8..04b7c74c6 100644 --- a/cookbooks/wiki/recipes/default.rb +++ b/cookbooks/wiki/recipes/default.rb @@ -60,6 +60,13 @@ # site_readonly "MAINTENANCE: WIKI READ-ONLY UNTIL Monday 16 May 2016 - 11:00am UTC/GMT." end +template "/srv/wiki.openstreetmap.org/00_before_extensions.php" do + source "before_extensions.php.erb" + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode "600" +end + mediawiki_extension "CodeEditor" do site "wiki.openstreetmap.org" end @@ -134,6 +141,13 @@ mode "0775" end +template "/srv/wiki.openstreetmap.org/99_after_extensions.php" do + source "after_extensions.php.erb" + owner node[:mediawiki][:user] + group node[:mediawiki][:group] + mode "600" +end + cron_d "wiki-dump" do minute "0" hour "2" diff --git a/cookbooks/wiki/templates/default/after_extensions.php.erb b/cookbooks/wiki/templates/default/after_extensions.php.erb new file mode 100644 index 000000000..190b40772 --- /dev/null +++ b/cookbooks/wiki/templates/default/after_extensions.php.erb @@ -0,0 +1,14 @@ + Date: Tue, 2 Aug 2022 20:49:36 +0300 Subject: [PATCH 06/17] wiki: switch to using hcaptcha Fixes: https://github.com/openstreetmap/operations/issues/454 --- cookbooks/foundation/recipes/board.rb | 2 -- cookbooks/foundation/recipes/dwg.rb | 2 -- cookbooks/foundation/recipes/mwg.rb | 2 -- cookbooks/foundation/recipes/wiki.rb | 2 -- cookbooks/mediawiki/resources/site.rb | 8 ++++---- .../default/mw-ext-ConfirmEdit.inc.php.erb | 16 ++++++++-------- cookbooks/wiki/recipes/default.rb | 4 ++-- test/data_bags/wiki/passwords.json | 2 +- 8 files changed, 15 insertions(+), 23 deletions(-) diff --git a/cookbooks/foundation/recipes/board.rb b/cookbooks/foundation/recipes/board.rb index ac39f67f5..82b2eb8ff 100644 --- a/cookbooks/foundation/recipes/board.rb +++ b/cookbooks/foundation/recipes/board.rb @@ -35,8 +35,6 @@ email_sender "webmaster@openstreetmap.org" email_sender_name "OSMF Board Wiki" private_site true - recaptcha_public_key "6LflIQATAAAAAMXyDWpba-FgipVzE-aGF4HIR59N" - recaptcha_private_key passwords["board"]["recaptcha"] version "1.37" end diff --git a/cookbooks/foundation/recipes/dwg.rb b/cookbooks/foundation/recipes/dwg.rb index ae0f1d37a..f939fb420 100644 --- a/cookbooks/foundation/recipes/dwg.rb +++ b/cookbooks/foundation/recipes/dwg.rb @@ -35,8 +35,6 @@ email_sender "webmaster@openstreetmap.org" email_sender_name "OSMF Board Wiki" private_site true - recaptcha_public_key "6LflIQATAAAAAMXyDWpba-FgipVzE-aGF4HIR59N" - recaptcha_private_key passwords["dwg"]["recaptcha"] version "1.37" end diff --git a/cookbooks/foundation/recipes/mwg.rb b/cookbooks/foundation/recipes/mwg.rb index 4775934a9..dd0bdab52 100644 --- a/cookbooks/foundation/recipes/mwg.rb +++ b/cookbooks/foundation/recipes/mwg.rb @@ -35,8 +35,6 @@ email_sender "webmaster@openstreetmap.org" email_sender_name "OSMF Board Wiki" private_site true - recaptcha_public_key "6LflIQATAAAAAMXyDWpba-FgipVzE-aGF4HIR59N" - recaptcha_private_key passwords["mwg"]["recaptcha"] version "1.37" end diff --git a/cookbooks/foundation/recipes/wiki.rb b/cookbooks/foundation/recipes/wiki.rb index b6470e158..199389d0e 100644 --- a/cookbooks/foundation/recipes/wiki.rb +++ b/cookbooks/foundation/recipes/wiki.rb @@ -41,8 +41,6 @@ email_sender "webmaster@openstreetmap.org" email_sender_name "OSMF Wiki" private_accounts true - recaptcha_public_key "6LflIQATAAAAAMXyDWpba-FgipVzE-aGF4HIR59N" - recaptcha_private_key passwords["wiki"]["recaptcha"] extra_file_extensions ["mp3"] version "1.37" end diff --git a/cookbooks/mediawiki/resources/site.rb b/cookbooks/mediawiki/resources/site.rb index 82ae15c28..6763797dd 100644 --- a/cookbooks/mediawiki/resources/site.rb +++ b/cookbooks/mediawiki/resources/site.rb @@ -42,8 +42,8 @@ property :admin_password, :kind_of => String, :required => [:create] property :private_accounts, :kind_of => [TrueClass, FalseClass], :default => false property :private_site, :kind_of => [TrueClass, FalseClass], :default => false -property :recaptcha_public_key, :kind_of => String -property :recaptcha_private_key, :kind_of => String +property :hcaptcha_public_key, :kind_of => String, :default => "" +property :hcaptcha_private_key, :kind_of => String, :default => "" property :extra_file_extensions, :kind_of => [String, Array], :default => [] property :fpm_max_children, :kind_of => Integer, :default => 5 property :fpm_start_servers, :kind_of => Integer, :default => 2 @@ -297,8 +297,8 @@ mediawiki_extension "ConfirmEdit" do site new_resource.site template "mw-ext-ConfirmEdit.inc.php.erb" - variables :public_key => new_resource.recaptcha_public_key, - :private_key => new_resource.recaptcha_private_key + variables :public_key => new_resource.hcaptcha_public_key, + :private_key => new_resource.hcaptcha_private_key update_site false end end diff --git a/cookbooks/mediawiki/templates/default/mw-ext-ConfirmEdit.inc.php.erb b/cookbooks/mediawiki/templates/default/mw-ext-ConfirmEdit.inc.php.erb index 50e1d4801..2e0af37ba 100644 --- a/cookbooks/mediawiki/templates/default/mw-ext-ConfirmEdit.inc.php.erb +++ b/cookbooks/mediawiki/templates/default/mw-ext-ConfirmEdit.inc.php.erb @@ -1,12 +1,12 @@ '; -$wgReCaptchaSecretKey = '<%= @private_key %>'; - -$wgCaptchaTriggers['addurl'] = true; -$wgCaptchaTriggers['create'] = true; +wfLoadExtensions( array( 'ConfirmEdit', 'ConfirmEdit/hCaptcha' ) ); +$wgHCaptchaSendRemoteIP = true; +$wgHCaptchaSiteKey = '<%= @public_key %>'; +$wgHCaptchaSecretKey = '<%= @private_key %>'; $wgGroupPermissions['autoconfirmed']['skipcaptcha'] = true; +$wgGroupPermissions['bot' ]['skipcaptcha'] = true; +$wgGroupPermissions['sysop' ]['skipcaptcha'] = true; + +$wgRateLimits['badcaptcha']['newbie'] = [ 100, 86400 ]; diff --git a/cookbooks/wiki/recipes/default.rb b/cookbooks/wiki/recipes/default.rb index 72af19cb8..ef0d16b8b 100644 --- a/cookbooks/wiki/recipes/default.rb +++ b/cookbooks/wiki/recipes/default.rb @@ -53,8 +53,8 @@ metanamespace "Wiki" - recaptcha_public_key "6LdFIQATAAAAAMwtHeI8KDgPqvRbXeNYSq1gujKz" - recaptcha_private_key passwords["recaptcha"] + hcaptcha_public_key "b67a410b-955e-4049-b432-f9c00e0202c0" + hcaptcha_private_key passwords["hcaptcha"] # site_notice "MAINTENANCE: WIKI READ-ONLY UNTIL Monday 16 May 2016 - 11:00am UTC/GMT." # site_readonly "MAINTENANCE: WIKI READ-ONLY UNTIL Monday 16 May 2016 - 11:00am UTC/GMT." diff --git a/test/data_bags/wiki/passwords.json b/test/data_bags/wiki/passwords.json index 109e87137..961e60f96 100644 --- a/test/data_bags/wiki/passwords.json +++ b/test/data_bags/wiki/passwords.json @@ -1,6 +1,6 @@ { "database": "database_password", "admin": "admin_password", - "recaptcha": "precaptcha_token", + "hcaptcha": "precaptcha_token", "thunderforest": "thunderforest_token" } From 8bc7c3d0f30a9aa45e0ef3c961c8ab761927e393 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Tue, 2 Aug 2022 22:54:09 +0300 Subject: [PATCH 07/17] dev: update active admins --- roles/dev.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/dev.rb b/roles/dev.rb index 3ba2b803f..5d2c36edb 100644 --- a/roles/dev.rb +++ b/roles/dev.rb @@ -5,7 +5,7 @@ :accounts => { :users => { :edgemaster => { :status => :administrator }, - :emacsen => { :status => :administrator }, + :emacsen => { :status => :user }, :twain => { :status => :user }, :bretth => { :status => :user }, :richard => { :status => :user }, From 6abf28ac8a3c059c4f58a71d4c42f0c146320a87 Mon Sep 17 00:00:00 2001 From: Tigerfell Date: Sun, 7 Nov 2021 15:39:44 +0100 Subject: [PATCH 08/17] remove account confirmation for private wikis --- .../templates/default/LocalSettings.php.erb | 58 ++++++++++++------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb index b27f7c11b..a25c60377 100644 --- a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb +++ b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb @@ -186,16 +186,6 @@ $wgResourceLoaderMaxQueryLength = -1; # Only Allow Signed-in users to edit $wgGroupPermissions['*']['edit'] = false; -# Only allow autoconfirmed for a few actions -$wgGroupPermissions['user']['move'] = false; -$wgGroupPermissions['user']['movefile'] = false; -$wgGroupPermissions['user']['move-categorypages'] = false; -$wgGroupPermissions['user']['upload'] = false; -$wgGroupPermissions['autoconfirmed']['move'] = true; -$wgGroupPermissions['autoconfirmed']['movefile'] = true; -$wgGroupPermissions['autoconfirmed']['move-categorypages'] = true; -$wgGroupPermissions['autoconfirmed']['upload'] = true; - # Allow bureaucrat group access to oversight options $wgGroupPermissions['bureaucrat']['hideuser'] = true; $wgGroupPermissions['bureaucrat']['deletelogentry'] = true; @@ -224,8 +214,8 @@ $wgGroupPermissions['sysop']['gadgets-definition-edit'] = true; $wgGroupPermissions['*']['createaccount'] = false; $wgGroupPermissions['user']['createaccount'] = true; <% end -%> -<% if @mediawiki[:private_site] -%> +<% if @mediawiki[:private_site] -%> # Disable reading by anonymous users $wgGroupPermissions['*']['read'] = false; @@ -239,13 +229,6 @@ $wgGroupPermissions['*']['createaccount'] = false; $wgUploadPath = "$wgScriptPath/img_auth.php"; <% end -%> -<% if not(@mediawiki[:private_accounts]) and not(@mediawiki[:private_site]) -%> -# user group "confirmed" with identical rights as "autoconfirmed", but assigned manually by sysops -$wgGroupPermissions['confirmed'] = $wgGroupPermissions['autoconfirmed']; -$wgAddGroups['sysop'][] = 'confirmed'; -$wgRemoveGroups['sysop'][] = 'confirmed'; -<% end -%> - # Allow Subpages on Main Namespace $wgNamespacesWithSubpages[NS_MAIN] = true; @@ -259,10 +242,6 @@ $wgEmailConfirmToEdit = true; # Extend autoblock period $wgAutoblockExpiry = 7776000; // 90 days -# Autopromote users to autoconfirmed -$wgAutoConfirmAge = 345600; // 4 days -$wgAutoConfirmCount = 10; - # Disable Hit Counter for Performance $wgDisableCounters = TRUE; # Disable IP in Header to avoid cache issue @@ -373,6 +352,41 @@ $wgSiteNotice = "<%= @mediawiki[:site_notice] %>"; $wgReadOnly = "<%= @mediawiki[:site_readonly] %>"; <% end -%> +# load extensions <% Dir.glob("#{@directory}/LocalSettings.d/*.php") do |file| -%> <%= "require_once('#{file}');" %> <% end -%> + +<% if not(@mediawiki[:private_accounts]) and not(@mediawiki[:private_site]) -%> +# require user confirmation for certain actions +$wgGroupPermissions['user']['move'] = false; +$wgGroupPermissions['user']['movefile'] = false; +$wgGroupPermissions['user']['move-categorypages'] = false; +$wgGroupPermissions['user']['upload'] = false; +$wgGroupPermissions['autoconfirmed']['move'] = true; +$wgGroupPermissions['autoconfirmed']['movefile'] = true; +$wgGroupPermissions['autoconfirmed']['move-categorypages'] = true; +$wgGroupPermissions['autoconfirmed']['upload'] = true; +# Autopromote users to autoconfirmed +$wgAutoConfirmAge = 345600; // 4 days +$wgAutoConfirmCount = 10; + +# user group "confirmed" with identical rights as "autoconfirmed", but assigned manually by sysops +$wgGroupPermissions['confirmed'] = $wgGroupPermissions['autoconfirmed']; +$wgAddGroups['sysop'][] = 'confirmed'; +$wgRemoveGroups['sysop'][] = 'confirmed'; +<% end -%> + +<% if @mediawiki[:private_accounts] or @mediawiki[:private_site] -%> +# disable automatic confirmation of users, grant all "autoconfirmed" rights to all users +$wgAutoConfirmAge = 0; +$wgAutoConfirmCount = 0; +$wgGroupPermissions['user'] = array_merge( $wgGroupPermissions['user'], $wgGroupPermissions['autoconfirmed'] ); + +unset( $wgGroupPermissions['autoconfirmed'] ); +unset( $wgRevokePermissions['autoconfirmed'] ); +unset( $wgAddGroups['autoconfirmed'] ); +unset( $wgRemoveGroups['autoconfirmed'] ); +unset( $wgGroupsAddToSelf['autoconfirmed'] ); +unset( $wgGroupsRemoveFromSelf['autoconfirmed'] ); +<% end -%> From 7c7e12aee08cc078e5a442c81576b272cc134074 Mon Sep 17 00:00:00 2001 From: Tigerfell Date: Sun, 7 Nov 2021 16:58:46 +0100 Subject: [PATCH 09/17] Add CategoryTree extension to wiki.osm.org --- cookbooks/wiki/recipes/default.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cookbooks/wiki/recipes/default.rb b/cookbooks/wiki/recipes/default.rb index ef0d16b8b..3a032ee3d 100644 --- a/cookbooks/wiki/recipes/default.rb +++ b/cookbooks/wiki/recipes/default.rb @@ -60,6 +60,10 @@ # site_readonly "MAINTENANCE: WIKI READ-ONLY UNTIL Monday 16 May 2016 - 11:00am UTC/GMT." end +mediawiki_extension "CategoryTree" do + site "wiki.openstreetmap.org" +end + mediawiki_extension "CodeEditor" do site "wiki.openstreetmap.org" end From 1ebe519fb753057e4fcc2a02401cc6d2c20cee14 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Tue, 2 Aug 2022 23:25:59 +0300 Subject: [PATCH 10/17] mediawiki: Enable CategoryTree on all wikis --- cookbooks/mediawiki/resources/site.rb | 5 +++++ cookbooks/wiki/recipes/default.rb | 4 ---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cookbooks/mediawiki/resources/site.rb b/cookbooks/mediawiki/resources/site.rb index 6763797dd..0508bcbad 100644 --- a/cookbooks/mediawiki/resources/site.rb +++ b/cookbooks/mediawiki/resources/site.rb @@ -386,6 +386,11 @@ update_site false end + mediawiki_extension "CategoryTree" do + site new_resource.site + update_site false + end + mediawiki_extension "cldr" do site new_resource.site template "mw-ext-cldr.inc.php.erb" diff --git a/cookbooks/wiki/recipes/default.rb b/cookbooks/wiki/recipes/default.rb index 3a032ee3d..ef0d16b8b 100644 --- a/cookbooks/wiki/recipes/default.rb +++ b/cookbooks/wiki/recipes/default.rb @@ -60,10 +60,6 @@ # site_readonly "MAINTENANCE: WIKI READ-ONLY UNTIL Monday 16 May 2016 - 11:00am UTC/GMT." end -mediawiki_extension "CategoryTree" do - site "wiki.openstreetmap.org" -end - mediawiki_extension "CodeEditor" do site "wiki.openstreetmap.org" end From 0a6824a8973356e876bbe7c3c85fe928e6ca70ae Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Wed, 3 Aug 2022 00:22:55 +0300 Subject: [PATCH 11/17] wiki: Ensure custom config for wiki.osm.org is loaded --- .../templates/default/LocalSettings.php.erb | 88 +++++++++++++++++ .../default/mw-ext-CirrusSearch.inc.php.erb | 2 +- cookbooks/wiki/recipes/default.rb | 14 --- .../default/after_extensions.php.erb | 14 --- .../default/before_extensions.php.erb | 95 ------------------- 5 files changed, 89 insertions(+), 124 deletions(-) delete mode 100644 cookbooks/wiki/templates/default/after_extensions.php.erb delete mode 100644 cookbooks/wiki/templates/default/before_extensions.php.erb diff --git a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb index dff320d56..d67e65e56 100644 --- a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb +++ b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb @@ -275,6 +275,94 @@ $wgSiteNotice = "<%= @mediawiki[:site_notice] %>"; $wgReadOnly = "<%= @mediawiki[:site_readonly] %>"; <% end -%> +<% if @mediawiki[:site] == "wiki.openstreetmap.org" -%> +# DE +define('NS_LANG_DE', 200); +$wgExtraNamespaces[NS_LANG_DE] = 'DE'; +$wgNamespacesWithSubpages[NS_LANG_DE] = TRUE; +$wgContentNamespaces[] = NS_LANG_DE; +define('NS_LANG_DE_TALK', 201); +$wgExtraNamespaces[NS_LANG_DE_TALK] = 'DE_talk'; +$wgNamespacesWithSubpages[NS_LANG_DE_TALK] = TRUE; + +# FR +define('NS_LANG_FR', 202); +$wgExtraNamespaces[NS_LANG_FR] = 'FR'; +$wgNamespacesWithSubpages[NS_LANG_FR] = TRUE; +$wgContentNamespaces[] = NS_LANG_FR; +define('NS_LANG_FR_TALK', 203); +$wgExtraNamespaces[NS_LANG_FR_TALK] = 'FR_talk'; +$wgNamespacesWithSubpages[NS_LANG_FR_TALK] = TRUE; + +# ES +define('NS_LANG_ES', 204); +$wgExtraNamespaces[NS_LANG_ES] = 'ES'; +$wgNamespacesWithSubpages[NS_LANG_ES] = TRUE; +$wgContentNamespaces[] = NS_LANG_ES; +define('NS_LANG_ES_TALK', 205); +$wgExtraNamespaces[NS_LANG_ES_TALK] = 'ES_talk'; +$wgNamespacesWithSubpages[NS_LANG_ES_TALK] = TRUE; + +# IT +define('NS_LANG_IT', 206); +$wgExtraNamespaces[NS_LANG_IT] = 'IT'; +$wgNamespacesWithSubpages[NS_LANG_IT] = TRUE; +$wgContentNamespaces[] = NS_LANG_IT; +define('NS_LANG_IT_TALK', 207); +$wgExtraNamespaces[NS_LANG_IT_TALK] = 'IT_talk'; +$wgNamespacesWithSubpages[NS_LANG_IT_TALK] = TRUE; + +# NL +define('NS_LANG_NL', 208); +$wgExtraNamespaces[NS_LANG_NL] = 'NL'; +$wgNamespacesWithSubpages[NS_LANG_NL] = TRUE; +$wgContentNamespaces[] = NS_LANG_NL; +define('NS_LANG_NL_TALK', 209); +$wgExtraNamespaces[NS_LANG_NL_TALK] = 'NL_talk'; +$wgNamespacesWithSubpages[NS_LANG_NL_TALK] = TRUE; + +# RU +define('NS_LANG_RU', 210); +$wgExtraNamespaces[NS_LANG_RU] = 'RU'; +$wgNamespacesWithSubpages[NS_LANG_RU] = TRUE; +$wgContentNamespaces[] = NS_LANG_RU; +define('NS_LANG_RU_TALK', 211); +$wgExtraNamespaces[NS_LANG_RU_TALK] = 'RU_talk'; +$wgNamespacesWithSubpages[NS_LANG_RU_TALK] = TRUE; + +# JA +define('NS_LANG_JA', 212); +$wgExtraNamespaces[NS_LANG_JA] = 'JA'; +$wgNamespacesWithSubpages[NS_LANG_JA] = TRUE; +$wgContentNamespaces[] = NS_LANG_JA; +define('NS_LANG_JA_TALK', 213); +$wgExtraNamespaces[NS_LANG_JA_TALK] = 'JA_talk'; +$wgNamespacesWithSubpages[NS_LANG_JA_TALK] = TRUE; + +# Proposal +# namespace features a specific search weight defined at +# cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb +define('NS_PROPOSAL', 3000); +$wgExtraNamespaces[NS_PROPOSAL] = 'Proposal'; +$wgNamespacesWithSubpages[NS_PROPOSAL] = TRUE; +$wgContentNamespaces[] = NS_PROPOSAL; +define('NS_PROPOSAL_TALK', 3001); +$wgExtraNamespaces[NS_PROPOSAL_TALK] = 'Proposal talk'; +$wgNamespacesWithSubpages[NS_PROPOSAL_TALK] = TRUE; + +$wgNamespacesToBeSearchedDefault[NS_LANG_DE] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_LANG_FR] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_LANG_ES] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_LANG_IT] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_LANG_NL] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_LANG_RU] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_LANG_JA] = TRUE; +$wgNamespacesToBeSearchedDefault[NS_PROPOSAL] = TRUE; + +# defines which links of the sidebar are translatable +$wgForceUIMsgAsContentMsg = array( 'mainpage-url', 'mapfeatures-url', 'contributors-url', 'helppage', 'blogs-url', 'shop-url', 'sitesupport-url' ); +<% end -%> + # load extensions <% Dir.glob("#{@directory}/LocalSettings.d/*.php") do |file| -%> <%= "require_once('#{file}');" %> diff --git a/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb b/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb index 44485f2c3..56412467e 100644 --- a/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb +++ b/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb @@ -4,7 +4,7 @@ wfLoadExtension( 'CirrusSearch' ); $wgDisableSearchUpdate = false; $wgSearchType = 'CirrusSearch'; -<% if @mediawiki[:site] === "wiki.openstreetmap.org" %> +<% if @mediawiki[:site] == "wiki.openstreetmap.org" -%> # setting the search weight of the main wiki's proposal namespace lower then general talk pages (0.2), but # higher then wiki project namespace (0.1) # Documentation at https://phabricator.wikimedia.org/source/extension-cirrussearch/browse/master/docs/settings.txt$693 diff --git a/cookbooks/wiki/recipes/default.rb b/cookbooks/wiki/recipes/default.rb index b99e9c3b5..ef0d16b8b 100644 --- a/cookbooks/wiki/recipes/default.rb +++ b/cookbooks/wiki/recipes/default.rb @@ -60,13 +60,6 @@ # site_readonly "MAINTENANCE: WIKI READ-ONLY UNTIL Monday 16 May 2016 - 11:00am UTC/GMT." end -template "/srv/wiki.openstreetmap.org/00_before_extensions.php" do - source "before_extensions.php.erb" - owner node[:mediawiki][:user] - group node[:mediawiki][:group] - mode "600" -end - mediawiki_extension "CodeEditor" do site "wiki.openstreetmap.org" end @@ -141,13 +134,6 @@ mode "0775" end -template "/srv/wiki.openstreetmap.org/99_after_extensions.php" do - source "after_extensions.php.erb" - owner node[:mediawiki][:user] - group node[:mediawiki][:group] - mode "600" -end - cron_d "wiki-dump" do minute "0" hour "2" diff --git a/cookbooks/wiki/templates/default/after_extensions.php.erb b/cookbooks/wiki/templates/default/after_extensions.php.erb deleted file mode 100644 index 190b40772..000000000 --- a/cookbooks/wiki/templates/default/after_extensions.php.erb +++ /dev/null @@ -1,14 +0,0 @@ - Date: Wed, 3 Aug 2022 00:34:36 +0300 Subject: [PATCH 12/17] mediawiki: support site in templates --- cookbooks/mediawiki/resources/site.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/cookbooks/mediawiki/resources/site.rb b/cookbooks/mediawiki/resources/site.rb index 0508bcbad..976913cde 100644 --- a/cookbooks/mediawiki/resources/site.rb +++ b/cookbooks/mediawiki/resources/site.rb @@ -654,6 +654,7 @@ def database_params def mediawiki_params { + :site => => new_resource.site, :sitename => new_resource.sitename, :metanamespace => new_resource.metanamespace, :logo => new_resource.logo, From 0d8247a2964b6e1c21df340808a183090cc0ae87 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Wed, 3 Aug 2022 00:39:01 +0300 Subject: [PATCH 13/17] mediawiki: tweak namespace search for all sites --- .../mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb | 2 -- 1 file changed, 2 deletions(-) diff --git a/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb b/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb index 56412467e..8a6ef31ca 100644 --- a/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb +++ b/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb @@ -4,9 +4,7 @@ wfLoadExtension( 'CirrusSearch' ); $wgDisableSearchUpdate = false; $wgSearchType = 'CirrusSearch'; -<% if @mediawiki[:site] == "wiki.openstreetmap.org" -%> # setting the search weight of the main wiki's proposal namespace lower then general talk pages (0.2), but # higher then wiki project namespace (0.1) # Documentation at https://phabricator.wikimedia.org/source/extension-cirrussearch/browse/master/docs/settings.txt$693 $wgCirrusSearchNamespaceWeights = array_merge ( $wgCirrusSearchNamespaceWeights, array ( NS_PROPOSAL => 0.15 )); -<% end -%> From f3a8f9b9c6f82205ec5509f311b0a1edeac3d40c Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Wed, 3 Aug 2022 00:41:36 +0300 Subject: [PATCH 14/17] mediawiki: fix site name scoping --- cookbooks/mediawiki/resources/site.rb | 1 - cookbooks/mediawiki/templates/default/LocalSettings.php.erb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/cookbooks/mediawiki/resources/site.rb b/cookbooks/mediawiki/resources/site.rb index 976913cde..0508bcbad 100644 --- a/cookbooks/mediawiki/resources/site.rb +++ b/cookbooks/mediawiki/resources/site.rb @@ -654,7 +654,6 @@ def database_params def mediawiki_params { - :site => => new_resource.site, :sitename => new_resource.sitename, :metanamespace => new_resource.metanamespace, :logo => new_resource.logo, diff --git a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb index d67e65e56..7b7190005 100644 --- a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb +++ b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb @@ -275,7 +275,7 @@ $wgSiteNotice = "<%= @mediawiki[:site_notice] %>"; $wgReadOnly = "<%= @mediawiki[:site_readonly] %>"; <% end -%> -<% if @mediawiki[:site] == "wiki.openstreetmap.org" -%> +<% if @name == "wiki.openstreetmap.org" -%> # DE define('NS_LANG_DE', 200); $wgExtraNamespaces[NS_LANG_DE] = 'DE'; From 8aff36f30dc7d2df2ba40783f422b2405106e926 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 2 Aug 2022 15:15:43 +0100 Subject: [PATCH 15/17] Remove support for rsyncing old hosts data --- roles/ironbelly.rb | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/roles/ironbelly.rb b/roles/ironbelly.rb index 8260dfb28..635e197fa 100644 --- a/roles/ironbelly.rb +++ b/roles/ironbelly.rb @@ -73,21 +73,6 @@ }, :rsyncd => { :modules => { - :hosts => { - :comment => "Host data", - :path => "/home/hosts", - :read_only => true, - :write_only => false, - :list => false, - :uid => "tomh", - :gid => "tomh", - :transfer_logging => false, - :hosts_allow => [ - "212.110.172.32", # shenron - "2001:41c9:1:400::32", # shenron - "212.159.112.221" # grant - ] - }, :logs => { :comment => "Log files", :path => "/store/logs", From f1c9bbf0ff3bde913226bbfae37f576215531347 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 2 Aug 2022 21:44:20 +0000 Subject: [PATCH 16/17] Restore elasticsearch6.x and get rid of elasticsearch5.x --- cookbooks/apt/recipes/default.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cookbooks/apt/recipes/default.rb b/cookbooks/apt/recipes/default.rb index f69db4f3e..7619d0a9c 100644 --- a/cookbooks/apt/recipes/default.rb +++ b/cookbooks/apt/recipes/default.rb @@ -107,9 +107,9 @@ key "ABF5BD827BD9BF62" end -apt_repository "elasticsearch5.x" do - action repository_actions["elasticsearch5.x"] - uri "https://artifacts.elastic.co/packages/5.x/apt" +apt_repository "elasticsearch6.x" do + action repository_actions["elasticsearch6.x"] + uri "https://artifacts.elastic.co/packages/6.x/apt" distribution "stable" components ["main"] key "D27D666CD88E42B4" From 8a453080af3ff555115f67fb82697fa40f7ba56c Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Wed, 3 Aug 2022 00:57:23 +0300 Subject: [PATCH 17/17] mediawiki: fix CirrusSearch tweak --- .../mediawiki/templates/default/LocalSettings.php.erb | 7 +++++++ .../templates/default/mw-ext-CirrusSearch.inc.php.erb | 5 ----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb index 7b7190005..d5bbf71a7 100644 --- a/cookbooks/mediawiki/templates/default/LocalSettings.php.erb +++ b/cookbooks/mediawiki/templates/default/LocalSettings.php.erb @@ -368,6 +368,13 @@ $wgForceUIMsgAsContentMsg = array( 'mainpage-url', 'mapfeatures-url', 'contribut <%= "require_once('#{file}');" %> <% end -%> +<% if @name == "wiki.openstreetmap.org" -%> +# setting the search weight of the main wiki's proposal namespace lower then general talk pages (0.2), but +# higher then wiki project namespace (0.1) +# Documentation at https://phabricator.wikimedia.org/source/extension-cirrussearch/browse/master/docs/settings.txt$693 +$wgCirrusSearchNamespaceWeights = array_merge ( $wgCirrusSearchNamespaceWeights, array ( NS_PROPOSAL => 0.15 )); +<% end -%> + <% if not(@mediawiki[:private_accounts]) and not(@mediawiki[:private_site]) -%> # require user confirmation for certain actions $wgGroupPermissions['user']['move'] = false; diff --git a/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb b/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb index 8a6ef31ca..ddb87f166 100644 --- a/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb +++ b/cookbooks/mediawiki/templates/default/mw-ext-CirrusSearch.inc.php.erb @@ -3,8 +3,3 @@ wfLoadExtension( 'CirrusSearch' ); $wgDisableSearchUpdate = false; $wgSearchType = 'CirrusSearch'; - -# setting the search weight of the main wiki's proposal namespace lower then general talk pages (0.2), but -# higher then wiki project namespace (0.1) -# Documentation at https://phabricator.wikimedia.org/source/extension-cirrussearch/browse/master/docs/settings.txt$693 -$wgCirrusSearchNamespaceWeights = array_merge ( $wgCirrusSearchNamespaceWeights, array ( NS_PROPOSAL => 0.15 ));