Skip to content

Commit

Permalink
Bump MediaWiki to 1.40 (#776)
Browse files Browse the repository at this point in the history
* 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 c7b3b12.
  • Loading branch information
lens0021 authored Aug 8, 2023
1 parent 5829bae commit 84cfc3a
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 74 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
# npm dependencies
/node_modules/
yarn-error.log

# Ruby
/extension-installer/vendor
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 실행은 미디어위키 설치 직후 혹은 확장 기능 추가 시에만 필요합니다.
Expand Down Expand Up @@ -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

Expand Down
48 changes: 0 additions & 48 deletions configs/LocalSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/<domain>/v3/' for Parsoid and '/restbase/<domain>/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
//
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -563,7 +532,6 @@

// Flow
wfLoadExtension( 'Flow' );
$wgFlowEditorList = [ 'visualeditor', 'none' ];
foreach ( [
NS_TALK,
NS_USER_TALK,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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/";
}

//
Expand Down
5 changes: 0 additions & 5 deletions development/Caddyfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 0 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
18 changes: 9 additions & 9 deletions extension-installer/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"Echo",
"EventLogging",
"FlaggedRevs",
"Flow",
"GoogleSiteSearch",
"Graph",
"GrowthExperiments",
"GuidedTour",
Expand Down Expand Up @@ -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/[email protected]/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",
Expand All @@ -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"
}
}
}
3 changes: 3 additions & 0 deletions extension-installer/install_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 84cfc3a

Please sign in to comment.