From 84cfc3aca2f85fd7fc540b936f9d8606ab22c32f Mon Sep 17 00:00:00 2001 From: Lens0021 / Leslie Date: Wed, 9 Aug 2023 01:05:05 +0900 Subject: [PATCH] Bump MediaWiki to 1.40 (#776) * ci: Add test for RESTBase * Bump MW to 1.40.0 * extension-installer: Improve error output * Use GoogleSiteSearch REL1_40 There is the option which made I picked up e121def. https://github.com/wikimedia/mediawiki-extensions-GoogleSiteSearch/blob/5f550e432ab247391b7eba5dcf9c4c2a5e611ba4/extension.json#L24 * Bump Gadgets extension * Bump FemiwikiSkin to v4 * Use full path to ReCaptchaNoCaptcha * README: Append a tag to the example command * Remove $wgCaptchaClass it is ancient. https://www.mediawiki.org/?title=Extension:ConfirmEdit&diff=prev&oldid=5657994 * Bump php to 8.1.18 * ParsoidAutoConfig is deprecated since MW 1.40 * FlowEditorList is removed https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Flow/+/775873 * Bump FemiwikiSkin * AllowLossySwitching is removed https://gerrit.wikimedia.org/r/c/mediawiki/extensions/VisualEditor/+/853921 * Remove RESTBase configs * Renew extensions for MW1.40 * Remove RESTBase from docker-compose * Remove RESTBase from Caddyfile * Bump PHP to 8.1.22 * Revert "ci: Add test for RESTBase" This reverts commit c7b3b12b7bada300558fd42a98aae3e309d8ca4f. --- .gitignore | 3 ++ Dockerfile | 6 +-- README.md | 3 +- configs/LocalSettings.php | 48 ----------------------- development/Caddyfile | 5 --- docker-compose.yml | 7 ---- extension-installer/extensions.json | 18 ++++----- extension-installer/install_extensions.rb | 3 ++ 8 files changed, 19 insertions(+), 74 deletions(-) diff --git a/.gitignore b/.gitignore index 2af97c07..da09f79c 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ # npm dependencies /node_modules/ yarn-error.log + +# Ruby +/extension-installer/vendor diff --git a/Dockerfile b/Dockerfile index 38807d10..c02e56e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG MEDIAWIKI_VERSION=1.39.3 +ARG MEDIAWIKI_VERSION=1.40.0 ARG CADDY_MWCACHE_COMMIT=6fd44b88b911e9e0ad1055a8f8f2b85080b3b50e ARG TINI_VERSION=0.18.0 @@ -44,7 +44,7 @@ FROM --platform=$TARGETPLATFORM composer:2.5.8 AS composer # 미디어위키 다운로드 스테이지. 다운받은 확장기능에 더해 미디어위키를 추가로 받고 # Composer로 디펜던시들을 설치한다. # -FROM --platform=$TARGETPLATFORM php:8.1.13-cli AS base-mediawiki +FROM --platform=$TARGETPLATFORM php:8.1.22-cli AS base-mediawiki ARG MEDIAWIKI_VERSION @@ -97,7 +97,7 @@ RUN XCADDY_DEBUG=1 xcaddy build v2.7.3 \ # /var/log/cron.log 크론 로그 # /tini tini # -FROM --platform=$TARGETPLATFORM php:8.1.13-fpm +FROM --platform=$TARGETPLATFORM php:8.1.22-fpm ARG TARGETPLATFORM ARG TINI_VERSION diff --git a/README.md b/README.md index 2089b93f..7f267920 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,6 @@ http: 다음 환경 변수를 설정할 수 있습니다. - `MEDIAWIKI_SERVER`: `$wgServer`를 덮어씁니다. 기본값 `'https://femiwiki.com'`. -- `MEDIAWIKI_DOMAIN_FOR_NODE_SERVICE`: domain은 Parsoid, RESTBase 등과 통신할 때 사용하는 임의 문자열입니다. 기본값 `'femiwiki.com'`. - `MEDIAWIKI_DEBUG_MODE`: 설정되었을 경우 미디어위키에서 제공하는 디버그 기능들을 켜고 개발 환경에서 세팅이 어려운 확장기능들을 비활성화합니다. - `MEDIAWIKI_SKIP_INSTALL`: 설정되었을 경우 컨테이너 시작 시 install.php를 실행하지 않습니다. install.php는 데이터베이스가 세팅되지 않은지 검사하고 초기화하는 일과 LocalSettings.php 생성 작업을 하므로 둘 모두 이미 처리된 경우에 스킵할 수 있습니다. - `MEDIAWIKI_SKIP_UPDATE`: 설정되었을 경우 컨테이너 시작 시 update.php를 실행하지 않습니다. update.php 실행은 미디어위키 설치 직후 혹은 확장 기능 추가 시에만 필요합니다. @@ -69,7 +68,7 @@ docker-compose -f docker-compose.yml up ```bash # 도커이미지 빌드 -docker build -t femiwiki/mediawiki . +docker build -t femiwiki/mediawiki:dev . # 수정된 도커이미지를 실행할때엔 아래와 같이 docker service update --force femiwiki_fastcgi diff --git a/configs/LocalSettings.php b/configs/LocalSettings.php index fa42c71a..b0e9c4b9 100644 --- a/configs/LocalSettings.php +++ b/configs/LocalSettings.php @@ -354,36 +354,6 @@ 'linting' => true ]; -# Disable "zero configuration" VisualEditor -# zero-conf VisualEditor assumes that all the services are served as the same host. ('/' for -# MediaWiki, '/rest.php//v3/' for Parsoid and '/restbase//v1/' for RESTBase) -# It is not our use case, we are serving those services behind the orchestration tool, Docker or -# Nomad and a variety of addresses are used. -$wgVisualEditorParsoidAutoConfig = false; - -$wgVirtualRestConfig = [ - 'modules' => [ - 'parsoid' => [ - 'url' => 'http://' . ( getenv( 'NOMAD_UPSTREAM_ADDR_http' ) ?: 'http:8080' ) . '/rest.php', - ], - 'restbase' => [ - 'url' => 'http://' . ( getenv( 'NOMAD_UPSTREAM_ADDR_restbase' ) ?: 'restbase:7231' ), - # https://github.com/femiwiki/femiwiki/issues/266 - 'domain' => 'femiwiki.com', - ], - ], - 'global' => [ - 'domain' => 'femiwiki.com', - 'restbaseCompat' => true, - 'forwardCookies' => false, - ], -]; - -$wgVisualEditorRestbaseURL = 'https://femiwiki.com/femiwiki.com/v1/page/html/'; -$wgVisualEditorFullRestbaseURL = 'https://femiwiki.com/femiwiki.com/'; - -wfLoadExtension( 'Parsoid', 'vendor/wikimedia/parsoid/extension.json' ); - // // Extensions // @@ -459,7 +429,6 @@ // ConfirmEdit wfLoadExtensions( [ 'ConfirmEdit', 'ConfirmEdit/ReCaptchaNoCaptcha' ] ); -$wgCaptchaClass = 'ReCaptchaNoCaptcha'; $wgCaptchaTriggers['createaccount'] = true; // If you plan to use VisualEditor forget about this new and better No Captcha solution from Google. $wgCaptchaTriggers['edit'] = false; @@ -563,7 +532,6 @@ // Flow wfLoadExtension( 'Flow' ); -$wgFlowEditorList = [ 'visualeditor', 'none' ]; foreach ( [ NS_TALK, NS_USER_TALK, @@ -928,8 +896,6 @@ // VisualEditor wfLoadExtension( 'VisualEditor' ); -// Disallow switching from wikitext to visual editor if doing so may cause dirty diffs -$wgVisualEditorAllowLossySwitching = false; // Namespaces in which to enable VisualEditor $wgVisualEditorAvailableNamespaces = [ NS_SPECIAL => true, @@ -1025,20 +991,6 @@ $wgWBRepoSettings['conceptBaseUri'] = $wgServer . '/w/Item:'; $wgWBClientSettings['dataBridgeHrefRegExp'] = '^' . $wgCanonicalServer . str_replace( '$1', '(Item:(Q[1-9][0-9]*)).*#(P[1-9][0-9]*)', $wgArticlePath ) . '$'; - - $domain = getenv( 'MEDIAWIKI_DOMAIN_FOR_NODE_SERVICE' ) ?: 'femiwiki.com'; - $wgVisualEditorRestbaseURL = "$wgServer/$domain/v1/page/html/"; - $wgVisualEditorFullRestbaseURL = "$wgServer/$domain/"; -} - -// Domain is an arbitrary keyword for communicate with MediaWiki node services -if ( getenv( 'MEDIAWIKI_DOMAIN_FOR_NODE_SERVICE' ) ) { - $domain = getenv( 'MEDIAWIKI_DOMAIN_FOR_NODE_SERVICE' ); - $wgVirtualRestConfig['global']['domain'] = $domain; - # https://github.com/femiwiki/femiwiki/issues/266 - $wgVirtualRestConfig['modules']['restbase']['domain'] = $domain; - $wgVisualEditorRestbaseURL = "$wgServer/$domain/v1/page/html/"; - $wgVisualEditorFullRestbaseURL = "$wgServer/$domain/"; } // diff --git a/development/Caddyfile b/development/Caddyfile index cf831078..629a594b 100644 --- a/development/Caddyfile +++ b/development/Caddyfile @@ -28,8 +28,3 @@ header { rewrite /w/api.php /api.php rewrite /w/* /index.php - -# Proxy requests to RESTBase -# Reference: -# https://www.mediawiki.org/wiki/RESTBase/Installation#Proxy_requests_to_RESTBase_from_your_webserver -reverse_proxy /127.0.0.1/* restbase:7231 diff --git a/docker-compose.yml b/docker-compose.yml index 97334a53..e57ed7ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,6 @@ services: - l18n_cache:/tmp/cache environment: - MEDIAWIKI_SERVER=http://127.0.0.1:8080 - - MEDIAWIKI_DOMAIN_FOR_NODE_SERVICE=127.0.0.1 - MEDIAWIKI_DEBUG_MODE=1 depends_on: - mysql @@ -49,12 +48,6 @@ services: - DB_HOSTNAME # secret.php.example에 적힌 기본값 memcached: image: memcached:1-alpine - restbase: - image: ghcr.io/femiwiki/restbase:latest - environment: - - MEDIAWIKI_APIS_URI=http://http:8080/api.php - - MEDIAWIKI_APIS_DOMAIN=127.0.0.1 - - PARSOID_URI=http://http:8080/rest.php volumes: database: diff --git a/extension-installer/extensions.json b/extension-installer/extensions.json index 2c40db71..beccb018 100644 --- a/extension-installer/extensions.json +++ b/extension-installer/extensions.json @@ -23,7 +23,7 @@ "Echo", "EventLogging", "FlaggedRevs", - "Flow", + "GoogleSiteSearch", "Graph", "GrowthExperiments", "GuidedTour", @@ -77,8 +77,12 @@ ], "non-WMF": { "Gadgets": { - "@note": "See https://github.com/femiwiki/remote-gadgets/issues/33", - "template": "https://github.com/femiwiki/mediawiki-extensions-Gadgets/archive/refs/heads/REL1_39.tar.gz" + "@note": "https://github.com/femiwiki/remote-gadgets/issues/33", + "template": "https://github.com/femiwiki/mediawiki-extensions-Gadgets/archive/refs/heads/REL1_40.tar.gz" + }, + "Flow": { + "@note": "https://lists.wikimedia.org/hyperkitty/list/mediawiki-l@lists.wikimedia.org/thread/MEM3ZPLZVVAUV7ZVDZB2CSNC4ENRJY7Y/", + "template": "https://github.com/femiwiki/mediawiki-extensions-Flow/releases/download/REL1_40/REL1_40.tar.gz" }, "AchievementBadges": { "template": "https://github.com/femiwiki/AchievementBadges/releases/download/$1/$1.tar.gz", @@ -103,18 +107,14 @@ "Femiwiki": { "type": "skin", "template": "https://github.com/femiwiki/FemiwikiSkin/releases/download/$1/$1.tar.gz", - "version": "v3.3.0" + "version": "v4.0.1" }, "AWS": { "template": "https://github.com/edwardspec/mediawiki-aws-s3/archive/v0.12.0.tar.gz" }, "EmbedVideo": { "template": "https://github.com/StarCitizenWiki/mediawiki-extensions-EmbedVideo/archive/refs/tags/$1.tar.gz", - "version": "v3.2.6" - }, - "GoogleSiteSearch": { - "template": "https://github.com/wikimedia/mediawiki-extensions-GoogleSiteSearch/archive/$1.tar.gz", - "version": "e121def9095fec79eb044867978a6c8b84699e31" + "version": "v3.2.8" } } } diff --git a/extension-installer/install_extensions.rb b/extension-installer/install_extensions.rb index 9cb899a4..8e5a6acb 100644 --- a/extension-installer/install_extensions.rb +++ b/extension-installer/install_extensions.rb @@ -64,6 +64,9 @@ def name_to_aria2_input_line(name, type) response = response[5..-1] sha = JSON.parse(response)['revision'] "https://extdist.wmflabs.org/dist/#{type}s/#{name}-#{MEDIAWIKI_BRANCH}-#{sha[0..6]}.tar.gz\n out=#{name}.tar.gz\n" +rescue JSON::ParserError => e + puts "#{e.message} #{type}s/#{name}" + raise e end input_file.write(