From aaa2af01741eefdce02620ba2d0204a279754021 Mon Sep 17 00:00:00 2001 From: lens0021 Date: Sun, 6 Jan 2019 19:47:06 +0900 Subject: [PATCH 1/9] Introduce travis-ci 1. Create '.travis.yml' 2. Update gitignore and dockerignore files 3. Create composer.json and composer.lock 4. Import .phpcs.xml from https://github.com/wikimedia/mediawiki/blob/REL1_31/.phpcs.xml 5. Update editorconfig for composer.lock and phpcs.xml --- .dockerignore | 3 + .editorconfig | 6 ++ .gitignore | 3 + .phpcs.xml | 90 ++++++++++++++++ .travis.yml | 174 +++++++++++++++++++++++++++++++ composer.json | 18 ++++ composer.lock | 283 ++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 577 insertions(+) create mode 100644 .phpcs.xml create mode 100644 .travis.yml create mode 100644 composer.json create mode 100644 composer.lock diff --git a/.dockerignore b/.dockerignore index db103f00..fe9d137f 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,5 +2,8 @@ /configs/secret.php /configs/env +# Composer +/vendor + # Git /.git/ diff --git a/.editorconfig b/.editorconfig index c3cebb46..a03d5131 100644 --- a/.editorconfig +++ b/.editorconfig @@ -10,3 +10,9 @@ indent_size = 2 [*.{php,php.example}] indent_style = tab indent_size = 4 + +[*.xml] +indent_style = tab + +[composer.lock] +indent_size = 4 diff --git a/.gitignore b/.gitignore index ef061ed3..9c068f9d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ # secret /configs/secret.php /configs/env + +# Composer +/vendor diff --git a/.phpcs.xml b/.phpcs.xml new file mode 100644 index 00000000..31e6eebc --- /dev/null +++ b/.phpcs.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + */languages/messages/Messages*\.php + + + */includes/StubObject\.php + + . + + + ^extensions/ + ^skins/ + AdminSettings\.php + LocalSettings\.php + StartProfiler\.php + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..e821848e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,174 @@ +language: php + +php: '7.2' + +os: linux + +dist: xenial + +git: + quiet: true + depth: 3 + +env: + global: + - MEDIAWIKI_BRANCH=REL1_31 + - LOOP_LIMIT=300 + +cache: + directories: + - vendor + +services: + - docker + +jobs: + include: + - name: lint + install: + - composer install --prefer-source --quiet --no-interaction + script: + - php -l configs/LocalSettings.php + - php -l configs/secret.php.example + - composer test . + - name: docker + install: + - git clone https://github.com/femiwiki/database.git ~/swarm --depth=1 + before_script: + - cp configs/env.example configs/env + - cp configs/secret.php.example configs/secret.php + - echo -en "\n\nwfRunDebugMode( 'localhost' );\n" >> configs/LocalSettings.php + - echo -en '\n\nrequire_once "$IP/includes/DevelopmentSettings.php";\n' >> configs/LocalSettings.php + - docker swarm init + # Setup database + - sudo mkdir -p /srv/mysql/ + - docker stack deploy -c ~/swarm/database.yml database + - | + printf 'Waiting for database_mysql service...'; + COUNTER=0; + while [ -z $(docker service logs database_mysql 2>&1 | grep -oP 'GENERATED ROOT PASSWORD: \K.+') ]; do + sleep 1; + printf '.'; + (( COUNTER++ )); + if [ $COUNTER -gt $LOOP_LIMIT ]; then + printf '\n'; + echo 'Falied to start database_mysql service'; + docker service logs database_mysql; + travis_terminate 1; + fi + done; printf '\n' + - HOST_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') + - MYSQL_USER=root + - "MYSQL_PW=$(docker service logs database_mysql 2>&1 | grep -Po 'GENERATED ROOT PASSWORD: \\K.+')" + - sed -ri "s/mysqlhostname/${HOST_IP}/" configs/env + - sed -ri "s/mysqlusername/${MYSQL_USER}/" configs/env + - sed -ri "s/mysqlpassword/${MYSQL_PW}/" configs/env + - sed -ri "s/DB_HOSTNAME/${HOST_IP}/" configs/secret.php + - sed -ri "s/DB_USERNAME/${MYSQL_USER}/" configs/secret.php + - sed -ri "s/DB_PASSWORD/${MYSQL_PW}/" configs/secret.php + # Setup memcached + - docker stack deploy -c ~/swarm/memcached.yml memcached + - sed -ri "s/MEMCACHED_HOSTNAME/${HOST_IP}/" configs/secret.php + script: + - docker build --tag femiwiki/mediawiki . + - docker stack deploy -c docker-compose.yml mediawiki + - | + printf 'Waiting for mediawiki_parsoid container...'; + COUNTER=0; + while [ -z $(docker container ls -qf 'name=mediawiki_parsoid') ]; do + sleep 1; + printf '.'; + (( COUNTER++ )); + if [ $COUNTER -gt $LOOP_LIMIT ]; then + printf '\n'; + echo 'Failed to start mediawiki_parsoid service'; + docker service logs mediawiki_parsoid; + travis_terminate 1; + fi + done; printf '\n' + - docker service logs mediawiki_parsoid + - | + printf 'Waiting for mediawiki_fastcgi container...'; + COUNTER=0; + while [ -z $(docker container ls -qf 'name=mediawiki_fastcgi') ]; do + sleep 1; + printf '.'; + (( COUNTER++ )); + if [ $COUNTER -gt $LOOP_LIMIT ]; then + printf '\n'; + echo 'to start mediawiki_fastcgi service'; + docker service logs mediawiki_fastcgi; + travis_terminate 1; + fi + done; printf '\n' + # We don't have a health check yet, so wait a moment for starting process is end... + - sleep 10 + - docker service logs mediawiki_fastcgi + - test -z "$(docker service ps -qf "desired-state=Shutdown" mediawiki_fastcgi)" + - | + printf 'Waiting for http...' + COUNTER=0; + until [ "$(curl -Lfs localhost)" ]; do + sleep 1; + printf '.'; + (( COUNTER++ )); + if [ $COUNTER -gt $LOOP_LIMIT ]; then + printf '\n'; + echo 'Failed to connect to localhost'; + travis_terminate 1; + fi + done; printf '\n' + - curl -Lf localhost | head + - docker exec $(docker container ls -qf name=mediawiki_fastcgi) + apt-get install -y git unzip + - docker exec $(docker container ls -qf name=mediawiki_fastcgi) + php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" + - docker exec $(docker container ls -qf name=mediawiki_fastcgi) + php composer-setup.php --install-dir=/usr/local/bin --filename=composer --quiet + - docker exec $(docker container ls -qf name=mediawiki_fastcgi) + composer install --prefer-source --quiet --no-interaction + - "docker exec $(docker container ls -qf name=mediawiki_fastcgi) + php tests/phpunit/phpunit.php --group '\ + Abusefilter,\ + AuthManager,\ + BetaFeatures,\ + Blocking,\ + CSSMin,\ + Cache,\ + CheckUser,\ + ComposerHooks,\ + DataBase,\ + Diff,\ + Gadgets,\ + GlobalFunctions,\ + HKDF,\ + Hash,\ + HashRing,\ + Http,\ + IP,\ + Installer,\ + Interwiki,\ + JobQueue,\ + Language,\ + Media,\ + MediaWikiTestCaseTest,\ + Output,\ + PageImages,\ + Pager,\ + RequestContext,\ + ResourceLoader,\ + Sanitizer,\ + Shell,\ + Site,\ + SpecialPage,\ + SpecialPageAliases,\ + SystemTest,\ + Templates,\ + Test,\ + TestsWithNoNeedForAwsCredentials,\ + Thanks,\ + Upload,\ + WebRequest,\ + db,\ + large,\ + '" diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..016c8350 --- /dev/null +++ b/composer.json @@ -0,0 +1,18 @@ +{ + "require-dev": { + "mediawiki/mediawiki-codesniffer": "23.0.0", + "phpunit/phpunit": "4.8.36 || ^6.5", + "jakub-onderka/php-parallel-lint": "0.9.2", + "mediawiki/minus-x": "0.3.1" + }, + "scripts": { + "lint": "parallel-lint --exclude vendor", + "phpcs": "phpcs -p -s", + "fix": "phpcbf", + "test": [ + "composer lint", + "composer phpcs", + "minus-x check" + ] + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000..7e21a3be --- /dev/null +++ b/composer.lock @@ -0,0 +1,283 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "44e403c1152e43f7b017cc2be0d5dbfb", + "packages": [], + "packages-dev": [ + { + "name": "composer/semver", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2016-08-30T16:08:34+00:00" + }, + { + "name": "composer/spdx-licenses", + "version": "1.4.0", + "source": { + "type": "git", + "url": "https://github.com/composer/spdx-licenses.git", + "reference": "cb17687e9f936acd7e7245ad3890f953770dec1b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/cb17687e9f936acd7e7245ad3890f953770dec1b", + "reference": "cb17687e9f936acd7e7245ad3890f953770dec1b", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Spdx\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "SPDX licenses list and validation library.", + "keywords": [ + "license", + "spdx", + "validator" + ], + "time": "2018-04-30T10:33:04+00:00" + }, + { + "name": "jakub-onderka/php-parallel-lint", + "version": "v0.9.2", + "source": { + "type": "git", + "url": "https://github.com/JakubOnderka/PHP-Parallel-Lint.git", + "reference": "2ead2e4043ab125bee9554f356e0a86742c2d4fa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JakubOnderka/PHP-Parallel-Lint/zipball/2ead2e4043ab125bee9554f356e0a86742c2d4fa", + "reference": "2ead2e4043ab125bee9554f356e0a86742c2d4fa", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "jakub-onderka/php-console-highlighter": "~0.3", + "nette/tester": "~1.3" + }, + "suggest": { + "jakub-onderka/php-console-highlighter": "Highlight syntax in code snippet" + }, + "bin": [ + "parallel-lint" + ], + "type": "library", + "autoload": { + "classmap": [ + "./" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-2-Clause" + ], + "authors": [ + { + "name": "Jakub Onderka", + "email": "jakub.onderka@gmail.com" + } + ], + "description": "This tool check syntax of PHP files about 20x faster than serial check.", + "homepage": "https://github.com/JakubOnderka/PHP-Parallel-Lint", + "time": "2015-12-15T10:42:16+00:00" + }, + { + "name": "mediawiki/mediawiki-codesniffer", + "version": "v23.0.0", + "source": { + "type": "git", + "url": "https://github.com/wikimedia/mediawiki-tools-codesniffer.git", + "reference": "c271e2b0388d2eaf7f2b15afc4d0f1dcfc30d937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/wikimedia/mediawiki-tools-codesniffer/zipball/c271e2b0388d2eaf7f2b15afc4d0f1dcfc30d937", + "reference": "c271e2b0388d2eaf7f2b15afc4d0f1dcfc30d937", + "shasum": "" + }, + "require": { + "composer/semver": "1.4.2", + "composer/spdx-licenses": "1.4.0", + "php": ">= 5.6.99", + "squizlabs/php_codesniffer": "3.3.2" + }, + "require-dev": { + "jakub-onderka/php-console-highlighter": "0.3.2", + "jakub-onderka/php-parallel-lint": "1.0.0", + "mediawiki/minus-x": "0.3.1", + "phpunit/phpunit": "4.8.36 || ^6.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "MediaWiki\\": "MediaWiki" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-or-later" + ], + "description": "MediaWiki CodeSniffer Standards", + "homepage": "https://www.mediawiki.org/wiki/Manual:Coding_conventions/PHP", + "keywords": [ + "codesniffer", + "mediawiki" + ], + "time": "2018-11-14T01:45:17+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6ad28354c04b364c3c71a34e4a18b629cc3b231e", + "reference": "6ad28354c04b364c3c71a34e4a18b629cc3b231e", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2018-09-23T23:08:17+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} From ee3bb020d5ea58d709329d4dfe1f22fabbc4d91d Mon Sep 17 00:00:00 2001 From: lens0021 Date: Sat, 2 Feb 2019 02:59:07 +0900 Subject: [PATCH 2/9] Update travis.yml: Don't do phpunit and minus-x It is too much to test the external codes --- .travis.yml | 53 ----------------------------------------------------- 1 file changed, 53 deletions(-) diff --git a/.travis.yml b/.travis.yml index e821848e..cf929c8e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -119,56 +119,3 @@ jobs: fi done; printf '\n' - curl -Lf localhost | head - - docker exec $(docker container ls -qf name=mediawiki_fastcgi) - apt-get install -y git unzip - - docker exec $(docker container ls -qf name=mediawiki_fastcgi) - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" - - docker exec $(docker container ls -qf name=mediawiki_fastcgi) - php composer-setup.php --install-dir=/usr/local/bin --filename=composer --quiet - - docker exec $(docker container ls -qf name=mediawiki_fastcgi) - composer install --prefer-source --quiet --no-interaction - - "docker exec $(docker container ls -qf name=mediawiki_fastcgi) - php tests/phpunit/phpunit.php --group '\ - Abusefilter,\ - AuthManager,\ - BetaFeatures,\ - Blocking,\ - CSSMin,\ - Cache,\ - CheckUser,\ - ComposerHooks,\ - DataBase,\ - Diff,\ - Gadgets,\ - GlobalFunctions,\ - HKDF,\ - Hash,\ - HashRing,\ - Http,\ - IP,\ - Installer,\ - Interwiki,\ - JobQueue,\ - Language,\ - Media,\ - MediaWikiTestCaseTest,\ - Output,\ - PageImages,\ - Pager,\ - RequestContext,\ - ResourceLoader,\ - Sanitizer,\ - Shell,\ - Site,\ - SpecialPage,\ - SpecialPageAliases,\ - SystemTest,\ - Templates,\ - Test,\ - TestsWithNoNeedForAwsCredentials,\ - Thanks,\ - Upload,\ - WebRequest,\ - db,\ - large,\ - '" From 1137e9bc58ba897a485766069e23e0dbb550ec7f Mon Sep 17 00:00:00 2001 From: lens0021 Date: Sat, 2 Feb 2019 02:57:36 +0900 Subject: [PATCH 3/9] Update travis.yml: Multiple improvements 1. Don't lint 'secret.php' 2. Preperation steps are 'before_script' phase not 'install' phase 3. Reorder some steps 4. Don't wait until 'mediawiki_parsoid' and 'mediawiki_fastcgi' are up 5. Add comments --- .travis.yml | 61 +++++++++++++++++++---------------------------------- 1 file changed, 22 insertions(+), 39 deletions(-) diff --git a/.travis.yml b/.travis.yml index cf929c8e..1fb7cf93 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ git: env: global: - MEDIAWIKI_BRANCH=REL1_31 + # Maximum iteration limit for loop - LOOP_LIMIT=300 cache: @@ -25,38 +26,49 @@ services: jobs: include: - name: lint - install: + before_script: - composer install --prefer-source --quiet --no-interaction script: - php -l configs/LocalSettings.php - - php -l configs/secret.php.example - composer test . - name: docker - install: - - git clone https://github.com/femiwiki/database.git ~/swarm --depth=1 before_script: + # Setup files for database and memcached + - git clone https://github.com/femiwiki/database.git ~/swarm --depth=1 + - sudo mkdir -p /srv/mysql/ + # Prepare configuration files - cp configs/env.example configs/env - cp configs/secret.php.example configs/secret.php + # Tweak LocalSettings.php for debugging - echo -en "\n\nwfRunDebugMode( 'localhost' );\n" >> configs/LocalSettings.php - echo -en '\n\nrequire_once "$IP/includes/DevelopmentSettings.php";\n' >> configs/LocalSettings.php + # Initialize docker swarm - docker swarm init - # Setup database - - sudo mkdir -p /srv/mysql/ + # Start up database - docker stack deploy -c ~/swarm/database.yml database + # We need root password of the database, so wait for the generation - | printf 'Waiting for database_mysql service...'; + # Set counter to check endless loop COUNTER=0; while [ -z $(docker service logs database_mysql 2>&1 | grep -oP 'GENERATED ROOT PASSWORD: \K.+') ]; do + # retry every 1 second. sleep 1; + # Append dots to the previous message if process is delayed. printf '.'; + # Terminate Travis-ci if loop exceeds limit (( COUNTER++ )); if [ $COUNTER -gt $LOOP_LIMIT ]; then printf '\n'; echo 'Falied to start database_mysql service'; + # Print logs for debugging docker service logs database_mysql; travis_terminate 1; fi done; printf '\n' + # Start up memcached + - docker stack deploy -c ~/swarm/memcached.yml memcached + # Configure mediawiki - HOST_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') - MYSQL_USER=root - "MYSQL_PW=$(docker service logs database_mysql 2>&1 | grep -Po 'GENERATED ROOT PASSWORD: \\K.+')" @@ -66,45 +78,16 @@ jobs: - sed -ri "s/DB_HOSTNAME/${HOST_IP}/" configs/secret.php - sed -ri "s/DB_USERNAME/${MYSQL_USER}/" configs/secret.php - sed -ri "s/DB_PASSWORD/${MYSQL_PW}/" configs/secret.php - # Setup memcached - - docker stack deploy -c ~/swarm/memcached.yml memcached - sed -ri "s/MEMCACHED_HOSTNAME/${HOST_IP}/" configs/secret.php script: - docker build --tag femiwiki/mediawiki . - docker stack deploy -c docker-compose.yml mediawiki - - | - printf 'Waiting for mediawiki_parsoid container...'; - COUNTER=0; - while [ -z $(docker container ls -qf 'name=mediawiki_parsoid') ]; do - sleep 1; - printf '.'; - (( COUNTER++ )); - if [ $COUNTER -gt $LOOP_LIMIT ]; then - printf '\n'; - echo 'Failed to start mediawiki_parsoid service'; - docker service logs mediawiki_parsoid; - travis_terminate 1; - fi - done; printf '\n' - - docker service logs mediawiki_parsoid - - | - printf 'Waiting for mediawiki_fastcgi container...'; - COUNTER=0; - while [ -z $(docker container ls -qf 'name=mediawiki_fastcgi') ]; do - sleep 1; - printf '.'; - (( COUNTER++ )); - if [ $COUNTER -gt $LOOP_LIMIT ]; then - printf '\n'; - echo 'to start mediawiki_fastcgi service'; - docker service logs mediawiki_fastcgi; - travis_terminate 1; - fi - done; printf '\n' - # We don't have a health check yet, so wait a moment for starting process is end... - - sleep 10 + # We don't have a health check yet, so wait a moment for starting process is end... + - sleep 60 - docker service logs mediawiki_fastcgi + # Check if container is shoutdown - test -z "$(docker service ps -qf "desired-state=Shutdown" mediawiki_fastcgi)" + # Access localhost until success - | printf 'Waiting for http...' COUNTER=0; From 2e756bddfa958fa13732dcc1d56d8f6d91009902 Mon Sep 17 00:00:00 2001 From: Hyeon Kim Date: Sat, 2 Feb 2019 21:16:27 +0900 Subject: [PATCH 4/9] Update composer.json: Remove unused dependencies --- composer.json | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 016c8350..6e5019e6 100644 --- a/composer.json +++ b/composer.json @@ -1,9 +1,7 @@ { "require-dev": { "mediawiki/mediawiki-codesniffer": "23.0.0", - "phpunit/phpunit": "4.8.36 || ^6.5", - "jakub-onderka/php-parallel-lint": "0.9.2", - "mediawiki/minus-x": "0.3.1" + "jakub-onderka/php-parallel-lint": "0.9.2" }, "scripts": { "lint": "parallel-lint --exclude vendor", @@ -11,8 +9,7 @@ "fix": "phpcbf", "test": [ "composer lint", - "composer phpcs", - "minus-x check" + "composer phpcs" ] } } From 189784630c45f23d668f74165b29f7d3734c941f Mon Sep 17 00:00:00 2001 From: Hyeon Kim Date: Sat, 2 Feb 2019 21:20:18 +0900 Subject: [PATCH 5/9] Update composer scripts --- .travis.yml | 3 +-- composer.json | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1fb7cf93..18d768e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,8 +29,7 @@ jobs: before_script: - composer install --prefer-source --quiet --no-interaction script: - - php -l configs/LocalSettings.php - - composer test . + - composer test - name: docker before_script: # Setup files for database and memcached diff --git a/composer.json b/composer.json index 6e5019e6..5c2414c1 100644 --- a/composer.json +++ b/composer.json @@ -4,12 +4,11 @@ "jakub-onderka/php-parallel-lint": "0.9.2" }, "scripts": { - "lint": "parallel-lint --exclude vendor", - "phpcs": "phpcs -p -s", "fix": "phpcbf", "test": [ - "composer lint", - "composer phpcs" + "php -l configs/LocalSettings.php", + "parallel-lint --exclude vendor .", + "phpcs -p -s ." ] } } From c7ea6eb8f8df1d9a9e562ea3b9f50b6921b17132 Mon Sep 17 00:00:00 2001 From: Hyeon Kim Date: Sat, 2 Feb 2019 20:31:31 +0900 Subject: [PATCH 6/9] Update travis.yml: Speed up 1. Simplify multiple codes 2. Remove 'sleep 60' --- .travis.yml | 106 +++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 56 deletions(-) diff --git a/.travis.yml b/.travis.yml index 18d768e7..f198c9d3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,91 +1,84 @@ -language: php - -php: '7.2' - os: linux - dist: xenial - git: quiet: true depth: 3 +# PHP +language: php +php: '7.2' +cache: + directories: + - vendor + env: global: - - MEDIAWIKI_BRANCH=REL1_31 # Maximum iteration limit for loop - LOOP_LIMIT=300 -cache: - directories: - - vendor - services: - docker jobs: include: + # + # LocalSettings.php 코드 lint + # - name: lint before_script: - composer install --prefer-source --quiet --no-interaction script: - composer test + + + # + # 미디어위키 도커 이미지가 정상적으로 실행되는지 확인 + # - name: docker before_script: # Setup files for database and memcached - git clone https://github.com/femiwiki/database.git ~/swarm --depth=1 - sudo mkdir -p /srv/mysql/ - # Prepare configuration files - - cp configs/env.example configs/env - - cp configs/secret.php.example configs/secret.php - # Tweak LocalSettings.php for debugging - - echo -en "\n\nwfRunDebugMode( 'localhost' );\n" >> configs/LocalSettings.php - - echo -en '\n\nrequire_once "$IP/includes/DevelopmentSettings.php";\n' >> configs/LocalSettings.php - # Initialize docker swarm + # Initialize docker swarm and start memcached and MySQL - docker swarm init - # Start up database + - docker stack deploy -c ~/swarm/memcached.yml memcached - docker stack deploy -c ~/swarm/database.yml database - # We need root password of the database, so wait for the generation + # Wait until root account's password of MySQL is generated - | - printf 'Waiting for database_mysql service...'; - # Set counter to check endless loop - COUNTER=0; - while [ -z $(docker service logs database_mysql 2>&1 | grep -oP 'GENERATED ROOT PASSWORD: \K.+') ]; do - # retry every 1 second. - sleep 1; - # Append dots to the previous message if process is delayed. - printf '.'; - # Terminate Travis-ci if loop exceeds limit - (( COUNTER++ )); - if [ $COUNTER -gt $LOOP_LIMIT ]; then - printf '\n'; - echo 'Falied to start database_mysql service'; - # Print logs for debugging - docker service logs database_mysql; - travis_terminate 1; - fi - done; printf '\n' - # Start up memcached - - docker stack deploy -c ~/swarm/memcached.yml memcached - # Configure mediawiki - - HOST_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') - - MYSQL_USER=root - - "MYSQL_PW=$(docker service logs database_mysql 2>&1 | grep -Po 'GENERATED ROOT PASSWORD: \\K.+')" - - sed -ri "s/mysqlhostname/${HOST_IP}/" configs/env - - sed -ri "s/mysqlusername/${MYSQL_USER}/" configs/env - - sed -ri "s/mysqlpassword/${MYSQL_PW}/" configs/env - - sed -ri "s/DB_HOSTNAME/${HOST_IP}/" configs/secret.php - - sed -ri "s/DB_USERNAME/${MYSQL_USER}/" configs/secret.php - - sed -ri "s/DB_PASSWORD/${MYSQL_PW}/" configs/secret.php - - sed -ri "s/MEMCACHED_HOSTNAME/${HOST_IP}/" configs/secret.php + printf 'Waiting for database_mysql service...'; + # Set counter to check endless loop + COUNTER=0; + while [ -z $(docker service logs database_mysql 2>&1 | grep -oP 'GENERATED ROOT PASSWORD: \K.+') ]; do + # retry every 1 second. + sleep 1; + # Append dots to the previous message if process is delayed. + printf '.'; + # Terminate Travis-ci if loop exceeds limit + (( COUNTER++ )); + if [ $COUNTER -gt $LOOP_LIMIT ]; then + printf '\n'; + echo 'Falied to start database_mysql service'; + # Print logs for debugging + docker service logs database_mysql; + travis_terminate 1; + fi + done; + printf '\n'; + # Edit configuration + - | + HOST_IP="$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+')"; + MYSQL_PW="$(docker service logs database_mysql 2>&1 | grep -Po 'GENERATED ROOT PASSWORD: \K.+')"; + - mv configs/env.example configs/env + - sed -ri "s/mysqlhostname/${HOST_IP}/; s/mysqlusername/root/; s/mysqlpassword/${MYSQL_PW}/" configs/env + - mv configs/secret.php.example configs/secret.php + - sed -ri "s/DB_HOSTNAME/${HOST_IP}/; s/DB_USERNAME/root/; s/DB_PASSWORD/${MYSQL_PW}/; s/MEMCACHED_HOSTNAME/${HOST_IP}/" configs/secret.php + # Tweak LocalSettings.php for debugging + - printf 'wfRunDebugMode("localhost");\nrequire_once "$IP/includes/DevelopmentSettings.php";\n' >> configs/LocalSettings.php script: - docker build --tag femiwiki/mediawiki . - docker stack deploy -c docker-compose.yml mediawiki - # We don't have a health check yet, so wait a moment for starting process is end... - - sleep 60 - - docker service logs mediawiki_fastcgi - # Check if container is shoutdown - - test -z "$(docker service ps -qf "desired-state=Shutdown" mediawiki_fastcgi)" + # Check if status of container is shutdown + - test -z "$(docker service ps -qf 'desired-state=Shutdown' mediawiki_fastcgi)" # Access localhost until success - | printf 'Waiting for http...' @@ -100,4 +93,5 @@ jobs: travis_terminate 1; fi done; printf '\n' + - docker service logs mediawiki_fastcgi - curl -Lf localhost | head From d61968bf7e61ff91eaea2819c57d325fe5191cda Mon Sep 17 00:00:00 2001 From: Hyeon Kim Date: Sat, 2 Feb 2019 21:20:06 +0900 Subject: [PATCH 7/9] Lint LocalSettings.php --- configs/LocalSettings.php | 196 +++++++++++++++++++------------------- 1 file changed, 100 insertions(+), 96 deletions(-) diff --git a/configs/LocalSettings.php b/configs/LocalSettings.php index 7a3814be..ac3d9a13 100644 --- a/configs/LocalSettings.php +++ b/configs/LocalSettings.php @@ -14,52 +14,57 @@ exit; } -## Uncomment this to disable output compression -# $wgDisableOutputCompression = true; - $wgSitename = '페미위키'; -## The URL base path to the directory containing the wiki; -## defaults for all runtime URL paths are based off of this. -## For more information on customizing the URLs -## (like /w/index.php/Page_title to /wiki/Page_title) please see: -## https://www.mediawiki.org/wiki/Manual:Short_URL +# The URL base path to the directory containing the wiki; +# defaults for all runtime URL paths are based off of this. +# For more information on customizing the URLs +# (like /w/index.php/Page_title to /wiki/Page_title) please see: +# https://www.mediawiki.org/wiki/Manual:Short_URL $wgScriptPath = ''; $wgArticlePath = "/w/$1"; -## The protocol and server name to use in fully-qualified URLs +# The protocol and server name to use in fully-qualified URLs $wgServer = 'https://femiwiki.com'; $wgCanonicalServer = 'https://femiwiki.com'; $wgEnableCanonicalServerLink = true; -## The URL path to static resources (images, scripts, etc.) +# The URL path to static resources (images, scripts, etc.) $wgResourceBasePath = $wgScriptPath; $wgStyleVersion = '20181013_0'; $wgResourceLoaderMaxage = [ 'versioned' => [ - // Squid/Varnish but also any other public proxy cache between the client and MediaWiki - 'server' => 90 * 24 * 60 * 60, // 90 days - // On the client side (e.g. in the browser cache). - 'client' => 90 * 24 * 60 * 60, // 90 days + # Squid/Varnish but also any other public proxy cache between the client and MediaWiki + 'server' => 90 * 24 * 60 * 60, # 90 days + # On the client side (e.g. in the browser cache). + 'client' => 90 * 24 * 60 * 60, # 90 days ], 'unversioned' => [ - 'server' => 3 * 60, // 3 mins - 'client' => 3 * 60, // 3 mins + # 3 minutes + 'server' => 3 * 60, + # 3 minutes + 'client' => 3 * 60, ], ]; -## Trust an X-Forwarded-For (XFF) header specifying a private IP in requests -## from a trusted forwarding proxy +# Trust an X-Forwarded-For (XFF) header specifying a private IP in requests +# from a trusted forwarding proxy $wgUsePrivateIPs = true; $wgSquidServersNoPurge = [ '172.31.0.0/16', '10.0.0.0/8' ]; -## The URL path to the logo. Make sure you change this from the default, -## or else you'll overwrite your logo when you upgrade! +# The URL path to the logo. Make sure you change this from the default, +# or else you'll overwrite your logo when you upgrade! +# +# References: +# https://www.mediawiki.org/wiki/Manual:$wgLogo +# https://www.mediawiki.org/wiki/Manual:$wgLogoHD $wgLogo = "$wgResourceBasePath/skins/Femiwiki/images/logo-1200-630.png"; -# @todo Add $wgLogoHD -## UPO means: this is also a user preference option +# UPO means: this is also a user preference option +# +# Reference: +# https://www.mediawiki.org/wiki/Help:User_preference_option $wgEnableEmail = true; $wgEnableUserEmail = true; # UPO $wgAllowHTMLEmail = true; @@ -79,7 +84,7 @@ $wgEnotifWatchlist = false; # UPO $wgEmailAuthentication = true; -## $wgStructuredChangeFiltersShowPreference do exists untli Mediawiki 1.32. +# $wgStructuredChangeFiltersShowPreference do exists untli Mediawiki 1.32. if ( version_compare( $wgVersion, '1.32', '<' ) ) { $wgStructuredChangeFiltersShowPreference = true; # UPO } @@ -94,14 +99,14 @@ # MySQL table options to use during installation or update $wgDBTableOptions = 'ENGINE=InnoDB, DEFAULT CHARSET=binary'; -## Shared memory settings +# Shared memory settings $wgMainCacheType = CACHE_MEMCACHED; $wgSessionCacheType = CACHE_MEMCACHED; $wgParserCacheType = CACHE_MEMCACHED; $wgMessageCacheType = CACHE_MEMCACHED; -## To enable image uploads, make sure the 'images' directory -## is writable, then set this to true: +# To enable image uploads, make sure the 'images' directory +# is writable, then set this to true: $wgEnableUploads = true; $wgFileExtensions[] = 'svg'; $wgAllowTitlesInSVG = true; @@ -112,14 +117,14 @@ # InstantCommons allows wiki to use images from https://commons.wikimedia.org $wgUseInstantCommons = true; -## If you use ImageMagick (or any other shell command) on a -## Linux server, this will need to be set to the name of an -## available UTF-8 locale +# If you use ImageMagick (or any other shell command) on a +# Linux server, this will need to be set to the name of an +# available UTF-8 locale $wgShellLocale = 'C.UTF-8'; -## Set $wgCacheDirectory to a writable directory on the web server -## to make your wiki go slightly faster. The directory should not -## be publically accessible from the web. +# Set $wgCacheDirectory to a writable directory on the web server +# to make your wiki go slightly faster. The directory should not +# be publically accessible from the web. $wgCacheDirectory = '/tmp/cache'; $wgUseFileCache = true; @@ -135,8 +140,8 @@ # Path to the GNU diff3 utility. Used for conflict resolution. $wgDiff3 = '/usr/bin/diff3'; -## Default skin: you can change the default skin. Use the internal symbolic -## names, ie 'vector', 'monobook': +# Default skin: you can change the default skin. Use the internal symbolic +# names, ie 'vector', 'monobook': $wgDefaultSkin = 'femiwiki'; # Enabled skins. @@ -145,17 +150,16 @@ wfLoadSkin( 'Femiwiki' ); $wgFacebookAppId = '1937597133150935'; -# End of automatically generated settings. -# Add more configuration options below. - +# # Namespace settings -## BBS +# +# BBS define( 'NS_BBS', 3906 ); define( 'NS_BBS_TALK', 3907 ); $wgExtraNamespaces[NS_BBS] = '게시판'; $wgExtraNamespaces[NS_BBS_TALK] = '게시판토론'; -## BBS (Legacy) +# BBS (Legacy) define( 'NS_BBSFREE', 3902 ); define( 'NS_BBSFREE_TALK', 3903 ); $wgExtraNamespaces[NS_BBSFREE] = '자유게시판'; @@ -174,10 +178,10 @@ $wgGroupPermissions['oversight']['deleterevision'] = true; $wgGroupPermissions['bot']['patrolmarks'] = true; -## Prevent anonymous users from edit pages +# Prevent anonymous users from edit pages $wgGroupPermissions['*']['edit'] = false; -## Set when users become autoconfirmed users +# Set when users become autoconfirmed users $wgAutoConfirmCount = 0; $wgAutoConfirmAge = 3600; @@ -188,11 +192,11 @@ ], ]; -## Allow autoconfirmed users to edit pages +# Allow autoconfirmed users to edit pages $wgGroupPermissions['user']['edit'] = false; $wgGroupPermissions['autoconfirmed']['edit'] = true; -## Early adopt interface-admin that introduced in Mediawiki 1.32 +# Early adopt interface-admin that introduced in Mediawiki 1.32 if ( version_compare( $wgVersion, '1.32', '<' ) ) { $wgGroupPermissions['interface-admin']['editusercss'] = true; $wgGroupPermissions['interface-admin']['edituserjson'] = true; @@ -206,7 +210,7 @@ $wgGroupPermissions['sysop']['edituserjs'] = false; } -## Add restricted-sysop group +# Add restricted-sysop group $wgGroupPermissions['restricted-sysop'] = $wgGroupPermissions['sysop']; $wgGroupPermissions['restricted-sysop']['apihighlimits'] = false; $wgGroupPermissions['restricted-sysop']['editinterface'] = false; @@ -216,10 +220,10 @@ $wgGroupPermissions['restricted-sysop']['move-rootuserpages'] = false; $wgGroupPermissions['restricted-sysop']['unblockself'] = false; -## FemiwikiTeam is just a list of all Femiwiki team member +# FemiwikiTeam is just a list of all Femiwiki team member $wgGroupPermissions['femiwiki-team']['editprotected'] = true; -## Remain commemorative Seeder group +# Remain commemorative Seeder group $wgGroupPermissions['seeder']['read'] = true; # Show numbers on headings @@ -231,11 +235,11 @@ # Hide some Preferences $wgHiddenPrefs[] = 'gender'; $wgHiddenPrefs[] = 'realname'; -## @See https://github.com/femiwiki/mediawiki/issues/210 +# See https://github.com/femiwiki/mediawiki/issues/210 if ( version_compare( $wgVersion, '1.32', '<' ) ) { $wgHiddenPrefs[] = 'showtoolbar'; } -## @See https://github.com/femiwiki/mediawiki/issues/211 +# See https://github.com/femiwiki/mediawiki/issues/211 $wgHiddenPrefs[] = 'numberheadings'; # Allow display titles not only to titles that normalize to the same canonical @@ -262,7 +266,7 @@ # all pages (that are not redirects) are considered as valid articles $wgArticleCountMethod = 'any'; -## Prevent Search for some namespaces +# Prevent Search for some namespaces $wgNamespaceRobotPolicies = [ NS_TALK => 'noindex,nofollow', NS_USER => 'noindex,nofollow', @@ -288,18 +292,18 @@ # # Extensions # -## ParserFunction +# ParserFunction wfLoadExtension( 'ParserFunctions' ); $wgPFEnableStringFunctions = true; -## AWS +# AWS wfLoadExtension( 'AWS' ); $wgAWSRegion = 'ap-northeast-1'; $wgAWSBucketPrefix = 'femiwiki-uploaded-files'; $wgAWSRepoHashLevels = 2; $wgAWSRepoDeletedHashLevels = 2; -## VisualEditor +# VisualEditor wfLoadExtension( 'VisualEditor' ); $wgVisualEditorAvailableNamespaces = [ NS_SPECIAL => true, @@ -341,30 +345,30 @@ # Enable twocolconflict to opt-out $wgDefaultUserOptions['twocolconflict'] = true; -## TemplateData +# TemplateData wfLoadExtension( 'TemplateData' ); -## RevisionSlider +# RevisionSlider wfLoadExtension( 'RevisionSlider' ); -## Echo +# Echo wfLoadExtension( 'Echo' ); -## TwoColConflict +# TwoColConflict wfLoadExtension( 'TwoColConflict' ); $wgDefaultUserOptions['twocolconft'] = true; -## Interwiki +# Interwiki wfLoadExtension( 'Interwiki' ); -## Thanks +# Thanks wfLoadExtension( 'Thanks' ); -## Scribunto +# Scribunto wfLoadExtension( 'Scribunto' ); $wgScribuntoDefaultEngine = 'luastandalone'; -## Flow +# Flow wfLoadExtension( 'Flow' ); $wgFlowEditorList = [ 'visualeditor', 'none' ]; $wgNamespaceContentModels[NS_TALK] = 'flow-board'; @@ -375,35 +379,35 @@ $wgNamespaceContentModels[NS_TEMPLATE_TALK] = 'flow-board'; $wgNamespaceContentModels[NS_HELP_TALK] = 'flow-board'; $wgNamespaceContentModels[NS_CATEGORY_TALK] = 'flow-board'; -$wgNamespaceContentModels[275] = 'flow-board'; /* Widget talk */ -$wgNamespaceContentModels[829] = 'flow-board'; /* Module talk */ -$wgNamespaceContentModels[2301] = 'flow-board'; /* Gadget talk */ -$wgNamespaceContentModels[2303] = 'flow-board'; /* Gadget definition talk */ +$wgNamespaceContentModels[275] = 'flow-board'; # Widget talk +$wgNamespaceContentModels[829] = 'flow-board'; # Module talk +$wgNamespaceContentModels[2301] = 'flow-board'; # Gadget talk +$wgNamespaceContentModels[2303] = 'flow-board'; # Gadget definition talk $wgNamespaceContentModels[NS_BBS] = 'flow-board'; $wgNamespaceContentModels[NS_BBS_TALK] = 'flow-board'; -## TemplateStyles +# TemplateStyles wfLoadExtension( 'TemplateStyles' ); -## CategoryTree +# CategoryTree wfLoadExtension( 'CategoryTree' ); -## Disambiguator +# Disambiguator wfLoadExtension( 'Disambiguator' ); -## CreateUserPage +# CreateUserPage wfLoadExtension( 'CreateUserPage' ); -## Cite +# Cite wfLoadExtension( 'Cite' ); -## CiteThisPage +# CiteThisPage wfLoadExtension( 'CiteThisPage' ); -## CodeEditor +# CodeEditor wfLoadExtension( 'CodeEditor' ); -## WikiEditor +# WikiEditor wfLoadExtension( 'WikiEditor' ); $wgDefaultUserOptions['usebetatoolbar'] = 1; $wgDefaultUserOptions['usebetatoolbar-cgd'] = 1; @@ -411,7 +415,7 @@ $wgDefaultUserOptions['wikieditor-publish'] = 1; $wgHiddenPrefs[] = 'usebetatoolbar'; -## AbuseFilter +# AbuseFilter wfLoadExtension( 'AbuseFilter' ); $wgGroupPermissions['sysop']['abusefilter-modify'] = true; $wgGroupPermissions['*']['abusefilter-log-detail'] = true; @@ -421,7 +425,7 @@ $wgGroupPermissions['sysop']['abusefilter-modify-restricted'] = true; $wgGroupPermissions['sysop']['abusefilter-revert'] = true; -## ConfirmEdit +# ConfirmEdit wfLoadExtensions( [ 'ConfirmEdit', 'ConfirmEdit/QuestyCaptcha' ] ); $wgCaptchaQuestions = [ '나는 페미니스트입니다.' => [ @@ -441,79 +445,79 @@ $wgCaptchaTriggers['createaccount'] = true; $wgCaptchaTriggers['badlogin'] = false; -## Gadgets +# Gadgets wfLoadExtension( 'Gadgets' ); $wgGadgetsRepoClass = 'GadgetDefinitionNamespaceRepo'; -## Widgets +# Widgets require_once "$IP/extensions/Widgets/Widgets.php"; $wgNamespaceContentModels[274] = CONTENT_MODEL_TEXT; -## CheckUser +# CheckUser wfLoadExtension( 'CheckUser' ); -## UserMerge +# UserMerge wfLoadExtension( 'UserMerge' ); -## Renameuser +# Renameuser wfLoadExtension( 'Renameuser' ); -## Poem +# Poem wfLoadExtension( 'Poem' ); -## SyntaxHighlight +# SyntaxHighlight wfLoadExtension( 'SyntaxHighlight_GeSHi' ); -## CharInsert +# CharInsert wfLoadExtension( 'CharInsert' ); -## CodeMirror +# CodeMirror wfLoadExtension( 'CodeMirror' ); -## EmbedVideo +# EmbedVideo wfLoadExtension( 'EmbedVideo' ); -## InputBox +# InputBox wfLoadExtension( 'InputBox' ); -## Description2 +# Description2 wfLoadExtension( 'Description2' ); -## OpenGraphMeta +# OpenGraphMeta wfLoadExtension( 'OpenGraphMeta' ); -## PageImages +# PageImages wfLoadExtension( 'PageImages' ); -## FacetedCategory +# FacetedCategory wfLoadExtension( 'FacetedCategory' ); -## UnifiedExtensionForFemiwiki --it requires the CategoryTree extension +# UnifiedExtensionForFemiwiki --it requires the CategoryTree extension wfLoadExtension( 'UnifiedExtensionForFemiwiki' ); $wgSpecialPages['Uncategorizedcategories'] = [ SpecialUncategorizedCategoryTree::class ]; $wgSpecialPages['Whatlinkshere'] = [ SpecialOrderedWhatlinkshere::class ]; $wgGoogleAnalyticsTrackingID = 'UA-82072330-1'; -## IntersectionSearch +# IntersectionSearch wfLoadExtension( 'CategoryIntersectionSearch' ); -## SimpleMathJax +# SimpleMathJax wfLoadExtension( 'SimpleMathJax' ); -## HTMLTags +# HTMLTags require_once "$IP/extensions/HTMLTags/HTMLTags.php"; $wgHTMLTagsAttributes['a'] = [ 'href', 'class', 'itemprop' ]; $wgHTMLTagsAttributes['link'] = [ 'href', 'itemprop' ]; $wgHTMLTagsAttributes['meta'] = [ 'content', 'itemprop' ]; $wgHTMLTagsAttributes['iframe'] = [ 'src', 'class', 'style' ]; -## Josa +# Josa wfLoadExtension( 'Josa' ); -## Sanction +# Sanction wfLoadExtension( 'Sanctions' ); -## BetaFeatures +# BetaFeatures wfLoadExtension( 'BetaFeatures' ); # From b2d25650571932f2f00932e3b30459ee6e115875 Mon Sep 17 00:00:00 2001 From: Hyeon Kim Date: Sat, 2 Feb 2019 19:29:48 +0900 Subject: [PATCH 8/9] Update phpcs.xml 1. Made it not to ignore LocalSettings.php 2. Removed redundant rules --- .phpcs.xml | 84 ++---------------------------------------------------- 1 file changed, 2 insertions(+), 82 deletions(-) diff --git a/.phpcs.xml b/.phpcs.xml index 31e6eebc..9e23142a 100644 --- a/.phpcs.xml +++ b/.phpcs.xml @@ -1,90 +1,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */languages/messages/Messages*\.php - - - */includes/StubObject\.php + + . - ^extensions/ - ^skins/ - AdminSettings\.php - LocalSettings\.php - StartProfiler\.php From 99d580f6410101e8c04af031e90cf99d9dd8f6aa Mon Sep 17 00:00:00 2001 From: lens0021 Date: Tue, 8 Jan 2019 01:38:06 +0900 Subject: [PATCH 9/9] Update README.md 1. Add a badge of Travis CI 2. Mention 'composer test' 3. Organize instructions --- README.md | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 9f9d3d9f..ed9f2b29 100644 --- a/README.md +++ b/README.md @@ -1,45 +1,41 @@ -페미위키 미디어위키 서버 [![Docker Hub Status]][Docker Hub Link] +페미위키 미디어위키 서버 [![Docker Hub Status]][Docker Hub Link] [![Travis CI Status]][Travis CI Link] ======== 한국의 페미니즘 위키인 [femiwiki.com]에 사용되는 미디어위키 서버입니다. Dockerfile, 도커 컴포즈 파일 등 다양한 코드를 담고있습니다. -|| 내용 -:---|---- -기능 | 미디어위키 서버 -Base AMI | [Femiwiki Base AMI](https://github.com/femiwiki/ami) - -```sh -git clone https://github.com/femiwiki/mediawiki ~/mediawiki --depth=1 -cp ~/mediawiki/configs/env.example ~/mediawiki/configs/env -cp ~/mediawiki/configs/secret.php.example ~/mediawiki/configs/secret.php -vim configs/{env,secret.php} -# 각 설정 파일을 필요한 내용으로 고쳐주세요. - -sudo docker swarm init -sudo docker stack deploy -c ~/mediawiki/docker-compose.yml mediawiki -``` - -### 개발 ```bash -# 도커 이미지 업데이트 +# 도커이미지 빌드 docker build -t femiwiki/mediawiki . -docker push femiwiki/mediawiki -``` - -로컬에서 테스트하는 방법 -```bash +# 환경설정 파일인 secret.php와 env 를 적절히 수정해주세요 cp configs/secret.php.example configs/secret.php cp configs/env.example configs/env vim configs/{env,secret.php} -# secret.php와 env 를 적절히 수정해주세요 -# DB를 별도의 방법으로 적절히 띄운 뒤 도커 컴포즈 실행 +# (Optional) configs/LocalSettings.php 검사 +composer install +composer test +# (Optional) configs/LocalSettings.php 자동 교정 +composer fix + +# MySQL와 memcached를 별도의 방법으로 띄운 뒤 도커 컴포즈를 실행해주면 됩니다. +# 자세한 내용은 https://github.com/femiwiki/database 참고 docker-compose up ```   +### Production +페미위키 프로덕션 배포는 [Docker Swarm]으로 이뤄집니다. 페미위키에서 사용하는 +AWS EC2 AMI는 [femiwiki/ami]를 참고해주세요. + +```sh +sudo docker swarm init +sudo docker stack deploy -c ~/mediawiki/docker-compose.yml mediawiki +``` + +  + -------- The source code of *femiwiki/mediawiki* is primarily distributed under the terms @@ -48,6 +44,10 @@ of the [GNU Affero General Public License v3.0] or any later version. See [Docker Hub Status]: https://badgen.net/docker/pulls/femiwiki/mediawiki/?icon=docker&label=pulls [Docker Hub Link]: https://hub.docker.com/r/femiwiki/mediawiki/ +[Travis CI Status]: https://badgen.net/travis/femiwiki/mediawiki/master?label=build +[Travis CI Link]: https://travis-ci.org/femiwiki/mediawiki [femiwiki.com]: https://femiwiki.com +[Docker Swarm]: https://docs.docker.com/engine/swarm/ +[femiwiki/ami]: https://github.com/femiwiki/ami [GNU Affero General Public License v3.0]: LICENSE [COPYRIGHT]: COPYRIGHT