diff --git a/composer.json b/composer.json index b974df4da3819ce45d997a708fd5a356dba3b124..350bb7117d4608453addea72362f2d857b72eef5 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,7 @@ "description": "Site de soutien LQDN", "require": { "bcosca/fatfree": "^3.5", - "robmorgan/phinx": "^0.6.4", + "robmorgan/phinx": "^0.10.0", "vlucas/phpdotenv": "^2.4", "pimple/pimple": "^3.0", "doctrine/dbal": "^2.5", diff --git a/composer.lock b/composer.lock index 01e2c50051377f4a62f2e3bfe281ffffb4aa4a9e..e75e5419c2b75790fb78ac6675d711c5294b973d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "edd15e67b3a00deeba773a575a3b276d", - "content-hash": "ece126552c48f94571113296890f60fa", + "hash": "8fcd8612489ab74ec7fc8b83f213db42", + "content-hash": "71824fcbe266f51a6a2fed4709096366", "packages": [ { "name": "bcosca/fatfree", @@ -38,6 +38,297 @@ "homepage": "http://fatfreeframework.com/", "time": "2018-04-19 17:23:25" }, + { + "name": "cakephp/cache", + "version": "3.6.12", + "source": { + "type": "git", + "url": "https://github.com/cakephp/cache.git", + "reference": "5941977c584843b9ddb32ec864a9483fbef88d52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/cache/zipball/5941977c584843b9ddb32ec864a9483fbef88d52", + "reference": "5941977c584843b9ddb32ec864a9483fbef88d52", + "shasum": "" + }, + "require": { + "cakephp/core": "^3.6.0", + "php": ">=5.6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Cake\\Cache\\": "." + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/cache/graphs/contributors" + } + ], + "description": "Easy to use Caching library with support for multiple caching backends", + "homepage": "https://cakephp.org", + "keywords": [ + "cache", + "caching", + "cakephp" + ], + "time": "2018-09-01 17:00:52" + }, + { + "name": "cakephp/collection", + "version": "3.6.12", + "source": { + "type": "git", + "url": "https://github.com/cakephp/collection.git", + "reference": "c5b3a3561eb92a5c25ffcc90ad3a1f193962065f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/collection/zipball/c5b3a3561eb92a5c25ffcc90ad3a1f193962065f", + "reference": "c5b3a3561eb92a5c25ffcc90ad3a1f193962065f", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Cake\\Collection\\": "." + }, + "files": [ + "functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/collection/graphs/contributors" + } + ], + "description": "Work easily with arrays and iterators by having a battery of utility traversal methods", + "homepage": "https://cakephp.org", + "keywords": [ + "arrays", + "cakephp", + "collections", + "iterators" + ], + "time": "2018-07-26 19:56:06" + }, + { + "name": "cakephp/core", + "version": "3.6.12", + "source": { + "type": "git", + "url": "https://github.com/cakephp/core.git", + "reference": "82741aeb90ca2fbbf9fbbd507d56d53b081db237" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/core/zipball/82741aeb90ca2fbbf9fbbd507d56d53b081db237", + "reference": "82741aeb90ca2fbbf9fbbd507d56d53b081db237", + "shasum": "" + }, + "require": { + "cakephp/utility": "^3.6.0", + "php": ">=5.6.0" + }, + "suggest": { + "cakephp/event": "To use PluginApplicationInterface or plugin applications." + }, + "type": "library", + "autoload": { + "psr-4": { + "Cake\\Core\\": "." + }, + "files": [ + "functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/core/graphs/contributors" + } + ], + "description": "CakePHP Framework Core classes", + "homepage": "https://cakephp.org", + "keywords": [ + "cakephp", + "core", + "framework" + ], + "time": "2018-07-26 19:56:06" + }, + { + "name": "cakephp/database", + "version": "3.6.12", + "source": { + "type": "git", + "url": "https://github.com/cakephp/database.git", + "reference": "1494d12bc2b42cb1e844936cbbdd686a5e36235d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/database/zipball/1494d12bc2b42cb1e844936cbbdd686a5e36235d", + "reference": "1494d12bc2b42cb1e844936cbbdd686a5e36235d", + "shasum": "" + }, + "require": { + "cakephp/cache": "^3.6.0", + "cakephp/core": "^3.6.0", + "cakephp/datasource": "^3.6.0", + "php": ">=5.6.0" + }, + "suggest": { + "cakephp/log": "Require this if you want to use the built-in query logger" + }, + "type": "library", + "autoload": { + "psr-4": { + "Cake\\Database\\": "." + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/database/graphs/contributors" + } + ], + "description": "Flexible and powerful Database abstraction library with a familiar PDO-like API", + "homepage": "https://cakephp.org", + "keywords": [ + "abstraction", + "cakephp", + "database", + "database abstraction", + "pdo" + ], + "time": "2018-09-28 10:56:48" + }, + { + "name": "cakephp/datasource", + "version": "3.6.12", + "source": { + "type": "git", + "url": "https://github.com/cakephp/datasource.git", + "reference": "44222238fa97e32d39e48bb2add4933ccffbd896" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/datasource/zipball/44222238fa97e32d39e48bb2add4933ccffbd896", + "reference": "44222238fa97e32d39e48bb2add4933ccffbd896", + "shasum": "" + }, + "require": { + "cakephp/core": "^3.6.0", + "php": ">=5.6.0" + }, + "suggest": { + "cakephp/cache": "If you decide to use Query caching.", + "cakephp/collection": "If you decide to use ResultSetInterface.", + "cakephp/utility": "If you decide to use EntityTrait." + }, + "type": "library", + "autoload": { + "psr-4": { + "Cake\\Datasource\\": "." + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/datasource/graphs/contributors" + } + ], + "description": "Provides connection managing and traits for Entities and Queries that can be reused for different datastores", + "homepage": "https://cakephp.org", + "keywords": [ + "cakephp", + "connection management", + "datasource", + "entity", + "query" + ], + "time": "2018-09-28 10:56:48" + }, + { + "name": "cakephp/utility", + "version": "3.6.12", + "source": { + "type": "git", + "url": "https://github.com/cakephp/utility.git", + "reference": "14b61586db830a84aedadd57be2825f40cc29e09" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cakephp/utility/zipball/14b61586db830a84aedadd57be2825f40cc29e09", + "reference": "14b61586db830a84aedadd57be2825f40cc29e09", + "shasum": "" + }, + "require": { + "cakephp/core": "^3.6.0", + "php": ">=5.6.0" + }, + "suggest": { + "ext-intl": "To use Text::transliterate() or Text::slug()", + "lib-ICU": "To use Text::transliterate() or Text::slug()" + }, + "type": "library", + "autoload": { + "psr-4": { + "Cake\\Utility\\": "." + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/utility/graphs/contributors" + } + ], + "description": "CakePHP Utility classes such as Inflector, String, Hash, and Security", + "homepage": "https://cakephp.org", + "keywords": [ + "cakephp", + "hash", + "inflector", + "security", + "string", + "utility" + ], + "time": "2018-09-05 00:44:03" + }, { "name": "doctrine/annotations", "version": "v1.4.0", @@ -705,26 +996,30 @@ }, { "name": "robmorgan/phinx", - "version": "v0.6.6", + "version": "0.10.6", "source": { "type": "git", "url": "https://github.com/cakephp/phinx.git", - "reference": "cc97b79f62c2180caba0be1d3744a335a296a678" + "reference": "f28a1c6ab1fa1f0295cddade9aea05eeb303bd2b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cakephp/phinx/zipball/cc97b79f62c2180caba0be1d3744a335a296a678", - "reference": "cc97b79f62c2180caba0be1d3744a335a296a678", + "url": "https://api.github.com/repos/cakephp/phinx/zipball/f28a1c6ab1fa1f0295cddade9aea05eeb303bd2b", + "reference": "f28a1c6ab1fa1f0295cddade9aea05eeb303bd2b", "shasum": "" }, "require": { - "php": ">=5.4", - "symfony/config": "~2.8|~3.0", - "symfony/console": "~2.8|~3.0", - "symfony/yaml": "~2.8|~3.0" + "cakephp/collection": "^3.6", + "cakephp/database": "^3.6", + "php": ">=5.6", + "symfony/config": "^2.8|^3.0|^4.0", + "symfony/console": "^2.8|^3.0|^4.0", + "symfony/yaml": "^2.8|^3.0|^4.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.26|^5.0" + "cakephp/cakephp-codesniffer": "^3.0", + "phpunit/phpunit": ">=5.7", + "sebastian/comparator": ">=1.2.3" }, "bin": [ "bin/phinx" @@ -732,7 +1027,7 @@ "type": "library", "autoload": { "psr-4": { - "Phinx\\": "src/Phinx" + "Phinx\\": "src/Phinx/" } }, "notification-url": "https://packagist.org/downloads/", @@ -756,6 +1051,10 @@ "name": "Richard Quadling", "email": "rquadling@gmail.com", "role": "Developer" + }, + { + "name": "CakePHP Community", + "homepage": "https://github.com/cakephp/phinx/graphs/contributors" } ], "description": "Phinx makes it ridiculously easy to manage the database migrations for your PHP app.", @@ -767,7 +1066,7 @@ "migrations", "phinx" ], - "time": "2017-01-23 08:53:20" + "time": "2018-08-12 17:22:43" }, { "name": "sentry/sentry", @@ -1862,16 +2161,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.13.0", + "version": "v2.13.1", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "7136aa4e0c5f912e8af82383775460d906168a10" + "reference": "54814c62d5beef3ba55297b9b3186ed8b8a1b161" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/7136aa4e0c5f912e8af82383775460d906168a10", - "reference": "7136aa4e0c5f912e8af82383775460d906168a10", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/54814c62d5beef3ba55297b9b3186ed8b8a1b161", + "reference": "54814c62d5beef3ba55297b9b3186ed8b8a1b161", "shasum": "" }, "require": { @@ -1882,7 +2181,7 @@ "ext-tokenizer": "*", "php": "^5.6 || >=7.0 <7.3", "php-cs-fixer/diff": "^1.3", - "symfony/console": "^3.2 || ^4.0", + "symfony/console": "^3.4.17 || ^4.1.6", "symfony/event-dispatcher": "^3.0 || ^4.0", "symfony/filesystem": "^3.0 || ^4.0", "symfony/finder": "^3.0 || ^4.0", @@ -1918,11 +2217,6 @@ "php-cs-fixer" ], "type": "application", - "extra": { - "branch-alias": { - "dev-master": "2.13-dev" - } - }, "autoload": { "psr-4": { "PhpCsFixer\\": "src/" @@ -1954,7 +2248,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2018-08-23 13:15:44" + "time": "2018-10-21 00:32:10" }, { "name": "guzzlehttp/guzzle", diff --git a/db/migrations/20161204123914_remove_bonus_table.php b/db/migrations/20161204123914_remove_bonus_table.php index 54d6aa062631a33ac7c09e0c29915b7ece98d269..0ad1ad0bf75733349ada5be91e667f16989a837d 100644 --- a/db/migrations/20161204123914_remove_bonus_table.php +++ b/db/migrations/20161204123914_remove_bonus_table.php @@ -28,7 +28,7 @@ class RemoveBonusTable extends AbstractMigration public function change() { if ($this->hasTable('bonus')) { - $this->dropTable('bonus'); + $this->table('bonus')->drop()->save(); } } } diff --git a/db/migrations/20181029145849_user_email_unique.php b/db/migrations/20181029145849_user_email_unique.php new file mode 100644 index 0000000000000000000000000000000000000000..371c82021fcacb4b622d2f65878f1f772f9b0e81 --- /dev/null +++ b/db/migrations/20181029145849_user_email_unique.php @@ -0,0 +1,39 @@ +table('users'); + $table->addIndex(['email'], ['unique' => true, 'name' => 'idx_users_emails']) + ->update(); + } +} diff --git a/scripts/import_users.sh b/scripts/import_users.sh new file mode 100755 index 0000000000000000000000000000000000000000..55089ff80957e2eb35b557c44684e711cd715b9e --- /dev/null +++ b/scripts/import_users.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# Cette monstruosité utilise un import/export par CSV de psql vers mariadb des utilisqteurs nécessaires. On pipe l'un dans l'autre. Il faut exécuter ce script avec des droits sudo. +PSQL_QUERY="COPY (SELECT DISTINCT ON (auth_user.email) email, auth_user.username pseudo FROM auth_user WHERE email NOT LIKE '' AND is_active = 't') TO STDOUT WITH (FORMAT CSV, HEADER, DELIMITER ',');" +MYSQL_QUERY="LOAD DATA LOCAL INFILE '/dev/stdin' INTO TABLE users FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '\\"' ESCAPED BY '\\"' LINES TERMINATED BY '\n' IGNORE 1 LINES (email, pseudo);" +sudo -u postgres psql -d soutien -c "$PSQL_QUERY" | mysql $SQL_DATABASE -u $SQL_USER -p$SQL_PASSWORD --local-infile=1 -e "$MYSQL_QUERY"