Jean-Frédéric has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/315226

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 necessary)
- Add cweiske/php-sqllint to composer.json
- Add secure-http config option
  (otherwise install fails)

Bug: T132641
Change-Id: I9e4bb96d9ddb2f090e704df3207b4c5f01027ac8
---
M composer.json
M erfgoedbot/monument_tables.py
2 files changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/labs/tools/heritage 
refs/changes/26/315226/1

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/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: newchange
Gerrit-Change-Id: I9e4bb96d9ddb2f090e704df3207b4c5f01027ac8
Gerrit-PatchSet: 1
Gerrit-Project: labs/tools/heritage
Gerrit-Branch: master
Gerrit-Owner: Jean-Frédéric <jeanfrederic.w...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to