-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert to Symfony and use ToolforgeBundle
This is more or less a rewrite, but visually nothing should have changed. Moving to Symfony and using ToolforgeBundle makes the app more maintainable, especially for Community Tech (the maintaining team). All controller actions are now in a single class, AppController. From here, we build Record objects that get pass to the views. Just as with before, there are separate classes to communicate with the db and APIs, now called CopyPatrolRepository and WikiRepository. Summary of other changes: * Add .editorconfig * Use .env.local in local envs, with .env as the template * Add .nvmrc * Covert JS to ES6 and use Webpack Encore * Remove old browser-prefixed rules from the LESS * Rename status values to work with new bot/schema * Update all PHP dependencies, remove those we don't need * Remove code that now lives in ToolforgeBundle * Remove unused messages from i18n * Use NPM releases of bootstrap and jquery, and only include the parts that we need. * Remove Select2 JS library as we're not using it anymore * Do all validations server-side and not just in the JS * Add caching to main DB queries and HTTP requests * Convert the data structure for the view in to a Record model * Fetch WikiProjects at the same time as redlink status of page titles * Add stylelint and fix violations * Add integration tests * Other various code cleanup This rewrite does NOT check against the user allowlist and auto-mark records for users who are on it. That job is going to be moved to the bot. See T341726. Bug: T340600
- Loading branch information
1 parent
2732713
commit f13fcdc
Showing
285 changed files
with
20,734 additions
and
13,149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# https://EditorConfig.org | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
# tab indentation | ||
[*.{php,js,less,twig}] | ||
indent_style = tab | ||
indent_size = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
###> symfony/framework-bundle ### | ||
APP_ENV=dev | ||
APP_SECRET=666e4642f204738f71997c183bb4735e | ||
###< symfony/framework-bundle ### | ||
|
||
# Credentials for Toolforge replicas | ||
REPLICAS_USERNAME= | ||
REPLICAS_PASSWORD= | ||
REPLICAS_HOST_S1=127.0.0.1 | ||
REPLICAS_HOST_S2=127.0.0.1 | ||
REPLICAS_HOST_S3=127.0.0.1 | ||
REPLICAS_HOST_S4=127.0.0.1 | ||
REPLICAS_HOST_S5=127.0.0.1 | ||
REPLICAS_HOST_S6=127.0.0.1 | ||
REPLICAS_HOST_S7=127.0.0.1 | ||
REPLICAS_HOST_S8=127.0.0.1 | ||
REPLICAS_PORT_S1=4711 | ||
REPLICAS_PORT_S2=4712 | ||
REPLICAS_PORT_S3=4713 | ||
REPLICAS_PORT_S4=4714 | ||
REPLICAS_PORT_S5=4715 | ||
REPLICAS_PORT_S6=4716 | ||
REPLICAS_PORT_S7=4717 | ||
REPLICAS_PORT_S8=4718 | ||
|
||
# Credentials for CopyPatrol database | ||
TOOLSDB_HOST=127.0.0.1 | ||
TOOLSDB_PORT=4720 | ||
TOOLSDB_USERNAME= | ||
TOOLSDB_PASSWORD= | ||
COPYPATROL_DB_NAME=s52615__copypatrol_migrate_test_02_p | ||
|
||
# OAuth credentials | ||
OAUTH_URL='https://meta.wikimedia.org/w/index.php?title=Special:OAuth' | ||
OAUTH_KEY= | ||
OAUTH_SECRET= | ||
|
||
# iThenticate credentials | ||
ITHENTICATE_USERNAME= | ||
ITHENTICATE_PASSWORD= | ||
|
||
# App configuration | ||
APP_ENABLED_LANGS=ar,en,es,fr,simple | ||
APP_NOTICE_TEXT= | ||
APP_NOTICE_STYLE= | ||
|
||
LOGGED_IN_USER= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Production overrides. | ||
# Passwords and other credentials go in .env.prod.local | ||
|
||
APP_ENV=prod | ||
|
||
# Wikimedia Cloud Services | ||
TRUSTED_PROXIES=172.16.0.0/21 | ||
|
||
REPLICAS_HOST_S1=s1.web.db.svc.wikimedia.cloud | ||
REPLICAS_HOST_S2=s2.web.db.svc.wikimedia.cloud | ||
REPLICAS_HOST_S3=s3.web.db.svc.wikimedia.cloud | ||
REPLICAS_HOST_S4=s4.web.db.svc.wikimedia.cloud | ||
REPLICAS_HOST_S5=s5.web.db.svc.wikimedia.cloud | ||
REPLICAS_HOST_S6=s6.web.db.svc.wikimedia.cloud | ||
REPLICAS_HOST_S7=s7.web.db.svc.wikimedia.cloud | ||
REPLICAS_HOST_S8=s8.web.db.svc.wikimedia.cloud | ||
REPLICAS_PORT_S1=3306 | ||
REPLICAS_PORT_S2=3306 | ||
REPLICAS_PORT_S3=3306 | ||
REPLICAS_PORT_S4=3306 | ||
REPLICAS_PORT_S5=3306 | ||
REPLICAS_PORT_S6=3306 | ||
REPLICAS_PORT_S7=3306 | ||
REPLICAS_PORT_S8=3306 | ||
|
||
TOOLSDB_HOST=tools.db.svc.wikimedia.cloud | ||
TOOLSDB_PORT=3306 | ||
COPYPATROL_DB_NAME=s52615__copypatrol_migrate_test_02_p |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# define your env variables for the test env here | ||
KERNEL_CLASS='App\Kernel' | ||
APP_SECRET='$ecretf0rt3st' | ||
SYMFONY_DEPRECATIONS_HELPER=999999 | ||
PANTHER_APP_ENV=panther | ||
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots | ||
|
||
# Credentials for Toolforge replicas | ||
REPLICAS_USERNAME= | ||
REPLICAS_PASSWORD= | ||
REPLICAS_HOST_S1=127.0.0.1 | ||
REPLICAS_HOST_S2=127.0.0.1 | ||
REPLICAS_HOST_S3=127.0.0.1 | ||
REPLICAS_HOST_S4=127.0.0.1 | ||
REPLICAS_HOST_S5=127.0.0.1 | ||
REPLICAS_HOST_S6=127.0.0.1 | ||
REPLICAS_HOST_S7=127.0.0.1 | ||
REPLICAS_HOST_S8=127.0.0.1 | ||
REPLICAS_PORT_S1=4711 | ||
REPLICAS_PORT_S2=4712 | ||
REPLICAS_PORT_S3=4713 | ||
REPLICAS_PORT_S4=4714 | ||
REPLICAS_PORT_S5=4715 | ||
REPLICAS_PORT_S6=4716 | ||
REPLICAS_PORT_S7=4717 | ||
REPLICAS_PORT_S8=4718 | ||
|
||
# Credentials for CopyPatrol database | ||
TOOLSDB_HOST=127.0.0.1 | ||
TOOLSDB_PORT=4720 | ||
TOOLSDB_USERNAME= | ||
TOOLSDB_PASSWORD= | ||
COPYPATROL_DB_NAME=s52615__copypatrol_migrate_test_02_p | ||
|
||
APP_ENABLED_LANGS=ar,en,es,fr,simple | ||
APP_NOTICE_TEXT= | ||
APP_NOTICE_STYLE= |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
module.exports = { | ||
extends: [ | ||
'wikimedia', | ||
'wikimedia/language/es2019' | ||
], | ||
rules: { | ||
'no-alert': 0 | ||
}, | ||
parserOptions: { | ||
sourceType: 'module' | ||
}, | ||
env: { | ||
browser: true, | ||
node: true, | ||
es6: true | ||
}, | ||
globals: { | ||
$: true, | ||
jsUnauthorized: true, | ||
jsDbError: true, | ||
jsUndoOwnOnly: true, | ||
jsUnknownError: true, | ||
jsLoadMore: true, | ||
jsNoMore: true, | ||
wikiLang: true | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,13 @@ jobs: | |
extensions: json | ||
tools: composer | ||
- run: composer update | ||
- run: composer test | ||
- run: | | ||
composer validate | ||
./vendor/bin/phpcs -s . | ||
./bin/console lint:twig ./templates | ||
./bin/console lint:yaml ./config | ||
./vendor/bin/minus-x check . | ||
./bin/phpunit --exclude-group=integration | ||
build_image: | ||
name: Build Docker image | ||
runs-on: ubuntu-latest | ||
|
@@ -87,7 +93,6 @@ jobs: | |
run: | | ||
docker load --input /tmp/copypatrol-${{ matrix.targets.name }}.image.tar | ||
docker image ls -a | ||
- name: Dive | ||
uses: yuichielectric/[email protected] | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,26 @@ | ||
.DS_Store | ||
.lighttpd.conf | ||
.htaccess | ||
.viminfo | ||
.my.cnf | ||
.env | ||
.*_history | ||
.bash* | ||
*.log | ||
tmp/ | ||
/vendor/ | ||
/cache/* | ||
src/Less/cache/* | ||
fill_patroller/ | ||
flask-mwoauth/ | ||
.composer/ | ||
.npm/ | ||
.idea/ | ||
.local/ | ||
.subversion/ | ||
.kube/ | ||
replica.my.cnf | ||
service.manifest | ||
restart_webservice.sh | ||
deploy.sh | ||
!.gitkeep | ||
|
||
###> symfony/framework-bundle ### | ||
/.env.local | ||
/.env.local.php | ||
/.env.*.local | ||
/config/secrets/prod/prod.decrypt.private.php | ||
/public/bundles/ | ||
/var/ | ||
/vendor/ | ||
###< symfony/framework-bundle ### | ||
|
||
###> squizlabs/php_codesniffer ### | ||
/.phpcs-cache | ||
###< squizlabs/php_codesniffer ### | ||
|
||
###> symfony/webpack-encore-bundle ### | ||
/node_modules/ | ||
npm-debug.log | ||
yarn-error.log | ||
###< symfony/webpack-encore-bundle ### | ||
|
||
###> symfony/phpunit-bridge ### | ||
.phpunit.result.cache | ||
/phpunit.xml | ||
###< symfony/phpunit-bridge ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
14.17.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "stylelint-config-wikimedia", | ||
"rules": { | ||
"color-named": null, | ||
"declaration-property-unit-disallowed-list": null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.