From 1da2a68f937fea32cd4238f3ff9135a8292aa870 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Thu, 7 Nov 2013 11:07:26 +0100 Subject: [PATCH 01/13] Update composer --- composer.json | 5 +- composer.lock | 234 +++++++++++++++++++++++++++----------------------- 2 files changed, 129 insertions(+), 110 deletions(-) diff --git a/composer.json b/composer.json index eaec81f445..466eaef7af 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "alchemy/task-manager" : "~1.0", "dailymotion/sdk" : "~1.5", "data-uri/data-uri" : "~0.1.0", - "doctrine/orm" : "~2.3.0", + "doctrine/orm" : "~2.4.0", "facebook/php-sdk" : "~3.0", "gedmo/doctrine-extensions" : "~2.3.0", "alchemy/google-plus-api-client" : "~0.6.2", @@ -53,7 +53,8 @@ "behat/mink-extension" : "~1.0", "behat/mink-goutte-driver" : "~1.0", "behat/mink-selenium2-driver" : "~1.0", - "fabpot/goutte" : "~1.0" + "fabpot/goutte" : "~1.0", + "doctrine/migrations" : "1.0.*@dev" }, "repositories": [ { diff --git a/composer.lock b/composer.lock index 8ca6e4bc07..987a423d5b 100644 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "9adc21c7c8c7337bf913c5c3f5ba65fb", + "hash": "57f05e1ba483ccfc8cd091e223df557d", "packages": [ { "name": "alchemy-fr/tcpdf-clone", @@ -720,31 +720,33 @@ }, { "name": "doctrine/dbal", - "version": "2.3.4", + "version": "v2.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "2a37b007dda8e21bdbb8fa445be8fa0064199e13" + "reference": "3eb557f144ec41e6e84997e43acb1946c92fbc88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/2a37b007dda8e21bdbb8fa445be8fa0064199e13", - "reference": "2a37b007dda8e21bdbb8fa445be8fa0064199e13", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/3eb557f144ec41e6e84997e43acb1946c92fbc88", + "reference": "3eb557f144ec41e6e84997e43acb1946c92fbc88", "shasum": "" }, "require": { - "doctrine/common": ">=2.3.0,<2.5-dev", + "doctrine/common": "~2.4", "php": ">=5.3.2" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3.x-dev" - } + "require-dev": { + "phpunit/phpunit": "3.7.*", + "symfony/console": "~2.0" }, + "suggest": { + "symfony/console": "Allows use of the command line interface" + }, + "type": "library", "autoload": { "psr-0": { - "Doctrine\\DBAL": "lib/" + "Doctrine\\DBAL\\": "lib/" } }, "notification-url": "https://packagist.org/downloads/", @@ -753,9 +755,10 @@ ], "authors": [ { - "name": "Jonathan Wage", + "name": "Jonathan H. Wage", "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" + "homepage": "http://www.jwage.com/", + "role": "Creator" }, { "name": "Guilherme Blanco", @@ -779,7 +782,7 @@ "persistence", "queryobject" ], - "time": "2013-05-11 07:45:37" + "time": "2013-09-07 10:49:18" }, { "name": "doctrine/inflector", @@ -898,23 +901,28 @@ }, { "name": "doctrine/orm", - "version": "2.3.4", + "version": "v2.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/doctrine2.git", - "reference": "a41b02c080114c0de3da4ee9fba61f7d18fae7d0" + "reference": "57705e0d781719b96daf322a6d6f66ff21e3cdc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/a41b02c080114c0de3da4ee9fba61f7d18fae7d0", - "reference": "a41b02c080114c0de3da4ee9fba61f7d18fae7d0", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/57705e0d781719b96daf322a6d6f66ff21e3cdc9", + "reference": "57705e0d781719b96daf322a6d6f66ff21e3cdc9", "shasum": "" }, "require": { - "doctrine/dbal": "2.3.*", + "doctrine/collections": "~1.1", + "doctrine/dbal": "~2.4", "ext-pdo": "*", "php": ">=5.3.2", - "symfony/console": "2.*" + "symfony/console": "~2.0" + }, + "require-dev": { + "satooshi/php-coveralls": "dev-master", + "symfony/yaml": "~2.1" }, "suggest": { "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" @@ -926,12 +934,12 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3.x-dev" + "dev-master": "2.4.x-dev" } }, "autoload": { "psr-0": { - "Doctrine\\ORM": "lib/" + "Doctrine\\ORM\\": "lib/" } }, "notification-url": "https://packagist.org/downloads/", @@ -940,9 +948,10 @@ ], "authors": [ { - "name": "Jonathan Wage", + "name": "Jonathan H. Wage", "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" + "homepage": "http://www.jwage.com/", + "role": "Creator" }, { "name": "Guilherme Blanco", @@ -964,7 +973,7 @@ "database", "orm" ], - "time": "2013-05-11 07:51:12" + "time": "2013-09-07 16:19:56" }, { "name": "evenement/evenement", @@ -1051,16 +1060,16 @@ }, { "name": "gedmo/doctrine-extensions", - "version": "v2.3.8", + "version": "v2.3.7", "source": { "type": "git", "url": "https://github.com/l3pp4rd/DoctrineExtensions.git", - "reference": "d2bef940268e4dc5f0f050e80458169a7267813a" + "reference": "0aa660ffea298b630b8ded7bd2a7eae0d8619fdb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/l3pp4rd/DoctrineExtensions/zipball/d2bef940268e4dc5f0f050e80458169a7267813a", - "reference": "d2bef940268e4dc5f0f050e80458169a7267813a", + "url": "https://api.github.com/repos/l3pp4rd/DoctrineExtensions/zipball/0aa660ffea298b630b8ded7bd2a7eae0d8619fdb", + "reference": "0aa660ffea298b630b8ded7bd2a7eae0d8619fdb", "shasum": "" }, "require": { @@ -1127,7 +1136,7 @@ "tree", "uploadable" ], - "time": "2013-11-09 21:23:13" + "time": "2013-08-18 07:18:44" }, { "name": "guzzle/guzzle", @@ -1635,16 +1644,16 @@ }, { "name": "monolog/monolog", - "version": "1.7.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "6225b22de9dcf36546be3a0b2fa8e3d986153f57" + "reference": "f72392d0e6eb855118f5a84e89ac2d257c704abd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/6225b22de9dcf36546be3a0b2fa8e3d986153f57", - "reference": "6225b22de9dcf36546be3a0b2fa8e3d986153f57", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f72392d0e6eb855118f5a84e89ac2d257c704abd", + "reference": "f72392d0e6eb855118f5a84e89ac2d257c704abd", "shasum": "" }, "require": { @@ -1652,26 +1661,21 @@ "psr/log": "~1.0" }, "require-dev": { - "aws/aws-sdk-php": "~2.4.8", "doctrine/couchdb": "dev-master", "mlehner/gelf-php": "1.0.*", - "phpunit/phpunit": "~3.7.0", - "raven/raven": "0.5.*", - "ruflin/elastica": "0.90.*" + "raven/raven": "0.5.*" }, "suggest": { - "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", "doctrine/couchdb": "Allow sending log messages to a CouchDB server", "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", "ext-mongo": "Allow sending log messages to a MongoDB server", "mlehner/gelf-php": "Allow sending log messages to a GrayLog2 server", - "raven/raven": "Allow sending log messages to a Sentry server", - "ruflin/elastica": "Allow sending log messages to an Elastic Search server" + "raven/raven": "Allow sending log messages to a Sentry server" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.6.x-dev" } }, "autoload": { @@ -1698,7 +1702,7 @@ "logging", "psr-3" ], - "time": "2013-11-14 19:48:31" + "time": "2013-07-28 22:38:30" }, { "name": "mrclay/minify", @@ -2458,16 +2462,16 @@ }, { "name": "pimple/pimple", - "version": "v1.1.0", + "version": "v1.0.2", "source": { "type": "git", "url": "https://github.com/fabpot/Pimple.git", - "reference": "471c7d7c52ad6594e17b8ec33efdd1be592b5d83" + "reference": "ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Pimple/zipball/471c7d7c52ad6594e17b8ec33efdd1be592b5d83", - "reference": "471c7d7c52ad6594e17b8ec33efdd1be592b5d83", + "url": "https://api.github.com/repos/fabpot/Pimple/zipball/ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94", + "reference": "ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94", "shasum": "" }, "require": { @@ -2476,7 +2480,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { @@ -2500,7 +2504,7 @@ "container", "dependency injection" ], - "time": "2013-09-19 04:53:08" + "time": "2013-03-08 08:21:40" }, { "name": "psr/log", @@ -2826,12 +2830,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "4e9332b6b66d52750142e5b32cc754620f875fe7" + "reference": "88906277988d3b0de562b1b99e5c49c146d4f2f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/4e9332b6b66d52750142e5b32cc754620f875fe7", - "reference": "4e9332b6b66d52750142e5b32cc754620f875fe7", + "url": "https://api.github.com/repos/symfony/symfony/zipball/88906277988d3b0de562b1b99e5c49c146d4f2f2", + "reference": "88906277988d3b0de562b1b99e5c49c146d4f2f2", "shasum": "" }, "require": { @@ -2931,7 +2935,7 @@ "keywords": [ "framework" ], - "time": "2013-11-17 08:45:14" + "time": "2013-11-04 09:03:40" }, { "name": "themattharris/tmhoauth", @@ -2939,12 +2943,12 @@ "source": { "type": "git", "url": "https://github.com/themattharris/tmhOAuth.git", - "reference": "47dcee2ac74f8c032d2a1afb836e65108bf582b7" + "reference": "0.8.3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/themattharris/tmhOAuth/zipball/47dcee2ac74f8c032d2a1afb836e65108bf582b7", - "reference": "47dcee2ac74f8c032d2a1afb836e65108bf582b7", + "url": "https://api.github.com/repos/themattharris/tmhOAuth/zipball/0.8.3", + "reference": "0.8.3", "shasum": "" }, "require": { @@ -3071,54 +3075,6 @@ ], "time": "2013-10-30 08:20:53" }, - { - "name": "vierbergenlars/php-semver", - "version": "v2.1.0", - "source": { - "type": "git", - "url": "https://github.com/vierbergenlars/php-semver.git", - "reference": "6b16f72b8c2d3aa00368f9fa612b2218a96245fc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/vierbergenlars/php-semver/zipball/6b16f72b8c2d3aa00368f9fa612b2218a96245fc", - "reference": "6b16f72b8c2d3aa00368f9fa612b2218a96245fc", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "require-dev": { - "vierbergenlars/simpletest": "1.1.*" - }, - "bin": [ - "bin/semver", - "bin/update-versions" - ], - "type": "library", - "autoload": { - "psr-0": { - "vierbergenlars\\SemVer": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Lars Vierbergen", - "email": "vierbergenlars@gmail.com" - } - ], - "description": "The Semantic Versioner for PHP", - "keywords": [ - "semantic", - "semver", - "versioning" - ], - "time": "2013-09-20 10:41:27" - }, { "name": "zend/gdata", "version": "1.12.1", @@ -3603,7 +3559,8 @@ { "name": "Jonathan Wage", "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/" + "homepage": "http://www.jwage.com/", + "role": "Creator" } ], "description": "Data Fixtures for all Doctrine Object Managers", @@ -3613,6 +3570,66 @@ ], "time": "2013-10-16 14:26:38" }, + { + "name": "doctrine/migrations", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/migrations.git", + "reference": "0f5a110a1e6ae413e425912e6601643f91b069c1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/migrations/zipball/0f5a110a1e6ae413e425912e6601643f91b069c1", + "reference": "0f5a110a1e6ae413e425912e6601643f91b069c1", + "shasum": "" + }, + "require": { + "doctrine/dbal": "~2.0", + "php": ">=5.3.2" + }, + "require-dev": { + "symfony/console": "2.*", + "symfony/yaml": "2.*" + }, + "suggest": { + "symfony/console": "to run the migration from the console" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\Migrations": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/", + "role": "Creator" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + } + ], + "description": "Database Schema migrations using Doctrine DBAL", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "migrations" + ], + "time": "2013-11-03 20:54:43" + }, { "name": "fabpot/goutte", "version": "v1.0.3", @@ -4105,10 +4122,11 @@ "symfony/symfony": 20, "doctrine/data-fixtures": 20, "behat/behat": 20, - "behat/gherkin": 20 + "behat/gherkin": 20, + "doctrine/migrations": 20 }, "platform": { - "php": ">=5.4" + "php": ">=5.3.3" }, "platform-dev": [ From dec0ae91c9ede0cb050e06047a18783362ac3a1b Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Thu, 7 Nov 2013 18:01:34 +0100 Subject: [PATCH 02/13] Add DoctrineMigrationProvider --- .../DoctrineMigrationServiceProvider.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 lib/Alchemy/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProvider.php diff --git a/lib/Alchemy/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProvider.php b/lib/Alchemy/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProvider.php new file mode 100644 index 0000000000..7774717aba --- /dev/null +++ b/lib/Alchemy/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProvider.php @@ -0,0 +1,34 @@ +share(function ($app) { + $configuration = new YamlConfiguration($app['EM']->getConnection()); + $configuration->load(sprintf('%s/lib/conf.d/migrations.yml', $app['root.path'])); + $configuration->setMigrationsDirectory(sprintf('%s/lib/Alchemy/Phrasea/Setup/DoctrineMigration', $app['root.path'])); + + return $configuration; + }); + } + + public function boot(Application $app) + { + } +} From c3947844e02f3bafc33833a013eb3ed0d66d630a Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Thu, 7 Nov 2013 18:02:19 +0100 Subject: [PATCH 03/13] Add doctrine migration commands --- cli-config.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 cli-config.php diff --git a/cli-config.php b/cli-config.php new file mode 100644 index 0000000000..895d9d490c --- /dev/null +++ b/cli-config.php @@ -0,0 +1,17 @@ + new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($app['EM']->getConnection()), + 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($app['EM']) +)); \ No newline at end of file From 431d2532e262c5adcb94b29242e7a72bea9eea10 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Thu, 7 Nov 2013 18:03:12 +0100 Subject: [PATCH 04/13] UseDoctrineMigrationServiceProvider --- bin/setup | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/setup b/bin/setup index 8bf9f6f669..2000bce2cf 100755 --- a/bin/setup +++ b/bin/setup @@ -22,6 +22,7 @@ use Alchemy\Phrasea\Command\Setup\Install; use Alchemy\Phrasea\Command\Setup\PluginsReset; use Alchemy\Phrasea\CLI; use Alchemy\Phrasea\Command\Setup\CheckEnvironment; +use Alchemy\Phrasea\Core\CLIProvider\DoctrineMigrationServiceProvider; require_once __DIR__ . '/../vendor/autoload.php'; @@ -45,6 +46,9 @@ $app = new CLI(" under certain conditions; type `about:license' for details.\n\n" . ' SETUP', Version::getName() . ' ' . Version::getNumber()); + +$app->register(new DoctrineMigrationServiceProvider()); + $app->command(new \module_console_aboutAuthors('about:authors')); $app->command(new \module_console_aboutLicense('about:license')); From 99d4895f574bd48faeac42072e3d859c1cf008d0 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Thu, 7 Nov 2013 18:05:10 +0100 Subject: [PATCH 05/13] Add DoctrineMigration Patch --- bin/setup | 1 - cli-config.php | 2 +- .../DoctrineMigrations/Version320alpha4.php | 65 ++++++++++++++++++ .../DoctrineMigrations/Version360alpha1.php | 52 ++++++++++++++ .../DoctrineMigrations/Version370alpha7.php | 40 +++++++++++ .../DoctrineMigrations/Version370alpha8.php | 28 ++++++++ .../DoctrineMigrations/Version380alpha11.php | 32 +++++++++ .../DoctrineMigrations/Version380alpha4.php | 28 ++++++++ .../DoctrineMigrations/Version390alpha1a.php | 29 ++++++++ .../DoctrineMigrations/Version390alpha1b.php | 33 +++++++++ .../DoctrineMigrations/Version390alpha2.php | 30 ++++++++ .../DoctrineMigrations/Version390alpha3.php | 29 ++++++++ .../DoctrineMigrations/Version390alpha4.php | 29 ++++++++ .../DoctrineMigrations/Version390alpha5.php | 29 ++++++++ .../DoctrineMigrations/Version390alpha6.php | 32 +++++++++ .../DoctrineMigrations/Version390alpha7.php | 68 +++++++++++++++++++ .../DoctrineMigrations/Version390alpha8.php | 28 ++++++++ .../PreSchemaUpgradeCollection.php | 1 - .../Version/PreSchemaUpgrade/Upgrade39.php | 44 ------------ lib/classes/appbox.php | 14 ++-- lib/classes/patch/320alpha4b.php | 5 +- lib/classes/patch/360alpha1a.php | 62 +++++++++-------- lib/classes/patch/370alpha7a.php | 3 + lib/classes/patch/370alpha8a.php | 5 +- lib/classes/patch/380alpha11a.php | 3 + lib/classes/patch/380alpha4a.php | 3 + lib/classes/patch/390alpha1a.php | 3 + lib/classes/patch/390alpha1b.php | 3 + lib/classes/patch/390alpha2a.php | 3 + lib/classes/patch/390alpha3a.php | 3 + lib/classes/patch/390alpha4a.php | 3 + lib/classes/patch/390alpha5a.php | 3 + lib/classes/patch/390alpha6a.php | 3 + lib/classes/patch/390alpha7a.php | 3 + lib/classes/patch/390alpha8a.php | 3 + lib/conf.d/migrations.yml | 50 ++++++++++++++ .../DoctrineMigrationServiceProviderTest.php | 17 +++++ 37 files changed, 705 insertions(+), 84 deletions(-) create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version320alpha4.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version360alpha1.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha7.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha8.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha11.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha4.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1a.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1b.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha2.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha3.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha4.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha5.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha6.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha7.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha8.php delete mode 100644 lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/Upgrade39.php create mode 100644 lib/conf.d/migrations.yml create mode 100644 tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php diff --git a/bin/setup b/bin/setup index 2000bce2cf..a896981feb 100755 --- a/bin/setup +++ b/bin/setup @@ -46,7 +46,6 @@ $app = new CLI(" under certain conditions; type `about:license' for details.\n\n" . ' SETUP', Version::getName() . ' ' . Version::getNumber()); - $app->register(new DoctrineMigrationServiceProvider()); $app->command(new \module_console_aboutAuthors('about:authors')); diff --git a/cli-config.php b/cli-config.php index 895d9d490c..88fb969508 100644 --- a/cli-config.php +++ b/cli-config.php @@ -14,4 +14,4 @@ $app = new \Alchemy\Phrasea\Application(); return $helperSet = new \Symfony\Component\Console\Helper\HelperSet(array( 'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($app['EM']->getConnection()), 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($app['EM']) -)); \ No newline at end of file +)); diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version320alpha4.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version320alpha4.php new file mode 100644 index 0000000000..7f4f92c48c --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version320alpha4.php @@ -0,0 +1,65 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $app = new Application(); + + $rsm = new ResultSetMapping(); + $rsm->addScalarResult('Name', 'Name'); + + $found = false; + + foreach ($app['EM']->createNativeQuery('SHOW TABLE STATUS', $rsm)->getResult() as $row) { + if (strcmp('feeds', $row['Name'])) { + $found = true; + break; + } + } + + if ($found) { + $this->addSql("RENAME TABLE `feeds` TO `feeds_backup`"); + } + + $this->addSql("CREATE TABLE IF NOT EXISTS Feeds (id INT AUTO_INCREMENT NOT NULL, public TINYINT(1) NOT NULL, icon_url TINYINT(1) NOT NULL, base_id INT DEFAULT NULL, title VARCHAR(128) NOT NULL, subtitle VARCHAR(1024) DEFAULT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS FeedPublishers (id INT AUTO_INCREMENT NOT NULL, feed_id INT DEFAULT NULL, usr_id INT NOT NULL, owner TINYINT(1) NOT NULL, created_on DATETIME NOT NULL, INDEX IDX_31AFAB251A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS FeedEntries (id INT AUTO_INCREMENT NOT NULL, publisher_id INT DEFAULT NULL, feed_id INT DEFAULT NULL, title VARCHAR(128) NOT NULL, subtitle VARCHAR(128) NOT NULL, author_name VARCHAR(128) NOT NULL, author_email VARCHAR(128) NOT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, INDEX IDX_5FC892F940C86FCE (publisher_id), INDEX IDX_5FC892F951A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS FeedItems (id INT AUTO_INCREMENT NOT NULL, entry_id INT DEFAULT NULL, record_id INT NOT NULL, sbas_id INT NOT NULL, ord INT NOT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, INDEX IDX_7F9CDFA6BA364942 (entry_id), UNIQUE INDEX lookup_unique_idx (entry_id, sbas_id, record_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS FeedTokens (id INT AUTO_INCREMENT NOT NULL, feed_id INT DEFAULT NULL, usr_id INT NOT NULL, value VARCHAR(12) DEFAULT NULL, INDEX IDX_9D1CA84851A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("ALTER TABLE FeedPublishers ADD CONSTRAINT FK_31AFAB251A5BC03 FOREIGN KEY (feed_id) REFERENCES Feeds (id)"); + $this->addSql("ALTER TABLE FeedEntries ADD CONSTRAINT FK_5FC892F940C86FCE FOREIGN KEY (publisher_id) REFERENCES FeedPublishers (id)"); + $this->addSql("ALTER TABLE FeedEntries ADD CONSTRAINT FK_5FC892F951A5BC03 FOREIGN KEY (feed_id) REFERENCES Feeds (id)"); + $this->addSql("ALTER TABLE FeedItems ADD CONSTRAINT FK_7F9CDFA6BA364942 FOREIGN KEY (entry_id) REFERENCES FeedEntries (id)"); + $this->addSql("ALTER TABLE FeedTokens ADD CONSTRAINT FK_9D1CA84851A5BC03 FOREIGN KEY (feed_id) REFERENCES Feeds (id)"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("ALTER TABLE FeedPublishers DROP FOREIGN KEY FK_31AFAB251A5BC03"); + $this->addSql("ALTER TABLE FeedEntries DROP FOREIGN KEY FK_5FC892F951A5BC03"); + $this->addSql("ALTER TABLE FeedTokens DROP FOREIGN KEY FK_9D1CA84851A5BC03"); + $this->addSql("ALTER TABLE FeedEntries DROP FOREIGN KEY FK_5FC892F940C86FCE"); + $this->addSql("ALTER TABLE FeedItems DROP FOREIGN KEY FK_7F9CDFA6BA364942"); + $this->addSql("DROP TABLE Feeds"); + $this->addSql("DROP TABLE FeedPublishers"); + $this->addSql("DROP TABLE FeedEntries"); + $this->addSql("DROP TABLE FeedItems"); + $this->addSql("DROP TABLE FeedTokens"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version360alpha1.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version360alpha1.php new file mode 100644 index 0000000000..c429b80ecd --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version360alpha1.php @@ -0,0 +1,52 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("CREATE TABLE IF NOT EXISTS Baskets (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(128) NOT NULL, description LONGTEXT DEFAULT NULL, usr_id INT NOT NULL, is_read TINYINT(1) NOT NULL, pusher_id INT DEFAULT NULL, archived TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS StoryWZ (id INT AUTO_INCREMENT NOT NULL, sbas_id INT NOT NULL, record_id INT NOT NULL, usr_id INT NOT NULL, created DATETIME NOT NULL, UNIQUE INDEX user_story (usr_id, sbas_id, record_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS ValidationSessions (id INT AUTO_INCREMENT NOT NULL, basket_id INT DEFAULT NULL, initiator_id INT NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, expires DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_5B9DFB061BE1FB52 (basket_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS ValidationDatas (id INT AUTO_INCREMENT NOT NULL, participant_id INT DEFAULT NULL, basket_element_id INT DEFAULT NULL, agreement TINYINT(1) DEFAULT NULL, note LONGTEXT DEFAULT NULL, updated DATETIME NOT NULL, INDEX IDX_70E84DDC9D1C3019 (participant_id), INDEX IDX_70E84DDCE989605 (basket_element_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS BasketElements (id INT AUTO_INCREMENT NOT NULL, basket_id INT DEFAULT NULL, record_id INT NOT NULL, sbas_id INT NOT NULL, ord INT NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX IDX_C0B7ECB71BE1FB52 (basket_id), UNIQUE INDEX unique_recordcle (basket_id, sbas_id, record_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS ValidationParticipants (id INT AUTO_INCREMENT NOT NULL, usr_id INT NOT NULL, is_aware TINYINT(1) NOT NULL, is_confirmed TINYINT(1) NOT NULL, can_agree TINYINT(1) NOT NULL, can_see_others TINYINT(1) NOT NULL, reminded DATETIME DEFAULT NULL, ValidationSession_id INT DEFAULT NULL, INDEX IDX_17850D7BF25B0F5B (ValidationSession_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("ALTER TABLE ValidationSessions ADD CONSTRAINT FK_5B9DFB061BE1FB52 FOREIGN KEY (basket_id) REFERENCES Baskets (id)"); + $this->addSql("ALTER TABLE ValidationDatas ADD CONSTRAINT FK_70E84DDC9D1C3019 FOREIGN KEY (participant_id) REFERENCES ValidationParticipants (id)"); + $this->addSql("ALTER TABLE ValidationDatas ADD CONSTRAINT FK_70E84DDCE989605 FOREIGN KEY (basket_element_id) REFERENCES BasketElements (id)"); + $this->addSql("ALTER TABLE BasketElements ADD CONSTRAINT FK_C0B7ECB71BE1FB52 FOREIGN KEY (basket_id) REFERENCES Baskets (id)"); + $this->addSql("ALTER TABLE ValidationParticipants ADD CONSTRAINT FK_17850D7BF25B0F5B FOREIGN KEY (ValidationSession_id) REFERENCES ValidationSessions (id)"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("ALTER TABLE ValidationSessions DROP FOREIGN KEY FK_5B9DFB061BE1FB52"); + $this->addSql("ALTER TABLE Orders DROP FOREIGN KEY FK_E283F8D81BE1FB52"); + $this->addSql("ALTER TABLE BasketElements DROP FOREIGN KEY FK_C0B7ECB71BE1FB52"); + $this->addSql("ALTER TABLE ValidationParticipants DROP FOREIGN KEY FK_17850D7BF25B0F5B"); + $this->addSql("ALTER TABLE OrderElements DROP FOREIGN KEY FK_8C7066C88D9F6D38"); + $this->addSql("ALTER TABLE ValidationDatas DROP FOREIGN KEY FK_70E84DDCE989605"); + $this->addSql("ALTER TABLE ValidationDatas DROP FOREIGN KEY FK_70E84DDC9D1C3019"); + $this->addSql("DROP TABLE Baskets"); + $this->addSql("DROP TABLE StoryWZ"); + $this->addSql("DROP TABLE ValidationSessions"); + $this->addSql("DROP TABLE Orders"); + $this->addSql("DROP TABLE ValidationDatas"); + $this->addSql("DROP TABLE BasketElements"); + $this->addSql("DROP TABLE ValidationParticipants"); + $this->addSql("DROP TABLE OrderElements"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha7.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha7.php new file mode 100644 index 0000000000..316af539dc --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha7.php @@ -0,0 +1,40 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("CREATE TABLE IF NOT EXISTS LazaretChecks (id INT AUTO_INCREMENT NOT NULL, lazaret_file_id INT DEFAULT NULL, checkClassname VARCHAR(512) NOT NULL, INDEX IDX_CE873ED44CF84ADD (lazaret_file_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS LazaretSessions (id INT AUTO_INCREMENT NOT NULL, usr_id INT DEFAULT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS LazaretAttributes (id INT AUTO_INCREMENT NOT NULL, lazaret_file_id INT DEFAULT NULL, name VARCHAR(64) NOT NULL, value VARCHAR(2048) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX IDX_5FF72F9B4CF84ADD (lazaret_file_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS LazaretFiles (id INT AUTO_INCREMENT NOT NULL, lazaret_session_id INT DEFAULT NULL, filename VARCHAR(512) NOT NULL, thumbFilename VARCHAR(512) NOT NULL, originalName VARCHAR(256) NOT NULL, base_id INT NOT NULL, uuid VARCHAR(36) NOT NULL, sha256 VARCHAR(64) NOT NULL, forced TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX IDX_D30BD768EE187C01 (lazaret_session_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("ALTER TABLE LazaretChecks ADD CONSTRAINT FK_CE873ED44CF84ADD FOREIGN KEY (lazaret_file_id) REFERENCES LazaretFiles (id)"); + $this->addSql("ALTER TABLE LazaretAttributes ADD CONSTRAINT FK_5FF72F9B4CF84ADD FOREIGN KEY (lazaret_file_id) REFERENCES LazaretFiles (id)"); + $this->addSql("ALTER TABLE LazaretFiles ADD CONSTRAINT FK_D30BD768EE187C01 FOREIGN KEY (lazaret_session_id) REFERENCES LazaretSessions (id)"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("ALTER TABLE LazaretFiles DROP FOREIGN KEY FK_D30BD768EE187C01"); + $this->addSql("ALTER TABLE LazaretChecks DROP FOREIGN KEY FK_CE873ED44CF84ADD"); + $this->addSql("ALTER TABLE LazaretAttributes DROP FOREIGN KEY FK_5FF72F9B4CF84ADD"); + $this->addSql("DROP TABLE LazaretChecks"); + $this->addSql("DROP TABLE LazaretSessions"); + $this->addSql("DROP TABLE LazaretAttributes"); + $this->addSql("DROP TABLE LazaretFiles"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha8.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha8.php new file mode 100644 index 0000000000..207358bf97 --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha8.php @@ -0,0 +1,28 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("CREATE TABLE IF NOT EXISTS Tasks (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, jobId VARCHAR(255) NOT NULL, settings LONGTEXT NOT NULL, completed TINYINT(1) NOT NULL, status VARCHAR(255) NOT NULL, crashed INT NOT NULL, single_run TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, last_execution DATETIME DEFAULT NULL, period INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("DROP TABLE Tasks"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha11.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha11.php new file mode 100644 index 0000000000..7e7da308b6 --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha11.php @@ -0,0 +1,32 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("CREATE TABLE IF NOT EXISTS SessionModules (id INT AUTO_INCREMENT NOT NULL, session_id INT DEFAULT NULL, module_id INT NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX IDX_BA36EF49613FECDF (session_id), UNIQUE INDEX unique_module (session_id, module_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS Sessions (id INT AUTO_INCREMENT NOT NULL, usr_id INT NOT NULL, user_agent VARCHAR(512) NOT NULL, ip_address VARCHAR(40) DEFAULT NULL, platform VARCHAR(128) DEFAULT NULL, browser_name VARCHAR(128) DEFAULT NULL, browser_version VARCHAR(32) DEFAULT NULL, screen_width INT DEFAULT NULL, screen_height INT DEFAULT NULL, token VARCHAR(128) DEFAULT NULL, nonce VARCHAR(16) DEFAULT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, UNIQUE INDEX UNIQ_6316FF455F37A13B (token), INDEX usr_id (usr_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("ALTER TABLE SessionModules ADD CONSTRAINT FK_BA36EF49613FECDF FOREIGN KEY (session_id) REFERENCES Sessions (id)"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("ALTER TABLE SessionModules DROP FOREIGN KEY FK_BA36EF49613FECDF"); + $this->addSql("DROP TABLE SessionModules"); + $this->addSql("DROP TABLE Sessions"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha4.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha4.php new file mode 100644 index 0000000000..3c00b4ce9c --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha4.php @@ -0,0 +1,28 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("CREATE TABLE IF NOT EXISTS AuthFailures (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(128) NOT NULL, ip VARCHAR(128) DEFAULT NULL, locked TINYINT(1) NOT NULL, created DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("DROP TABLE AuthFailures"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1a.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1a.php new file mode 100644 index 0000000000..6fbf46c41e --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1a.php @@ -0,0 +1,29 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("CREATE TABLE IF NOT EXISTS FtpCredential (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, usrId INT NOT NULL, active TINYINT(1) NOT NULL, address VARCHAR(128) NOT NULL, login VARCHAR(128) NOT NULL, password VARCHAR(128) NOT NULL, reception_folder VARCHAR(128) NOT NULL, repository_prefix_name VARCHAR(128) NOT NULL, passive TINYINT(1) NOT NULL, tls TINYINT(1) NOT NULL, max_retry INT NOT NULL, updated DATETIME NOT NULL, UNIQUE INDEX UNIQ_62DA9661A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("ALTER TABLE FtpCredential ADD CONSTRAINT FK_62DA9661A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("DROP TABLE FtpCredential"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1b.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1b.php new file mode 100644 index 0000000000..ee2b8c6092 --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1b.php @@ -0,0 +1,33 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("CREATE TABLE IF NOT EXISTS Orders (id INT AUTO_INCREMENT NOT NULL, basket_id INT DEFAULT NULL, usr_id INT NOT NULL, order_usage VARCHAR(2048) NOT NULL, todo INT DEFAULT NULL, deadline DATETIME NOT NULL, created_on DATETIME NOT NULL, UNIQUE INDEX UNIQ_E283F8D81BE1FB52 (basket_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS OrderElements (id INT AUTO_INCREMENT NOT NULL, order_id INT DEFAULT NULL, base_id INT NOT NULL, record_id INT NOT NULL, order_master_id INT DEFAULT NULL, deny TINYINT(1) DEFAULT NULL, INDEX IDX_8C7066C88D9F6D38 (order_id), UNIQUE INDEX unique_ordercle (base_id, record_id, order_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("ALTER TABLE Orders ADD CONSTRAINT FK_E283F8D81BE1FB52 FOREIGN KEY (basket_id) REFERENCES Baskets (id)"); + $this->addSql("ALTER TABLE OrderElements ADD CONSTRAINT FK_8C7066C88D9F6D38 FOREIGN KEY (order_id) REFERENCES Orders (id)"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("ALTER TABLE OrderElements DROP FOREIGN KEY FK_8C7066C88D9F6D38"); + $this->addSql("DROP TABLE Orders"); + $this->addSql("DROP TABLE OrderElements"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha2.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha2.php new file mode 100644 index 0000000000..8fb21b31ed --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha2.php @@ -0,0 +1,30 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("CREATE TABLE IF NOT EXISTS Users (id INT AUTO_INCREMENT NOT NULL, model_of INT DEFAULT NULL, login VARCHAR(128) NOT NULL, email VARCHAR(128) DEFAULT NULL, password VARCHAR(128) DEFAULT NULL, nonce VARCHAR(16) DEFAULT NULL, salted_password TINYINT(1) NOT NULL, first_name VARCHAR(64) NOT NULL, last_name VARCHAR(64) NOT NULL, gender VARCHAR(8) DEFAULT NULL, address LONGTEXT NOT NULL, city VARCHAR(64) NOT NULL, country VARCHAR(64) NOT NULL, zip_code VARCHAR(32) NOT NULL, geoname_id INT DEFAULT NULL, locale VARCHAR(8) DEFAULT NULL, timezone VARCHAR(128) NOT NULL, job VARCHAR(128) NOT NULL, activity VARCHAR(256) NOT NULL, company VARCHAR(64) NOT NULL, phone VARCHAR(32) NOT NULL, fax VARCHAR(32) NOT NULL, admin TINYINT(1) NOT NULL, guest TINYINT(1) NOT NULL, mail_notifications TINYINT(1) NOT NULL, request_notifications TINYINT(1) NOT NULL, ldap_created TINYINT(1) NOT NULL, last_model VARCHAR(64) DEFAULT NULL, push_list LONGTEXT NOT NULL, can_change_profil TINYINT(1) NOT NULL, can_change_ftp_profil TINYINT(1) NOT NULL, last_connection DATETIME DEFAULT NULL, mail_locked TINYINT(1) NOT NULL, deleted TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, UNIQUE INDEX UNIQ_D5428AEDC121714D (model_of), INDEX salted_password (salted_password), INDEX admin (admin), INDEX guest (guest), UNIQUE INDEX email_unique (email), UNIQUE INDEX login_unique (login), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("ALTER TABLE Users ADD CONSTRAINT FK_D5428AEDC121714D FOREIGN KEY (model_of) REFERENCES Users (id)"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("ALTER TABLE Users DROP FOREIGN KEY FK_D5428AEDC121714D"); + $this->addSql("DROP TABLE Users"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha3.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha3.php new file mode 100644 index 0000000000..28bc5612b3 --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha3.php @@ -0,0 +1,29 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("CREATE TABLE IF NOT EXISTS UserQueries (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, usr_id INT NOT NULL, query VARCHAR(256) NOT NULL, created DATETIME NOT NULL, INDEX IDX_5FB80D87A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("ALTER TABLE UserQueries ADD CONSTRAINT FK_5FB80D87A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("DROP TABLE UserQueries"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha4.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha4.php new file mode 100644 index 0000000000..2c612aca15 --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha4.php @@ -0,0 +1,29 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("CREATE TABLE IF NOT EXISTS UserSettings (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, usr_id INT NOT NULL, name VARCHAR(64) NOT NULL, value VARCHAR(128) DEFAULT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX IDX_2847E61CA76ED395 (user_id), UNIQUE INDEX unique_setting (user_id, name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("ALTER TABLE UserSettings ADD CONSTRAINT FK_2847E61CA76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("DROP TABLE UserSettings"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha5.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha5.php new file mode 100644 index 0000000000..f4be6f74d5 --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha5.php @@ -0,0 +1,29 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("CREATE TABLE IF NOT EXISTS UserNotificationSettings (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, usr_id INT NOT NULL, name VARCHAR(64) NOT NULL, value VARCHAR(128) DEFAULT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX IDX_CFF041AAA76ED395 (user_id), UNIQUE INDEX unique_index (user_id, name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("ALTER TABLE UserNotificationSettings ADD CONSTRAINT FK_CFF041AAA76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("DROP TABLE UserNotificationSettings"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha6.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha6.php new file mode 100644 index 0000000000..ed827d5424 --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha6.php @@ -0,0 +1,32 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("CREATE TABLE IF NOT EXISTS FtpExportElements (id INT AUTO_INCREMENT NOT NULL, export_id INT DEFAULT NULL, record_id INT NOT NULL, base_id INT NOT NULL, subdef VARCHAR(255) NOT NULL, filename VARCHAR(255) NOT NULL, folder VARCHAR(255) DEFAULT NULL, error TINYINT(1) NOT NULL, done TINYINT(1) NOT NULL, businessfields TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX IDX_7BF0AE1264CDAF82 (export_id), INDEX done (done), INDEX error (error), UNIQUE INDEX unique_ftp_export (export_id, base_id, record_id, subdef), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS FtpExports (id INT AUTO_INCREMENT NOT NULL, crash INT NOT NULL, nbretry INT NOT NULL, mail LONGTEXT DEFAULT NULL, addr LONGTEXT NOT NULL, use_ssl TINYINT(1) NOT NULL, login LONGTEXT DEFAULT NULL, pwd LONGTEXT DEFAULT NULL, passif TINYINT(1) NOT NULL, destfolder LONGTEXT NOT NULL, sendermail LONGTEXT DEFAULT NULL, text_mail_sender LONGTEXT DEFAULT NULL, text_mail_receiver LONGTEXT DEFAULT NULL, usr_id INT NOT NULL, foldertocreate LONGTEXT DEFAULT NULL, logfile TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("ALTER TABLE FtpExportElements ADD CONSTRAINT FK_7BF0AE1264CDAF82 FOREIGN KEY (export_id) REFERENCES FtpExports (id)"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("ALTER TABLE FtpExportElements DROP FOREIGN KEY FK_7BF0AE1264CDAF82"); + $this->addSql("DROP TABLE FtpExportElements"); + $this->addSql("DROP TABLE FtpExports"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha7.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha7.php new file mode 100644 index 0000000000..315382023b --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha7.php @@ -0,0 +1,68 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $app = new Application(); + + $rsm = new ResultSetMapping(); + $rsm->addScalarResult('Name', 'Name'); + + $found = false; + + foreach ($app['EM']->createNativeQuery('SHOW TABLE STATUS', $rsm)->getResult() as $row) { + if (strcmp('feeds', $row['Name'])) { + $found = true; + break; + } + } + + if ($found) { + $this->addSql("RENAME TABLE `feeds` TO `feeds_backup`"); + } + + $this->addSql("CREATE TABLE IF NOT EXISTS Feeds (id INT AUTO_INCREMENT NOT NULL, public TINYINT(1) NOT NULL, icon_url TINYINT(1) NOT NULL, base_id INT DEFAULT NULL, title VARCHAR(128) NOT NULL, subtitle VARCHAR(1024) DEFAULT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS FeedPublishers (id INT AUTO_INCREMENT NOT NULL, feed_id INT DEFAULT NULL, usr_id INT NOT NULL, owner TINYINT(1) NOT NULL, created_on DATETIME NOT NULL, INDEX IDX_31AFAB251A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS AggregateTokens (id INT AUTO_INCREMENT NOT NULL, usr_id INT NOT NULL, value VARCHAR(12) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS FeedEntries (id INT AUTO_INCREMENT NOT NULL, publisher_id INT DEFAULT NULL, feed_id INT DEFAULT NULL, title VARCHAR(128) NOT NULL, subtitle VARCHAR(128) NOT NULL, author_name VARCHAR(128) NOT NULL, author_email VARCHAR(128) NOT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, INDEX IDX_5FC892F940C86FCE (publisher_id), INDEX IDX_5FC892F951A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS FeedItems (id INT AUTO_INCREMENT NOT NULL, entry_id INT DEFAULT NULL, record_id INT NOT NULL, sbas_id INT NOT NULL, ord INT NOT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, INDEX IDX_7F9CDFA6BA364942 (entry_id), UNIQUE INDEX lookup_unique_idx (entry_id, sbas_id, record_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS FeedTokens (id INT AUTO_INCREMENT NOT NULL, feed_id INT DEFAULT NULL, usr_id INT NOT NULL, value VARCHAR(12) DEFAULT NULL, INDEX IDX_9D1CA84851A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("ALTER TABLE FeedPublishers ADD CONSTRAINT FK_31AFAB251A5BC03 FOREIGN KEY (feed_id) REFERENCES Feeds (id)"); + $this->addSql("ALTER TABLE FeedEntries ADD CONSTRAINT FK_5FC892F940C86FCE FOREIGN KEY (publisher_id) REFERENCES FeedPublishers (id)"); + $this->addSql("ALTER TABLE FeedEntries ADD CONSTRAINT FK_5FC892F951A5BC03 FOREIGN KEY (feed_id) REFERENCES Feeds (id)"); + $this->addSql("ALTER TABLE FeedItems ADD CONSTRAINT FK_7F9CDFA6BA364942 FOREIGN KEY (entry_id) REFERENCES FeedEntries (id)"); + $this->addSql("ALTER TABLE FeedTokens ADD CONSTRAINT FK_9D1CA84851A5BC03 FOREIGN KEY (feed_id) REFERENCES Feeds (id)"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("ALTER TABLE FeedPublishers DROP FOREIGN KEY FK_31AFAB251A5BC03"); + $this->addSql("ALTER TABLE FeedEntries DROP FOREIGN KEY FK_5FC892F951A5BC03"); + $this->addSql("ALTER TABLE FeedTokens DROP FOREIGN KEY FK_9D1CA84851A5BC03"); + $this->addSql("ALTER TABLE FeedEntries DROP FOREIGN KEY FK_5FC892F940C86FCE"); + $this->addSql("ALTER TABLE FeedItems DROP FOREIGN KEY FK_7F9CDFA6BA364942"); + $this->addSql("DROP TABLE Feeds"); + $this->addSql("DROP TABLE FeedPublishers"); + $this->addSql("DROP TABLE AggregateTokens"); + $this->addSql("DROP TABLE FeedEntries"); + $this->addSql("DROP TABLE FeedItems"); + $this->addSql("DROP TABLE FeedTokens"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha8.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha8.php new file mode 100644 index 0000000000..90addd13b6 --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha8.php @@ -0,0 +1,28 @@ +abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("CREATE TABLE IF NOT EXISTS Tasks (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, jobId VARCHAR(255) NOT NULL, settings LONGTEXT NOT NULL, completed TINYINT(1) NOT NULL, status VARCHAR(255) NOT NULL, crashed INT NOT NULL, single_run TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, last_execution DATETIME DEFAULT NULL, period INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + } + + public function down(Schema $schema) + { + // this down() migration is auto-generated, please modify it to your needs + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->addSql("DROP TABLE Tasks"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/PreSchemaUpgradeCollection.php b/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/PreSchemaUpgradeCollection.php index f9e42b8fb2..866ba3b07e 100644 --- a/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/PreSchemaUpgradeCollection.php +++ b/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/PreSchemaUpgradeCollection.php @@ -23,7 +23,6 @@ class PreSchemaUpgradeCollection public function __construct() { - $this->upgrades[] = new Upgrade39(); } /** diff --git a/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/Upgrade39.php b/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/Upgrade39.php deleted file mode 100644 index 4993d997a4..0000000000 --- a/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/Upgrade39.php +++ /dev/null @@ -1,44 +0,0 @@ -getConnection()->executeQuery('RENAME TABLE `feeds` TO `feeds_backup`'); - } - - /** - * {@inheritdoc} - */ - public function isApplyable(Application $app) - { - $rs = $app['phraseanet.appbox']->get_connection()->query('SHOW TABLE STATUS'); - $found = false; - - foreach ($rs as $row) { - if ('feeds' === $row['Name']) { - $found = true; - break; - } - } - - return $found; - } -} diff --git a/lib/classes/appbox.php b/lib/classes/appbox.php index 9120f2252c..cae0385fe8 100644 --- a/lib/classes/appbox.php +++ b/lib/classes/appbox.php @@ -10,6 +10,7 @@ */ use Alchemy\Phrasea\Application; +use Doctrine\ORM\Tools\SchemaTool; use MediaAlchemyst\Alchemyst; use MediaAlchemyst\Specification\Image as ImageSpecification; use Symfony\Component\Filesystem\Filesystem; @@ -304,16 +305,9 @@ class appbox extends base $upgrader->add_steps_complete(1); $upgrader->set_current_message(_('Creating new tables')); - //create schema $app['phraseanet.pre-schema-upgrader']->apply($app); - if ($app['EM']->getConnection()->getDatabasePlatform()->supportsAlterTable()) { - $tool = new \Doctrine\ORM\Tools\SchemaTool($app['EM']); - $metas = $app['EM']->getMetadataFactory()->getAllMetadata(); - $tool->updateSchema($metas, true); - } - $upgrader->add_steps_complete(1); /** @@ -388,6 +382,12 @@ class appbox extends base $app['phraseanet.cache-service']->flushAll(); + if ($app['EM']->getConnection()->getDatabasePlatform()->supportsAlterTable()) { + $tool = new SchemaTool($app['EM']); + $metas = $app['EM']->getMetadataFactory()->getAllMetadata(); + $tool->updateSchema($metas, true); + } + $upgrader->add_steps_complete(1); if (version::lt($from_version, '3.1')) { diff --git a/lib/classes/patch/320alpha4b.php b/lib/classes/patch/320alpha4b.php index 1018ea50cc..3f271149e8 100644 --- a/lib/classes/patch/320alpha4b.php +++ b/lib/classes/patch/320alpha4b.php @@ -61,7 +61,10 @@ class patch_320alpha4b implements patchInterface public function apply(base $appbox, Application $app) { - $feeds = []; + $version = $app['doctrine-migration.configuration']->getVersion($this->release); + $version->execute('up'); + + $feeds = array(); try { $sql = 'ALTER TABLE `ssel` ADD `migrated` INT NOT NULL DEFAULT "0"'; diff --git a/lib/classes/patch/360alpha1a.php b/lib/classes/patch/360alpha1a.php index c7fb59eca0..b6b18949f0 100644 --- a/lib/classes/patch/360alpha1a.php +++ b/lib/classes/patch/360alpha1a.php @@ -10,6 +10,8 @@ */ use Alchemy\Phrasea\Application; +use Doctrine\DBAL\Migrations\Configuration\Configuration; +use Doctrine\DBAL\DriverManager; /** * @@ -55,7 +57,10 @@ class patch_360alpha1a implements patchInterface public function apply(base $appbox, Application $app) { - $tables = ['StoryWZ', 'ValidationDatas', 'ValidationParticipants', 'ValidationSessions', 'BasketElements', 'Baskets']; + $version = $app['doctrine-migration.configuration']->getVersion($this->release); + $version->execute('up'); + + $tables = array('StoryWZ', 'ValidationDatas', 'ValidationParticipants', 'ValidationSessions', 'BasketElements', 'Baskets'); foreach ($tables as $table) { $sql = 'DELETE FROM ' . $table; @@ -67,8 +72,8 @@ class patch_360alpha1a implements patchInterface $stories = []; $sql = 'SELECT sbas_id, rid as record_id, usr_id - FROM ssel - WHERE temporaryType = "1"'; + FROM ssel + WHERE temporaryType = "1"'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); @@ -88,8 +93,9 @@ class patch_360alpha1a implements patchInterface } $sql = 'DELETE FROM ssel - WHERE temporaryType="1" AND record_id = :record_id - AND usr_id = :usr_id AND sbas_id = :sbas_id'; + WHERE temporaryType="1" AND record_id = :record_id + AND usr_id = :usr_id AND sbas_id = :sbas_id'; + $stmt = $appbox->get_connection()->prepare($sql); foreach ($stories as $row) { @@ -117,8 +123,7 @@ class patch_360alpha1a implements patchInterface $sql = 'INSERT INTO Baskets ( SELECT ssel_id as id, name, descript as description, usr_id, 1 as is_read - , pushFrom as pusher_id, - 0 as archived, date as created, updater as updated + , pushFrom as pusher_id, 0 as archived, date as created, updater as updated FROM ssel WHERE temporaryType = "0" )'; @@ -137,9 +142,9 @@ class patch_360alpha1a implements patchInterface foreach ($rs as $row) { $sql = 'SELECT c.sselcont_id, c.record_id, b.sbas_id - FROM sselcont c, bas b, ssel s - WHERE s.temporaryType = "0" AND b.base_id = c.base_id - AND c.ssel_id = :ssel_id AND s.ssel_id = c.ssel_id'; + FROM sselcont c, bas b, ssel s + WHERE s.temporaryType = "0" AND b.base_id = c.base_id + AND c.ssel_id = :ssel_id AND s.ssel_id = c.ssel_id'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute([':ssel_id' => $row['ssel_id']]); @@ -189,8 +194,8 @@ class patch_360alpha1a implements patchInterface $sql = 'INSERT INTO ValidationSessions ( SELECT null as id, v.ssel_id as basket_id ,created_on as created - ,updated_on as updated ,expires_on as expires - ,v.usr_id as initiator_id + ,updated_on as updated ,expires_on as expires + ,v.usr_id as initiator_id FROM ssel s, validate v WHERE v.ssel_id = s.ssel_id AND v.usr_id = s.usr_id )'; @@ -202,11 +207,11 @@ class patch_360alpha1a implements patchInterface $sql = 'INSERT INTO ValidationParticipants ( SELECT v.id as id, v.usr_id - , 1 AS is_aware, confirmed as is_confirmed, 1 as can_agree - , can_see_others, last_reminder AS reminded - , vs.`id` AS ValidationSession_id - FROM validate v, ssel s, ValidationSessions vs - WHERE s.ssel_id = v.ssel_id AND vs.basket_id = v.ssel_id + , 1 AS is_aware, confirmed as is_confirmed, 1 as can_agree + , can_see_others, last_reminder AS reminded + , vs.`id` AS ValidationSession_id + FROM validate v, ssel s, ValidationSessions vs + WHERE s.ssel_id = v.ssel_id AND vs.basket_id = v.ssel_id )'; $stmt = $appbox->get_connection()->prepare($sql); @@ -214,21 +219,22 @@ class patch_360alpha1a implements patchInterface $stmt->closeCursor(); $sql = 'SELECT usr_id, basket_id, p.id as participant_id - FROM ValidationParticipants p, ValidationSessions s - WHERE p.ValidationSession_Id = s.id'; + FROM ValidationParticipants p, ValidationSessions s + WHERE p.ValidationSession_Id = s.id'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $sql = 'INSERT INTO ValidationDatas ( - SELECT d.id , :participant_id as participant_id, d.sselcont_id, d.agreement, - d.note, d.updated_on as updated - FROM validate v, validate_datas d, sselcont c - WHERE c.sselcont_id = d.sselcont_id AND v.id = d.validate_id - AND v.usr_id = :usr_id AND v.ssel_id = :basket_id - )'; + $sql = 'INSERT INTO ValidationDatas + ( + SELECT d.id , :participant_id as participant_id, d.sselcont_id, d.agreement + ,d.note, d.updated_on as updated + FROM validate v, validate_datas d, sselcont c + WHERE c.sselcont_id = d.sselcont_id AND v.id = d.validate_id + AND v.usr_id = :usr_id AND v.ssel_id = :basket_id + )'; $stmt = $appbox->get_connection()->prepare($sql); foreach ($rs as $row) { $params = [ @@ -242,14 +248,14 @@ class patch_360alpha1a implements patchInterface $stmt->closeCursor(); $sql = 'UPDATE ValidationDatas - SET agreement = NULL where agreement = "0"'; + SET agreement = NULL where agreement = "0"'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); $sql = 'UPDATE ValidationDatas - SET agreement = "0" where agreement = "-1"'; + SET agreement = "0" where agreement = "-1"'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/370alpha7a.php b/lib/classes/patch/370alpha7a.php index a34f3e247c..58ff5a029f 100644 --- a/lib/classes/patch/370alpha7a.php +++ b/lib/classes/patch/370alpha7a.php @@ -59,6 +59,9 @@ class patch_370alpha7a implements patchInterface public function apply(base $appbox, Application $app) { + $version = $app['doctrine-migration.configuration']->getVersion($this->release); + $version->execute('up'); + $conn = $appbox->get_connection(); try { diff --git a/lib/classes/patch/370alpha8a.php b/lib/classes/patch/370alpha8a.php index e4c714712e..39013c4fae 100644 --- a/lib/classes/patch/370alpha8a.php +++ b/lib/classes/patch/370alpha8a.php @@ -65,7 +65,10 @@ class patch_370alpha8a implements patchInterface */ public function apply(base $appbox, Application $app) { - $ttasks = []; + $version = $app['doctrine-migration.configuration']->getVersion($this->release); + $version->execute('up'); + + $ttasks = array(); $conn = $appbox->get_connection(); $sql = 'SELECT task_id, active, name, class, settings FROM task2 WHERE class=\'task_period_workflow01\''; if (($stmt = $conn->prepare($sql)) !== FALSE) { diff --git a/lib/classes/patch/380alpha11a.php b/lib/classes/patch/380alpha11a.php index fce0e78819..fec3c3a947 100644 --- a/lib/classes/patch/380alpha11a.php +++ b/lib/classes/patch/380alpha11a.php @@ -50,6 +50,9 @@ class patch_380alpha11a implements patchInterface */ public function apply(base $appbox, Application $app) { + $version = $app['doctrine-migration.configuration']->getVersion($this->release); + $version->execute('up'); + try { $sql = 'SELECT usr_id, user_agent, ip, platform, browser, app, browser_version, screen, token, nonce, lastaccess, created_on diff --git a/lib/classes/patch/380alpha4a.php b/lib/classes/patch/380alpha4a.php index e256520661..10cb5efb13 100644 --- a/lib/classes/patch/380alpha4a.php +++ b/lib/classes/patch/380alpha4a.php @@ -49,6 +49,9 @@ class patch_380alpha4a implements patchInterface */ public function apply(base $appbox, Application $app) { + $version = $app['doctrine-migration.configuration']->getVersion($this->release); + $version->execute('up'); + $conn = $app['phraseanet.appbox']->get_connection(); $sql = 'SELECT date, login, ip, locked FROM badlog ORDER BY id ASC'; $stmt = $conn->prepare($sql); diff --git a/lib/classes/patch/390alpha1a.php b/lib/classes/patch/390alpha1a.php index 013ad6d67f..5a9c85038d 100644 --- a/lib/classes/patch/390alpha1a.php +++ b/lib/classes/patch/390alpha1a.php @@ -49,6 +49,9 @@ class patch_390alpha1a implements patchInterface */ public function apply(base $appbox, Application $app) { + $version = $app['doctrine-migration.configuration']->getVersion($this->release . 'a'); + $version->execute('up'); + $conn = $app['phraseanet.appbox']->get_connection(); $sql = 'SELECT usr_id, activeFTP, addrFTP, loginFTP, retryFTP, passifFTP, pwdFTP, destFTP, prefixFTPfolder diff --git a/lib/classes/patch/390alpha1b.php b/lib/classes/patch/390alpha1b.php index 247578c577..2651732564 100644 --- a/lib/classes/patch/390alpha1b.php +++ b/lib/classes/patch/390alpha1b.php @@ -51,6 +51,9 @@ class patch_390alpha1b implements patchInterface */ public function apply(base $appbox, Application $app) { + $version = $app['doctrine-migration.configuration']->getVersion($this->release . 'b'); + $version->execute('up'); + $sql = 'DELETE FROM Orders'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha2a.php b/lib/classes/patch/390alpha2a.php index 297fdbb6ce..4e828a65e0 100644 --- a/lib/classes/patch/390alpha2a.php +++ b/lib/classes/patch/390alpha2a.php @@ -51,6 +51,9 @@ class patch_390alpha2a implements patchInterface */ public function apply(base $appbox, Application $app) { + $version = $app['doctrine-migration.configuration']->getVersion($this->release); + $version->execute('up'); + $sql = 'DELETE FROM Users'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha3a.php b/lib/classes/patch/390alpha3a.php index e8b152d35d..513e190e2e 100644 --- a/lib/classes/patch/390alpha3a.php +++ b/lib/classes/patch/390alpha3a.php @@ -49,6 +49,9 @@ class patch_390alpha3a implements patchInterface */ public function apply(base $appbox, Application $app) { + $version = $app['doctrine-migration.configuration']->getVersion($this->release); + $version->execute('up'); + $sql = 'DELETE FROM UserQueries'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha4a.php b/lib/classes/patch/390alpha4a.php index cf7b918532..0a87d42726 100644 --- a/lib/classes/patch/390alpha4a.php +++ b/lib/classes/patch/390alpha4a.php @@ -49,6 +49,9 @@ class patch_390alpha4a implements patchInterface */ public function apply(base $appbox, Application $app) { + $version = $app['doctrine-migration.configuration']->getVersion($this->release); + $version->execute('up'); + $sql = 'DELETE FROM UserSettings'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha5a.php b/lib/classes/patch/390alpha5a.php index f46842e37d..2253aea336 100644 --- a/lib/classes/patch/390alpha5a.php +++ b/lib/classes/patch/390alpha5a.php @@ -49,6 +49,9 @@ class patch_390alpha5a implements patchInterface */ public function apply(base $appbox, Application $app) { + $version = $app['doctrine-migration.configuration']->getVersion($this->release); + $version->execute('up'); + $sql = 'DELETE FROM UserNotificationSettings'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha6a.php b/lib/classes/patch/390alpha6a.php index 91baaf310b..6f6681763b 100644 --- a/lib/classes/patch/390alpha6a.php +++ b/lib/classes/patch/390alpha6a.php @@ -51,6 +51,9 @@ class patch_390alpha6a implements patchInterface */ public function apply(base $appbox, Application $app) { + $version = $app['doctrine-migration.configuration']->getVersion($this->release); + $version->execute('up'); + $sql = 'DELETE FROM FtpExports'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha7a.php b/lib/classes/patch/390alpha7a.php index 5c2fdeb583..7d19d8851d 100644 --- a/lib/classes/patch/390alpha7a.php +++ b/lib/classes/patch/390alpha7a.php @@ -54,6 +54,9 @@ class patch_390alpha7a implements patchInterface */ public function apply(base $appbox, Application $app) { + $version = $app['doctrine-migration.configuration']->getVersion($this->release); + $version->execute('up'); + $sql = 'DELETE FROM Feeds'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha8a.php b/lib/classes/patch/390alpha8a.php index 7b9f137213..94eef2aa1e 100644 --- a/lib/classes/patch/390alpha8a.php +++ b/lib/classes/patch/390alpha8a.php @@ -49,6 +49,9 @@ class patch_390alpha8a implements patchInterface */ public function apply(base $appbox, Application $app) { + $version = $app['doctrine-migration.configuration']->getVersion($this->release); + $version->execute('up'); + $sql = 'DELETE FROM Tasks'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/conf.d/migrations.yml b/lib/conf.d/migrations.yml new file mode 100644 index 0000000000..a7c8e5010b --- /dev/null +++ b/lib/conf.d/migrations.yml @@ -0,0 +1,50 @@ +name: Phraseanet Migrations +migrations_namespace: Alchemy\Phrasea\Setup\DoctrineMigrations +table_name: doctrine_migration_versions + +migrations: + migration1: + version: 3.2.0-alpha.4 + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version320alpha4 + migration2: + version: 3.6.0-alpha.1 + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version360alpha1 + migration3: + version: 3.7.0-alpha.7 + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version370alpha7 + migration4: + version: 3.7.0-alpha.8 + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version370alpha8 + migration5: + version: 3.8.0-alpha.4 + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version380alpha4 + migration6: + version: 3.8.0-alpha.11 + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version380alpha11 + migration7: + version: 3.9.0-alpha.1a + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha1a + migration8: + version: 3.9.0-alpha.1b + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha1b + migration9: + version: 3.9.0-alpha.2 + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha2 + migration10: + version: 3.9.0-alpha.3 + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha3 + migration11: + version: 3.9.0-alpha.4 + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha4 + migration12: + version: 3.9.0-alpha.5 + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha5 + migration13: + version: 3.9.0-alpha.6 + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha6 + migration14: + version: 3.9.0-alpha.7 + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha7 + migration15: + version: 3.9.0-alpha.8 + class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha8 diff --git a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php new file mode 100644 index 0000000000..03cb45949a --- /dev/null +++ b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php @@ -0,0 +1,17 @@ + Date: Tue, 12 Nov 2013 19:48:08 +0100 Subject: [PATCH 06/13] Patch CS consistency --- lib/classes/patch/320alpha1a.php | 2 +- lib/classes/patch/320alpha1b.php | 13 +++---- lib/classes/patch/320alpha2a.php | 1 - lib/classes/patch/320alpha4b.php | 9 +++-- lib/classes/patch/320alpha5a.php | 2 +- lib/classes/patch/320alpha6a.php | 8 ++--- lib/classes/patch/360alpha2a.php | 3 +- lib/classes/patch/360alpha2b.php | 24 +++++++------ lib/classes/patch/370alpha3a.php | 2 ++ lib/classes/patch/370alpha4a.php | 1 - lib/classes/patch/370alpha7a.php | 2 +- lib/classes/patch/371alpha1a.php | 2 ++ lib/classes/patch/380alpha10a.php | 2 ++ lib/classes/patch/380alpha11a.php | 4 ++- lib/classes/patch/380alpha2a.php | 2 ++ lib/classes/patch/380alpha2b.php | 2 +- lib/classes/patch/380alpha3a.php | 60 +++++++++++++++---------------- lib/classes/patch/380alpha4a.php | 2 ++ lib/classes/patch/380alpha6a.php | 2 ++ lib/classes/patch/380alpha8a.php | 2 +- lib/classes/patch/380alpha9a.php | 2 ++ lib/classes/patch/381alpha1a.php | 4 +-- lib/classes/patch/390alpha1a.php | 2 ++ lib/classes/patch/390alpha1b.php | 2 ++ lib/classes/patch/390alpha2a.php | 10 +++--- lib/classes/patch/390alpha3a.php | 2 ++ lib/classes/patch/390alpha4a.php | 2 ++ lib/classes/patch/390alpha5a.php | 2 ++ lib/classes/patch/390alpha6a.php | 5 +-- lib/classes/patch/390alpha7a.php | 2 ++ 30 files changed, 105 insertions(+), 73 deletions(-) diff --git a/lib/classes/patch/320alpha1a.php b/lib/classes/patch/320alpha1a.php index b50520f006..607a442a0c 100644 --- a/lib/classes/patch/320alpha1a.php +++ b/lib/classes/patch/320alpha1a.php @@ -57,7 +57,7 @@ class patch_320alpha1a implements patchInterface public function apply(base $databox, Application $app) { $sql = 'UPDATE record SET parent_record_id = "1" - WHERE parent_record_id != "0"'; + WHERE parent_record_id != "0"'; $stmt = $databox->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); diff --git a/lib/classes/patch/320alpha1b.php b/lib/classes/patch/320alpha1b.php index 051e23f804..bebc0481b9 100644 --- a/lib/classes/patch/320alpha1b.php +++ b/lib/classes/patch/320alpha1b.php @@ -56,12 +56,13 @@ class patch_320alpha1b implements patchInterface public function apply(base $appbox, Application $app) { $sql = 'REPLACE INTO records_rights - (SELECT null as id, usr_id, b.sbas_id, record_id, "1" as document - , null as preview, "push" as `case`, pushFrom as pusher_usr_id - FROM sselcont c, ssel s, bas b - WHERE c.ssel_id = s.ssel_id - AND b.base_id = c.base_id AND c.canHD = 1 - )'; + ( + SELECT null as id, usr_id, b.sbas_id, record_id, "1" as document, null as preview + , "push" as `case`, pushFrom as pusher_usr_id + FROM sselcont c, ssel s, bas b + WHERE c.ssel_id = s.ssel_id + AND b.base_id = c.base_id AND c.canHD = 1 + )'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); diff --git a/lib/classes/patch/320alpha2a.php b/lib/classes/patch/320alpha2a.php index a67a054af4..e8c9c67da8 100644 --- a/lib/classes/patch/320alpha2a.php +++ b/lib/classes/patch/320alpha2a.php @@ -56,7 +56,6 @@ class patch_320alpha2a implements patchInterface public function apply(base $appbox, Application $app) { $sql = 'SELECT * FROM usr WHERE nonce IS NULL'; - $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); diff --git a/lib/classes/patch/320alpha4b.php b/lib/classes/patch/320alpha4b.php index 3f271149e8..92d55286f1 100644 --- a/lib/classes/patch/320alpha4b.php +++ b/lib/classes/patch/320alpha4b.php @@ -75,9 +75,8 @@ class patch_320alpha4b implements patchInterface } - $sql = 'SELECT ssel_id, usr_id, name, descript, pub_date - , updater, pub_restrict, homelink - FROM ssel WHERE (public = "1" or homelink="1") and migrated = 0'; + $sql = 'SELECT ssel_id, usr_id, name, descript, pub_date, updater, pub_restrict, homelink + FROM ssel WHERE (public = "1" or homelink="1") and migrated = 0'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); @@ -119,7 +118,7 @@ class patch_320alpha4b implements patchInterface } $sql = 'SELECT sselcont_id, ssel_id, base_id, record_id - FROM sselcont WHERE ssel_id = :ssel_id ORDER BY ord ASC'; + FROM sselcont WHERE ssel_id = :ssel_id ORDER BY ord ASC'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute([':ssel_id' => $row['ssel_id']]); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); @@ -142,7 +141,7 @@ class patch_320alpha4b implements patchInterface $app['EM']->persist($entry); $sql = 'UPDATE ssel SET deleted = "1", migrated="1" - WHERE ssel_id = :ssel_id'; + WHERE ssel_id = :ssel_id'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute([':ssel_id' => $row['ssel_id']]); $stmt->closeCursor(); diff --git a/lib/classes/patch/320alpha5a.php b/lib/classes/patch/320alpha5a.php index 38d516e2a3..2ed2a46ddb 100644 --- a/lib/classes/patch/320alpha5a.php +++ b/lib/classes/patch/320alpha5a.php @@ -63,7 +63,7 @@ class patch_320alpha5a implements patchInterface $stmt->closeCursor(); $sql = 'UPDATE basusr SET order_master="1" - WHERE base_id = :base_id AND usr_id = :usr_id'; + WHERE base_id = :base_id AND usr_id = :usr_id'; $stmt = $appbox->get_connection()->prepare($sql); foreach ($rs as $row) { diff --git a/lib/classes/patch/320alpha6a.php b/lib/classes/patch/320alpha6a.php index 878b40f6de..9261b936c8 100644 --- a/lib/classes/patch/320alpha6a.php +++ b/lib/classes/patch/320alpha6a.php @@ -56,15 +56,15 @@ class patch_320alpha6a implements patchInterface public function apply(base $databox, Application $app) { $sql = 'UPDATE record r, subdef s - SET r.mime = s.mime - WHERE r.record_id = s.record_id AND s.name="document"'; + SET r.mime = s.mime + WHERE r.record_id = s.record_id AND s.name="document"'; $stmt = $databox->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); $sql = 'UPDATE subdef s, record r - SET s.updated_on = r.moddate, s.created_on = r.credate - WHERE s.record_id = r.record_id'; + SET s.updated_on = r.moddate, s.created_on = r.credate + WHERE s.record_id = r.record_id'; $stmt = $databox->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); diff --git a/lib/classes/patch/360alpha2a.php b/lib/classes/patch/360alpha2a.php index dd8893ff69..6470be88a8 100644 --- a/lib/classes/patch/360alpha2a.php +++ b/lib/classes/patch/360alpha2a.php @@ -57,7 +57,8 @@ class patch_360alpha2a implements patchInterface { $sql = 'UPDATE usr SET usr_mail = NULL - WHERE usr_mail IS NOT NULL AND usr_login LIKE "(#deleted%"'; + WHERE usr_mail IS NOT NULL + AND usr_login LIKE "(#deleted%"'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/360alpha2b.php b/lib/classes/patch/360alpha2b.php index 20480fec22..239ee3e773 100644 --- a/lib/classes/patch/360alpha2b.php +++ b/lib/classes/patch/360alpha2b.php @@ -60,16 +60,18 @@ class patch_360alpha2b implements patchInterface */ try { $sql = "ALTER TABLE `metadatas` - ADD `updated` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '1', - ADD INDEX ( `updated` )"; + ADD `updated` TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '1', + ADD INDEX ( `updated` )"; $stmt = $databox->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); $sql = 'UPDATE metadatas SET updated = "0" - WHERE meta_struct_id - IN (SELECT id FROM metadatas_structure WHERE multi = "1")'; + WHERE meta_struct_id IN + ( + SELECT id FROM metadatas_structure WHERE multi = "1" + )'; $stmt = $databox->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); @@ -88,9 +90,9 @@ class patch_360alpha2b implements patchInterface } $sql = 'SELECT m . * - FROM metadatas_structure s, metadatas m - WHERE m.meta_struct_id = s.id - AND s.multi = "1" AND updated="0"'; + FROM metadatas_structure s, metadatas m + WHERE m.meta_struct_id = s.id + AND s.multi = "1" AND updated="0"'; $stmt = $databox->get_connection()->prepare($sql); $stmt->execute(); @@ -102,9 +104,9 @@ class patch_360alpha2b implements patchInterface while ($n < $rowCount) { $sql = 'SELECT m . * - FROM metadatas_structure s, metadatas m - WHERE m.meta_struct_id = s.id - AND s.multi = "1" LIMIT ' . $n . ', ' . $perPage; + FROM metadatas_structure s, metadatas m + WHERE m.meta_struct_id = s.id + AND s.multi = "1" LIMIT ' . $n . ', ' . $perPage; $stmt = $databox->get_connection()->prepare($sql); $stmt->execute(); @@ -114,7 +116,7 @@ class patch_360alpha2b implements patchInterface $databox->get_connection()->beginTransaction(); $sql = 'INSERT INTO metadatas(id, record_id, meta_struct_id, value) - VALUES (null, :record_id, :meta_struct_id, :value)'; + VALUES (null, :record_id, :meta_struct_id, :value)'; $stmt = $databox->get_connection()->prepare($sql); $databox_fields = []; diff --git a/lib/classes/patch/370alpha3a.php b/lib/classes/patch/370alpha3a.php index e4c744dfcd..c0f34b3a96 100644 --- a/lib/classes/patch/370alpha3a.php +++ b/lib/classes/patch/370alpha3a.php @@ -69,5 +69,7 @@ class patch_370alpha3a implements patchInterface $client->set_type(\API_OAuth2_Application::DESKTOP_TYPE); $client->set_redirect_uri(\API_OAuth2_Application::NATIVE_APP_REDIRECT_URI); } + + return true; } } diff --git a/lib/classes/patch/370alpha4a.php b/lib/classes/patch/370alpha4a.php index 755791348b..a9393c1267 100644 --- a/lib/classes/patch/370alpha4a.php +++ b/lib/classes/patch/370alpha4a.php @@ -55,7 +55,6 @@ class patch_370alpha4a implements patchInterface public function apply(base $databox, Application $app) { - $sql = 'SELECT id, src FROM metadatas_structure'; $stmt = $databox->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/370alpha7a.php b/lib/classes/patch/370alpha7a.php index 58ff5a029f..427cce5a68 100644 --- a/lib/classes/patch/370alpha7a.php +++ b/lib/classes/patch/370alpha7a.php @@ -153,7 +153,7 @@ class patch_370alpha7a implements patchInterface $stmt->closeCursor(); - return; + return true; } private function truncateTable(\Doctrine\ORM\EntityManager $em, $className) diff --git a/lib/classes/patch/371alpha1a.php b/lib/classes/patch/371alpha1a.php index 4065052db1..7a5a0431a1 100644 --- a/lib/classes/patch/371alpha1a.php +++ b/lib/classes/patch/371alpha1a.php @@ -62,5 +62,7 @@ class patch_371alpha1a implements patchInterface foreach ($databox->get_meta_structure() as $databox_field) { $databox_field->save(); } + + return true; } } diff --git a/lib/classes/patch/380alpha10a.php b/lib/classes/patch/380alpha10a.php index 86d24c1104..e053f87d21 100644 --- a/lib/classes/patch/380alpha10a.php +++ b/lib/classes/patch/380alpha10a.php @@ -65,5 +65,7 @@ class patch_380alpha10a implements patchInterface } $stmt->closeCursor(); + + return true; } } diff --git a/lib/classes/patch/380alpha11a.php b/lib/classes/patch/380alpha11a.php index fec3c3a947..cff56183d5 100644 --- a/lib/classes/patch/380alpha11a.php +++ b/lib/classes/patch/380alpha11a.php @@ -63,7 +63,7 @@ class patch_380alpha11a implements patchInterface $stmt->closeCursor(); } catch (\PDOException $e) { // this may fail on oldest versions - return; + return false; } foreach ($rs as $row) { @@ -115,5 +115,7 @@ class patch_380alpha11a implements patchInterface } $app['EM']->flush(); + + return true; } } diff --git a/lib/classes/patch/380alpha2a.php b/lib/classes/patch/380alpha2a.php index 327c2cc31b..9e9481183d 100644 --- a/lib/classes/patch/380alpha2a.php +++ b/lib/classes/patch/380alpha2a.php @@ -66,5 +66,7 @@ class patch_380alpha2a implements patchInterface } $app['configuration']->setConfig($config); + + return true; } } diff --git a/lib/classes/patch/380alpha2b.php b/lib/classes/patch/380alpha2b.php index ffdb4def3f..c472381d87 100644 --- a/lib/classes/patch/380alpha2b.php +++ b/lib/classes/patch/380alpha2b.php @@ -70,6 +70,6 @@ class patch_380alpha2b implements patchInterface $app['phraseanet.appbox']->get_connection()->exec($sql); } - return; + return true; } } diff --git a/lib/classes/patch/380alpha3a.php b/lib/classes/patch/380alpha3a.php index ce033d518e..2145268b39 100644 --- a/lib/classes/patch/380alpha3a.php +++ b/lib/classes/patch/380alpha3a.php @@ -68,44 +68,44 @@ class patch_380alpha3a implements patchInterface $procedure = " CREATE PROCEDURE explode_log_table(bound VARCHAR(255)) BEGIN - DECLARE l_log_id INT UNSIGNED DEFAULT 0; - DECLARE l_coll_list TEXT; - DECLARE occurance INT DEFAULT 0; - DECLARE i INT DEFAULT 0; - DECLARE dest_coll_id INT; - DECLARE done INT DEFAULT 0; - DECLARE result_set CURSOR FOR + DECLARE l_log_id INT UNSIGNED DEFAULT 0; + DECLARE l_coll_list TEXT; + DECLARE occurance INT DEFAULT 0; + DECLARE i INT DEFAULT 0; + DECLARE dest_coll_id INT; + DECLARE done INT DEFAULT 0; + DECLARE result_set CURSOR FOR SELECT l.id, l.coll_list FROM log l LEFT JOIN log_colls lc ON (lc.log_id = l.id) WHERE (lc.log_id IS NULL) AND coll_list != ''; - DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; - OPEN result_set; + DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1; + OPEN result_set; read_loop: LOOP - FETCH result_set INTO l_log_id, l_coll_list; - IF done THEN + FETCH result_set INTO l_log_id, l_coll_list; + IF done THEN LEAVE read_loop; - END IF; - SET occurance = (SELECT LENGTH(l_coll_list) - LENGTH(REPLACE(l_coll_list, bound, ''))+1); - SET i=1; - START TRANSACTION; - WHILE i <= occurance DO - SET dest_coll_id = (SELECT REPLACE( - SUBSTRING( - SUBSTRING_INDEX(l_coll_list, bound, i), - LENGTH(SUBSTRING_INDEX(l_coll_list, bound, i - 1)) + 1 - ), - ',', - '' - )); - IF dest_coll_id > 0 THEN - INSERT INTO log_colls VALUES (null, l_log_id, dest_coll_id); END IF; - SET i = i + 1; - END WHILE; - COMMIT; + SET occurance = (SELECT LENGTH(l_coll_list) - LENGTH(REPLACE(l_coll_list, bound, ''))+1); + SET i=1; + START TRANSACTION; + WHILE i <= occurance DO + SET dest_coll_id = (SELECT REPLACE( + SUBSTRING( + SUBSTRING_INDEX(l_coll_list, bound, i), + LENGTH(SUBSTRING_INDEX(l_coll_list, bound, i - 1)) + 1 + ), + ',', + '' + )); + IF dest_coll_id > 0 THEN + INSERT INTO log_colls VALUES (null, l_log_id, dest_coll_id); + END IF; + SET i = i + 1; + END WHILE; + COMMIT; END LOOP; - CLOSE result_set; + CLOSE result_set; END;"; $stmt = $conn->prepare($procedure); diff --git a/lib/classes/patch/380alpha4a.php b/lib/classes/patch/380alpha4a.php index 10cb5efb13..abe085ce51 100644 --- a/lib/classes/patch/380alpha4a.php +++ b/lib/classes/patch/380alpha4a.php @@ -81,5 +81,7 @@ class patch_380alpha4a implements patchInterface $app['EM']->flush(); $app['EM']->clear(); + + return true; } } diff --git a/lib/classes/patch/380alpha6a.php b/lib/classes/patch/380alpha6a.php index e1c5f8db0e..d916539d7a 100644 --- a/lib/classes/patch/380alpha6a.php +++ b/lib/classes/patch/380alpha6a.php @@ -50,5 +50,7 @@ class patch_380alpha6a implements patchInterface { $app['configuration']->setDefault('registration-fields'); $app['configuration']->setDefault('authentication'); + + return true; } } diff --git a/lib/classes/patch/380alpha8a.php b/lib/classes/patch/380alpha8a.php index 8681218cfb..03608de2a4 100644 --- a/lib/classes/patch/380alpha8a.php +++ b/lib/classes/patch/380alpha8a.php @@ -57,7 +57,7 @@ class patch_380alpha8a implements patchInterface $stmt->closeCursor(); if (!$row) { - return; + return false; } $sxe = simplexml_load_string($row['settings']); diff --git a/lib/classes/patch/380alpha9a.php b/lib/classes/patch/380alpha9a.php index 4fd9a97d8a..25b19cbb09 100644 --- a/lib/classes/patch/380alpha9a.php +++ b/lib/classes/patch/380alpha9a.php @@ -70,5 +70,7 @@ class patch_380alpha9a implements patchInterface $dom->loadXML($sxe->asXML()); $databox->saveStructure($dom); + + return true; } } diff --git a/lib/classes/patch/381alpha1a.php b/lib/classes/patch/381alpha1a.php index 47c01c5915..e40f079c3e 100644 --- a/lib/classes/patch/381alpha1a.php +++ b/lib/classes/patch/381alpha1a.php @@ -49,8 +49,8 @@ class patch_381alpha1a implements patchInterface public function apply(base $appbox, Application $app) { $sql = 'SELECT base_id, ord, sbas_id - FROM `bas` - ORDER BY sbas_id, ord'; + FROM `bas` + ORDER BY sbas_id, ord'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); diff --git a/lib/classes/patch/390alpha1a.php b/lib/classes/patch/390alpha1a.php index 5a9c85038d..0ea4adfc69 100644 --- a/lib/classes/patch/390alpha1a.php +++ b/lib/classes/patch/390alpha1a.php @@ -88,5 +88,7 @@ class patch_390alpha1a implements patchInterface $em->flush(); $em->clear(); + + return true; } } diff --git a/lib/classes/patch/390alpha1b.php b/lib/classes/patch/390alpha1b.php index 2651732564..ab02c8169d 100644 --- a/lib/classes/patch/390alpha1b.php +++ b/lib/classes/patch/390alpha1b.php @@ -123,5 +123,7 @@ class patch_390alpha1b implements patchInterface $em->clear(); $em->getEventManager()->addEventSubscriber(new TimestampableListener()); + + return true; } } diff --git a/lib/classes/patch/390alpha2a.php b/lib/classes/patch/390alpha2a.php index 4e828a65e0..9696214f25 100644 --- a/lib/classes/patch/390alpha2a.php +++ b/lib/classes/patch/390alpha2a.php @@ -68,6 +68,8 @@ class patch_390alpha2a implements patchInterface $this->updateModels($em, $conn); $em->getEventManager()->addEventSubscriber(new TimestampableListener()); + + return true; } /** @@ -76,10 +78,10 @@ class patch_390alpha2a implements patchInterface private function updateUsers(EntityManager $em, $conn) { $sql = 'SELECT activite, adresse, create_db, canchgftpprofil, canchgprofil, ville, - societe, pays, usr_mail, fax, usr_prenom, geonameid, invite, fonction, last_conn, lastModel, - usr_nom, ldap_created, locale, usr_login, mail_locked, mail_notifications, nonce, usr_password, push_list, - request_notifications, salted_password, usr_sexe, tel, timezone, cpostal, usr_creationdate, usr_modificationdate - FROM usr WHERE model_of = 0'; + societe, pays, usr_mail, fax, usr_prenom, geonameid, invite, fonction, last_conn, lastModel, + usr_nom, ldap_created, locale, usr_login, mail_locked, mail_notifications, nonce, usr_password, push_list, + request_notifications, salted_password, usr_sexe, tel, timezone, cpostal, usr_creationdate, usr_modificationdate + FROM usr WHERE model_of = 0'; $stmt = $conn->prepare($sql); $stmt->execute(); $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC); diff --git a/lib/classes/patch/390alpha3a.php b/lib/classes/patch/390alpha3a.php index 513e190e2e..1faaf34c77 100644 --- a/lib/classes/patch/390alpha3a.php +++ b/lib/classes/patch/390alpha3a.php @@ -84,5 +84,7 @@ class patch_390alpha3a implements patchInterface $em->flush(); $em->clear(); + + return true; } } diff --git a/lib/classes/patch/390alpha4a.php b/lib/classes/patch/390alpha4a.php index 0a87d42726..dbadbbb7f9 100644 --- a/lib/classes/patch/390alpha4a.php +++ b/lib/classes/patch/390alpha4a.php @@ -89,5 +89,7 @@ class patch_390alpha4a implements patchInterface $em->flush(); $em->clear(); + + return true; } } diff --git a/lib/classes/patch/390alpha5a.php b/lib/classes/patch/390alpha5a.php index 2253aea336..154d43eb17 100644 --- a/lib/classes/patch/390alpha5a.php +++ b/lib/classes/patch/390alpha5a.php @@ -85,5 +85,7 @@ class patch_390alpha5a implements patchInterface $em->flush(); $em->clear(); + + return true; } } diff --git a/lib/classes/patch/390alpha6a.php b/lib/classes/patch/390alpha6a.php index 6f6681763b..c99fedae1a 100644 --- a/lib/classes/patch/390alpha6a.php +++ b/lib/classes/patch/390alpha6a.php @@ -80,8 +80,7 @@ class patch_390alpha6a implements patchInterface $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); - $sql = 'SELECT base_id, record_id, subdef, filename, folder, error, - done, businessfields + $sql = 'SELECT base_id, record_id, subdef, filename, folder, error, done, businessfields FROM ftp_export_elements WHERE ftp_export_id = :export_id'; $stmt = $conn->prepare($sql); @@ -152,5 +151,7 @@ class patch_390alpha6a implements patchInterface $em->clear(); $em->getEventManager()->addEventSubscriber(new TimestampableListener()); + + return true; } } diff --git a/lib/classes/patch/390alpha7a.php b/lib/classes/patch/390alpha7a.php index 7d19d8851d..01885b7668 100644 --- a/lib/classes/patch/390alpha7a.php +++ b/lib/classes/patch/390alpha7a.php @@ -220,5 +220,7 @@ class patch_390alpha7a implements patchInterface $em->flush(); $em->clear(); + + return true; } } From e38be1ade7178888d81ab34d1c4cfe674d0a89b1 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Tue, 12 Nov 2013 20:03:47 +0100 Subject: [PATCH 07/13] update cpsr.lock --- composer.lock | 112 +++++++++++++++++++++++++++++++++++--------------- 1 file changed, 80 insertions(+), 32 deletions(-) diff --git a/composer.lock b/composer.lock index 987a423d5b..88af5a5f60 100644 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "57f05e1ba483ccfc8cd091e223df557d", + "hash": "71eadbedd0128a36df83b31412e86ece", "packages": [ { "name": "alchemy-fr/tcpdf-clone", @@ -720,16 +720,16 @@ }, { "name": "doctrine/dbal", - "version": "v2.4.0", + "version": "v2.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "3eb557f144ec41e6e84997e43acb1946c92fbc88" + "reference": "328357bd9eea9d671fe5fff0737f01953bfe66a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/3eb557f144ec41e6e84997e43acb1946c92fbc88", - "reference": "3eb557f144ec41e6e84997e43acb1946c92fbc88", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/328357bd9eea9d671fe5fff0737f01953bfe66a0", + "reference": "328357bd9eea9d671fe5fff0737f01953bfe66a0", "shasum": "" }, "require": { @@ -755,7 +755,7 @@ ], "authors": [ { - "name": "Jonathan H. Wage", + "name": "Jonathan Wage", "email": "jonwage@gmail.com", "homepage": "http://www.jwage.com/", "role": "Creator" @@ -782,7 +782,7 @@ "persistence", "queryobject" ], - "time": "2013-09-07 10:49:18" + "time": "2013-11-12 12:38:28" }, { "name": "doctrine/inflector", @@ -901,16 +901,16 @@ }, { "name": "doctrine/orm", - "version": "v2.4.0", + "version": "v2.4.1", "source": { "type": "git", "url": "https://github.com/doctrine/doctrine2.git", - "reference": "57705e0d781719b96daf322a6d6f66ff21e3cdc9" + "reference": "84373d05a4198ec380918d535abf83c454c3867f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/57705e0d781719b96daf322a6d6f66ff21e3cdc9", - "reference": "57705e0d781719b96daf322a6d6f66ff21e3cdc9", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/84373d05a4198ec380918d535abf83c454c3867f", + "reference": "84373d05a4198ec380918d535abf83c454c3867f", "shasum": "" }, "require": { @@ -948,7 +948,7 @@ ], "authors": [ { - "name": "Jonathan H. Wage", + "name": "Jonathan Wage", "email": "jonwage@gmail.com", "homepage": "http://www.jwage.com/", "role": "Creator" @@ -973,7 +973,7 @@ "database", "orm" ], - "time": "2013-09-07 16:19:56" + "time": "2013-11-12 12:40:13" }, { "name": "evenement/evenement", @@ -1060,16 +1060,16 @@ }, { "name": "gedmo/doctrine-extensions", - "version": "v2.3.7", + "version": "v2.3.8", "source": { "type": "git", "url": "https://github.com/l3pp4rd/DoctrineExtensions.git", - "reference": "0aa660ffea298b630b8ded7bd2a7eae0d8619fdb" + "reference": "d2bef940268e4dc5f0f050e80458169a7267813a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/l3pp4rd/DoctrineExtensions/zipball/0aa660ffea298b630b8ded7bd2a7eae0d8619fdb", - "reference": "0aa660ffea298b630b8ded7bd2a7eae0d8619fdb", + "url": "https://api.github.com/repos/l3pp4rd/DoctrineExtensions/zipball/d2bef940268e4dc5f0f050e80458169a7267813a", + "reference": "d2bef940268e4dc5f0f050e80458169a7267813a", "shasum": "" }, "require": { @@ -1136,7 +1136,7 @@ "tree", "uploadable" ], - "time": "2013-08-18 07:18:44" + "time": "2013-11-09 21:23:13" }, { "name": "guzzle/guzzle", @@ -2462,16 +2462,16 @@ }, { "name": "pimple/pimple", - "version": "v1.0.2", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/fabpot/Pimple.git", - "reference": "ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94" + "reference": "471c7d7c52ad6594e17b8ec33efdd1be592b5d83" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/fabpot/Pimple/zipball/ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94", - "reference": "ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94", + "url": "https://api.github.com/repos/fabpot/Pimple/zipball/471c7d7c52ad6594e17b8ec33efdd1be592b5d83", + "reference": "471c7d7c52ad6594e17b8ec33efdd1be592b5d83", "shasum": "" }, "require": { @@ -2480,7 +2480,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { @@ -2504,7 +2504,7 @@ "container", "dependency injection" ], - "time": "2013-03-08 08:21:40" + "time": "2013-09-19 04:53:08" }, { "name": "psr/log", @@ -2830,12 +2830,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "88906277988d3b0de562b1b99e5c49c146d4f2f2" + "reference": "b76ac2f865bae2e2ca87302935f5d9a458f1401f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/88906277988d3b0de562b1b99e5c49c146d4f2f2", - "reference": "88906277988d3b0de562b1b99e5c49c146d4f2f2", + "url": "https://api.github.com/repos/symfony/symfony/zipball/b76ac2f865bae2e2ca87302935f5d9a458f1401f", + "reference": "b76ac2f865bae2e2ca87302935f5d9a458f1401f", "shasum": "" }, "require": { @@ -2935,7 +2935,7 @@ "keywords": [ "framework" ], - "time": "2013-11-04 09:03:40" + "time": "2013-11-09 16:01:15" }, { "name": "themattharris/tmhoauth", @@ -3075,6 +3075,54 @@ ], "time": "2013-10-30 08:20:53" }, + { + "name": "vierbergenlars/php-semver", + "version": "v2.1.0", + "source": { + "type": "git", + "url": "https://github.com/vierbergenlars/php-semver.git", + "reference": "6b16f72b8c2d3aa00368f9fa612b2218a96245fc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/vierbergenlars/php-semver/zipball/6b16f72b8c2d3aa00368f9fa612b2218a96245fc", + "reference": "6b16f72b8c2d3aa00368f9fa612b2218a96245fc", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "vierbergenlars/simpletest": "1.1.*" + }, + "bin": [ + "bin/semver", + "bin/update-versions" + ], + "type": "library", + "autoload": { + "psr-0": { + "vierbergenlars\\SemVer": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Vierbergen", + "email": "vierbergenlars@gmail.com" + } + ], + "description": "The Semantic Versioner for PHP", + "keywords": [ + "semantic", + "semver", + "versioning" + ], + "time": "2013-09-20 10:41:27" + }, { "name": "zend/gdata", "version": "1.12.1", @@ -3576,12 +3624,12 @@ "source": { "type": "git", "url": "https://github.com/doctrine/migrations.git", - "reference": "0f5a110a1e6ae413e425912e6601643f91b069c1" + "reference": "37aacdae6507faad03c3df1624e7d3a6e6c1b388" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/migrations/zipball/0f5a110a1e6ae413e425912e6601643f91b069c1", - "reference": "0f5a110a1e6ae413e425912e6601643f91b069c1", + "url": "https://api.github.com/repos/doctrine/migrations/zipball/37aacdae6507faad03c3df1624e7d3a6e6c1b388", + "reference": "37aacdae6507faad03c3df1624e7d3a6e6c1b388", "shasum": "" }, "require": { @@ -3628,7 +3676,7 @@ "database", "migrations" ], - "time": "2013-11-03 20:54:43" + "time": "2013-11-10 05:33:50" }, { "name": "fabpot/goutte", From 57c9e6e4537c7e52926ad99f026de6bfe845f795 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Wed, 13 Nov 2013 11:29:58 +0100 Subject: [PATCH 08/13] Fix patch version --- lib/classes/patch/373alpha1a.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/classes/patch/373alpha1a.php b/lib/classes/patch/373alpha1a.php index 26958e1a0f..0fe5008d5e 100644 --- a/lib/classes/patch/373alpha1a.php +++ b/lib/classes/patch/373alpha1a.php @@ -22,7 +22,7 @@ class patch_373alpha1a implements patchInterface * * @var string */ - private $release = '3.7.3-alpha1'; + private $release = '3.7.3-alpha.1'; /** * From d8ea06b52193f4dfc550ab9aa28ec62e9d8b409f Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Wed, 13 Nov 2013 12:36:22 +0100 Subject: [PATCH 09/13] Fix migration --- .../DoctrineMigrations/AbstractMigration.php | 88 +++++++++++++++++++ .../AggregateTokenMigration.php | 27 ++++++ .../AuthFailureMigration.php | 27 ++++++ ...Version320alpha4.php => FeedMigration.php} | 45 +++------- .../FtpCredentialMigration.php | 27 ++++++ ...on390alpha6.php => FtpExportMigration.php} | 25 +++--- ...sion370alpha7.php => LazaretMigration.php} | 25 +++--- ...rsion390alpha1b.php => OrderMigration.php} | 25 +++--- ...ion380alpha11.php => SessionMigration.php} | 25 +++--- .../DoctrineMigrations/TaskMigration.php | 27 ++++++ ...Version390alpha2.php => UserMigration.php} | 25 +++--- ...p => UserNotificationSettingMigration.php} | 25 +++--- .../DoctrineMigrations/UserQueryMigration.php | 28 ++++++ ...390alpha4.php => UserSettingMigration.php} | 25 +++--- .../DoctrineMigrations/Version370alpha8.php | 28 ------ .../DoctrineMigrations/Version380alpha4.php | 28 ------ .../DoctrineMigrations/Version390alpha1a.php | 29 ------ .../DoctrineMigrations/Version390alpha3.php | 29 ------ .../DoctrineMigrations/Version390alpha7.php | 68 -------------- .../DoctrineMigrations/Version390alpha8.php | 28 ------ ...ion360alpha1.php => WorkzoneMigration.php} | 29 +++--- lib/classes/base.php | 12 ++- lib/classes/module/console/systemUpgrade.php | 6 +- lib/classes/patch/320alpha1a.php | 38 ++++---- lib/classes/patch/320alpha1b.php | 37 ++++---- lib/classes/patch/320alpha2a.php | 43 ++++----- lib/classes/patch/320alpha3a.php | 37 ++++---- lib/classes/patch/320alpha4a.php | 41 ++++----- lib/classes/patch/320alpha4b.php | 53 ++++++----- lib/classes/patch/320alpha5a.php | 42 ++++----- lib/classes/patch/320alpha6a.php | 38 ++++---- lib/classes/patch/320alpha8a.php | 38 ++++---- lib/classes/patch/360alpha1a.php | 61 +++++++------ lib/classes/patch/360alpha1b.php | 38 ++++---- lib/classes/patch/360alpha2a.php | 38 ++++---- lib/classes/patch/360alpha2b.php | 46 +++++----- lib/classes/patch/361alpha1a.php | 42 ++++----- lib/classes/patch/370alpha1a.php | 40 +++++---- lib/classes/patch/370alpha3a.php | 34 +++---- lib/classes/patch/370alpha4a.php | 45 +++++----- lib/classes/patch/370alpha5a.php | 45 +++++----- lib/classes/patch/370alpha6a.php | 77 ++++++++-------- lib/classes/patch/370alpha7a.php | 40 ++++----- lib/classes/patch/370alpha8a.php | 42 ++++----- lib/classes/patch/370alpha9a.php | 37 ++++---- lib/classes/patch/3715alpha1a.php | 26 +++--- lib/classes/patch/371alpha1a.php | 37 ++++---- lib/classes/patch/373alpha1a.php | 55 ++++++------ lib/classes/patch/379alpha1a.php | 32 +++---- lib/classes/patch/380alpha10a.php | 8 ++ lib/classes/patch/380alpha11a.php | 11 ++- lib/classes/patch/380alpha13a.php | 8 ++ lib/classes/patch/380alpha14a.php | 8 ++ lib/classes/patch/380alpha15a.php | 7 ++ lib/classes/patch/380alpha16a.php | 8 ++ lib/classes/patch/380alpha17a.php | 8 ++ lib/classes/patch/380alpha18a.php | 8 ++ lib/classes/patch/380alpha2a.php | 38 ++++---- lib/classes/patch/380alpha2b.php | 38 ++++---- lib/classes/patch/380alpha3a.php | 38 ++++---- lib/classes/patch/380alpha3b.php | 39 ++++---- lib/classes/patch/380alpha4a.php | 12 ++- lib/classes/patch/380alpha6a.php | 8 ++ lib/classes/patch/380alpha8a.php | 8 ++ lib/classes/patch/380alpha9a.php | 8 ++ lib/classes/patch/381alpha1a.php | 8 ++ lib/classes/patch/381alpha1b.php | 8 ++ lib/classes/patch/381alpha2a.php | 8 ++ lib/classes/patch/390alpha1a.php | 11 ++- lib/classes/patch/390alpha1b.php | 13 ++- lib/classes/patch/390alpha2a.php | 11 ++- lib/classes/patch/390alpha3a.php | 11 ++- lib/classes/patch/390alpha4a.php | 11 ++- lib/classes/patch/390alpha5a.php | 11 ++- lib/classes/patch/390alpha6a.php | 11 ++- lib/classes/patch/390alpha7a.php | 44 ++++++---- lib/classes/patch/390alpha8a.php | 11 ++- lib/classes/patchInterface.php | 34 ++++++- lib/conf.d/migrations.yml | 59 ++++++------- 79 files changed, 1249 insertions(+), 1060 deletions(-) create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AbstractMigration.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AggregateTokenMigration.php create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AuthFailureMigration.php rename lib/Alchemy/Phrasea/Setup/DoctrineMigrations/{Version320alpha4.php => FeedMigration.php} (73%) create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FtpCredentialMigration.php rename lib/Alchemy/Phrasea/Setup/DoctrineMigrations/{Version390alpha6.php => FtpExportMigration.php} (71%) rename lib/Alchemy/Phrasea/Setup/DoctrineMigrations/{Version370alpha7.php => LazaretMigration.php} (78%) rename lib/Alchemy/Phrasea/Setup/DoctrineMigrations/{Version390alpha1b.php => OrderMigration.php} (66%) rename lib/Alchemy/Phrasea/Setup/DoctrineMigrations/{Version380alpha11.php => SessionMigration.php} (67%) create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/TaskMigration.php rename lib/Alchemy/Phrasea/Setup/DoctrineMigrations/{Version390alpha2.php => UserMigration.php} (72%) rename lib/Alchemy/Phrasea/Setup/DoctrineMigrations/{Version390alpha5.php => UserNotificationSettingMigration.php} (52%) create mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/UserQueryMigration.php rename lib/Alchemy/Phrasea/Setup/DoctrineMigrations/{Version390alpha4.php => UserSettingMigration.php} (51%) delete mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha8.php delete mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha4.php delete mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1a.php delete mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha3.php delete mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha7.php delete mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha8.php rename lib/Alchemy/Phrasea/Setup/DoctrineMigrations/{Version360alpha1.php => WorkzoneMigration.php} (80%) diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AbstractMigration.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AbstractMigration.php new file mode 100644 index 0000000000..030df5faaf --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AbstractMigration.php @@ -0,0 +1,88 @@ +em = $em; + + return $this; + } + + /** + * Gets EntityManager. + * + * @return EntityManager + * + * @throws RuntimeException + */ + public function getEntityManager() + { + if (null === $this->em) { + throw new RuntimeException('EntityManager must be injected.'); + } + + return $this->em; + } + + /** + * @inheritdoc + */ + public function up(Schema $schema) + { + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->doUpSql($schema); + + return $this; + } + + /** + * @inheritdoc + */ + public function down(Schema $schema) + { + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); + + $this->doDownSql($schema); + + return $this; + } + + /** + * Executes update SQL. + */ + abstract public function doUpSql(Schema $schema); + + /** + * Execute downgrade SQL. + */ + abstract public function doDownSql(Schema $schema); +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AggregateTokenMigration.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AggregateTokenMigration.php new file mode 100644 index 0000000000..4ab80fb2f1 --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AggregateTokenMigration.php @@ -0,0 +1,27 @@ +addSql("CREATE TABLE IF NOT EXISTS AggregateTokens (id INT AUTO_INCREMENT NOT NULL, usr_id INT NOT NULL, value VARCHAR(12) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + } + + public function doDownSql(Schema $schema) + { + $this->addSql("DROP TABLE AggregateTokens"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AuthFailureMigration.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AuthFailureMigration.php new file mode 100644 index 0000000000..9cf3998110 --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AuthFailureMigration.php @@ -0,0 +1,27 @@ +addSql("CREATE TABLE IF NOT EXISTS AuthFailures (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(128) NOT NULL, ip VARCHAR(128) DEFAULT NULL, locked TINYINT(1) NOT NULL, created DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + } + + public function doDownSql(Schema $schema) + { + $this->addSql("DROP TABLE AuthFailures"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version320alpha4.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FeedMigration.php similarity index 73% rename from lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version320alpha4.php rename to lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FeedMigration.php index 7f4f92c48c..50cde7bbb0 100644 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version320alpha4.php +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FeedMigration.php @@ -1,39 +1,23 @@ abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - - $app = new Application(); - - $rsm = new ResultSetMapping(); - $rsm->addScalarResult('Name', 'Name'); - - $found = false; - - foreach ($app['EM']->createNativeQuery('SHOW TABLE STATUS', $rsm)->getResult() as $row) { - if (strcmp('feeds', $row['Name'])) { - $found = true; - break; - } - } - - if ($found) { - $this->addSql("RENAME TABLE `feeds` TO `feeds_backup`"); - } - $this->addSql("CREATE TABLE IF NOT EXISTS Feeds (id INT AUTO_INCREMENT NOT NULL, public TINYINT(1) NOT NULL, icon_url TINYINT(1) NOT NULL, base_id INT DEFAULT NULL, title VARCHAR(128) NOT NULL, subtitle VARCHAR(1024) DEFAULT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE IF NOT EXISTS FeedPublishers (id INT AUTO_INCREMENT NOT NULL, feed_id INT DEFAULT NULL, usr_id INT NOT NULL, owner TINYINT(1) NOT NULL, created_on DATETIME NOT NULL, INDEX IDX_31AFAB251A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE IF NOT EXISTS FeedEntries (id INT AUTO_INCREMENT NOT NULL, publisher_id INT DEFAULT NULL, feed_id INT DEFAULT NULL, title VARCHAR(128) NOT NULL, subtitle VARCHAR(128) NOT NULL, author_name VARCHAR(128) NOT NULL, author_email VARCHAR(128) NOT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, INDEX IDX_5FC892F940C86FCE (publisher_id), INDEX IDX_5FC892F951A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); @@ -46,11 +30,8 @@ class Version320alpha4 extends AbstractMigration $this->addSql("ALTER TABLE FeedTokens ADD CONSTRAINT FK_9D1CA84851A5BC03 FOREIGN KEY (feed_id) REFERENCES Feeds (id)"); } - public function down(Schema $schema) + public function doDownSql(Schema $schema) { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("ALTER TABLE FeedPublishers DROP FOREIGN KEY FK_31AFAB251A5BC03"); $this->addSql("ALTER TABLE FeedEntries DROP FOREIGN KEY FK_5FC892F951A5BC03"); $this->addSql("ALTER TABLE FeedTokens DROP FOREIGN KEY FK_9D1CA84851A5BC03"); diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FtpCredentialMigration.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FtpCredentialMigration.php new file mode 100644 index 0000000000..c1b3f732d2 --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FtpCredentialMigration.php @@ -0,0 +1,27 @@ +addSql("CREATE TABLE IF NOT EXISTS FtpCredential (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, usrId INT NOT NULL, active TINYINT(1) NOT NULL, address VARCHAR(128) NOT NULL, login VARCHAR(128) NOT NULL, password VARCHAR(128) NOT NULL, reception_folder VARCHAR(128) NOT NULL, repository_prefix_name VARCHAR(128) NOT NULL, passive TINYINT(1) NOT NULL, tls TINYINT(1) NOT NULL, max_retry INT NOT NULL, updated DATETIME NOT NULL, UNIQUE INDEX UNIQ_62DA9661A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + } + + public function doDownSql(Schema $schema) + { + $this->addSql("DROP TABLE FtpCredential"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha6.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FtpExportMigration.php similarity index 71% rename from lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha6.php rename to lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FtpExportMigration.php index ed827d5424..b73814b16c 100644 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha6.php +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FtpExportMigration.php @@ -1,30 +1,29 @@ abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("CREATE TABLE IF NOT EXISTS FtpExportElements (id INT AUTO_INCREMENT NOT NULL, export_id INT DEFAULT NULL, record_id INT NOT NULL, base_id INT NOT NULL, subdef VARCHAR(255) NOT NULL, filename VARCHAR(255) NOT NULL, folder VARCHAR(255) DEFAULT NULL, error TINYINT(1) NOT NULL, done TINYINT(1) NOT NULL, businessfields TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX IDX_7BF0AE1264CDAF82 (export_id), INDEX done (done), INDEX error (error), UNIQUE INDEX unique_ftp_export (export_id, base_id, record_id, subdef), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE IF NOT EXISTS FtpExports (id INT AUTO_INCREMENT NOT NULL, crash INT NOT NULL, nbretry INT NOT NULL, mail LONGTEXT DEFAULT NULL, addr LONGTEXT NOT NULL, use_ssl TINYINT(1) NOT NULL, login LONGTEXT DEFAULT NULL, pwd LONGTEXT DEFAULT NULL, passif TINYINT(1) NOT NULL, destfolder LONGTEXT NOT NULL, sendermail LONGTEXT DEFAULT NULL, text_mail_sender LONGTEXT DEFAULT NULL, text_mail_receiver LONGTEXT DEFAULT NULL, usr_id INT NOT NULL, foldertocreate LONGTEXT DEFAULT NULL, logfile TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("ALTER TABLE FtpExportElements ADD CONSTRAINT FK_7BF0AE1264CDAF82 FOREIGN KEY (export_id) REFERENCES FtpExports (id)"); } - public function down(Schema $schema) + public function doDownSql(Schema $schema) { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("ALTER TABLE FtpExportElements DROP FOREIGN KEY FK_7BF0AE1264CDAF82"); $this->addSql("DROP TABLE FtpExportElements"); $this->addSql("DROP TABLE FtpExports"); diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha7.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/LazaretMigration.php similarity index 78% rename from lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha7.php rename to lib/Alchemy/Phrasea/Setup/DoctrineMigrations/LazaretMigration.php index 316af539dc..db58b516bc 100644 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha7.php +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/LazaretMigration.php @@ -1,20 +1,22 @@ abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("CREATE TABLE IF NOT EXISTS LazaretChecks (id INT AUTO_INCREMENT NOT NULL, lazaret_file_id INT DEFAULT NULL, checkClassname VARCHAR(512) NOT NULL, INDEX IDX_CE873ED44CF84ADD (lazaret_file_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE IF NOT EXISTS LazaretSessions (id INT AUTO_INCREMENT NOT NULL, usr_id INT DEFAULT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE IF NOT EXISTS LazaretAttributes (id INT AUTO_INCREMENT NOT NULL, lazaret_file_id INT DEFAULT NULL, name VARCHAR(64) NOT NULL, value VARCHAR(2048) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX IDX_5FF72F9B4CF84ADD (lazaret_file_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); @@ -24,11 +26,8 @@ class Version370alpha7 extends AbstractMigration $this->addSql("ALTER TABLE LazaretFiles ADD CONSTRAINT FK_D30BD768EE187C01 FOREIGN KEY (lazaret_session_id) REFERENCES LazaretSessions (id)"); } - public function down(Schema $schema) + public function doDownSql(Schema $schema) { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("ALTER TABLE LazaretFiles DROP FOREIGN KEY FK_D30BD768EE187C01"); $this->addSql("ALTER TABLE LazaretChecks DROP FOREIGN KEY FK_CE873ED44CF84ADD"); $this->addSql("ALTER TABLE LazaretAttributes DROP FOREIGN KEY FK_5FF72F9B4CF84ADD"); diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1b.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/OrderMigration.php similarity index 66% rename from lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1b.php rename to lib/Alchemy/Phrasea/Setup/DoctrineMigrations/OrderMigration.php index ee2b8c6092..79452c1dcf 100644 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1b.php +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/OrderMigration.php @@ -1,31 +1,30 @@ abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("CREATE TABLE IF NOT EXISTS Orders (id INT AUTO_INCREMENT NOT NULL, basket_id INT DEFAULT NULL, usr_id INT NOT NULL, order_usage VARCHAR(2048) NOT NULL, todo INT DEFAULT NULL, deadline DATETIME NOT NULL, created_on DATETIME NOT NULL, UNIQUE INDEX UNIQ_E283F8D81BE1FB52 (basket_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE IF NOT EXISTS OrderElements (id INT AUTO_INCREMENT NOT NULL, order_id INT DEFAULT NULL, base_id INT NOT NULL, record_id INT NOT NULL, order_master_id INT DEFAULT NULL, deny TINYINT(1) DEFAULT NULL, INDEX IDX_8C7066C88D9F6D38 (order_id), UNIQUE INDEX unique_ordercle (base_id, record_id, order_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("ALTER TABLE Orders ADD CONSTRAINT FK_E283F8D81BE1FB52 FOREIGN KEY (basket_id) REFERENCES Baskets (id)"); $this->addSql("ALTER TABLE OrderElements ADD CONSTRAINT FK_8C7066C88D9F6D38 FOREIGN KEY (order_id) REFERENCES Orders (id)"); } - public function down(Schema $schema) + public function doDownSql(Schema $schema) { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("ALTER TABLE OrderElements DROP FOREIGN KEY FK_8C7066C88D9F6D38"); $this->addSql("DROP TABLE Orders"); $this->addSql("DROP TABLE OrderElements"); diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha11.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/SessionMigration.php similarity index 67% rename from lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha11.php rename to lib/Alchemy/Phrasea/Setup/DoctrineMigrations/SessionMigration.php index 7e7da308b6..cb8bdd36ec 100644 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha11.php +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/SessionMigration.php @@ -1,30 +1,29 @@ abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("CREATE TABLE IF NOT EXISTS SessionModules (id INT AUTO_INCREMENT NOT NULL, session_id INT DEFAULT NULL, module_id INT NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX IDX_BA36EF49613FECDF (session_id), UNIQUE INDEX unique_module (session_id, module_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE IF NOT EXISTS Sessions (id INT AUTO_INCREMENT NOT NULL, usr_id INT NOT NULL, user_agent VARCHAR(512) NOT NULL, ip_address VARCHAR(40) DEFAULT NULL, platform VARCHAR(128) DEFAULT NULL, browser_name VARCHAR(128) DEFAULT NULL, browser_version VARCHAR(32) DEFAULT NULL, screen_width INT DEFAULT NULL, screen_height INT DEFAULT NULL, token VARCHAR(128) DEFAULT NULL, nonce VARCHAR(16) DEFAULT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, UNIQUE INDEX UNIQ_6316FF455F37A13B (token), INDEX usr_id (usr_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("ALTER TABLE SessionModules ADD CONSTRAINT FK_BA36EF49613FECDF FOREIGN KEY (session_id) REFERENCES Sessions (id)"); } - public function down(Schema $schema) + public function doDownSql(Schema $schema) { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("ALTER TABLE SessionModules DROP FOREIGN KEY FK_BA36EF49613FECDF"); $this->addSql("DROP TABLE SessionModules"); $this->addSql("DROP TABLE Sessions"); diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/TaskMigration.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/TaskMigration.php new file mode 100644 index 0000000000..3733d2897b --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/TaskMigration.php @@ -0,0 +1,27 @@ +addSql("CREATE TABLE IF NOT EXISTS Tasks (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, jobId VARCHAR(255) NOT NULL, settings LONGTEXT NOT NULL, completed TINYINT(1) NOT NULL, status VARCHAR(255) NOT NULL, crashed INT NOT NULL, single_run TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, last_execution DATETIME DEFAULT NULL, period INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + } + + public function doDownSql(Schema $schema) + { + $this->addSql("DROP TABLE Tasks"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha2.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/UserMigration.php similarity index 72% rename from lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha2.php rename to lib/Alchemy/Phrasea/Setup/DoctrineMigrations/UserMigration.php index 8fb21b31ed..6d22211f33 100644 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha2.php +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/UserMigration.php @@ -1,29 +1,28 @@ abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("CREATE TABLE IF NOT EXISTS Users (id INT AUTO_INCREMENT NOT NULL, model_of INT DEFAULT NULL, login VARCHAR(128) NOT NULL, email VARCHAR(128) DEFAULT NULL, password VARCHAR(128) DEFAULT NULL, nonce VARCHAR(16) DEFAULT NULL, salted_password TINYINT(1) NOT NULL, first_name VARCHAR(64) NOT NULL, last_name VARCHAR(64) NOT NULL, gender VARCHAR(8) DEFAULT NULL, address LONGTEXT NOT NULL, city VARCHAR(64) NOT NULL, country VARCHAR(64) NOT NULL, zip_code VARCHAR(32) NOT NULL, geoname_id INT DEFAULT NULL, locale VARCHAR(8) DEFAULT NULL, timezone VARCHAR(128) NOT NULL, job VARCHAR(128) NOT NULL, activity VARCHAR(256) NOT NULL, company VARCHAR(64) NOT NULL, phone VARCHAR(32) NOT NULL, fax VARCHAR(32) NOT NULL, admin TINYINT(1) NOT NULL, guest TINYINT(1) NOT NULL, mail_notifications TINYINT(1) NOT NULL, request_notifications TINYINT(1) NOT NULL, ldap_created TINYINT(1) NOT NULL, last_model VARCHAR(64) DEFAULT NULL, push_list LONGTEXT NOT NULL, can_change_profil TINYINT(1) NOT NULL, can_change_ftp_profil TINYINT(1) NOT NULL, last_connection DATETIME DEFAULT NULL, mail_locked TINYINT(1) NOT NULL, deleted TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, UNIQUE INDEX UNIQ_D5428AEDC121714D (model_of), INDEX salted_password (salted_password), INDEX admin (admin), INDEX guest (guest), UNIQUE INDEX email_unique (email), UNIQUE INDEX login_unique (login), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("ALTER TABLE Users ADD CONSTRAINT FK_D5428AEDC121714D FOREIGN KEY (model_of) REFERENCES Users (id)"); } - public function down(Schema $schema) + public function doDownSql(Schema $schema) { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("ALTER TABLE Users DROP FOREIGN KEY FK_D5428AEDC121714D"); $this->addSql("DROP TABLE Users"); } diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha5.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/UserNotificationSettingMigration.php similarity index 52% rename from lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha5.php rename to lib/Alchemy/Phrasea/Setup/DoctrineMigrations/UserNotificationSettingMigration.php index f4be6f74d5..71304c0d3f 100644 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha5.php +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/UserNotificationSettingMigration.php @@ -1,29 +1,28 @@ abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("CREATE TABLE IF NOT EXISTS UserNotificationSettings (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, usr_id INT NOT NULL, name VARCHAR(64) NOT NULL, value VARCHAR(128) DEFAULT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX IDX_CFF041AAA76ED395 (user_id), UNIQUE INDEX unique_index (user_id, name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("ALTER TABLE UserNotificationSettings ADD CONSTRAINT FK_CFF041AAA76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)"); } - public function down(Schema $schema) + public function doDownSql(Schema $schema) { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("DROP TABLE UserNotificationSettings"); } } diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/UserQueryMigration.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/UserQueryMigration.php new file mode 100644 index 0000000000..d7fdfdd066 --- /dev/null +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/UserQueryMigration.php @@ -0,0 +1,28 @@ +addSql("CREATE TABLE IF NOT EXISTS UserQueries (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, usr_id INT NOT NULL, query VARCHAR(256) NOT NULL, created DATETIME NOT NULL, INDEX IDX_5FB80D87A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("ALTER TABLE UserQueries ADD CONSTRAINT FK_5FB80D87A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)"); + } + + public function doDownSql(Schema $schema) + { + $this->addSql("DROP TABLE UserQueries"); + } +} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha4.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/UserSettingMigration.php similarity index 51% rename from lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha4.php rename to lib/Alchemy/Phrasea/Setup/DoctrineMigrations/UserSettingMigration.php index 2c612aca15..61626aebbe 100644 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha4.php +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/UserSettingMigration.php @@ -1,29 +1,28 @@ abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("CREATE TABLE IF NOT EXISTS UserSettings (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, usr_id INT NOT NULL, name VARCHAR(64) NOT NULL, value VARCHAR(128) DEFAULT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, INDEX IDX_2847E61CA76ED395 (user_id), UNIQUE INDEX unique_setting (user_id, name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("ALTER TABLE UserSettings ADD CONSTRAINT FK_2847E61CA76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)"); } - public function down(Schema $schema) + public function doDownSql(Schema $schema) { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("DROP TABLE UserSettings"); } } diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha8.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha8.php deleted file mode 100644 index 207358bf97..0000000000 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version370alpha8.php +++ /dev/null @@ -1,28 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - - $this->addSql("CREATE TABLE IF NOT EXISTS Tasks (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, jobId VARCHAR(255) NOT NULL, settings LONGTEXT NOT NULL, completed TINYINT(1) NOT NULL, status VARCHAR(255) NOT NULL, crashed INT NOT NULL, single_run TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, last_execution DATETIME DEFAULT NULL, period INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); - } - - public function down(Schema $schema) - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - - $this->addSql("DROP TABLE Tasks"); - } -} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha4.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha4.php deleted file mode 100644 index 3c00b4ce9c..0000000000 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version380alpha4.php +++ /dev/null @@ -1,28 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - - $this->addSql("CREATE TABLE IF NOT EXISTS AuthFailures (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(128) NOT NULL, ip VARCHAR(128) DEFAULT NULL, locked TINYINT(1) NOT NULL, created DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); - } - - public function down(Schema $schema) - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - - $this->addSql("DROP TABLE AuthFailures"); - } -} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1a.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1a.php deleted file mode 100644 index 6fbf46c41e..0000000000 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha1a.php +++ /dev/null @@ -1,29 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - - $this->addSql("CREATE TABLE IF NOT EXISTS FtpCredential (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, usrId INT NOT NULL, active TINYINT(1) NOT NULL, address VARCHAR(128) NOT NULL, login VARCHAR(128) NOT NULL, password VARCHAR(128) NOT NULL, reception_folder VARCHAR(128) NOT NULL, repository_prefix_name VARCHAR(128) NOT NULL, passive TINYINT(1) NOT NULL, tls TINYINT(1) NOT NULL, max_retry INT NOT NULL, updated DATETIME NOT NULL, UNIQUE INDEX UNIQ_62DA9661A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); - $this->addSql("ALTER TABLE FtpCredential ADD CONSTRAINT FK_62DA9661A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)"); - } - - public function down(Schema $schema) - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - - $this->addSql("DROP TABLE FtpCredential"); - } -} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha3.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha3.php deleted file mode 100644 index 28bc5612b3..0000000000 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha3.php +++ /dev/null @@ -1,29 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - - $this->addSql("CREATE TABLE IF NOT EXISTS UserQueries (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, usr_id INT NOT NULL, query VARCHAR(256) NOT NULL, created DATETIME NOT NULL, INDEX IDX_5FB80D87A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); - $this->addSql("ALTER TABLE UserQueries ADD CONSTRAINT FK_5FB80D87A76ED395 FOREIGN KEY (user_id) REFERENCES Users (id)"); - } - - public function down(Schema $schema) - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - - $this->addSql("DROP TABLE UserQueries"); - } -} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha7.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha7.php deleted file mode 100644 index 315382023b..0000000000 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha7.php +++ /dev/null @@ -1,68 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - - $app = new Application(); - - $rsm = new ResultSetMapping(); - $rsm->addScalarResult('Name', 'Name'); - - $found = false; - - foreach ($app['EM']->createNativeQuery('SHOW TABLE STATUS', $rsm)->getResult() as $row) { - if (strcmp('feeds', $row['Name'])) { - $found = true; - break; - } - } - - if ($found) { - $this->addSql("RENAME TABLE `feeds` TO `feeds_backup`"); - } - - $this->addSql("CREATE TABLE IF NOT EXISTS Feeds (id INT AUTO_INCREMENT NOT NULL, public TINYINT(1) NOT NULL, icon_url TINYINT(1) NOT NULL, base_id INT DEFAULT NULL, title VARCHAR(128) NOT NULL, subtitle VARCHAR(1024) DEFAULT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); - $this->addSql("CREATE TABLE IF NOT EXISTS FeedPublishers (id INT AUTO_INCREMENT NOT NULL, feed_id INT DEFAULT NULL, usr_id INT NOT NULL, owner TINYINT(1) NOT NULL, created_on DATETIME NOT NULL, INDEX IDX_31AFAB251A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); - $this->addSql("CREATE TABLE IF NOT EXISTS AggregateTokens (id INT AUTO_INCREMENT NOT NULL, usr_id INT NOT NULL, value VARCHAR(12) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); - $this->addSql("CREATE TABLE IF NOT EXISTS FeedEntries (id INT AUTO_INCREMENT NOT NULL, publisher_id INT DEFAULT NULL, feed_id INT DEFAULT NULL, title VARCHAR(128) NOT NULL, subtitle VARCHAR(128) NOT NULL, author_name VARCHAR(128) NOT NULL, author_email VARCHAR(128) NOT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, INDEX IDX_5FC892F940C86FCE (publisher_id), INDEX IDX_5FC892F951A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); - $this->addSql("CREATE TABLE IF NOT EXISTS FeedItems (id INT AUTO_INCREMENT NOT NULL, entry_id INT DEFAULT NULL, record_id INT NOT NULL, sbas_id INT NOT NULL, ord INT NOT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, INDEX IDX_7F9CDFA6BA364942 (entry_id), UNIQUE INDEX lookup_unique_idx (entry_id, sbas_id, record_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); - $this->addSql("CREATE TABLE IF NOT EXISTS FeedTokens (id INT AUTO_INCREMENT NOT NULL, feed_id INT DEFAULT NULL, usr_id INT NOT NULL, value VARCHAR(12) DEFAULT NULL, INDEX IDX_9D1CA84851A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); - $this->addSql("ALTER TABLE FeedPublishers ADD CONSTRAINT FK_31AFAB251A5BC03 FOREIGN KEY (feed_id) REFERENCES Feeds (id)"); - $this->addSql("ALTER TABLE FeedEntries ADD CONSTRAINT FK_5FC892F940C86FCE FOREIGN KEY (publisher_id) REFERENCES FeedPublishers (id)"); - $this->addSql("ALTER TABLE FeedEntries ADD CONSTRAINT FK_5FC892F951A5BC03 FOREIGN KEY (feed_id) REFERENCES Feeds (id)"); - $this->addSql("ALTER TABLE FeedItems ADD CONSTRAINT FK_7F9CDFA6BA364942 FOREIGN KEY (entry_id) REFERENCES FeedEntries (id)"); - $this->addSql("ALTER TABLE FeedTokens ADD CONSTRAINT FK_9D1CA84851A5BC03 FOREIGN KEY (feed_id) REFERENCES Feeds (id)"); - } - - public function down(Schema $schema) - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - - $this->addSql("ALTER TABLE FeedPublishers DROP FOREIGN KEY FK_31AFAB251A5BC03"); - $this->addSql("ALTER TABLE FeedEntries DROP FOREIGN KEY FK_5FC892F951A5BC03"); - $this->addSql("ALTER TABLE FeedTokens DROP FOREIGN KEY FK_9D1CA84851A5BC03"); - $this->addSql("ALTER TABLE FeedEntries DROP FOREIGN KEY FK_5FC892F940C86FCE"); - $this->addSql("ALTER TABLE FeedItems DROP FOREIGN KEY FK_7F9CDFA6BA364942"); - $this->addSql("DROP TABLE Feeds"); - $this->addSql("DROP TABLE FeedPublishers"); - $this->addSql("DROP TABLE AggregateTokens"); - $this->addSql("DROP TABLE FeedEntries"); - $this->addSql("DROP TABLE FeedItems"); - $this->addSql("DROP TABLE FeedTokens"); - } -} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha8.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha8.php deleted file mode 100644 index 90addd13b6..0000000000 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version390alpha8.php +++ /dev/null @@ -1,28 +0,0 @@ -abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - - $this->addSql("CREATE TABLE IF NOT EXISTS Tasks (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, jobId VARCHAR(255) NOT NULL, settings LONGTEXT NOT NULL, completed TINYINT(1) NOT NULL, status VARCHAR(255) NOT NULL, crashed INT NOT NULL, single_run TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, last_execution DATETIME DEFAULT NULL, period INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); - } - - public function down(Schema $schema) - { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - - $this->addSql("DROP TABLE Tasks"); - } -} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version360alpha1.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/WorkzoneMigration.php similarity index 80% rename from lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version360alpha1.php rename to lib/Alchemy/Phrasea/Setup/DoctrineMigrations/WorkzoneMigration.php index c429b80ecd..846b2622a8 100644 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/Version360alpha1.php +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/WorkzoneMigration.php @@ -1,20 +1,22 @@ abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("CREATE TABLE IF NOT EXISTS Baskets (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(128) NOT NULL, description LONGTEXT DEFAULT NULL, usr_id INT NOT NULL, is_read TINYINT(1) NOT NULL, pusher_id INT DEFAULT NULL, archived TINYINT(1) NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE IF NOT EXISTS StoryWZ (id INT AUTO_INCREMENT NOT NULL, sbas_id INT NOT NULL, record_id INT NOT NULL, usr_id INT NOT NULL, created DATETIME NOT NULL, UNIQUE INDEX user_story (usr_id, sbas_id, record_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE IF NOT EXISTS ValidationSessions (id INT AUTO_INCREMENT NOT NULL, basket_id INT DEFAULT NULL, initiator_id INT NOT NULL, created DATETIME NOT NULL, updated DATETIME NOT NULL, expires DATETIME DEFAULT NULL, UNIQUE INDEX UNIQ_5B9DFB061BE1FB52 (basket_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); @@ -28,25 +30,18 @@ class Version360alpha1 extends AbstractMigration $this->addSql("ALTER TABLE ValidationParticipants ADD CONSTRAINT FK_17850D7BF25B0F5B FOREIGN KEY (ValidationSession_id) REFERENCES ValidationSessions (id)"); } - public function down(Schema $schema) + public function doDownSql(Schema $schema) { - // this down() migration is auto-generated, please modify it to your needs - $this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql", "Migration can only be executed safely on 'mysql'."); - $this->addSql("ALTER TABLE ValidationSessions DROP FOREIGN KEY FK_5B9DFB061BE1FB52"); - $this->addSql("ALTER TABLE Orders DROP FOREIGN KEY FK_E283F8D81BE1FB52"); $this->addSql("ALTER TABLE BasketElements DROP FOREIGN KEY FK_C0B7ECB71BE1FB52"); $this->addSql("ALTER TABLE ValidationParticipants DROP FOREIGN KEY FK_17850D7BF25B0F5B"); - $this->addSql("ALTER TABLE OrderElements DROP FOREIGN KEY FK_8C7066C88D9F6D38"); $this->addSql("ALTER TABLE ValidationDatas DROP FOREIGN KEY FK_70E84DDCE989605"); $this->addSql("ALTER TABLE ValidationDatas DROP FOREIGN KEY FK_70E84DDC9D1C3019"); $this->addSql("DROP TABLE Baskets"); $this->addSql("DROP TABLE StoryWZ"); $this->addSql("DROP TABLE ValidationSessions"); - $this->addSql("DROP TABLE Orders"); $this->addSql("DROP TABLE ValidationDatas"); $this->addSql("DROP TABLE BasketElements"); $this->addSql("DROP TABLE ValidationParticipants"); - $this->addSql("DROP TABLE OrderElements"); } } diff --git a/lib/classes/base.php b/lib/classes/base.php index e68298a654..e1c0af08cf 100644 --- a/lib/classes/base.php +++ b/lib/classes/base.php @@ -827,8 +827,18 @@ abstract class base implements cache_cacheableInterface $success = true; foreach ($list_patches as $patch) { - if ( ! $patch->apply($this, $app)) + foreach($patch->getDoctrineMigrations() as $doctrineVersion) { + $version = $app['doctrine-migration.configuration']->getVersion($doctrineVersion); + $version->getMigration()->setEntityManager($app['EM']); + if (false === $version->isMigrated()) { + $version->execute('up'); + } + } + + if (false === $patch->apply($this, $app)) { $success = false; + } + $upgrader->add_steps_complete(1); } diff --git a/lib/classes/module/console/systemUpgrade.php b/lib/classes/module/console/systemUpgrade.php index d4ba3a18df..fabe3bb7de 100644 --- a/lib/classes/module/console/systemUpgrade.php +++ b/lib/classes/module/console/systemUpgrade.php @@ -68,11 +68,15 @@ class module_console_systemUpgrade extends Command try { $upgrader = new Setup_Upgrade($this->container, $input->getOption('force')); + $queries = $this->getService('phraseanet.appbox')->forceUpgrade($upgrader, $this->container); } catch (\Exception_Setup_FixBadEmailAddresses $e) { return $output->writeln(sprintf('You have to fix your database before upgrade with the system:mailCheck command ')); + } catch (\Exception $e) { + $output->write(''.$e->getMessage().'', true); + var_dump($e->getTraceAsString()); } - $queries = $this->getService('phraseanet.appbox')->forceUpgrade($upgrader, $this->container); + if ($input->getOption('dump')) { if (0 < count($queries)) { diff --git a/lib/classes/patch/320alpha1a.php b/lib/classes/patch/320alpha1a.php index 607a442a0c..71531b870b 100644 --- a/lib/classes/patch/320alpha1a.php +++ b/lib/classes/patch/320alpha1a.php @@ -11,49 +11,49 @@ use Alchemy\Phrasea\Application; -/** - * - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_320alpha1a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.2.0-alpha.1'; - /** - * - * @var Array - */ - private $concern = [base::DATA_BOX]; + /** @var Array */ + private $concern = array(base::DATA_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $databox, Application $app) { $sql = 'UPDATE record SET parent_record_id = "1" diff --git a/lib/classes/patch/320alpha1b.php b/lib/classes/patch/320alpha1b.php index bebc0481b9..182705482a 100644 --- a/lib/classes/patch/320alpha1b.php +++ b/lib/classes/patch/320alpha1b.php @@ -11,48 +11,49 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_320alpha1b implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.2.0-alpha.1'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var Array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $appbox, Application $app) { $sql = 'REPLACE INTO records_rights diff --git a/lib/classes/patch/320alpha2a.php b/lib/classes/patch/320alpha2a.php index e8c9c67da8..6eeb9766e6 100644 --- a/lib/classes/patch/320alpha2a.php +++ b/lib/classes/patch/320alpha2a.php @@ -11,48 +11,49 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_320alpha2a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.2.0-alpha.2'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $appbox, Application $app) { $sql = 'SELECT * FROM usr WHERE nonce IS NULL'; @@ -65,7 +66,7 @@ class patch_320alpha2a implements patchInterface $stmt = $appbox->get_connection()->prepare($sql); foreach ($rs as $row) { $nonce = random::generatePassword(16); - $params = [':usr_id' => $row['usr_id'], ':nonce' => $nonce]; + $params = array(':usr_id' => $row['usr_id'], ':nonce' => $nonce); $stmt->execute($params); } $stmt->closeCursor(); @@ -82,10 +83,10 @@ class patch_320alpha2a implements patchInterface if (strpos($row['class'], 'task_period_') !== false) continue; - $params = [ + $params = array( ':task_id' => $row['task_id'] , ':class' => str_replace('task_', 'task_period_', $row['class']) - ]; + ); $stmt->execute($params); } diff --git a/lib/classes/patch/320alpha3a.php b/lib/classes/patch/320alpha3a.php index 9fa14b3821..b0b99ec4ce 100644 --- a/lib/classes/patch/320alpha3a.php +++ b/lib/classes/patch/320alpha3a.php @@ -11,48 +11,49 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_320alpha3a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.2.0-alpha.3'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $appbox, Application $app) { $sql = 'UPDATE basusr SET nowatermark=1 WHERE needwatermark=0'; diff --git a/lib/classes/patch/320alpha4a.php b/lib/classes/patch/320alpha4a.php index 89d4118a50..329c92eeea 100644 --- a/lib/classes/patch/320alpha4a.php +++ b/lib/classes/patch/320alpha4a.php @@ -11,48 +11,49 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_320alpha4a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.2.0-alpha.4'; - /** - * - * @var Array - */ - private $concern = [base::DATA_BOX]; + /** @var array */ + private $concern = array(base::DATA_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $databox, Application $app) { $sql = 'TRUNCATE metadatas'; @@ -70,7 +71,7 @@ class patch_320alpha4a implements patchInterface $stmt->execute(); $stmt->closeCursor(); - $phrasea_maps = [ + $phrasea_maps = array( 'pdftext' => 'Phraseanet:pdftext' , 'tf-archivedate' => 'Phraseanet:tf-archivedate' , 'tf-atime' => 'Phraseanet:tf-atime' @@ -89,7 +90,7 @@ class patch_320alpha4a implements patchInterface , 'tf-recordid' => 'Phraseanet:tf-recordid' , 'tf-size' => 'Phraseanet:tf-size' , 'tf-width' => 'Phraseanet:tf-width' - ]; + ); $sxe = $databox->get_sxml_structure(); $dom_struct = $databox->get_dom_structure(); diff --git a/lib/classes/patch/320alpha4b.php b/lib/classes/patch/320alpha4b.php index 92d55286f1..9e939c0fec 100644 --- a/lib/classes/patch/320alpha4b.php +++ b/lib/classes/patch/320alpha4b.php @@ -15,55 +15,54 @@ use Alchemy\Phrasea\Model\Entities\FeedEntry; use Alchemy\Phrasea\Model\Entities\FeedItem; use Alchemy\Phrasea\Model\Entities\FeedPublisher; use Gedmo\Timestampable\TimestampableListener; +use Doctrine\ORM\Query\ResultSetMapping; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_320alpha4b implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.2.0-alpha.4'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('feed'); + } + + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return true; } /** - * - * @return Array + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release); - $version->execute('up'); - $feeds = array(); try { @@ -120,7 +119,7 @@ class patch_320alpha4b implements patchInterface $sql = 'SELECT sselcont_id, ssel_id, base_id, record_id FROM sselcont WHERE ssel_id = :ssel_id ORDER BY ord ASC'; $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute([':ssel_id' => $row['ssel_id']]); + $stmt->execute(array(':ssel_id' => $row['ssel_id'])); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -143,7 +142,7 @@ class patch_320alpha4b implements patchInterface $sql = 'UPDATE ssel SET deleted = "1", migrated="1" WHERE ssel_id = :ssel_id'; $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute([':ssel_id' => $row['ssel_id']]); + $stmt->execute(array(':ssel_id' => $row['ssel_id'])); $stmt->closeCursor(); $app['EM']->persist($feed); $n++; @@ -171,7 +170,7 @@ class patch_320alpha4b implements patchInterface return; } - protected static $feeds = []; + protected static $feeds = array(); protected function get_feed(appbox $appbox, User_Adapter $user, $pub_restrict, $homelink, Application $app) { @@ -204,9 +203,9 @@ class patch_320alpha4b implements patchInterface if ($homelink) { $feed->setPublic(true); - $app['EM']->persist($feed); - $app['EM']->persist($user); - $app['EM']->flush(); + $app['EM']->persist($feed); + $app['EM']->persist($user); + $app['EM']->flush(); } elseif ($pub_restrict == 1) { $collections = $app['acl']->get($user)->get_granted_base(); diff --git a/lib/classes/patch/320alpha5a.php b/lib/classes/patch/320alpha5a.php index 2ed2a46ddb..dfb4647cf7 100644 --- a/lib/classes/patch/320alpha5a.php +++ b/lib/classes/patch/320alpha5a.php @@ -11,51 +11,51 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_320alpha5a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.2.0-alpha.5'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $appbox, Application $app) { - $sql = 'SELECT base_id, usr_id FROM order_masters'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); @@ -67,10 +67,10 @@ class patch_320alpha5a implements patchInterface $stmt = $appbox->get_connection()->prepare($sql); foreach ($rs as $row) { - $params = [ + $params = array( ':base_id' => $row['base_id'], ':usr_id' => $row['usr_id'] - ]; + ); $stmt->execute($params); } diff --git a/lib/classes/patch/320alpha6a.php b/lib/classes/patch/320alpha6a.php index 9261b936c8..3276ce6d9a 100644 --- a/lib/classes/patch/320alpha6a.php +++ b/lib/classes/patch/320alpha6a.php @@ -11,48 +11,50 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ + class patch_320alpha6a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.2.0-alpha.6'; - /** - * - * @var Array - */ - private $concern = [base::DATA_BOX]; + /** @var array */ + private $concern = array(base::DATA_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $databox, Application $app) { $sql = 'UPDATE record r, subdef s diff --git a/lib/classes/patch/320alpha8a.php b/lib/classes/patch/320alpha8a.php index 0b6a404c64..fbb90ef1b2 100644 --- a/lib/classes/patch/320alpha8a.php +++ b/lib/classes/patch/320alpha8a.php @@ -11,48 +11,50 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ + class patch_320alpha8a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.2.0-alpha.8'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return true; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $appbox, Application $app) { $sql = 'DELETE FROM basusr WHERE actif = "0"'; diff --git a/lib/classes/patch/360alpha1a.php b/lib/classes/patch/360alpha1a.php index b6b18949f0..2a564e654f 100644 --- a/lib/classes/patch/360alpha1a.php +++ b/lib/classes/patch/360alpha1a.php @@ -13,53 +13,52 @@ use Alchemy\Phrasea\Application; use Doctrine\DBAL\Migrations\Configuration\Configuration; use Doctrine\DBAL\DriverManager; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ + class patch_360alpha1a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.6.0-alpha.1'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return true; } /** - * - * @return Array + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('workzone', 'session'); + } + + /** + * {@inheritdoc} + */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release); - $version->execute('up'); - $tables = array('StoryWZ', 'ValidationDatas', 'ValidationParticipants', 'ValidationSessions', 'BasketElements', 'Baskets'); foreach ($tables as $table) { @@ -69,7 +68,7 @@ class patch_360alpha1a implements patchInterface $stmt->closeCursor(); } - $stories = []; + $stories = array(); $sql = 'SELECT sbas_id, rid as record_id, usr_id FROM ssel @@ -80,7 +79,7 @@ class patch_360alpha1a implements patchInterface $rs_s = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $current = []; + $current = array(); foreach ($rs_s as $row_story) { $serial = $row_story['sbas_id'] . '_' . $row_story['usr_id'] . '_' . $row_story['record_id']; @@ -99,11 +98,11 @@ class patch_360alpha1a implements patchInterface $stmt = $appbox->get_connection()->prepare($sql); foreach ($stories as $row) { - $params = [ + $params = array( ':usr_id' => $row['usr_id'], ':sbas_id' => $row['sbas_id'], ':record_id' => $row['record_id'] - ]; + ); $stmt->execute($params); } @@ -138,7 +137,7 @@ class patch_360alpha1a implements patchInterface $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $sselcont_ids = []; + $sselcont_ids = array(); foreach ($rs as $row) { $sql = 'SELECT c.sselcont_id, c.record_id, b.sbas_id @@ -147,11 +146,11 @@ class patch_360alpha1a implements patchInterface AND c.ssel_id = :ssel_id AND s.ssel_id = c.ssel_id'; $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute([':ssel_id' => $row['ssel_id']]); + $stmt->execute(array(':ssel_id' => $row['ssel_id'])); $rs_be = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $current = []; + $current = array(); foreach ($rs_be as $row_sselcont) { $serial = $row_sselcont['sbas_id'] . '_' . $row_sselcont['record_id']; @@ -168,7 +167,7 @@ class patch_360alpha1a implements patchInterface $stmt = $appbox->get_connection()->prepare($sql); foreach ($sselcont_ids as $sselcont_id) { - $stmt->execute([':sselcont_id' => $sselcont_id]); + $stmt->execute(array(':sselcont_id' => $sselcont_id)); } $stmt->closeCursor(); @@ -237,11 +236,11 @@ class patch_360alpha1a implements patchInterface )'; $stmt = $appbox->get_connection()->prepare($sql); foreach ($rs as $row) { - $params = [ + $params = array( ':participant_id' => $row['participant_id'], ':basket_id' => $row['basket_id'], ':usr_id' => $row['usr_id'], - ]; + ); $stmt->execute($params); } diff --git a/lib/classes/patch/360alpha1b.php b/lib/classes/patch/360alpha1b.php index 09009c2d8d..378cd0e75b 100644 --- a/lib/classes/patch/360alpha1b.php +++ b/lib/classes/patch/360alpha1b.php @@ -11,48 +11,50 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ + class patch_360alpha1b implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.6.0-alpha.1'; - /** - * - * @var Array - */ - private $concern = [base::DATA_BOX]; + /** @var array */ + private $concern = array(base::DATA_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $databox, Application $app) { try { diff --git a/lib/classes/patch/360alpha2a.php b/lib/classes/patch/360alpha2a.php index 6470be88a8..4283f568c2 100644 --- a/lib/classes/patch/360alpha2a.php +++ b/lib/classes/patch/360alpha2a.php @@ -11,48 +11,50 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ + class patch_360alpha2a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.6.0-alpha.2'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return true; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $appbox, Application $app) { diff --git a/lib/classes/patch/360alpha2b.php b/lib/classes/patch/360alpha2b.php index 239ee3e773..f017d028d1 100644 --- a/lib/classes/patch/360alpha2b.php +++ b/lib/classes/patch/360alpha2b.php @@ -11,48 +11,50 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ + class patch_360alpha2b implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.6.0-alpha.2'; - /** - * - * @var Array - */ - private $concern = [base::DATA_BOX]; + /** @var array */ + private $concern = array(base::DATA_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return true; } /** - * - * @return Array + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $databox, Application $app) { /** @@ -119,7 +121,7 @@ class patch_360alpha2b implements patchInterface VALUES (null, :record_id, :meta_struct_id, :value)'; $stmt = $databox->get_connection()->prepare($sql); - $databox_fields = []; + $databox_fields = array(); foreach ($rs as $row) { $meta_struct_id = $row['meta_struct_id']; @@ -131,11 +133,11 @@ class patch_360alpha2b implements patchInterface $values = \caption_field::get_multi_values($row['value'], $databox_fields[$meta_struct_id]->get_separator()); foreach ($values as $value) { - $params = [ + $params = array( ':record_id' => $row['record_id'], ':meta_struct_id' => $row['meta_struct_id'], ':value' => $value, - ]; + ); $stmt->execute($params); } } @@ -146,7 +148,7 @@ class patch_360alpha2b implements patchInterface $stmt = $databox->get_connection()->prepare($sql); foreach ($rs as $row) { - $params = [':id' => $row['id']]; + $params = array(':id' => $row['id']); $stmt->execute($params); } diff --git a/lib/classes/patch/361alpha1a.php b/lib/classes/patch/361alpha1a.php index 4fa4563196..c620a9f7fc 100644 --- a/lib/classes/patch/361alpha1a.php +++ b/lib/classes/patch/361alpha1a.php @@ -12,48 +12,50 @@ use Alchemy\Phrasea\Application; use Doctrine\ORM\Tools\Pagination\Paginator; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ + class patch_361alpha1a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.6.1-alpha.1'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { - return false; + return true; } /** - * - * @return Array + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('workzone'); + } + + /** + * {@inheritdoc} + */ public function apply(base $appbox, Application $app) { $conn = $appbox->get_connection(); @@ -77,7 +79,7 @@ class patch_361alpha1a implements patchInterface $sql = 'SELECT record_id FROM record WHERE record_id = :record_id'; $stmt = $connbas->prepare($sql); - $stmt->execute([':record_id' => $row['record_id']]); + $stmt->execute(array(':record_id' => $row['record_id'])); $rowCount = $stmt->rowCount(); $stmt->closeCursor(); diff --git a/lib/classes/patch/370alpha1a.php b/lib/classes/patch/370alpha1a.php index 86c29a004a..23e163345b 100644 --- a/lib/classes/patch/370alpha1a.php +++ b/lib/classes/patch/370alpha1a.php @@ -11,48 +11,50 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ + class patch_370alpha1a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.7.0-alpha.1'; - /** - * - * @var Array - */ - private $concern = [base::DATA_BOX]; + /** @var array */ + private $concern = array(base::DATA_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $databox, Application $app) { $conn = $databox->get_connection(); @@ -84,7 +86,7 @@ class patch_370alpha1a implements patchInterface $sql = 'UPDATE pref SET value = :structure WHERE prop = "structure"'; $stmt = $conn->prepare($sql); - $stmt->execute([':structure' => $DOMDocument->saveXML()]); + $stmt->execute(array(':structure' => $DOMDocument->saveXML())); $stmt->closeCursor(); return true; diff --git a/lib/classes/patch/370alpha3a.php b/lib/classes/patch/370alpha3a.php index c0f34b3a96..5c793ce1a3 100644 --- a/lib/classes/patch/370alpha3a.php +++ b/lib/classes/patch/370alpha3a.php @@ -12,24 +12,13 @@ use Alchemy\Phrasea\Application; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_370alpha3a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.7.0-alpha.3'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** * @@ -40,20 +29,33 @@ class patch_370alpha3a implements patchInterface return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $appbox, Application $app) { try { diff --git a/lib/classes/patch/370alpha4a.php b/lib/classes/patch/370alpha4a.php index a9393c1267..2ea61bed89 100644 --- a/lib/classes/patch/370alpha4a.php +++ b/lib/classes/patch/370alpha4a.php @@ -11,48 +11,49 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_370alpha4a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.7.0-alpha.4'; - /** - * - * @var Array - */ - private $concern = [base::DATA_BOX]; + /** @var array */ + private $concern = array(base::DATA_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} + */ public function apply(base $databox, Application $app) { $sql = 'SELECT id, src FROM metadatas_structure'; @@ -61,7 +62,7 @@ class patch_370alpha4a implements patchInterface $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $update = []; + $update = array(); $tagDirname = new \Alchemy\Phrasea\Metadata\Tag\TfDirname(); $tagBasename = new \Alchemy\Phrasea\Metadata\Tag\TfBasename(); @@ -69,10 +70,10 @@ class patch_370alpha4a implements patchInterface foreach ($rs as $row) { if (strpos(strtolower($row['src']), 'tf-parentdir') !== false) { - $update[] = ['id' => $row['id'], 'src' => $tagDirname->getTagname()]; + $update[] = array('id' => $row['id'], 'src' => $tagDirname->getTagname()); } if (strpos(strtolower($row['src']), 'tf-filename') !== false) { - $update[] = ['id' => $row['id'], 'src' => $tagBasename->getTagname()]; + $update[] = array('id' => $row['id'], 'src' => $tagBasename->getTagname()); } } @@ -80,7 +81,7 @@ class patch_370alpha4a implements patchInterface $stmt = $databox->get_connection()->prepare($sql); foreach ($update as $row) { - $stmt->execute([':src' => $row['src'], ':id' => $row['id']]); + $stmt->execute(array(':src' => $row['src'], ':id' => $row['id'])); } $stmt->closeCursor(); diff --git a/lib/classes/patch/370alpha5a.php b/lib/classes/patch/370alpha5a.php index aa31ffcd10..797ea2661c 100644 --- a/lib/classes/patch/370alpha5a.php +++ b/lib/classes/patch/370alpha5a.php @@ -11,48 +11,49 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_370alpha5a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.7.0-alpha.5'; - /** - * - * @var Array - */ - private $concern = [base::DATA_BOX]; + /** @var array */ + private $concern = array(base::DATA_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} + */ public function apply(base $databox, Application $app) { @@ -62,20 +63,20 @@ class patch_370alpha5a implements patchInterface $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $update = []; + $update = array(); foreach ($rs as $row) { $src = str_replace( - ['/rdf:RDF/rdf:Description/PHRASEANET:', '/rdf:RDF/rdf:Description/'], ['Phraseanet:', ''], $row['src'] + array('/rdf:RDF/rdf:Description/PHRASEANET:', '/rdf:RDF/rdf:Description/'), array('Phraseanet:', ''), $row['src'] ); - $update[] = ['id' => $row['id'], 'src' => $src]; + $update[] = array('id' => $row['id'], 'src' => $src); } $sql = 'UPDATE metadatas_structure SET src = :src WHERE id = :id'; $stmt = $databox->get_connection()->prepare($sql); foreach ($update as $row) { - $stmt->execute([':src' => $row['src'], ':id' => $row['id']]); + $stmt->execute(array(':src' => $row['src'], ':id' => $row['id'])); } $stmt->closeCursor(); diff --git a/lib/classes/patch/370alpha6a.php b/lib/classes/patch/370alpha6a.php index 0d80e5d2d3..d8073d9ba3 100644 --- a/lib/classes/patch/370alpha6a.php +++ b/lib/classes/patch/370alpha6a.php @@ -11,48 +11,49 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_370alpha6a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.7.0-alpha.6'; - /** - * - * @var Array - */ - private $concern = [base::DATA_BOX]; + /** @var array */ + private $concern = array(base::DATA_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} + */ public function apply(base $databox, Application $app) { $structure = $databox->get_structure(); @@ -80,7 +81,7 @@ class patch_370alpha6a implements patchInterface $this->addScreenDeviceOption($subdefgroups, $subdef, $groupname); - if (in_array($name, ['preview', 'thumbnail'])) { + if (in_array($name, array('preview', 'thumbnail'))) { if ($name == 'thumbnail' || $subdef->getSubdefType()->getType() != \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO) { $this->addMobileSubdefImage($subdefgroups, $subdef, $groupname); @@ -104,7 +105,7 @@ class patch_370alpha6a implements patchInterface { $optionsSubdef = $subdef->getOptions(); - $options = []; + $options = array(); foreach ($optionsSubdef as $optname => $option) { $options[$optname] = $option->getValue(); @@ -113,19 +114,19 @@ class patch_370alpha6a implements patchInterface $options['path'] = $subdef->get_path(); $options['mediatype'] = $subdef->getSubdefType()->getType(); $options['meta'] = $subdef->meta_writeable() ? 'yes' : 'no'; - $options['devices'] = [databox_subdef::DEVICE_SCREEN]; + $options['devices'] = array(databox_subdef::DEVICE_SCREEN); - $root->set_subdef($groupname, $subdef->get_name(), $subdef->get_class(), $subdef->is_downloadable(), $options, []); + $root->set_subdef($groupname, $subdef->get_name(), $subdef->get_class(), $subdef->is_downloadable(), $options, array()); } protected function addMobileSubdefVideo($root, $baseSubdef, $groupname) { - $newSubdefOptionsWebM = $newSubdefOptionsOgg = $newSubdefOptionsX264 = [ + $newSubdefOptionsWebM = $newSubdefOptionsOgg = $newSubdefOptionsX264 = array( 'path' => $baseSubdef->get_path(), 'mediatype' => \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO - ]; + ); - $options = [ + $options = array( 'path' => $baseSubdef->get_path(), 'mediatype' => \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO, 'bitrate' => '300', @@ -133,8 +134,8 @@ class patch_370alpha6a implements patchInterface 'GOPsize' => '25', 'size' => '480', 'fps' => '15', - 'devices' => [databox_subdef::DEVICE_HANDHELD], - ]; + 'devices' => array(databox_subdef::DEVICE_HANDHELD), + ); foreach ($options as $name => $value) { $newSubdefOptionsWebM[$name] = $value; @@ -151,14 +152,14 @@ class patch_370alpha6a implements patchInterface $newSubdefOptionsX264['acodec'] = 'libvo_aacenc'; $newSubdefOptionsX264['vcodec'] = 'libx264'; - $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_webM', $baseSubdef->get_class(), false, $newSubdefOptionsWebM, []); - $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg, []); - $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_X264', $baseSubdef->get_class(), false, $newSubdefOptionsX264, []); + $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_webM', $baseSubdef->get_class(), false, $newSubdefOptionsWebM, array()); + $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg, array()); + $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_X264', $baseSubdef->get_class(), false, $newSubdefOptionsX264, array()); } protected function addMobileSubdefImage($root, $baseSubdef, $groupname) { - $optionMobile = []; + $optionMobile = array(); $optionMobile['size'] = $baseSubdef->get_name() == 'thumbnail' ? '150' : '480'; $optionMobile['resolution'] = '72'; @@ -168,18 +169,18 @@ class patch_370alpha6a implements patchInterface $optionMobile['mediatype'] = \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_IMAGE; $optionMobile['meta'] = 'no'; - $optionMobile['devices'] = [databox_subdef::DEVICE_HANDHELD]; + $optionMobile['devices'] = array(databox_subdef::DEVICE_HANDHELD); - $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile', $baseSubdef->get_class(), false, $optionMobile, []); + $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile', $baseSubdef->get_class(), false, $optionMobile, array()); } protected function addHtml5Video($root, $baseSubdef, $groupname) { - $newSubdefOptionsWebM = $newSubdefOptionsOgg = [ + $newSubdefOptionsWebM = $newSubdefOptionsOgg = array( 'path' => $baseSubdef->get_path(), 'mediatype' => \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO, - 'devices' => [\databox_subdef::DEVICE_SCREEN] - ]; + 'devices' => array(\databox_subdef::DEVICE_SCREEN) + ); foreach ($baseSubdef->getOptions() as $optionname => $option) { $newSubdefOptionsWebM[$optionname] = $option->getValue(); @@ -192,7 +193,7 @@ class patch_370alpha6a implements patchInterface $newSubdefOptionsOgg['vcodec'] = 'libtheora'; $newSubdefOptionsOgg['acodec'] = 'libvorbis'; - $root->set_subdef($groupname, $baseSubdef->get_name() . '_webM', $baseSubdef->get_class(), false, $newSubdefOptionsWebM, []); - $root->set_subdef($groupname, $baseSubdef->get_name() . '_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg, []); + $root->set_subdef($groupname, $baseSubdef->get_name() . '_webM', $baseSubdef->get_class(), false, $newSubdefOptionsWebM, array()); + $root->set_subdef($groupname, $baseSubdef->get_name() . '_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg, array()); } } diff --git a/lib/classes/patch/370alpha7a.php b/lib/classes/patch/370alpha7a.php index 427cce5a68..1d370dcffe 100644 --- a/lib/classes/patch/370alpha7a.php +++ b/lib/classes/patch/370alpha7a.php @@ -15,53 +15,51 @@ use Alchemy\Phrasea\Model\Entities\LazaretSession; use MediaAlchemyst\Exception\ExceptionInterface as MediaAlchemystException; use MediaAlchemyst\Specification\Image as ImageSpec; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_370alpha7a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.7.0-alpha.7'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('lazaret'); + } + + /** + * {@inheritdoc} + */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release); - $version->execute('up'); - $conn = $appbox->get_connection(); try { diff --git a/lib/classes/patch/370alpha8a.php b/lib/classes/patch/370alpha8a.php index 39013c4fae..815c6ba638 100644 --- a/lib/classes/patch/370alpha8a.php +++ b/lib/classes/patch/370alpha8a.php @@ -12,48 +12,43 @@ use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Model\Entities\Task; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_370alpha8a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.7.0-alpha.8'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} */ public function concern() { return $this->concern; } + public function getDoctrineMigrations() + { + return array('task'); + } + /** * transform tasks 'workflow 01' to 'RecordMover' * will group tasks(01) with same period to a single task(02) @@ -65,9 +60,6 @@ class patch_370alpha8a implements patchInterface */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release); - $version->execute('up'); - $ttasks = array(); $conn = $appbox->get_connection(); $sql = 'SELECT task_id, active, name, class, settings FROM task2 WHERE class=\'task_period_workflow01\''; @@ -77,11 +69,11 @@ class patch_370alpha8a implements patchInterface $stmt->closeCursor(); } - $tdom = []; // key = period - $taskstodel = []; + $tdom = array(); // key = period + $taskstodel = array(); foreach ($ttasks as $task) { $active = true; - $warning = []; + $warning = array(); /* * migrating task 'workflow01' @@ -98,7 +90,7 @@ class patch_370alpha8a implements patchInterface $ts->appendChild($dom->createElement('period'))->appendChild($dom->createTextNode(60 * $period)); $ts->appendChild($dom->createElement('logsql'))->appendChild($dom->createTextNode('1')); $tasks = $ts->appendChild($dom->createElement('tasks')); - $tdom['_' . $period] = ['dom' => $dom, 'tasks' => $tasks]; + $tdom['_' . $period] = array('dom' => $dom, 'tasks' => $tasks); } else { $dom = &$tdom['_' . $period]['dom']; $tasks = &$tdom['_' . $period]['tasks']; diff --git a/lib/classes/patch/370alpha9a.php b/lib/classes/patch/370alpha9a.php index 802da59f3e..7077217848 100644 --- a/lib/classes/patch/370alpha9a.php +++ b/lib/classes/patch/370alpha9a.php @@ -11,42 +11,40 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_370alpha9a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.7.0-alpha.9'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { @@ -54,8 +52,7 @@ class patch_370alpha9a implements patchInterface } /** - * @param base $appbox - * @param Application $app + * {@inheritdoc} */ public function apply(base $appbox, Application $app) { diff --git a/lib/classes/patch/3715alpha1a.php b/lib/classes/patch/3715alpha1a.php index 15590a63d9..4e861ef5e7 100644 --- a/lib/classes/patch/3715alpha1a.php +++ b/lib/classes/patch/3715alpha1a.php @@ -19,29 +19,35 @@ class patch_3715alpha1a implements patchInterface */ private $release = '3.7.15-alpha1'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { @@ -49,7 +55,7 @@ class patch_3715alpha1a implements patchInterface } /** - * @param base $databox + * {@inheritdoc} */ public function apply(base $appbox, Application $app) { diff --git a/lib/classes/patch/371alpha1a.php b/lib/classes/patch/371alpha1a.php index 7a5a0431a1..5eaaa5bb11 100644 --- a/lib/classes/patch/371alpha1a.php +++ b/lib/classes/patch/371alpha1a.php @@ -11,42 +11,32 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_371alpha1a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.7.1-alpha1'; - /** - * - * @var Array - */ - private $concern = [base::DATA_BOX]; + /** @var array */ + private $concern = array(base::DATA_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} */ public function concern() { @@ -54,8 +44,15 @@ class patch_371alpha1a implements patchInterface } /** - * @param base $databox - * @param Application $app + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function apply(base $databox, Application $app) { diff --git a/lib/classes/patch/373alpha1a.php b/lib/classes/patch/373alpha1a.php index 0fe5008d5e..2d5a47162f 100644 --- a/lib/classes/patch/373alpha1a.php +++ b/lib/classes/patch/373alpha1a.php @@ -11,42 +11,40 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_373alpha1a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.7.3-alpha.1'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { @@ -54,15 +52,14 @@ class patch_373alpha1a implements patchInterface } /** - * @param base $appbox - * @param Application $app + * {@inheritdoc} */ public function apply(base $appbox, Application $app) { $sql = 'SELECT * FROM registry WHERE `key` = :key'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); - $Regbinaries = [ + $Regbinaries = array( 'GV_cli', 'GV_swf_extract', 'GV_pdf2swf', @@ -72,9 +69,9 @@ class patch_373alpha1a implements patchInterface 'GV_ffprobe', 'GV_mp4box', 'GV_pdftotext', - ]; + ); - $mapping = [ + $mapping = array( 'GV_cli' => 'php_binary', 'GV_swf_extract' => 'swf_extract_binary', 'GV_pdf2swf' => 'pdf2swf_binary', @@ -84,12 +81,12 @@ class patch_373alpha1a implements patchInterface 'GV_ffprobe' => 'ffprobe_binary', 'GV_mp4box' => 'mp4box_binary', 'GV_pdftotext' => 'pdftotext_binary', - ]; + ); - $binaries = ['ghostscript_binary' => null]; + $binaries = array('ghostscript_binary' => null); foreach ($Regbinaries as $name) { - $stmt->execute([':key' => $name]); + $stmt->execute(array(':key' => $name)); $row = $stmt->fetch(\PDO::FETCH_ASSOC); $value = is_executable($row['value']) ? $row['value'] : null; @@ -105,14 +102,14 @@ class patch_373alpha1a implements patchInterface $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); foreach ($Regbinaries as $name) { - $stmt->execute([':key' => $name]); + $stmt->execute(array(':key' => $name)); } $stmt->closeCursor(); $sql = 'SELECT value FROM registry WHERE `key` = :key'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute([':key'=>'GV_sit']); + $stmt->execute(array(':key'=>'GV_sit')); $row = $stmt->fetch(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -122,7 +119,7 @@ class patch_373alpha1a implements patchInterface $sql = 'DELETE FROM registry WHERE `key` = :key'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute([':key'=>'GV_sit']); + $stmt->execute(array(':key'=>'GV_sit')); $stmt->closeCursor(); return true; diff --git a/lib/classes/patch/379alpha1a.php b/lib/classes/patch/379alpha1a.php index ae8081c36f..73eec604cc 100644 --- a/lib/classes/patch/379alpha1a.php +++ b/lib/classes/patch/379alpha1a.php @@ -13,35 +13,38 @@ use Alchemy\Phrasea\Application; class patch_379alpha1a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.7.9-alpha1'; - /** - * - * @var Array - */ - private $concern = [base::DATA_BOX]; + /** @var array */ + private $concern = array(base::DATA_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { @@ -49,8 +52,7 @@ class patch_379alpha1a implements patchInterface } /** - * @param base $appbox - * @param Application $app + * {@inheritdoc} */ public function apply(base $appbox, Application $app) { diff --git a/lib/classes/patch/380alpha10a.php b/lib/classes/patch/380alpha10a.php index e053f87d21..dc48fa2f64 100644 --- a/lib/classes/patch/380alpha10a.php +++ b/lib/classes/patch/380alpha10a.php @@ -27,6 +27,14 @@ class patch_380alpha10a implements patchInterface return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/380alpha11a.php b/lib/classes/patch/380alpha11a.php index cff56183d5..8bae4e5adf 100644 --- a/lib/classes/patch/380alpha11a.php +++ b/lib/classes/patch/380alpha11a.php @@ -45,14 +45,19 @@ class patch_380alpha11a implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('session'); + } + /** * {@inheritdoc} */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release); - $version->execute('up'); - try { $sql = 'SELECT usr_id, user_agent, ip, platform, browser, app, browser_version, screen, token, nonce, lastaccess, created_on diff --git a/lib/classes/patch/380alpha13a.php b/lib/classes/patch/380alpha13a.php index 3c71683878..9df253a295 100644 --- a/lib/classes/patch/380alpha13a.php +++ b/lib/classes/patch/380alpha13a.php @@ -27,6 +27,14 @@ class patch_380alpha13a implements patchInterface return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/380alpha14a.php b/lib/classes/patch/380alpha14a.php index b94ce3235f..29c07693b5 100644 --- a/lib/classes/patch/380alpha14a.php +++ b/lib/classes/patch/380alpha14a.php @@ -35,6 +35,14 @@ class patch_380alpha14a implements patchInterface return false; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/380alpha15a.php b/lib/classes/patch/380alpha15a.php index 8a541c8b6f..3837f30e18 100644 --- a/lib/classes/patch/380alpha15a.php +++ b/lib/classes/patch/380alpha15a.php @@ -27,6 +27,13 @@ class patch_380alpha15a implements patchInterface return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } /** * {@inheritdoc} */ diff --git a/lib/classes/patch/380alpha16a.php b/lib/classes/patch/380alpha16a.php index 33b54816a6..d39cac4302 100644 --- a/lib/classes/patch/380alpha16a.php +++ b/lib/classes/patch/380alpha16a.php @@ -27,6 +27,14 @@ class patch_380alpha16a implements patchInterface return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/380alpha17a.php b/lib/classes/patch/380alpha17a.php index 810373e371..fe051a4bd7 100644 --- a/lib/classes/patch/380alpha17a.php +++ b/lib/classes/patch/380alpha17a.php @@ -27,6 +27,14 @@ class patch_380alpha17a implements patchInterface return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/380alpha18a.php b/lib/classes/patch/380alpha18a.php index 11725c566e..6f88f0952d 100644 --- a/lib/classes/patch/380alpha18a.php +++ b/lib/classes/patch/380alpha18a.php @@ -28,6 +28,14 @@ class patch_380alpha18a implements patchInterface return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/380alpha2a.php b/lib/classes/patch/380alpha2a.php index 9e9481183d..0b5757bb4e 100644 --- a/lib/classes/patch/380alpha2a.php +++ b/lib/classes/patch/380alpha2a.php @@ -11,42 +11,41 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ + class patch_380alpha2a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.8.0-alpha.2'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { @@ -54,8 +53,7 @@ class patch_380alpha2a implements patchInterface } /** - * @param base $databox - * @param Application $app + * {@inheritdoc} */ public function apply(base $databox, Application $app) { diff --git a/lib/classes/patch/380alpha2b.php b/lib/classes/patch/380alpha2b.php index c472381d87..f0b3805592 100644 --- a/lib/classes/patch/380alpha2b.php +++ b/lib/classes/patch/380alpha2b.php @@ -11,42 +11,41 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ + class patch_380alpha2b implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.8.0-alpha.2'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return true; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { @@ -54,8 +53,7 @@ class patch_380alpha2b implements patchInterface } /** - * @param base $appbox - * @param Application $app + * {@inheritdoc} */ public function apply(base $appbox, Application $app) { diff --git a/lib/classes/patch/380alpha3a.php b/lib/classes/patch/380alpha3a.php index 2145268b39..3b7ab01d32 100644 --- a/lib/classes/patch/380alpha3a.php +++ b/lib/classes/patch/380alpha3a.php @@ -11,49 +11,49 @@ use Alchemy\Phrasea\Application; -/** - * - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_380alpha3a implements patchInterface { - /** - * - * @var string - */ + /** @var string */ private $release = '3.8.0-alpha.3'; - /** - * - * @var Array - */ - private $concern = [base::DATA_BOX]; + /** @var array */ + private $concern = array(base::DATA_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return true; } /** - * - * @return Array + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function concern() { return $this->concern; } + /** + * {@inheritdoc} + */ public function apply(base $databox, Application $app) { $conn = $databox->get_connection(); diff --git a/lib/classes/patch/380alpha3b.php b/lib/classes/patch/380alpha3b.php index 94ec26f94c..d8334fc29b 100644 --- a/lib/classes/patch/380alpha3b.php +++ b/lib/classes/patch/380alpha3b.php @@ -11,43 +11,32 @@ use Alchemy\Phrasea\Application; -/** - * - * @license http://opensource.org/licenses/gpl-3.0 GPLv3 - * @link www.phraseanet.com - */ class patch_380alpha3b implements patchInterface { - - /** - * - * @var string - */ + /** @var string */ private $release = '3.8.0-alpha.3'; - /** - * - * @var Array - */ - private $concern = [base::APPLICATION_BOX]; + /** @var array */ + private $concern = array(base::APPLICATION_BOX); /** - * - * @return string + * {@inheritdoc} */ public function get_release() { return $this->release; } + /** + * {@inheritdoc} + */ public function require_all_upgrades() { return false; } /** - * - * @return Array + * {@inheritdoc} */ public function concern() { @@ -55,8 +44,15 @@ class patch_380alpha3b implements patchInterface } /** - * @param base $appbox - * @param Application $app + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + + /** + * {@inheritdoc} */ public function apply(base $appbox, Application $app) { @@ -64,5 +60,4 @@ class patch_380alpha3b implements patchInterface return true; } - } diff --git a/lib/classes/patch/380alpha4a.php b/lib/classes/patch/380alpha4a.php index abe085ce51..ae543f7cd3 100644 --- a/lib/classes/patch/380alpha4a.php +++ b/lib/classes/patch/380alpha4a.php @@ -44,14 +44,20 @@ class patch_380alpha4a implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('auth-failure'); + } + + /** * {@inheritdoc} */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release); - $version->execute('up'); - $conn = $app['phraseanet.appbox']->get_connection(); $sql = 'SELECT date, login, ip, locked FROM badlog ORDER BY id ASC'; $stmt = $conn->prepare($sql); diff --git a/lib/classes/patch/380alpha6a.php b/lib/classes/patch/380alpha6a.php index d916539d7a..78a7025107 100644 --- a/lib/classes/patch/380alpha6a.php +++ b/lib/classes/patch/380alpha6a.php @@ -43,6 +43,14 @@ class patch_380alpha6a implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/380alpha8a.php b/lib/classes/patch/380alpha8a.php index 03608de2a4..15b4534f8c 100644 --- a/lib/classes/patch/380alpha8a.php +++ b/lib/classes/patch/380alpha8a.php @@ -43,6 +43,14 @@ class patch_380alpha8a implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/380alpha9a.php b/lib/classes/patch/380alpha9a.php index 25b19cbb09..196cf8dbcd 100644 --- a/lib/classes/patch/380alpha9a.php +++ b/lib/classes/patch/380alpha9a.php @@ -43,6 +43,14 @@ class patch_380alpha9a implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/381alpha1a.php b/lib/classes/patch/381alpha1a.php index e40f079c3e..76afb2e895 100644 --- a/lib/classes/patch/381alpha1a.php +++ b/lib/classes/patch/381alpha1a.php @@ -35,6 +35,14 @@ class patch_381alpha1a implements patchInterface return false; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/381alpha1b.php b/lib/classes/patch/381alpha1b.php index 921f83b257..187e05ce05 100644 --- a/lib/classes/patch/381alpha1b.php +++ b/lib/classes/patch/381alpha1b.php @@ -35,6 +35,14 @@ class patch_381alpha1b implements patchInterface return false; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/381alpha2a.php b/lib/classes/patch/381alpha2a.php index 06ae412c32..9f32639910 100644 --- a/lib/classes/patch/381alpha2a.php +++ b/lib/classes/patch/381alpha2a.php @@ -35,6 +35,14 @@ class patch_381alpha2a implements patchInterface return false; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/390alpha1a.php b/lib/classes/patch/390alpha1a.php index 0ea4adfc69..50d690eef6 100644 --- a/lib/classes/patch/390alpha1a.php +++ b/lib/classes/patch/390alpha1a.php @@ -44,14 +44,19 @@ class patch_390alpha1a implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('ftp-credential'); + } + /** * {@inheritdoc} */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release . 'a'); - $version->execute('up'); - $conn = $app['phraseanet.appbox']->get_connection(); $sql = 'SELECT usr_id, activeFTP, addrFTP, loginFTP, retryFTP, passifFTP, pwdFTP, destFTP, prefixFTPfolder diff --git a/lib/classes/patch/390alpha1b.php b/lib/classes/patch/390alpha1b.php index ab02c8169d..a8ad6c5997 100644 --- a/lib/classes/patch/390alpha1b.php +++ b/lib/classes/patch/390alpha1b.php @@ -35,7 +35,7 @@ class patch_390alpha1b implements patchInterface */ public function require_all_upgrades() { - return false; + return true; } /** @@ -46,14 +46,19 @@ class patch_390alpha1b implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('order'); + } + /** * {@inheritdoc} */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release . 'b'); - $version->execute('up'); - $sql = 'DELETE FROM Orders'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha2a.php b/lib/classes/patch/390alpha2a.php index 9696214f25..dcf22b82a8 100644 --- a/lib/classes/patch/390alpha2a.php +++ b/lib/classes/patch/390alpha2a.php @@ -46,14 +46,19 @@ class patch_390alpha2a implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('user'); + } + /** * {@inheritdoc} */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release); - $version->execute('up'); - $sql = 'DELETE FROM Users'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha3a.php b/lib/classes/patch/390alpha3a.php index 1faaf34c77..7526ae5973 100644 --- a/lib/classes/patch/390alpha3a.php +++ b/lib/classes/patch/390alpha3a.php @@ -44,14 +44,19 @@ class patch_390alpha3a implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('user-query'); + } + /** * {@inheritdoc} */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release); - $version->execute('up'); - $sql = 'DELETE FROM UserQueries'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha4a.php b/lib/classes/patch/390alpha4a.php index dbadbbb7f9..9b5b38bdca 100644 --- a/lib/classes/patch/390alpha4a.php +++ b/lib/classes/patch/390alpha4a.php @@ -44,14 +44,19 @@ class patch_390alpha4a implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('user-setting'); + } + /** * {@inheritdoc} */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release); - $version->execute('up'); - $sql = 'DELETE FROM UserSettings'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha5a.php b/lib/classes/patch/390alpha5a.php index 154d43eb17..8a25985882 100644 --- a/lib/classes/patch/390alpha5a.php +++ b/lib/classes/patch/390alpha5a.php @@ -44,14 +44,19 @@ class patch_390alpha5a implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('user-notif-setting'); + } + /** * {@inheritdoc} */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release); - $version->execute('up'); - $sql = 'DELETE FROM UserNotificationSettings'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha6a.php b/lib/classes/patch/390alpha6a.php index c99fedae1a..6ffaa41b70 100644 --- a/lib/classes/patch/390alpha6a.php +++ b/lib/classes/patch/390alpha6a.php @@ -46,14 +46,19 @@ class patch_390alpha6a implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('ftp-export'); + } + /** * {@inheritdoc} */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release); - $version->execute('up'); - $sql = 'DELETE FROM FtpExports'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha7a.php b/lib/classes/patch/390alpha7a.php index 01885b7668..7b10c1ab3b 100644 --- a/lib/classes/patch/390alpha7a.php +++ b/lib/classes/patch/390alpha7a.php @@ -16,6 +16,7 @@ use Alchemy\Phrasea\Model\Entities\FeedEntry; use Alchemy\Phrasea\Model\Entities\FeedItem; use Alchemy\Phrasea\Model\Entities\FeedPublisher; use Alchemy\Phrasea\Model\Entities\FeedToken; +use Doctrine\ORM\Query\ResultSetMapping; class patch_390alpha7a implements patchInterface { @@ -49,13 +50,36 @@ class patch_390alpha7a implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('feed', 'aggregate-token'); + } + /** * {@inheritdoc} */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release); - $version->execute('up'); + $rsm = new ResultSetMapping(); + $rsm->addScalarResult('Name', 'Name'); + + $backup = false; + + foreach ($app['EM']->createNativeQuery('SHOW TABLE STATUS', $rsm)->getResult() as $row) { + if (0 === strcmp('feeds', $row['Name'])) { + $backup = true; + break; + } + } + + if (false === $backup) { + return false; + } + + $app['EM']->executeQuery("RENAME TABLE `feeds` TO `feeds_backup`"); $sql = 'DELETE FROM Feeds'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); @@ -89,22 +113,6 @@ class patch_390alpha7a implements patchInterface $conn = $app['phraseanet.appbox']->get_connection(); - $sql = 'SHOW TABLE STATUS;'; - $stmt = $conn->prepare($sql); - $stmt->execute(); - $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); - - $found = false; - foreach ($rs as $row) { - if ('feeds_backup' === $row['Name']) { - $found = true; - break; - } - } - if (!$found) { - return; - } - $sql = 'SELECT id, title, subtitle, public, created_on, updated_on, base_id FROM feeds_backup;'; $stmt = $conn->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha8a.php b/lib/classes/patch/390alpha8a.php index 94eef2aa1e..89b81bcef2 100644 --- a/lib/classes/patch/390alpha8a.php +++ b/lib/classes/patch/390alpha8a.php @@ -44,14 +44,19 @@ class patch_390alpha8a implements patchInterface return $this->concern; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array('task'); + } + /** * {@inheritdoc} */ public function apply(base $appbox, Application $app) { - $version = $app['doctrine-migration.configuration']->getVersion($this->release); - $version->execute('up'); - $sql = 'DELETE FROM Tasks'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patchInterface.php b/lib/classes/patchInterface.php index 0cf3b4db9e..5d6784529d 100644 --- a/lib/classes/patchInterface.php +++ b/lib/classes/patchInterface.php @@ -4,12 +4,44 @@ use Alchemy\Phrasea\Application; interface patchInterface { - + /** + * Returns the release version. + * + * @return string + */ public function get_release(); + /** + * Returns whether the patch concerns the Application Box or + * the Data Box. + * + * It accepts base::APPLICATION_BOX or base::DATA_BOX value. + * + * @return array + */ public function concern(); + /** + * Tells whether the patch must be run after the others or not. + * + * @return boolean + */ public function require_all_upgrades(); + /** + * Apply patch. + * + * @param base $base The Application Box or the Data Boxes where the patch is applied. + * @param Application $app + * + * @return boolean returns true if the patch succeed. + */ public function apply(base $base, Application $app); + + /** + * Returns doctrine migrations needed for the patch. + * + * @return array + */ + public function getDoctrineMigrations(); } diff --git a/lib/conf.d/migrations.yml b/lib/conf.d/migrations.yml index a7c8e5010b..8b49d630e9 100644 --- a/lib/conf.d/migrations.yml +++ b/lib/conf.d/migrations.yml @@ -4,47 +4,44 @@ table_name: doctrine_migration_versions migrations: migration1: - version: 3.2.0-alpha.4 - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version320alpha4 + version: feed + class: Alchemy\Phrasea\Setup\DoctrineMigrations\FeedMigration migration2: - version: 3.6.0-alpha.1 - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version360alpha1 + version: workzone + class: Alchemy\Phrasea\Setup\DoctrineMigrations\WorkzoneMigration migration3: - version: 3.7.0-alpha.7 - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version370alpha7 + version: lazaret + class: Alchemy\Phrasea\Setup\DoctrineMigrations\LazaretMigration migration4: - version: 3.7.0-alpha.8 - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version370alpha8 + version: task + class: Alchemy\Phrasea\Setup\DoctrineMigrations\TaskMigration migration5: - version: 3.8.0-alpha.4 - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version380alpha4 + version: auth-failure + class: Alchemy\Phrasea\Setup\DoctrineMigrations\AuthFailureMigration migration6: - version: 3.8.0-alpha.11 - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version380alpha11 + version: session + class: Alchemy\Phrasea\Setup\DoctrineMigrations\SessionMigration migration7: - version: 3.9.0-alpha.1a - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha1a + version: ftp-credential + class: Alchemy\Phrasea\Setup\DoctrineMigrations\FtpCredentialMigration migration8: - version: 3.9.0-alpha.1b - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha1b + version: order + class: Alchemy\Phrasea\Setup\DoctrineMigrations\OrderMigration migration9: - version: 3.9.0-alpha.2 - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha2 + version: user + class: Alchemy\Phrasea\Setup\DoctrineMigrations\UserMigration migration10: - version: 3.9.0-alpha.3 - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha3 + version: user-query + class: Alchemy\Phrasea\Setup\DoctrineMigrations\UserQueryMigration migration11: - version: 3.9.0-alpha.4 - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha4 + version: user-setting + class: Alchemy\Phrasea\Setup\DoctrineMigrations\UserSettingMigration migration12: - version: 3.9.0-alpha.5 - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha5 + version: user-notif-setting + class: Alchemy\Phrasea\Setup\DoctrineMigrations\UserNotificationSettingMigration migration13: - version: 3.9.0-alpha.6 - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha6 + version: ftp-export + class: Alchemy\Phrasea\Setup\DoctrineMigrations\FtpExportMigration migration14: - version: 3.9.0-alpha.7 - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha7 - migration15: - version: 3.9.0-alpha.8 - class: Alchemy\Phrasea\Setup\DoctrineMigrations\Version390alpha8 + version: aggregate-token + class: Alchemy\Phrasea\Setup\DoctrineMigrations\AggregateTokenMigration From 4c58b141eee1cde73d822bf2c20220046cafa430 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Thu, 14 Nov 2013 18:37:33 +0100 Subject: [PATCH 10/13] Fix neutron comments --- bin/developer | 14 ++ cli-config.php | 17 --- composer.json | 6 +- composer.lock | 134 +++++++++--------- .../DoctrineMigrationServiceProvider.php | 4 +- lib/classes/module/console/systemUpgrade.php | 6 +- lib/classes/patch/381alpha3a.php | 8 ++ lib/classes/patch/381alpha4a.php | 8 ++ .../DoctrineMigrationServiceProviderTest.php | 2 +- 9 files changed, 104 insertions(+), 95 deletions(-) delete mode 100644 cli-config.php diff --git a/bin/developer b/bin/developer index 6326046041..713f2482f9 100755 --- a/bin/developer +++ b/bin/developer @@ -41,6 +41,13 @@ use Doctrine\ORM\Tools\Console\Command\GenerateProxiesCommand; use Doctrine\ORM\Tools\Console\Command\ConvertMappingCommand; use Doctrine\ORM\Tools\Console\Command\RunDqlCommand; use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand; +// Migration Commands +use Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand; +use Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand; +use\Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand; +use Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand; +use Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand; +use Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand; require_once __DIR__ . '/../lib/autoload.php'; @@ -99,6 +106,13 @@ $cli['console']->addCommands([ new ConvertMappingCommand(), new RunDqlCommand(), new ValidateSchemaCommand(), + // Migrations Commands + new DiffCommand(), + new ExecuteCommand(), + new GenerateCommand(), + new MigrateCommand(), + new StatusCommand(), + new VersionCommand(), ]); exit($cli->runCLI()); diff --git a/cli-config.php b/cli-config.php deleted file mode 100644 index 88fb969508..0000000000 --- a/cli-config.php +++ /dev/null @@ -1,17 +0,0 @@ - new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($app['EM']->getConnection()), - 'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($app['EM']) -)); diff --git a/composer.json b/composer.json index 466eaef7af..842e832996 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,8 @@ "twig/twig" : "~1.14, >=1.14.2", "twig/extensions" : "~1.0", "vierbergenlars/php-semver" : "~2.1", - "zend/gdata" : "~1.12.1" + "zend/gdata" : "~1.12.1", + "doctrine/migrations" : "1.0.x-dev@dev" }, "require-dev": { "doctrine/data-fixtures" : "1.0.x@dev", @@ -53,8 +54,7 @@ "behat/mink-extension" : "~1.0", "behat/mink-goutte-driver" : "~1.0", "behat/mink-selenium2-driver" : "~1.0", - "fabpot/goutte" : "~1.0", - "doctrine/migrations" : "1.0.*@dev" + "fabpot/goutte" : "~1.0" }, "repositories": [ { diff --git a/composer.lock b/composer.lock index 88af5a5f60..7f2d58438b 100644 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "71eadbedd0128a36df83b31412e86ece", + "hash": "989a79784be4adcf2393615316d5fdd2", "packages": [ { "name": "alchemy-fr/tcpdf-clone", @@ -899,6 +899,66 @@ ], "time": "2013-01-12 18:59:04" }, + { + "name": "doctrine/migrations", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/migrations.git", + "reference": "37aacdae6507faad03c3df1624e7d3a6e6c1b388" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/migrations/zipball/37aacdae6507faad03c3df1624e7d3a6e6c1b388", + "reference": "37aacdae6507faad03c3df1624e7d3a6e6c1b388", + "shasum": "" + }, + "require": { + "doctrine/dbal": "~2.0", + "php": ">=5.3.2" + }, + "require-dev": { + "symfony/console": "2.*", + "symfony/yaml": "2.*" + }, + "suggest": { + "symfony/console": "to run the migration from the console" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\Migrations": "lib" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com", + "homepage": "http://www.jwage.com/", + "role": "Creator" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + } + ], + "description": "Database Schema migrations using Doctrine DBAL", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "migrations" + ], + "time": "2013-11-10 05:33:50" + }, { "name": "doctrine/orm", "version": "v2.4.1", @@ -2830,12 +2890,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/symfony.git", - "reference": "b76ac2f865bae2e2ca87302935f5d9a458f1401f" + "reference": "587f35513761547e43c4538e44df485f62fcd92e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/symfony/zipball/b76ac2f865bae2e2ca87302935f5d9a458f1401f", - "reference": "b76ac2f865bae2e2ca87302935f5d9a458f1401f", + "url": "https://api.github.com/repos/symfony/symfony/zipball/587f35513761547e43c4538e44df485f62fcd92e", + "reference": "587f35513761547e43c4538e44df485f62fcd92e", "shasum": "" }, "require": { @@ -2935,7 +2995,7 @@ "keywords": [ "framework" ], - "time": "2013-11-09 16:01:15" + "time": "2013-11-13 21:30:16" }, { "name": "themattharris/tmhoauth", @@ -3618,66 +3678,6 @@ ], "time": "2013-10-16 14:26:38" }, - { - "name": "doctrine/migrations", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/doctrine/migrations.git", - "reference": "37aacdae6507faad03c3df1624e7d3a6e6c1b388" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/migrations/zipball/37aacdae6507faad03c3df1624e7d3a6e6c1b388", - "reference": "37aacdae6507faad03c3df1624e7d3a6e6c1b388", - "shasum": "" - }, - "require": { - "doctrine/dbal": "~2.0", - "php": ">=5.3.2" - }, - "require-dev": { - "symfony/console": "2.*", - "symfony/yaml": "2.*" - }, - "suggest": { - "symfony/console": "to run the migration from the console" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\DBAL\\Migrations": "lib" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL" - ], - "authors": [ - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com", - "homepage": "http://www.jwage.com/", - "role": "Creator" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - } - ], - "description": "Database Schema migrations using Doctrine DBAL", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "database", - "migrations" - ], - "time": "2013-11-10 05:33:50" - }, { "name": "fabpot/goutte", "version": "v1.0.3", @@ -4168,10 +4168,10 @@ "imagine/imagine": 20, "silex/silex": 20, "symfony/symfony": 20, + "doctrine/migrations": 20, "doctrine/data-fixtures": 20, "behat/behat": 20, - "behat/gherkin": 20, - "doctrine/migrations": 20 + "behat/gherkin": 20 }, "platform": { "php": ">=5.3.3" diff --git a/lib/Alchemy/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProvider.php b/lib/Alchemy/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProvider.php index 7774717aba..1edee6f075 100644 --- a/lib/Alchemy/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProvider.php @@ -21,8 +21,8 @@ class DoctrineMigrationServiceProvider implements ServiceProviderInterface { $app['doctrine-migration.configuration'] = $app->share(function ($app) { $configuration = new YamlConfiguration($app['EM']->getConnection()); - $configuration->load(sprintf('%s/lib/conf.d/migrations.yml', $app['root.path'])); - $configuration->setMigrationsDirectory(sprintf('%s/lib/Alchemy/Phrasea/Setup/DoctrineMigration', $app['root.path'])); + $configuration->load(__DIR__.'/../../../../conf.d/migrations.yml'); + $configuration->setMigrationsDirectory(__DIR__.'/../../../../Alchemy/Phrasea/Setup/DoctrineMigration'); return $configuration; }); diff --git a/lib/classes/module/console/systemUpgrade.php b/lib/classes/module/console/systemUpgrade.php index fabe3bb7de..d4ba3a18df 100644 --- a/lib/classes/module/console/systemUpgrade.php +++ b/lib/classes/module/console/systemUpgrade.php @@ -68,15 +68,11 @@ class module_console_systemUpgrade extends Command try { $upgrader = new Setup_Upgrade($this->container, $input->getOption('force')); - $queries = $this->getService('phraseanet.appbox')->forceUpgrade($upgrader, $this->container); } catch (\Exception_Setup_FixBadEmailAddresses $e) { return $output->writeln(sprintf('You have to fix your database before upgrade with the system:mailCheck command ')); - } catch (\Exception $e) { - $output->write(''.$e->getMessage().'', true); - var_dump($e->getTraceAsString()); } - + $queries = $this->getService('phraseanet.appbox')->forceUpgrade($upgrader, $this->container); if ($input->getOption('dump')) { if (0 < count($queries)) { diff --git a/lib/classes/patch/381alpha3a.php b/lib/classes/patch/381alpha3a.php index 26fcc42673..64ca72ba69 100644 --- a/lib/classes/patch/381alpha3a.php +++ b/lib/classes/patch/381alpha3a.php @@ -27,6 +27,14 @@ class patch_381alpha3a implements patchInterface return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/lib/classes/patch/381alpha4a.php b/lib/classes/patch/381alpha4a.php index 157c965829..280b7e8fa2 100644 --- a/lib/classes/patch/381alpha4a.php +++ b/lib/classes/patch/381alpha4a.php @@ -27,6 +27,14 @@ class patch_381alpha4a implements patchInterface return $this->release; } + /** + * {@inheritdoc} + */ + public function getDoctrineMigrations() + { + return array(); + } + /** * {@inheritdoc} */ diff --git a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php index 03cb45949a..96289f696b 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php @@ -8,7 +8,7 @@ class DoctrineMigrationServiceProviderTest extends ServiceProviderTestCase { return array( array( - 'Alchemy\Phrasea\Core\CLIProvider\ DoctrineMigrationServiceProvider', + 'Alchemy\Phrasea\Core\CLIProvider\DoctrineMigrationServiceProvider', 'doctrine-migration.configuration', 'Doctrine\DBAL\Migrations\Configuration\YamlConfiguration' ) From 1cde667730e9ac9c115f48890cbecd05d383e971 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Mon, 18 Nov 2013 14:16:52 +0100 Subject: [PATCH 11/13] Remove PreSchema Upgrader --- .../ConfigurationTesterServiceProvider.php | 5 --- .../PreSchemaUpgradeCollection.php | 41 ------------------- .../PreSchemaUpgradeInterface.php | 38 ----------------- lib/classes/appbox.php | 2 - 4 files changed, 86 deletions(-) delete mode 100644 lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/PreSchemaUpgradeCollection.php delete mode 100644 lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/PreSchemaUpgradeInterface.php diff --git a/lib/Alchemy/Phrasea/Core/Provider/ConfigurationTesterServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/ConfigurationTesterServiceProvider.php index ac61a2234c..ddeb34d411 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/ConfigurationTesterServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/ConfigurationTesterServiceProvider.php @@ -13,7 +13,6 @@ namespace Alchemy\Phrasea\Core\Provider; use Alchemy\Phrasea\Setup\ConfigurationTester; use Alchemy\Phrasea\Application; -use Alchemy\Phrasea\Setup\Version\PreSchemaUpgrade\PreSchemaUpgradeCollection; use Silex\Application as SilexApplication; use Silex\ServiceProviderInterface; @@ -25,10 +24,6 @@ class ConfigurationTesterServiceProvider implements ServiceProviderInterface $app['phraseanet.configuration-tester'] = $app->share(function (Application $app) { return new ConfigurationTester($app); }); - - $app['phraseanet.pre-schema-upgrader'] = $app->share(function () { - return new PreSchemaUpgradeCollection(); - }); } public function boot(SilexApplication $app) diff --git a/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/PreSchemaUpgradeCollection.php b/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/PreSchemaUpgradeCollection.php deleted file mode 100644 index 866ba3b07e..0000000000 --- a/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/PreSchemaUpgradeCollection.php +++ /dev/null @@ -1,41 +0,0 @@ -upgrades as $upgrade) { - if ($upgrade->isApplyable($app)) { - $upgrade->apply($app['EM']); - } - } - } -} diff --git a/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/PreSchemaUpgradeInterface.php b/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/PreSchemaUpgradeInterface.php deleted file mode 100644 index e21f2423ff..0000000000 --- a/lib/Alchemy/Phrasea/Setup/Version/PreSchemaUpgrade/PreSchemaUpgradeInterface.php +++ /dev/null @@ -1,38 +0,0 @@ -set_current_message(_('Creating new tables')); - $app['phraseanet.pre-schema-upgrader']->apply($app); - $upgrader->add_steps_complete(1); /** From 98fee5038b82e2f2c8d76d3de7410b77280845fe Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Mon, 18 Nov 2013 14:40:20 +0100 Subject: [PATCH 12/13] Use short array syntax --- .../Core/Configuration/PropertyAccess.php | 6 +- lib/classes/patch/320alpha1a.php | 4 +- lib/classes/patch/320alpha1b.php | 4 +- lib/classes/patch/320alpha2a.php | 10 +- lib/classes/patch/320alpha3a.php | 4 +- lib/classes/patch/320alpha4a.php | 8 +- lib/classes/patch/320alpha4b.php | 12 +- lib/classes/patch/320alpha5a.php | 8 +- lib/classes/patch/320alpha6a.php | 4 +- lib/classes/patch/320alpha8a.php | 4 +- lib/classes/patch/360alpha1a.php | 26 ++-- lib/classes/patch/360alpha1b.php | 4 +- lib/classes/patch/360alpha2a.php | 4 +- lib/classes/patch/360alpha2b.php | 12 +- lib/classes/patch/361alpha1a.php | 6 +- lib/classes/patch/370alpha1a.php | 6 +- lib/classes/patch/370alpha3a.php | 4 +- lib/classes/patch/370alpha4a.php | 12 +- lib/classes/patch/370alpha5a.php | 12 +- lib/classes/patch/370alpha6a.php | 44 +++---- lib/classes/patch/370alpha7a.php | 4 +- lib/classes/patch/370alpha8a.php | 14 +- lib/classes/patch/370alpha9a.php | 4 +- lib/classes/patch/3715alpha1a.php | 4 +- lib/classes/patch/371alpha1a.php | 4 +- lib/classes/patch/373alpha1a.php | 22 ++-- lib/classes/patch/379alpha1a.php | 4 +- lib/classes/patch/380alpha10a.php | 2 +- lib/classes/patch/380alpha11a.php | 2 +- lib/classes/patch/380alpha13a.php | 2 +- lib/classes/patch/380alpha14a.php | 2 +- lib/classes/patch/380alpha15a.php | 2 +- lib/classes/patch/380alpha16a.php | 2 +- lib/classes/patch/380alpha17a.php | 2 +- lib/classes/patch/380alpha18a.php | 2 +- lib/classes/patch/380alpha2a.php | 4 +- lib/classes/patch/380alpha2b.php | 4 +- lib/classes/patch/380alpha3a.php | 4 +- lib/classes/patch/380alpha3b.php | 4 +- lib/classes/patch/380alpha4a.php | 2 +- lib/classes/patch/380alpha6a.php | 2 +- lib/classes/patch/380alpha8a.php | 2 +- lib/classes/patch/380alpha9a.php | 2 +- lib/classes/patch/381alpha1a.php | 2 +- lib/classes/patch/381alpha1b.php | 2 +- lib/classes/patch/381alpha2a.php | 2 +- lib/classes/patch/381alpha3a.php | 2 +- lib/classes/patch/381alpha4a.php | 2 +- lib/classes/patch/390alpha1a.php | 2 +- lib/classes/patch/390alpha1b.php | 2 +- lib/classes/patch/390alpha2a.php | 2 +- lib/classes/patch/390alpha3a.php | 2 +- lib/classes/patch/390alpha4a.php | 2 +- lib/classes/patch/390alpha5a.php | 2 +- lib/classes/patch/390alpha6a.php | 2 +- lib/classes/patch/390alpha7a.php | 2 +- lib/classes/patch/390alpha8a.php | 2 +- .../DoctrineMigrationServiceProviderTest.php | 8 +- .../Core/Configuration/PropertyAccessTest.php | 120 +++++++++--------- 59 files changed, 223 insertions(+), 223 deletions(-) diff --git a/lib/Alchemy/Phrasea/Core/Configuration/PropertyAccess.php b/lib/Alchemy/Phrasea/Core/Configuration/PropertyAccess.php index fb470d6154..ac1bb6ddc6 100644 --- a/lib/Alchemy/Phrasea/Core/Configuration/PropertyAccess.php +++ b/lib/Alchemy/Phrasea/Core/Configuration/PropertyAccess.php @@ -145,7 +145,7 @@ class PropertyAccess $conf[$prop] = $value; } else { if (! array_key_exists($prop, $conf)) { - $conf[$prop] = array(); + $conf[$prop] = []; } $this->doSet($conf[$prop], $props, $value); } @@ -165,7 +165,7 @@ class PropertyAccess return $conf[$prop] = $value; } if (!array_key_exists($prop, $conf)) { - $conf[$prop] = array(); + $conf[$prop] = []; } return $this->doMerge($conf[$prop], $props, $value); @@ -193,7 +193,7 @@ class PropertyAccess private function arrayize($value) { if (!is_array($value)) { - return array($value); + return [$value]; } return $value; diff --git a/lib/classes/patch/320alpha1a.php b/lib/classes/patch/320alpha1a.php index 71531b870b..8a0bb367bf 100644 --- a/lib/classes/patch/320alpha1a.php +++ b/lib/classes/patch/320alpha1a.php @@ -17,7 +17,7 @@ class patch_320alpha1a implements patchInterface private $release = '3.2.0-alpha.1'; /** @var Array */ - private $concern = array(base::DATA_BOX); + private $concern = [base::DATA_BOX]; /** * {@inheritdoc} @@ -32,7 +32,7 @@ class patch_320alpha1a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/320alpha1b.php b/lib/classes/patch/320alpha1b.php index 182705482a..662619e316 100644 --- a/lib/classes/patch/320alpha1b.php +++ b/lib/classes/patch/320alpha1b.php @@ -17,7 +17,7 @@ class patch_320alpha1b implements patchInterface private $release = '3.2.0-alpha.1'; /** @var Array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -40,7 +40,7 @@ class patch_320alpha1b implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/320alpha2a.php b/lib/classes/patch/320alpha2a.php index 6eeb9766e6..caa8d16e72 100644 --- a/lib/classes/patch/320alpha2a.php +++ b/lib/classes/patch/320alpha2a.php @@ -17,7 +17,7 @@ class patch_320alpha2a implements patchInterface private $release = '3.2.0-alpha.2'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -40,7 +40,7 @@ class patch_320alpha2a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** @@ -66,7 +66,7 @@ class patch_320alpha2a implements patchInterface $stmt = $appbox->get_connection()->prepare($sql); foreach ($rs as $row) { $nonce = random::generatePassword(16); - $params = array(':usr_id' => $row['usr_id'], ':nonce' => $nonce); + $params = [':usr_id' => $row['usr_id'], ':nonce' => $nonce]; $stmt->execute($params); } $stmt->closeCursor(); @@ -83,10 +83,10 @@ class patch_320alpha2a implements patchInterface if (strpos($row['class'], 'task_period_') !== false) continue; - $params = array( + $params = [ ':task_id' => $row['task_id'] , ':class' => str_replace('task_', 'task_period_', $row['class']) - ); + ]; $stmt->execute($params); } diff --git a/lib/classes/patch/320alpha3a.php b/lib/classes/patch/320alpha3a.php index b0b99ec4ce..12a70c5e99 100644 --- a/lib/classes/patch/320alpha3a.php +++ b/lib/classes/patch/320alpha3a.php @@ -17,7 +17,7 @@ class patch_320alpha3a implements patchInterface private $release = '3.2.0-alpha.3'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -40,7 +40,7 @@ class patch_320alpha3a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/320alpha4a.php b/lib/classes/patch/320alpha4a.php index 329c92eeea..51534733e3 100644 --- a/lib/classes/patch/320alpha4a.php +++ b/lib/classes/patch/320alpha4a.php @@ -17,7 +17,7 @@ class patch_320alpha4a implements patchInterface private $release = '3.2.0-alpha.4'; /** @var array */ - private $concern = array(base::DATA_BOX); + private $concern = [base::DATA_BOX]; /** * {@inheritdoc} @@ -40,7 +40,7 @@ class patch_320alpha4a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** @@ -71,7 +71,7 @@ class patch_320alpha4a implements patchInterface $stmt->execute(); $stmt->closeCursor(); - $phrasea_maps = array( + $phrasea_maps = [ 'pdftext' => 'Phraseanet:pdftext' , 'tf-archivedate' => 'Phraseanet:tf-archivedate' , 'tf-atime' => 'Phraseanet:tf-atime' @@ -90,7 +90,7 @@ class patch_320alpha4a implements patchInterface , 'tf-recordid' => 'Phraseanet:tf-recordid' , 'tf-size' => 'Phraseanet:tf-size' , 'tf-width' => 'Phraseanet:tf-width' - ); + ]; $sxe = $databox->get_sxml_structure(); $dom_struct = $databox->get_dom_structure(); diff --git a/lib/classes/patch/320alpha4b.php b/lib/classes/patch/320alpha4b.php index 9e939c0fec..da3bac2448 100644 --- a/lib/classes/patch/320alpha4b.php +++ b/lib/classes/patch/320alpha4b.php @@ -24,7 +24,7 @@ class patch_320alpha4b implements patchInterface private $release = '3.2.0-alpha.4'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -39,7 +39,7 @@ class patch_320alpha4b implements patchInterface */ public function getDoctrineMigrations() { - return array('feed'); + return ['feed']; } /** @@ -63,7 +63,7 @@ class patch_320alpha4b implements patchInterface */ public function apply(base $appbox, Application $app) { - $feeds = array(); + $feeds = []; try { $sql = 'ALTER TABLE `ssel` ADD `migrated` INT NOT NULL DEFAULT "0"'; @@ -119,7 +119,7 @@ class patch_320alpha4b implements patchInterface $sql = 'SELECT sselcont_id, ssel_id, base_id, record_id FROM sselcont WHERE ssel_id = :ssel_id ORDER BY ord ASC'; $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $row['ssel_id'])); + $stmt->execute([':ssel_id' => $row['ssel_id']]); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -142,7 +142,7 @@ class patch_320alpha4b implements patchInterface $sql = 'UPDATE ssel SET deleted = "1", migrated="1" WHERE ssel_id = :ssel_id'; $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $row['ssel_id'])); + $stmt->execute([':ssel_id' => $row['ssel_id']]); $stmt->closeCursor(); $app['EM']->persist($feed); $n++; @@ -170,7 +170,7 @@ class patch_320alpha4b implements patchInterface return; } - protected static $feeds = array(); + protected static $feeds = []; protected function get_feed(appbox $appbox, User_Adapter $user, $pub_restrict, $homelink, Application $app) { diff --git a/lib/classes/patch/320alpha5a.php b/lib/classes/patch/320alpha5a.php index dfb4647cf7..f8249b36a2 100644 --- a/lib/classes/patch/320alpha5a.php +++ b/lib/classes/patch/320alpha5a.php @@ -17,7 +17,7 @@ class patch_320alpha5a implements patchInterface private $release = '3.2.0-alpha.5'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -40,7 +40,7 @@ class patch_320alpha5a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** @@ -67,10 +67,10 @@ class patch_320alpha5a implements patchInterface $stmt = $appbox->get_connection()->prepare($sql); foreach ($rs as $row) { - $params = array( + $params = [ ':base_id' => $row['base_id'], ':usr_id' => $row['usr_id'] - ); + ]; $stmt->execute($params); } diff --git a/lib/classes/patch/320alpha6a.php b/lib/classes/patch/320alpha6a.php index 3276ce6d9a..1884e491c4 100644 --- a/lib/classes/patch/320alpha6a.php +++ b/lib/classes/patch/320alpha6a.php @@ -18,7 +18,7 @@ class patch_320alpha6a implements patchInterface private $release = '3.2.0-alpha.6'; /** @var array */ - private $concern = array(base::DATA_BOX); + private $concern = [base::DATA_BOX]; /** * {@inheritdoc} @@ -41,7 +41,7 @@ class patch_320alpha6a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/320alpha8a.php b/lib/classes/patch/320alpha8a.php index fbb90ef1b2..d08dd2023d 100644 --- a/lib/classes/patch/320alpha8a.php +++ b/lib/classes/patch/320alpha8a.php @@ -18,7 +18,7 @@ class patch_320alpha8a implements patchInterface private $release = '3.2.0-alpha.8'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -41,7 +41,7 @@ class patch_320alpha8a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/360alpha1a.php b/lib/classes/patch/360alpha1a.php index 2a564e654f..415053b490 100644 --- a/lib/classes/patch/360alpha1a.php +++ b/lib/classes/patch/360alpha1a.php @@ -20,7 +20,7 @@ class patch_360alpha1a implements patchInterface private $release = '3.6.0-alpha.1'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -51,7 +51,7 @@ class patch_360alpha1a implements patchInterface */ public function getDoctrineMigrations() { - return array('workzone', 'session'); + return ['workzone', 'session']; } /** @@ -59,7 +59,7 @@ class patch_360alpha1a implements patchInterface */ public function apply(base $appbox, Application $app) { - $tables = array('StoryWZ', 'ValidationDatas', 'ValidationParticipants', 'ValidationSessions', 'BasketElements', 'Baskets'); + $tables = ['StoryWZ', 'ValidationDatas', 'ValidationParticipants', 'ValidationSessions', 'BasketElements', 'Baskets']; foreach ($tables as $table) { $sql = 'DELETE FROM ' . $table; @@ -68,7 +68,7 @@ class patch_360alpha1a implements patchInterface $stmt->closeCursor(); } - $stories = array(); + $stories = []; $sql = 'SELECT sbas_id, rid as record_id, usr_id FROM ssel @@ -79,7 +79,7 @@ class patch_360alpha1a implements patchInterface $rs_s = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $current = array(); + $current = []; foreach ($rs_s as $row_story) { $serial = $row_story['sbas_id'] . '_' . $row_story['usr_id'] . '_' . $row_story['record_id']; @@ -98,11 +98,11 @@ class patch_360alpha1a implements patchInterface $stmt = $appbox->get_connection()->prepare($sql); foreach ($stories as $row) { - $params = array( + $params = [ ':usr_id' => $row['usr_id'], ':sbas_id' => $row['sbas_id'], ':record_id' => $row['record_id'] - ); + ]; $stmt->execute($params); } @@ -137,7 +137,7 @@ class patch_360alpha1a implements patchInterface $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $sselcont_ids = array(); + $sselcont_ids = []; foreach ($rs as $row) { $sql = 'SELECT c.sselcont_id, c.record_id, b.sbas_id @@ -146,11 +146,11 @@ class patch_360alpha1a implements patchInterface AND c.ssel_id = :ssel_id AND s.ssel_id = c.ssel_id'; $stmt = $appbox->get_connection()->prepare($sql); - $stmt->execute(array(':ssel_id' => $row['ssel_id'])); + $stmt->execute([':ssel_id' => $row['ssel_id']]); $rs_be = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $current = array(); + $current = []; foreach ($rs_be as $row_sselcont) { $serial = $row_sselcont['sbas_id'] . '_' . $row_sselcont['record_id']; @@ -167,7 +167,7 @@ class patch_360alpha1a implements patchInterface $stmt = $appbox->get_connection()->prepare($sql); foreach ($sselcont_ids as $sselcont_id) { - $stmt->execute(array(':sselcont_id' => $sselcont_id)); + $stmt->execute([':sselcont_id' => $sselcont_id]); } $stmt->closeCursor(); @@ -236,11 +236,11 @@ class patch_360alpha1a implements patchInterface )'; $stmt = $appbox->get_connection()->prepare($sql); foreach ($rs as $row) { - $params = array( + $params = [ ':participant_id' => $row['participant_id'], ':basket_id' => $row['basket_id'], ':usr_id' => $row['usr_id'], - ); + ]; $stmt->execute($params); } diff --git a/lib/classes/patch/360alpha1b.php b/lib/classes/patch/360alpha1b.php index 378cd0e75b..995d3774dc 100644 --- a/lib/classes/patch/360alpha1b.php +++ b/lib/classes/patch/360alpha1b.php @@ -18,7 +18,7 @@ class patch_360alpha1b implements patchInterface private $release = '3.6.0-alpha.1'; /** @var array */ - private $concern = array(base::DATA_BOX); + private $concern = [base::DATA_BOX]; /** * {@inheritdoc} @@ -41,7 +41,7 @@ class patch_360alpha1b implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/360alpha2a.php b/lib/classes/patch/360alpha2a.php index 4283f568c2..6d052bc296 100644 --- a/lib/classes/patch/360alpha2a.php +++ b/lib/classes/patch/360alpha2a.php @@ -18,7 +18,7 @@ class patch_360alpha2a implements patchInterface private $release = '3.6.0-alpha.2'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -41,7 +41,7 @@ class patch_360alpha2a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/360alpha2b.php b/lib/classes/patch/360alpha2b.php index f017d028d1..e3454ccdb4 100644 --- a/lib/classes/patch/360alpha2b.php +++ b/lib/classes/patch/360alpha2b.php @@ -18,7 +18,7 @@ class patch_360alpha2b implements patchInterface private $release = '3.6.0-alpha.2'; /** @var array */ - private $concern = array(base::DATA_BOX); + private $concern = [base::DATA_BOX]; /** * {@inheritdoc} @@ -33,7 +33,7 @@ class patch_360alpha2b implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** @@ -121,7 +121,7 @@ class patch_360alpha2b implements patchInterface VALUES (null, :record_id, :meta_struct_id, :value)'; $stmt = $databox->get_connection()->prepare($sql); - $databox_fields = array(); + $databox_fields = []; foreach ($rs as $row) { $meta_struct_id = $row['meta_struct_id']; @@ -133,11 +133,11 @@ class patch_360alpha2b implements patchInterface $values = \caption_field::get_multi_values($row['value'], $databox_fields[$meta_struct_id]->get_separator()); foreach ($values as $value) { - $params = array( + $params = [ ':record_id' => $row['record_id'], ':meta_struct_id' => $row['meta_struct_id'], ':value' => $value, - ); + ]; $stmt->execute($params); } } @@ -148,7 +148,7 @@ class patch_360alpha2b implements patchInterface $stmt = $databox->get_connection()->prepare($sql); foreach ($rs as $row) { - $params = array(':id' => $row['id']); + $params = [':id' => $row['id']]; $stmt->execute($params); } diff --git a/lib/classes/patch/361alpha1a.php b/lib/classes/patch/361alpha1a.php index c620a9f7fc..bbaf6d1381 100644 --- a/lib/classes/patch/361alpha1a.php +++ b/lib/classes/patch/361alpha1a.php @@ -19,7 +19,7 @@ class patch_361alpha1a implements patchInterface private $release = '3.6.1-alpha.1'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -50,7 +50,7 @@ class patch_361alpha1a implements patchInterface */ public function getDoctrineMigrations() { - return array('workzone'); + return ['workzone']; } /** @@ -79,7 +79,7 @@ class patch_361alpha1a implements patchInterface $sql = 'SELECT record_id FROM record WHERE record_id = :record_id'; $stmt = $connbas->prepare($sql); - $stmt->execute(array(':record_id' => $row['record_id'])); + $stmt->execute([':record_id' => $row['record_id']]); $rowCount = $stmt->rowCount(); $stmt->closeCursor(); diff --git a/lib/classes/patch/370alpha1a.php b/lib/classes/patch/370alpha1a.php index 23e163345b..34b85f0fd7 100644 --- a/lib/classes/patch/370alpha1a.php +++ b/lib/classes/patch/370alpha1a.php @@ -18,7 +18,7 @@ class patch_370alpha1a implements patchInterface private $release = '3.7.0-alpha.1'; /** @var array */ - private $concern = array(base::DATA_BOX); + private $concern = [base::DATA_BOX]; /** * {@inheritdoc} @@ -33,7 +33,7 @@ class patch_370alpha1a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** @@ -86,7 +86,7 @@ class patch_370alpha1a implements patchInterface $sql = 'UPDATE pref SET value = :structure WHERE prop = "structure"'; $stmt = $conn->prepare($sql); - $stmt->execute(array(':structure' => $DOMDocument->saveXML())); + $stmt->execute([':structure' => $DOMDocument->saveXML()]); $stmt->closeCursor(); return true; diff --git a/lib/classes/patch/370alpha3a.php b/lib/classes/patch/370alpha3a.php index 5c793ce1a3..8592df766c 100644 --- a/lib/classes/patch/370alpha3a.php +++ b/lib/classes/patch/370alpha3a.php @@ -18,7 +18,7 @@ class patch_370alpha3a implements patchInterface private $release = '3.7.0-alpha.3'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * @@ -42,7 +42,7 @@ class patch_370alpha3a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/370alpha4a.php b/lib/classes/patch/370alpha4a.php index 2ea61bed89..ef9d2a92cd 100644 --- a/lib/classes/patch/370alpha4a.php +++ b/lib/classes/patch/370alpha4a.php @@ -17,7 +17,7 @@ class patch_370alpha4a implements patchInterface private $release = '3.7.0-alpha.4'; /** @var array */ - private $concern = array(base::DATA_BOX); + private $concern = [base::DATA_BOX]; /** * {@inheritdoc} @@ -48,7 +48,7 @@ class patch_370alpha4a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** @@ -62,7 +62,7 @@ class patch_370alpha4a implements patchInterface $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $update = array(); + $update = []; $tagDirname = new \Alchemy\Phrasea\Metadata\Tag\TfDirname(); $tagBasename = new \Alchemy\Phrasea\Metadata\Tag\TfBasename(); @@ -70,10 +70,10 @@ class patch_370alpha4a implements patchInterface foreach ($rs as $row) { if (strpos(strtolower($row['src']), 'tf-parentdir') !== false) { - $update[] = array('id' => $row['id'], 'src' => $tagDirname->getTagname()); + $update[] = ['id' => $row['id'], 'src' => $tagDirname->getTagname()]; } if (strpos(strtolower($row['src']), 'tf-filename') !== false) { - $update[] = array('id' => $row['id'], 'src' => $tagBasename->getTagname()); + $update[] = ['id' => $row['id'], 'src' => $tagBasename->getTagname()]; } } @@ -81,7 +81,7 @@ class patch_370alpha4a implements patchInterface $stmt = $databox->get_connection()->prepare($sql); foreach ($update as $row) { - $stmt->execute(array(':src' => $row['src'], ':id' => $row['id'])); + $stmt->execute([':src' => $row['src'], ':id' => $row['id']]); } $stmt->closeCursor(); diff --git a/lib/classes/patch/370alpha5a.php b/lib/classes/patch/370alpha5a.php index 797ea2661c..e843defb2f 100644 --- a/lib/classes/patch/370alpha5a.php +++ b/lib/classes/patch/370alpha5a.php @@ -17,7 +17,7 @@ class patch_370alpha5a implements patchInterface private $release = '3.7.0-alpha.5'; /** @var array */ - private $concern = array(base::DATA_BOX); + private $concern = [base::DATA_BOX]; /** * {@inheritdoc} @@ -48,7 +48,7 @@ class patch_370alpha5a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** @@ -63,20 +63,20 @@ class patch_370alpha5a implements patchInterface $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); $stmt->closeCursor(); - $update = array(); + $update = []; foreach ($rs as $row) { $src = str_replace( - array('/rdf:RDF/rdf:Description/PHRASEANET:', '/rdf:RDF/rdf:Description/'), array('Phraseanet:', ''), $row['src'] + ['/rdf:RDF/rdf:Description/PHRASEANET:', '/rdf:RDF/rdf:Description/'], ['Phraseanet:', ''], $row['src'] ); - $update[] = array('id' => $row['id'], 'src' => $src); + $update[] = ['id' => $row['id'], 'src' => $src]; } $sql = 'UPDATE metadatas_structure SET src = :src WHERE id = :id'; $stmt = $databox->get_connection()->prepare($sql); foreach ($update as $row) { - $stmt->execute(array(':src' => $row['src'], ':id' => $row['id'])); + $stmt->execute([':src' => $row['src'], ':id' => $row['id']]); } $stmt->closeCursor(); diff --git a/lib/classes/patch/370alpha6a.php b/lib/classes/patch/370alpha6a.php index d8073d9ba3..b42be5656c 100644 --- a/lib/classes/patch/370alpha6a.php +++ b/lib/classes/patch/370alpha6a.php @@ -17,7 +17,7 @@ class patch_370alpha6a implements patchInterface private $release = '3.7.0-alpha.6'; /** @var array */ - private $concern = array(base::DATA_BOX); + private $concern = [base::DATA_BOX]; /** * {@inheritdoc} @@ -48,7 +48,7 @@ class patch_370alpha6a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** @@ -81,7 +81,7 @@ class patch_370alpha6a implements patchInterface $this->addScreenDeviceOption($subdefgroups, $subdef, $groupname); - if (in_array($name, array('preview', 'thumbnail'))) { + if (in_array($name, ['preview', 'thumbnail'])) { if ($name == 'thumbnail' || $subdef->getSubdefType()->getType() != \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO) { $this->addMobileSubdefImage($subdefgroups, $subdef, $groupname); @@ -105,7 +105,7 @@ class patch_370alpha6a implements patchInterface { $optionsSubdef = $subdef->getOptions(); - $options = array(); + $options = []; foreach ($optionsSubdef as $optname => $option) { $options[$optname] = $option->getValue(); @@ -114,19 +114,19 @@ class patch_370alpha6a implements patchInterface $options['path'] = $subdef->get_path(); $options['mediatype'] = $subdef->getSubdefType()->getType(); $options['meta'] = $subdef->meta_writeable() ? 'yes' : 'no'; - $options['devices'] = array(databox_subdef::DEVICE_SCREEN); + $options['devices'] = [databox_subdef::DEVICE_SCREEN]; - $root->set_subdef($groupname, $subdef->get_name(), $subdef->get_class(), $subdef->is_downloadable(), $options, array()); + $root->set_subdef($groupname, $subdef->get_name(), $subdef->get_class(), $subdef->is_downloadable(), $options, []); } protected function addMobileSubdefVideo($root, $baseSubdef, $groupname) { - $newSubdefOptionsWebM = $newSubdefOptionsOgg = $newSubdefOptionsX264 = array( + $newSubdefOptionsWebM = $newSubdefOptionsOgg = $newSubdefOptionsX264 = [ 'path' => $baseSubdef->get_path(), 'mediatype' => \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO - ); + ]; - $options = array( + $options = [ 'path' => $baseSubdef->get_path(), 'mediatype' => \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO, 'bitrate' => '300', @@ -134,8 +134,8 @@ class patch_370alpha6a implements patchInterface 'GOPsize' => '25', 'size' => '480', 'fps' => '15', - 'devices' => array(databox_subdef::DEVICE_HANDHELD), - ); + 'devices' => [databox_subdef::DEVICE_HANDHELD], + ]; foreach ($options as $name => $value) { $newSubdefOptionsWebM[$name] = $value; @@ -152,14 +152,14 @@ class patch_370alpha6a implements patchInterface $newSubdefOptionsX264['acodec'] = 'libvo_aacenc'; $newSubdefOptionsX264['vcodec'] = 'libx264'; - $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_webM', $baseSubdef->get_class(), false, $newSubdefOptionsWebM, array()); - $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg, array()); - $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_X264', $baseSubdef->get_class(), false, $newSubdefOptionsX264, array()); + $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_webM', $baseSubdef->get_class(), false, $newSubdefOptionsWebM, []); + $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg, []); + $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile_X264', $baseSubdef->get_class(), false, $newSubdefOptionsX264, []); } protected function addMobileSubdefImage($root, $baseSubdef, $groupname) { - $optionMobile = array(); + $optionMobile = []; $optionMobile['size'] = $baseSubdef->get_name() == 'thumbnail' ? '150' : '480'; $optionMobile['resolution'] = '72'; @@ -169,18 +169,18 @@ class patch_370alpha6a implements patchInterface $optionMobile['mediatype'] = \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_IMAGE; $optionMobile['meta'] = 'no'; - $optionMobile['devices'] = array(databox_subdef::DEVICE_HANDHELD); + $optionMobile['devices'] = [databox_subdef::DEVICE_HANDHELD]; - $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile', $baseSubdef->get_class(), false, $optionMobile, array()); + $root->set_subdef($groupname, $baseSubdef->get_name() . '_mobile', $baseSubdef->get_class(), false, $optionMobile, []); } protected function addHtml5Video($root, $baseSubdef, $groupname) { - $newSubdefOptionsWebM = $newSubdefOptionsOgg = array( + $newSubdefOptionsWebM = $newSubdefOptionsOgg = [ 'path' => $baseSubdef->get_path(), 'mediatype' => \Alchemy\Phrasea\Media\Subdef\Subdef::TYPE_VIDEO, - 'devices' => array(\databox_subdef::DEVICE_SCREEN) - ); + 'devices' => [\databox_subdef::DEVICE_SCREEN] + ]; foreach ($baseSubdef->getOptions() as $optionname => $option) { $newSubdefOptionsWebM[$optionname] = $option->getValue(); @@ -193,7 +193,7 @@ class patch_370alpha6a implements patchInterface $newSubdefOptionsOgg['vcodec'] = 'libtheora'; $newSubdefOptionsOgg['acodec'] = 'libvorbis'; - $root->set_subdef($groupname, $baseSubdef->get_name() . '_webM', $baseSubdef->get_class(), false, $newSubdefOptionsWebM, array()); - $root->set_subdef($groupname, $baseSubdef->get_name() . '_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg, array()); + $root->set_subdef($groupname, $baseSubdef->get_name() . '_webM', $baseSubdef->get_class(), false, $newSubdefOptionsWebM, []); + $root->set_subdef($groupname, $baseSubdef->get_name() . '_OGG', $baseSubdef->get_class(), false, $newSubdefOptionsOgg, []); } } diff --git a/lib/classes/patch/370alpha7a.php b/lib/classes/patch/370alpha7a.php index 1d370dcffe..38f0855d9b 100644 --- a/lib/classes/patch/370alpha7a.php +++ b/lib/classes/patch/370alpha7a.php @@ -21,7 +21,7 @@ class patch_370alpha7a implements patchInterface private $release = '3.7.0-alpha.7'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -52,7 +52,7 @@ class patch_370alpha7a implements patchInterface */ public function getDoctrineMigrations() { - return array('lazaret'); + return ['lazaret']; } /** diff --git a/lib/classes/patch/370alpha8a.php b/lib/classes/patch/370alpha8a.php index 815c6ba638..8922ce0082 100644 --- a/lib/classes/patch/370alpha8a.php +++ b/lib/classes/patch/370alpha8a.php @@ -18,7 +18,7 @@ class patch_370alpha8a implements patchInterface private $release = '3.7.0-alpha.8'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -46,7 +46,7 @@ class patch_370alpha8a implements patchInterface public function getDoctrineMigrations() { - return array('task'); + return ['task']; } /** @@ -60,7 +60,7 @@ class patch_370alpha8a implements patchInterface */ public function apply(base $appbox, Application $app) { - $ttasks = array(); + $ttasks = []; $conn = $appbox->get_connection(); $sql = 'SELECT task_id, active, name, class, settings FROM task2 WHERE class=\'task_period_workflow01\''; if (($stmt = $conn->prepare($sql)) !== FALSE) { @@ -69,11 +69,11 @@ class patch_370alpha8a implements patchInterface $stmt->closeCursor(); } - $tdom = array(); // key = period - $taskstodel = array(); + $tdom = []; // key = period + $taskstodel = []; foreach ($ttasks as $task) { $active = true; - $warning = array(); + $warning = []; /* * migrating task 'workflow01' @@ -90,7 +90,7 @@ class patch_370alpha8a implements patchInterface $ts->appendChild($dom->createElement('period'))->appendChild($dom->createTextNode(60 * $period)); $ts->appendChild($dom->createElement('logsql'))->appendChild($dom->createTextNode('1')); $tasks = $ts->appendChild($dom->createElement('tasks')); - $tdom['_' . $period] = array('dom' => $dom, 'tasks' => $tasks); + $tdom['_' . $period] = ['dom' => $dom, 'tasks' => $tasks]; } else { $dom = &$tdom['_' . $period]['dom']; $tasks = &$tdom['_' . $period]['tasks']; diff --git a/lib/classes/patch/370alpha9a.php b/lib/classes/patch/370alpha9a.php index 7077217848..6cb6630afe 100644 --- a/lib/classes/patch/370alpha9a.php +++ b/lib/classes/patch/370alpha9a.php @@ -17,7 +17,7 @@ class patch_370alpha9a implements patchInterface private $release = '3.7.0-alpha.9'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -40,7 +40,7 @@ class patch_370alpha9a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/3715alpha1a.php b/lib/classes/patch/3715alpha1a.php index 4e861ef5e7..91e13e2f12 100644 --- a/lib/classes/patch/3715alpha1a.php +++ b/lib/classes/patch/3715alpha1a.php @@ -20,7 +20,7 @@ class patch_3715alpha1a implements patchInterface private $release = '3.7.15-alpha1'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -43,7 +43,7 @@ class patch_3715alpha1a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/371alpha1a.php b/lib/classes/patch/371alpha1a.php index 5eaaa5bb11..ee3362a4fd 100644 --- a/lib/classes/patch/371alpha1a.php +++ b/lib/classes/patch/371alpha1a.php @@ -17,7 +17,7 @@ class patch_371alpha1a implements patchInterface private $release = '3.7.1-alpha1'; /** @var array */ - private $concern = array(base::DATA_BOX); + private $concern = [base::DATA_BOX]; /** * {@inheritdoc} @@ -48,7 +48,7 @@ class patch_371alpha1a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/373alpha1a.php b/lib/classes/patch/373alpha1a.php index 2d5a47162f..705d80c228 100644 --- a/lib/classes/patch/373alpha1a.php +++ b/lib/classes/patch/373alpha1a.php @@ -17,7 +17,7 @@ class patch_373alpha1a implements patchInterface private $release = '3.7.3-alpha.1'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -40,7 +40,7 @@ class patch_373alpha1a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** @@ -59,7 +59,7 @@ class patch_373alpha1a implements patchInterface $sql = 'SELECT * FROM registry WHERE `key` = :key'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); - $Regbinaries = array( + $Regbinaries = [ 'GV_cli', 'GV_swf_extract', 'GV_pdf2swf', @@ -69,9 +69,9 @@ class patch_373alpha1a implements patchInterface 'GV_ffprobe', 'GV_mp4box', 'GV_pdftotext', - ); + ]; - $mapping = array( + $mapping = [ 'GV_cli' => 'php_binary', 'GV_swf_extract' => 'swf_extract_binary', 'GV_pdf2swf' => 'pdf2swf_binary', @@ -81,12 +81,12 @@ class patch_373alpha1a implements patchInterface 'GV_ffprobe' => 'ffprobe_binary', 'GV_mp4box' => 'mp4box_binary', 'GV_pdftotext' => 'pdftotext_binary', - ); + ]; - $binaries = array('ghostscript_binary' => null); + $binaries = ['ghostscript_binary' => null]; foreach ($Regbinaries as $name) { - $stmt->execute(array(':key' => $name)); + $stmt->execute([':key' => $name]); $row = $stmt->fetch(\PDO::FETCH_ASSOC); $value = is_executable($row['value']) ? $row['value'] : null; @@ -102,14 +102,14 @@ class patch_373alpha1a implements patchInterface $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); foreach ($Regbinaries as $name) { - $stmt->execute(array(':key' => $name)); + $stmt->execute([':key' => $name]); } $stmt->closeCursor(); $sql = 'SELECT value FROM registry WHERE `key` = :key'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute(array(':key'=>'GV_sit')); + $stmt->execute([':key'=>'GV_sit']); $row = $stmt->fetch(\PDO::FETCH_ASSOC); $stmt->closeCursor(); @@ -119,7 +119,7 @@ class patch_373alpha1a implements patchInterface $sql = 'DELETE FROM registry WHERE `key` = :key'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); - $stmt->execute(array(':key'=>'GV_sit')); + $stmt->execute([':key'=>'GV_sit']); $stmt->closeCursor(); return true; diff --git a/lib/classes/patch/379alpha1a.php b/lib/classes/patch/379alpha1a.php index 73eec604cc..2ea7969fcb 100644 --- a/lib/classes/patch/379alpha1a.php +++ b/lib/classes/patch/379alpha1a.php @@ -17,7 +17,7 @@ class patch_379alpha1a implements patchInterface private $release = '3.7.9-alpha1'; /** @var array */ - private $concern = array(base::DATA_BOX); + private $concern = [base::DATA_BOX]; /** * {@inheritdoc} @@ -40,7 +40,7 @@ class patch_379alpha1a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/380alpha10a.php b/lib/classes/patch/380alpha10a.php index dc48fa2f64..83e5b14516 100644 --- a/lib/classes/patch/380alpha10a.php +++ b/lib/classes/patch/380alpha10a.php @@ -32,7 +32,7 @@ class patch_380alpha10a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/380alpha11a.php b/lib/classes/patch/380alpha11a.php index 8bae4e5adf..b39e455056 100644 --- a/lib/classes/patch/380alpha11a.php +++ b/lib/classes/patch/380alpha11a.php @@ -50,7 +50,7 @@ class patch_380alpha11a implements patchInterface */ public function getDoctrineMigrations() { - return array('session'); + return ['session']; } /** diff --git a/lib/classes/patch/380alpha13a.php b/lib/classes/patch/380alpha13a.php index 9df253a295..54f8daf2c3 100644 --- a/lib/classes/patch/380alpha13a.php +++ b/lib/classes/patch/380alpha13a.php @@ -32,7 +32,7 @@ class patch_380alpha13a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/380alpha14a.php b/lib/classes/patch/380alpha14a.php index 29c07693b5..d4dfc9dbef 100644 --- a/lib/classes/patch/380alpha14a.php +++ b/lib/classes/patch/380alpha14a.php @@ -40,7 +40,7 @@ class patch_380alpha14a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/380alpha15a.php b/lib/classes/patch/380alpha15a.php index 3837f30e18..0a9a65dc48 100644 --- a/lib/classes/patch/380alpha15a.php +++ b/lib/classes/patch/380alpha15a.php @@ -32,7 +32,7 @@ class patch_380alpha15a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** * {@inheritdoc} diff --git a/lib/classes/patch/380alpha16a.php b/lib/classes/patch/380alpha16a.php index d39cac4302..d0e36c8890 100644 --- a/lib/classes/patch/380alpha16a.php +++ b/lib/classes/patch/380alpha16a.php @@ -32,7 +32,7 @@ class patch_380alpha16a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/380alpha17a.php b/lib/classes/patch/380alpha17a.php index fe051a4bd7..d4c010833f 100644 --- a/lib/classes/patch/380alpha17a.php +++ b/lib/classes/patch/380alpha17a.php @@ -32,7 +32,7 @@ class patch_380alpha17a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/380alpha18a.php b/lib/classes/patch/380alpha18a.php index 6f88f0952d..8cb58fc978 100644 --- a/lib/classes/patch/380alpha18a.php +++ b/lib/classes/patch/380alpha18a.php @@ -33,7 +33,7 @@ class patch_380alpha18a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/380alpha2a.php b/lib/classes/patch/380alpha2a.php index 0b5757bb4e..3e28912f0a 100644 --- a/lib/classes/patch/380alpha2a.php +++ b/lib/classes/patch/380alpha2a.php @@ -18,7 +18,7 @@ class patch_380alpha2a implements patchInterface private $release = '3.8.0-alpha.2'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -41,7 +41,7 @@ class patch_380alpha2a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/380alpha2b.php b/lib/classes/patch/380alpha2b.php index f0b3805592..26b68bedbf 100644 --- a/lib/classes/patch/380alpha2b.php +++ b/lib/classes/patch/380alpha2b.php @@ -18,7 +18,7 @@ class patch_380alpha2b implements patchInterface private $release = '3.8.0-alpha.2'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -41,7 +41,7 @@ class patch_380alpha2b implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/380alpha3a.php b/lib/classes/patch/380alpha3a.php index 3b7ab01d32..5f81b1cc0d 100644 --- a/lib/classes/patch/380alpha3a.php +++ b/lib/classes/patch/380alpha3a.php @@ -17,7 +17,7 @@ class patch_380alpha3a implements patchInterface private $release = '3.8.0-alpha.3'; /** @var array */ - private $concern = array(base::DATA_BOX); + private $concern = [base::DATA_BOX]; /** * {@inheritdoc} @@ -40,7 +40,7 @@ class patch_380alpha3a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/380alpha3b.php b/lib/classes/patch/380alpha3b.php index d8334fc29b..888c4a372f 100644 --- a/lib/classes/patch/380alpha3b.php +++ b/lib/classes/patch/380alpha3b.php @@ -17,7 +17,7 @@ class patch_380alpha3b implements patchInterface private $release = '3.8.0-alpha.3'; /** @var array */ - private $concern = array(base::APPLICATION_BOX); + private $concern = [base::APPLICATION_BOX]; /** * {@inheritdoc} @@ -48,7 +48,7 @@ class patch_380alpha3b implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/380alpha4a.php b/lib/classes/patch/380alpha4a.php index ae543f7cd3..b0727e5710 100644 --- a/lib/classes/patch/380alpha4a.php +++ b/lib/classes/patch/380alpha4a.php @@ -49,7 +49,7 @@ class patch_380alpha4a implements patchInterface */ public function getDoctrineMigrations() { - return array('auth-failure'); + return ['auth-failure']; } diff --git a/lib/classes/patch/380alpha6a.php b/lib/classes/patch/380alpha6a.php index 78a7025107..c200ae8f0c 100644 --- a/lib/classes/patch/380alpha6a.php +++ b/lib/classes/patch/380alpha6a.php @@ -48,7 +48,7 @@ class patch_380alpha6a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/380alpha8a.php b/lib/classes/patch/380alpha8a.php index 15b4534f8c..2b00263773 100644 --- a/lib/classes/patch/380alpha8a.php +++ b/lib/classes/patch/380alpha8a.php @@ -48,7 +48,7 @@ class patch_380alpha8a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/380alpha9a.php b/lib/classes/patch/380alpha9a.php index 196cf8dbcd..8db38ad28b 100644 --- a/lib/classes/patch/380alpha9a.php +++ b/lib/classes/patch/380alpha9a.php @@ -48,7 +48,7 @@ class patch_380alpha9a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/381alpha1a.php b/lib/classes/patch/381alpha1a.php index 76afb2e895..d88c9afcc0 100644 --- a/lib/classes/patch/381alpha1a.php +++ b/lib/classes/patch/381alpha1a.php @@ -40,7 +40,7 @@ class patch_381alpha1a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/381alpha1b.php b/lib/classes/patch/381alpha1b.php index 187e05ce05..8814216c6c 100644 --- a/lib/classes/patch/381alpha1b.php +++ b/lib/classes/patch/381alpha1b.php @@ -40,7 +40,7 @@ class patch_381alpha1b implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/381alpha2a.php b/lib/classes/patch/381alpha2a.php index 9f32639910..6997f0572c 100644 --- a/lib/classes/patch/381alpha2a.php +++ b/lib/classes/patch/381alpha2a.php @@ -40,7 +40,7 @@ class patch_381alpha2a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/381alpha3a.php b/lib/classes/patch/381alpha3a.php index 64ca72ba69..05bd8780bf 100644 --- a/lib/classes/patch/381alpha3a.php +++ b/lib/classes/patch/381alpha3a.php @@ -32,7 +32,7 @@ class patch_381alpha3a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/381alpha4a.php b/lib/classes/patch/381alpha4a.php index 280b7e8fa2..c682321d5f 100644 --- a/lib/classes/patch/381alpha4a.php +++ b/lib/classes/patch/381alpha4a.php @@ -32,7 +32,7 @@ class patch_381alpha4a implements patchInterface */ public function getDoctrineMigrations() { - return array(); + return []; } /** diff --git a/lib/classes/patch/390alpha1a.php b/lib/classes/patch/390alpha1a.php index 50d690eef6..f38a1932ac 100644 --- a/lib/classes/patch/390alpha1a.php +++ b/lib/classes/patch/390alpha1a.php @@ -49,7 +49,7 @@ class patch_390alpha1a implements patchInterface */ public function getDoctrineMigrations() { - return array('ftp-credential'); + return ['ftp-credential']; } /** diff --git a/lib/classes/patch/390alpha1b.php b/lib/classes/patch/390alpha1b.php index a8ad6c5997..5dc1c82d0e 100644 --- a/lib/classes/patch/390alpha1b.php +++ b/lib/classes/patch/390alpha1b.php @@ -51,7 +51,7 @@ class patch_390alpha1b implements patchInterface */ public function getDoctrineMigrations() { - return array('order'); + return ['order']; } /** diff --git a/lib/classes/patch/390alpha2a.php b/lib/classes/patch/390alpha2a.php index dcf22b82a8..2a0267f569 100644 --- a/lib/classes/patch/390alpha2a.php +++ b/lib/classes/patch/390alpha2a.php @@ -51,7 +51,7 @@ class patch_390alpha2a implements patchInterface */ public function getDoctrineMigrations() { - return array('user'); + return ['user']; } /** diff --git a/lib/classes/patch/390alpha3a.php b/lib/classes/patch/390alpha3a.php index 7526ae5973..97eb62cb7c 100644 --- a/lib/classes/patch/390alpha3a.php +++ b/lib/classes/patch/390alpha3a.php @@ -49,7 +49,7 @@ class patch_390alpha3a implements patchInterface */ public function getDoctrineMigrations() { - return array('user-query'); + return ['user-query']; } /** diff --git a/lib/classes/patch/390alpha4a.php b/lib/classes/patch/390alpha4a.php index 9b5b38bdca..7ecab45612 100644 --- a/lib/classes/patch/390alpha4a.php +++ b/lib/classes/patch/390alpha4a.php @@ -49,7 +49,7 @@ class patch_390alpha4a implements patchInterface */ public function getDoctrineMigrations() { - return array('user-setting'); + return ['user-setting']; } /** diff --git a/lib/classes/patch/390alpha5a.php b/lib/classes/patch/390alpha5a.php index 8a25985882..7936a8330a 100644 --- a/lib/classes/patch/390alpha5a.php +++ b/lib/classes/patch/390alpha5a.php @@ -49,7 +49,7 @@ class patch_390alpha5a implements patchInterface */ public function getDoctrineMigrations() { - return array('user-notif-setting'); + return ['user-notif-setting']; } /** diff --git a/lib/classes/patch/390alpha6a.php b/lib/classes/patch/390alpha6a.php index 6ffaa41b70..eadaaadfc7 100644 --- a/lib/classes/patch/390alpha6a.php +++ b/lib/classes/patch/390alpha6a.php @@ -51,7 +51,7 @@ class patch_390alpha6a implements patchInterface */ public function getDoctrineMigrations() { - return array('ftp-export'); + return ['ftp-export']; } /** diff --git a/lib/classes/patch/390alpha7a.php b/lib/classes/patch/390alpha7a.php index 7b10c1ab3b..fffed24093 100644 --- a/lib/classes/patch/390alpha7a.php +++ b/lib/classes/patch/390alpha7a.php @@ -55,7 +55,7 @@ class patch_390alpha7a implements patchInterface */ public function getDoctrineMigrations() { - return array('feed', 'aggregate-token'); + return ['feed', 'aggregate-token']; } /** diff --git a/lib/classes/patch/390alpha8a.php b/lib/classes/patch/390alpha8a.php index 89b81bcef2..1642c368d6 100644 --- a/lib/classes/patch/390alpha8a.php +++ b/lib/classes/patch/390alpha8a.php @@ -49,7 +49,7 @@ class patch_390alpha8a implements patchInterface */ public function getDoctrineMigrations() { - return array('task'); + return ['task']; } /** diff --git a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php index 96289f696b..6bd8cd25df 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/CLIProvider/DoctrineMigrationServiceProviderTest.php @@ -6,12 +6,12 @@ class DoctrineMigrationServiceProviderTest extends ServiceProviderTestCase { public function provideServiceDescription() { - return array( - array( + return [ + [ 'Alchemy\Phrasea\Core\CLIProvider\DoctrineMigrationServiceProvider', 'doctrine-migration.configuration', 'Doctrine\DBAL\Migrations\Configuration\YamlConfiguration' - ) - ); + ] + ]; } } diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/PropertyAccessTest.php b/tests/Alchemy/Tests/Phrasea/Core/Configuration/PropertyAccessTest.php index 75a67b7125..86ccc2a272 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/PropertyAccessTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/PropertyAccessTest.php @@ -60,87 +60,87 @@ class PropertyAccessTest extends \PHPUnit_Framework_TestCase public function provideMergeData() { - $conf = array( - 'key1' => array('subkey1' => 'value1'), - ); + $conf = [ + 'key1' => ['subkey1' => 'value1'], + ]; - return array( - array($conf, 'key1', array('subkey2' => 'valuetest'), array('subkey1' => 'value1', 'subkey2' => 'valuetest'), array('key1' => array('subkey1' => 'value1', 'subkey2' => 'valuetest'))), - array($conf, 'key1', array('subkey1' => 'valuetest'), array('subkey1' => 'valuetest'), array('key1' => array('subkey1' => 'valuetest'))), - array($conf, 'key2', array('subkey1' => 'valuetest'), array('subkey1' => 'valuetest'), array('key1' => array('subkey1' => 'value1'), 'key2' => array('subkey1' => 'valuetest'))), - array($conf, array('key1', 'subkey2'), array('subkey3' => 'valuetest'), array('subkey3' => 'valuetest'), array('key1' => array('subkey1' => 'value1', 'subkey2' => array('subkey3' => 'valuetest')))), - ); + return [ + [$conf, 'key1', ['subkey2' => 'valuetest'], ['subkey1' => 'value1', 'subkey2' => 'valuetest'], ['key1' => ['subkey1' => 'value1', 'subkey2' => 'valuetest']]], + [$conf, 'key1', ['subkey1' => 'valuetest'], ['subkey1' => 'valuetest'], ['key1' => ['subkey1' => 'valuetest']]], + [$conf, 'key2', ['subkey1' => 'valuetest'], ['subkey1' => 'valuetest'], ['key1' => ['subkey1' => 'value1'], 'key2' => ['subkey1' => 'valuetest']]], + [$conf, ['key1', 'subkey2'], ['subkey3' => 'valuetest'], ['subkey3' => 'valuetest'], ['key1' => ['subkey1' => 'value1', 'subkey2' => ['subkey3' => 'valuetest']]]], + ]; } public function provideGetData() { - $conf = array( - 'key1' => array('subkey1' => 'value1'), - 'key2' => array('subkey1' => 'value1', 'subkey2' => array('subkey3' => 'value3')), - ); + $conf = [ + 'key1' => ['subkey1' => 'value1'], + 'key2' => ['subkey1' => 'value1', 'subkey2' => ['subkey3' => 'value3']], + ]; - return array( - array($conf, 'key1', array('subkey1' => 'value1'), null), - array($conf, 'key1', array('subkey1' => 'value1'), 'ladada'), - array($conf, 'key2', array('subkey1' => 'value1', 'subkey2' => array('subkey3' => 'value3')), null), - array($conf, 'key2', array('subkey1' => 'value1', 'subkey2' => array('subkey3' => 'value3')), 'ladada'), - array($conf, array('key2', 'subkey1'), 'value1', null), - array($conf, array('key2', 'subkey1'), 'value1', 'ladada'), - array($conf, array('key2', 'subkey2', 'subkey3'), 'value3', null), - array($conf, array('key2', 'subkey2', 'subkey3'), 'value3', 'ladada'), - array($conf, array('key2', 'subkey2', 'subkey4'), null, null), - array($conf, array('key2', 'subkey2', 'subkey4'), 'ladada', 'ladada'), - array($conf, array('key', 'subkey', 'subkey'), null, null), - array($conf, array('key', 'subkey', 'subkey'), 'ladada', 'ladada'), - array($conf, 'key3', null, null), - array($conf, 'key3', 'ladada', 'ladada'), - ); + return [ + [$conf, 'key1', ['subkey1' => 'value1'], null], + [$conf, 'key1', ['subkey1' => 'value1'], 'ladada'], + [$conf, 'key2', ['subkey1' => 'value1', 'subkey2' => ['subkey3' => 'value3']], null], + [$conf, 'key2', ['subkey1' => 'value1', 'subkey2' => ['subkey3' => 'value3']], 'ladada'], + [$conf, ['key2', 'subkey1'], 'value1', null], + [$conf, ['key2', 'subkey1'], 'value1', 'ladada'], + [$conf, ['key2', 'subkey2', 'subkey3'], 'value3', null], + [$conf, ['key2', 'subkey2', 'subkey3'], 'value3', 'ladada'], + [$conf, ['key2', 'subkey2', 'subkey4'], null, null], + [$conf, ['key2', 'subkey2', 'subkey4'], 'ladada', 'ladada'], + [$conf, ['key', 'subkey', 'subkey'], null, null], + [$conf, ['key', 'subkey', 'subkey'], 'ladada', 'ladada'], + [$conf, 'key3', null, null], + [$conf, 'key3', 'ladada', 'ladada'], + ]; } public function provideHasData() { - $conf = array( - 'key1' => array('subkey1' => 'value1'), - 'key2' => array('subkey1' => 'value1', 'subkey2' => array('subkey3' => 'value3')), - ); + $conf = [ + 'key1' => ['subkey1' => 'value1'], + 'key2' => ['subkey1' => 'value1', 'subkey2' => ['subkey3' => 'value3']], + ]; - return array( - array($conf, 'key1', true), - array($conf, 'key2', true), - array($conf, array('key2', 'subkey1'), true), - array($conf, array('key2', 'subkey2', 'subkey3'), true), - array($conf, array('key2', 'subkey2', 'subkey4'), false), - array($conf, array('key', 'subkey', 'subkey'), false), - array($conf, 'key3', false), - ); + return [ + [$conf, 'key1', true], + [$conf, 'key2', true], + [$conf, ['key2', 'subkey1'], true], + [$conf, ['key2', 'subkey2', 'subkey3'], true], + [$conf, ['key2', 'subkey2', 'subkey4'], false], + [$conf, ['key', 'subkey', 'subkey'], false], + [$conf, 'key3', false], + ]; } public function provideSetData() { - $conf = array( - 'key1' => array('subkey1' => 'value1'), - ); + $conf = [ + 'key1' => ['subkey1' => 'value1'], + ]; - return array( - array($conf, 'key1', 'valuetest', array('key1' => 'valuetest')), - array($conf, 'key2', 'valuetest', array('key1' => array('subkey1' => 'value1'), 'key2' => 'valuetest')), - array($conf, array('key2', 'subkey1'), 'valuetest', array('key1' => array('subkey1' => 'value1'), 'key2' => array('subkey1' => 'valuetest'))), - array($conf, array('key1', 'subkey2'), 'valuetest', array('key1' => array('subkey1' => 'value1', 'subkey2' => 'valuetest'))), - ); + return [ + [$conf, 'key1', 'valuetest', ['key1' => 'valuetest']], + [$conf, 'key2', 'valuetest', ['key1' => ['subkey1' => 'value1'], 'key2' => 'valuetest']], + [$conf, ['key2', 'subkey1'], 'valuetest', ['key1' => ['subkey1' => 'value1'], 'key2' => ['subkey1' => 'valuetest']]], + [$conf, ['key1', 'subkey2'], 'valuetest', ['key1' => ['subkey1' => 'value1', 'subkey2' => 'valuetest']]], + ]; } public function provideRemoveData() { - $conf = array( - 'key1' => array('subkey1' => 'value1'), - ); + $conf = [ + 'key1' => ['subkey1' => 'value1'], + ]; - return array( - array($conf, 'key1', array('subkey1' => 'value1'), array()), - array($conf, array('key1', 'subkey1'), 'value1', array('key1' => array())), - array($conf, array('key1', 'subkey2'), null, $conf), - array($conf, 'key2', null, $conf), - ); + return [ + [$conf, 'key1', ['subkey1' => 'value1'], []], + [$conf, ['key1', 'subkey1'], 'value1', ['key1' => []]], + [$conf, ['key1', 'subkey2'], null, $conf], + [$conf, 'key2', null, $conf], + ]; } } From 5b955b2a22451b822d6f96bc4546e84fa6caa162 Mon Sep 17 00:00:00 2001 From: Nicolas Le Goff Date: Mon, 18 Nov 2013 14:56:43 +0100 Subject: [PATCH 13/13] Fix neutron's comments --- bin/developer | 2 +- .../AggregateTokenMigration.php | 27 ------------- .../DoctrineMigrations/FeedMigration.php | 16 ++++++++ lib/classes/patch/320alpha1b.php | 7 ++-- lib/classes/patch/320alpha4b.php | 8 +++- lib/classes/patch/320alpha5a.php | 3 +- lib/classes/patch/320alpha6a.php | 3 +- lib/classes/patch/360alpha2a.php | 3 +- lib/classes/patch/360alpha2b.php | 4 +- lib/classes/patch/370alpha4a.php | 3 +- lib/classes/patch/370alpha8a.php | 4 +- lib/classes/patch/373alpha1a.php | 3 +- lib/classes/patch/379alpha1a.php | 3 +- lib/classes/patch/380alpha10a.php | 6 ++- lib/classes/patch/380alpha4a.php | 4 +- lib/classes/patch/380alpha8a.php | 4 +- lib/classes/patch/381alpha4a.php | 7 +++- lib/classes/patch/390alpha1a.php | 2 +- lib/classes/patch/390alpha1b.php | 4 +- lib/classes/patch/390alpha5a.php | 3 +- lib/classes/patch/390alpha7a.php | 40 +++++++++++-------- lib/conf.d/migrations.yml | 3 -- 22 files changed, 89 insertions(+), 70 deletions(-) delete mode 100644 lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AggregateTokenMigration.php diff --git a/bin/developer b/bin/developer index 713f2482f9..2ecabe682e 100755 --- a/bin/developer +++ b/bin/developer @@ -44,7 +44,7 @@ use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand; // Migration Commands use Doctrine\DBAL\Migrations\Tools\Console\Command\DiffCommand; use Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand; -use\Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand; +use Doctrine\DBAL\Migrations\Tools\Console\Command\GenerateCommand; use Doctrine\DBAL\Migrations\Tools\Console\Command\MigrateCommand; use Doctrine\DBAL\Migrations\Tools\Console\Command\StatusCommand; use Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand; diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AggregateTokenMigration.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AggregateTokenMigration.php deleted file mode 100644 index 4ab80fb2f1..0000000000 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/AggregateTokenMigration.php +++ /dev/null @@ -1,27 +0,0 @@ -addSql("CREATE TABLE IF NOT EXISTS AggregateTokens (id INT AUTO_INCREMENT NOT NULL, usr_id INT NOT NULL, value VARCHAR(12) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); - } - - public function doDownSql(Schema $schema) - { - $this->addSql("DROP TABLE AggregateTokens"); - } -} diff --git a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FeedMigration.php b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FeedMigration.php index 50cde7bbb0..1f0b12fcff 100644 --- a/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FeedMigration.php +++ b/lib/Alchemy/Phrasea/Setup/DoctrineMigrations/FeedMigration.php @@ -18,11 +18,26 @@ class FeedMigration extends AbstractMigration { public function doUpSql(Schema $schema) { + $rsm = (new ResultSetMapping())->addScalarResult('Name', 'Name'); + $backup = false; + + foreach ($this->getEntityManager()->createNativeQuery('SHOW TABLE STATUS', $rsm)->getResult() as $row) { + if ('feeds' === $row['Name']) { + $backup = true; + break; + } + } + + if ($backup) { + $this->getEntityManager()->executeQuery('RENAME TABLE `feeds` TO `feeds_backup`'); + } + $this->addSql("CREATE TABLE IF NOT EXISTS Feeds (id INT AUTO_INCREMENT NOT NULL, public TINYINT(1) NOT NULL, icon_url TINYINT(1) NOT NULL, base_id INT DEFAULT NULL, title VARCHAR(128) NOT NULL, subtitle VARCHAR(1024) DEFAULT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE IF NOT EXISTS FeedPublishers (id INT AUTO_INCREMENT NOT NULL, feed_id INT DEFAULT NULL, usr_id INT NOT NULL, owner TINYINT(1) NOT NULL, created_on DATETIME NOT NULL, INDEX IDX_31AFAB251A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE IF NOT EXISTS FeedEntries (id INT AUTO_INCREMENT NOT NULL, publisher_id INT DEFAULT NULL, feed_id INT DEFAULT NULL, title VARCHAR(128) NOT NULL, subtitle VARCHAR(128) NOT NULL, author_name VARCHAR(128) NOT NULL, author_email VARCHAR(128) NOT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, INDEX IDX_5FC892F940C86FCE (publisher_id), INDEX IDX_5FC892F951A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE IF NOT EXISTS FeedItems (id INT AUTO_INCREMENT NOT NULL, entry_id INT DEFAULT NULL, record_id INT NOT NULL, sbas_id INT NOT NULL, ord INT NOT NULL, created_on DATETIME NOT NULL, updated_on DATETIME NOT NULL, INDEX IDX_7F9CDFA6BA364942 (entry_id), UNIQUE INDEX lookup_unique_idx (entry_id, sbas_id, record_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("CREATE TABLE IF NOT EXISTS FeedTokens (id INT AUTO_INCREMENT NOT NULL, feed_id INT DEFAULT NULL, usr_id INT NOT NULL, value VARCHAR(12) DEFAULT NULL, INDEX IDX_9D1CA84851A5BC03 (feed_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); + $this->addSql("CREATE TABLE IF NOT EXISTS AggregateTokens (id INT AUTO_INCREMENT NOT NULL, usr_id INT NOT NULL, value VARCHAR(12) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB"); $this->addSql("ALTER TABLE FeedPublishers ADD CONSTRAINT FK_31AFAB251A5BC03 FOREIGN KEY (feed_id) REFERENCES Feeds (id)"); $this->addSql("ALTER TABLE FeedEntries ADD CONSTRAINT FK_5FC892F940C86FCE FOREIGN KEY (publisher_id) REFERENCES FeedPublishers (id)"); $this->addSql("ALTER TABLE FeedEntries ADD CONSTRAINT FK_5FC892F951A5BC03 FOREIGN KEY (feed_id) REFERENCES Feeds (id)"); @@ -42,5 +57,6 @@ class FeedMigration extends AbstractMigration $this->addSql("DROP TABLE FeedEntries"); $this->addSql("DROP TABLE FeedItems"); $this->addSql("DROP TABLE FeedTokens"); + $this->addSql("DROP TABLE AggregateTokens"); } } diff --git a/lib/classes/patch/320alpha1b.php b/lib/classes/patch/320alpha1b.php index 662619e316..8316883dca 100644 --- a/lib/classes/patch/320alpha1b.php +++ b/lib/classes/patch/320alpha1b.php @@ -58,11 +58,12 @@ class patch_320alpha1b implements patchInterface { $sql = 'REPLACE INTO records_rights ( - SELECT null as id, usr_id, b.sbas_id, record_id, "1" as document, null as preview - , "push" as `case`, pushFrom as pusher_usr_id + SELECT null as id, usr_id, b.sbas_id, record_id, "1" as document, null as preview, + "push" as `case`, pushFrom as pusher_usr_id FROM sselcont c, ssel s, bas b WHERE c.ssel_id = s.ssel_id - AND b.base_id = c.base_id AND c.canHD = 1 + AND b.base_id = c.base_id + AND c.canHD = 1 )'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/320alpha4b.php b/lib/classes/patch/320alpha4b.php index da3bac2448..8489ea0cf3 100644 --- a/lib/classes/patch/320alpha4b.php +++ b/lib/classes/patch/320alpha4b.php @@ -75,7 +75,9 @@ class patch_320alpha4b implements patchInterface } $sql = 'SELECT ssel_id, usr_id, name, descript, pub_date, updater, pub_restrict, homelink - FROM ssel WHERE (public = "1" or homelink="1") and migrated = 0'; + FROM ssel + WHERE (public = "1" OR homelink="1") + AND migrated = 0'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); @@ -117,7 +119,9 @@ class patch_320alpha4b implements patchInterface } $sql = 'SELECT sselcont_id, ssel_id, base_id, record_id - FROM sselcont WHERE ssel_id = :ssel_id ORDER BY ord ASC'; + FROM sselcont + WHERE ssel_id = :ssel_id + ORDER BY ord ASC'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute([':ssel_id' => $row['ssel_id']]); $rs = $stmt->fetchAll(PDO::FETCH_ASSOC); diff --git a/lib/classes/patch/320alpha5a.php b/lib/classes/patch/320alpha5a.php index f8249b36a2..9cd5cc0efb 100644 --- a/lib/classes/patch/320alpha5a.php +++ b/lib/classes/patch/320alpha5a.php @@ -63,7 +63,8 @@ class patch_320alpha5a implements patchInterface $stmt->closeCursor(); $sql = 'UPDATE basusr SET order_master="1" - WHERE base_id = :base_id AND usr_id = :usr_id'; + WHERE base_id = :base_id + AND usr_id = :usr_id'; $stmt = $appbox->get_connection()->prepare($sql); foreach ($rs as $row) { diff --git a/lib/classes/patch/320alpha6a.php b/lib/classes/patch/320alpha6a.php index 1884e491c4..2179b34a86 100644 --- a/lib/classes/patch/320alpha6a.php +++ b/lib/classes/patch/320alpha6a.php @@ -59,7 +59,8 @@ class patch_320alpha6a implements patchInterface { $sql = 'UPDATE record r, subdef s SET r.mime = s.mime - WHERE r.record_id = s.record_id AND s.name="document"'; + WHERE r.record_id = s.record_id + AND s.name="document"'; $stmt = $databox->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); diff --git a/lib/classes/patch/360alpha2a.php b/lib/classes/patch/360alpha2a.php index 6d052bc296..b8e9a874b9 100644 --- a/lib/classes/patch/360alpha2a.php +++ b/lib/classes/patch/360alpha2a.php @@ -60,8 +60,7 @@ class patch_360alpha2a implements patchInterface $sql = 'UPDATE usr SET usr_mail = NULL WHERE usr_mail IS NOT NULL - AND usr_login LIKE "(#deleted%"'; - + AND usr_login LIKE "(#deleted%"'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); diff --git a/lib/classes/patch/360alpha2b.php b/lib/classes/patch/360alpha2b.php index e3454ccdb4..4df22bf5c4 100644 --- a/lib/classes/patch/360alpha2b.php +++ b/lib/classes/patch/360alpha2b.php @@ -72,7 +72,9 @@ class patch_360alpha2b implements patchInterface $sql = 'UPDATE metadatas SET updated = "0" WHERE meta_struct_id IN ( - SELECT id FROM metadatas_structure WHERE multi = "1" + SELECT id + FROM metadatas_structure + WHERE multi = "1" )'; $stmt = $databox->get_connection()->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/370alpha4a.php b/lib/classes/patch/370alpha4a.php index ef9d2a92cd..613ed2e3b4 100644 --- a/lib/classes/patch/370alpha4a.php +++ b/lib/classes/patch/370alpha4a.php @@ -77,7 +77,8 @@ class patch_370alpha4a implements patchInterface } } - $sql = 'UPDATE metadatas_structure SET src = :src WHERE id = :id'; + $sql = 'UPDATE metadatas_structure SET src = :src + WHERE id = :id'; $stmt = $databox->get_connection()->prepare($sql); foreach ($update as $row) { diff --git a/lib/classes/patch/370alpha8a.php b/lib/classes/patch/370alpha8a.php index 8922ce0082..152862ee54 100644 --- a/lib/classes/patch/370alpha8a.php +++ b/lib/classes/patch/370alpha8a.php @@ -62,7 +62,9 @@ class patch_370alpha8a implements patchInterface { $ttasks = []; $conn = $appbox->get_connection(); - $sql = 'SELECT task_id, active, name, class, settings FROM task2 WHERE class=\'task_period_workflow01\''; + $sql = 'SELECT task_id, active, name, class, settings + FROM task2 + WHERE class=\'task_period_workflow01\''; if (($stmt = $conn->prepare($sql)) !== FALSE) { $stmt->execute(); $ttasks = $stmt->fetchAll(); diff --git a/lib/classes/patch/373alpha1a.php b/lib/classes/patch/373alpha1a.php index 705d80c228..104112d74d 100644 --- a/lib/classes/patch/373alpha1a.php +++ b/lib/classes/patch/373alpha1a.php @@ -56,7 +56,8 @@ class patch_373alpha1a implements patchInterface */ public function apply(base $appbox, Application $app) { - $sql = 'SELECT * FROM registry WHERE `key` = :key'; + $sql = 'SELECT * FROM registry + WHERE `key` = :key'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $Regbinaries = [ diff --git a/lib/classes/patch/379alpha1a.php b/lib/classes/patch/379alpha1a.php index 2ea7969fcb..44ffd6c1f8 100644 --- a/lib/classes/patch/379alpha1a.php +++ b/lib/classes/patch/379alpha1a.php @@ -56,7 +56,8 @@ class patch_379alpha1a implements patchInterface */ public function apply(base $appbox, Application $app) { - $sql = 'UPDATE permalinks SET label = "untitled" WHERE label = ""'; + $sql = 'UPDATE permalinks SET label = "untitled" + WHERE label = ""'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); $stmt->closeCursor(); diff --git a/lib/classes/patch/380alpha10a.php b/lib/classes/patch/380alpha10a.php index 83e5b14516..8250cb7207 100644 --- a/lib/classes/patch/380alpha10a.php +++ b/lib/classes/patch/380alpha10a.php @@ -56,13 +56,15 @@ class patch_380alpha10a implements patchInterface */ public function apply(base $appbox, Application $app) { - $sql = 'SELECT id, `usage` FROM `order`'; + $sql = 'SELECT id, `usage` + FROM `order`'; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); - $sql = 'UPDATE `order` SET `usage` = :usage WHERE id = :id'; + $sql = 'UPDATE `order` SET `usage` = :usage + WHERE id = :id'; $stmt = $appbox->get_connection()->prepare($sql); foreach ($rs as $row) { diff --git a/lib/classes/patch/380alpha4a.php b/lib/classes/patch/380alpha4a.php index b0727e5710..91ec94ef12 100644 --- a/lib/classes/patch/380alpha4a.php +++ b/lib/classes/patch/380alpha4a.php @@ -59,7 +59,9 @@ class patch_380alpha4a implements patchInterface public function apply(base $appbox, Application $app) { $conn = $app['phraseanet.appbox']->get_connection(); - $sql = 'SELECT date, login, ip, locked FROM badlog ORDER BY id ASC'; + $sql = 'SELECT date, login, ip, locked + FROM badlog + ORDER BY id ASC'; $stmt = $conn->prepare($sql); $stmt->execute(); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); diff --git a/lib/classes/patch/380alpha8a.php b/lib/classes/patch/380alpha8a.php index 2b00263773..db09c2b259 100644 --- a/lib/classes/patch/380alpha8a.php +++ b/lib/classes/patch/380alpha8a.php @@ -58,7 +58,9 @@ class patch_380alpha8a implements patchInterface { $conn = $appbox->get_connection(); - $sql = 'SELECT settings FROM task2 WHERE class="task_period_cindexer" LIMIT 1'; + $sql = 'SELECT settings + FROM task2 + WHERE class="task_period_cindexer" LIMIT 1'; $stmt = $conn->prepare($sql); $stmt->execute(); $row = $stmt->fetch(\PDO::FETCH_ASSOC); diff --git a/lib/classes/patch/381alpha4a.php b/lib/classes/patch/381alpha4a.php index c682321d5f..2f180f6d21 100644 --- a/lib/classes/patch/381alpha4a.php +++ b/lib/classes/patch/381alpha4a.php @@ -58,14 +58,17 @@ class patch_381alpha4a implements patchInterface { $sql = "SELECT usr_id, prop, value FROM usr_settings WHERE prop = 'editing_top_box' - OR prop = 'editing_right_box' OR prop = 'editing_left_box'"; + OR prop = 'editing_right_box' + OR prop = 'editing_left_box'"; $stmt = $appbox->get_connection()->prepare($sql); $stmt->execute(); $rows = $stmt->fetchAll(\PDO::FETCH_ASSOC); $stmt->closeCursor(); - $sql = 'UPDATE usr_settings SET value = :value WHERE usr_id = :usr_id AND prop = :prop'; + $sql = 'UPDATE usr_settings SET value = :value + WHERE usr_id = :usr_id + AND prop = :prop'; $stmt = $appbox->get_connection()->prepare($sql); foreach ($rows as $row) { diff --git a/lib/classes/patch/390alpha1a.php b/lib/classes/patch/390alpha1a.php index f38a1932ac..02f2f59586 100644 --- a/lib/classes/patch/390alpha1a.php +++ b/lib/classes/patch/390alpha1a.php @@ -59,7 +59,7 @@ class patch_390alpha1a implements patchInterface { $conn = $app['phraseanet.appbox']->get_connection(); $sql = 'SELECT usr_id, activeFTP, addrFTP, loginFTP, - retryFTP, passifFTP, pwdFTP, destFTP, prefixFTPfolder + retryFTP, passifFTP, pwdFTP, destFTP, prefixFTPfolder FROM usr'; $stmt = $conn->prepare($sql); $stmt->execute(); diff --git a/lib/classes/patch/390alpha1b.php b/lib/classes/patch/390alpha1b.php index 5dc1c82d0e..4af113c54c 100644 --- a/lib/classes/patch/390alpha1b.php +++ b/lib/classes/patch/390alpha1b.php @@ -82,7 +82,9 @@ class patch_390alpha1b implements patchInterface foreach ($rs as $row) { - $sql = 'SELECT count(id) as todo FROM order_elements WHERE deny = NULL AND order_id = :id'; + $sql = 'SELECT count(id) as todo FROM order_elements + WHERE deny = NULL + AND order_id = :id'; $stmt = $conn->prepare($sql); $stmt->execute([':id' => $row['id']]); $todo = $stmt->fetch(\PDO::FETCH_ASSOC); diff --git a/lib/classes/patch/390alpha5a.php b/lib/classes/patch/390alpha5a.php index 7936a8330a..401d16d2ae 100644 --- a/lib/classes/patch/390alpha5a.php +++ b/lib/classes/patch/390alpha5a.php @@ -63,7 +63,8 @@ class patch_390alpha5a implements patchInterface $stmt->closeCursor(); $conn = $app['phraseanet.appbox']->get_connection(); - $sql = 'SELECT * FROM usr_settings WHERE prop LIKE "notification_%"'; + $sql = 'SELECT * FROM usr_settings + WHERE prop LIKE "notification_%"'; $stmt = $conn->prepare($sql); $stmt->execute(); $rs = $stmt->fetchAll(\PDO::FETCH_ASSOC); diff --git a/lib/classes/patch/390alpha7a.php b/lib/classes/patch/390alpha7a.php index fffed24093..6fce84aa09 100644 --- a/lib/classes/patch/390alpha7a.php +++ b/lib/classes/patch/390alpha7a.php @@ -55,7 +55,7 @@ class patch_390alpha7a implements patchInterface */ public function getDoctrineMigrations() { - return ['feed', 'aggregate-token']; + return ['feed']; } /** @@ -63,24 +63,10 @@ class patch_390alpha7a implements patchInterface */ public function apply(base $appbox, Application $app) { - $rsm = new ResultSetMapping(); - $rsm->addScalarResult('Name', 'Name'); - - $backup = false; - - foreach ($app['EM']->createNativeQuery('SHOW TABLE STATUS', $rsm)->getResult() as $row) { - if (0 === strcmp('feeds', $row['Name'])) { - $backup = true; - break; - } - } - - if (false === $backup) { + if (false === $this->hasFeedBackup($app)) { return false; } - $app['EM']->executeQuery("RENAME TABLE `feeds` TO `feeds_backup`"); - $sql = 'DELETE FROM Feeds'; $stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql); $stmt->execute(); @@ -231,4 +217,26 @@ class patch_390alpha7a implements patchInterface return true; } + + /** + * Checks whether `feeds_backup` tables exists. + * + * @param Application $app + * + * @return boolean True if `feeds_backup` table exists. + */ + private function hasFeedBackup(Application $app) + { + $rsm = (new ResultSetMapping())->addScalarResult('Name', 'Name'); + $backup = false; + + foreach ($app['EM']->createNativeQuery('SHOW TABLE STATUS', $rsm)->getResult() as $row) { + if ('feeds_backup' === $row['Name']) { + $backup = true; + break; + } + } + + return $backup; + } } diff --git a/lib/conf.d/migrations.yml b/lib/conf.d/migrations.yml index 8b49d630e9..27f488abe2 100644 --- a/lib/conf.d/migrations.yml +++ b/lib/conf.d/migrations.yml @@ -42,6 +42,3 @@ migrations: migration13: version: ftp-export class: Alchemy\Phrasea\Setup\DoctrineMigrations\FtpExportMigration - migration14: - version: aggregate-token - class: Alchemy\Phrasea\Setup\DoctrineMigrations\AggregateTokenMigration