jenkins-bot has submitted this change and it was merged. Change subject: Lint SQL files using php-sqllint ......................................................................
Lint SQL files using php-sqllint - Do not write 'connect' line from 'create_tables*' sql files: it breaks linting, and is not needed as we always explicitly connect to the database when using them when necessary. - Remove the workaround in Dockerfile (as removed per above) - Add cweiske/php-sqllint to composer.json - Add secure-http config option (otherwise install fails) Bug: T132641 Change-Id: I9e4bb96d9ddb2f090e704df3207b4c5f01027ac8 --- M composer.json M conf/Dockerfile.dbempty M erfgoedbot/monument_tables.py 3 files changed, 5 insertions(+), 6 deletions(-) Approvals: Lokal Profil: Looks good to me, approved jenkins-bot: Verified diff --git a/composer.json b/composer.json index 7f82aba..5d367ea 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,10 @@ { + "config": { + "secure-http": false + }, "require-dev": { "phpunit/phpunit": "4.8.*", + "cweiske/php-sqllint": "^0.1.3", "jakub-onderka/php-parallel-lint": "0.9.2", "mediawiki/mediawiki-codesniffer": "0.7.2" }, @@ -8,6 +12,7 @@ "fix": "phpcbf", "test": [ "parallel-lint . --exclude vendor", + "php-sqllint $(find -not -path './vendor/*' -name *.sql)", "phpcs -p -s", "phpunit api/tests" ] diff --git a/conf/Dockerfile.dbempty b/conf/Dockerfile.dbempty index 240a934..d4212d1 100644 --- a/conf/Dockerfile.dbempty +++ b/conf/Dockerfile.dbempty @@ -2,6 +2,3 @@ # Create all database tables COPY ./erfgoedbot/sql/*.sql /docker-entrypoint-initdb.d/ - -# Remove the connect to database at the top of each SQL file -RUN sed -i 's/^connect.*$//' docker-entrypoint-initdb.d/* diff --git a/erfgoedbot/monument_tables.py b/erfgoedbot/monument_tables.py index 40fb020..693dd12 100755 --- a/erfgoedbot/monument_tables.py +++ b/erfgoedbot/monument_tables.py @@ -8,19 +8,16 @@ import os import monuments_config as mconfig -from database_connection import get_monuments_database_config def processCountry(countrycode, lang, countryconfig): # These are not listed in the monument config - db_config = get_monuments_database_config() extra_cols = " `source` varchar(510) NOT NULL DEFAULT '',\n" \ " `changed` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n" table = countryconfig.get('table') sql_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "sql") f = open(os.path.join(sql_dir, "create_table_%s.sql" % table), "w") - f.write("connect " + db_config['db_name'] + " " + db_config['server'] + ";\n") f.write("DROP TABLE IF EXISTS `" + table + "`;\n") f.write("CREATE TABLE IF NOT EXISTS `" + table + "` (\n") -- To view, visit https://gerrit.wikimedia.org/r/315226 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I9e4bb96d9ddb2f090e704df3207b4c5f01027ac8 Gerrit-PatchSet: 2 Gerrit-Project: labs/tools/heritage Gerrit-Branch: master Gerrit-Owner: Jean-Frédéric <jeanfrederic.w...@gmail.com> Gerrit-Reviewer: Jean-Frédéric <jeanfrederic.w...@gmail.com> Gerrit-Reviewer: Lokal Profil <lokal.pro...@gmail.com> Gerrit-Reviewer: Multichill <maar...@mdammers.nl> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits