Merge pull request #777 from nlegoff/doctrine_mig

[3.9] Add doctrine migration
This commit is contained in:
Romain Neutron
2013-11-18 08:06:12 -08:00
86 changed files with 1809 additions and 903 deletions

View File

@@ -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());

View File

@@ -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,8 @@ $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'));

View File

@@ -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",
@@ -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",

162
composer.lock generated
View File

@@ -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": "989a79784be4adcf2393615316d5fdd2",
"packages": [
{
"name": "alchemy-fr/tcpdf-clone",
@@ -720,31 +720,33 @@
},
{
"name": "doctrine/dbal",
"version": "2.3.4",
"version": "v2.4.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "2a37b007dda8e21bdbb8fa445be8fa0064199e13"
"reference": "328357bd9eea9d671fe5fff0737f01953bfe66a0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/2a37b007dda8e21bdbb8fa445be8fa0064199e13",
"reference": "2a37b007dda8e21bdbb8fa445be8fa0064199e13",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/328357bd9eea9d671fe5fff0737f01953bfe66a0",
"reference": "328357bd9eea9d671fe5fff0737f01953bfe66a0",
"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/",
@@ -755,7 +757,8 @@
{
"name": "Jonathan 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-11-12 12:38:28"
},
{
"name": "doctrine/inflector",
@@ -897,24 +900,89 @@
"time": "2013-01-12 18:59:04"
},
{
"name": "doctrine/orm",
"version": "2.3.4",
"name": "doctrine/migrations",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/doctrine/doctrine2.git",
"reference": "a41b02c080114c0de3da4ee9fba61f7d18fae7d0"
"url": "https://github.com/doctrine/migrations.git",
"reference": "37aacdae6507faad03c3df1624e7d3a6e6c1b388"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/doctrine2/zipball/a41b02c080114c0de3da4ee9fba61f7d18fae7d0",
"reference": "a41b02c080114c0de3da4ee9fba61f7d18fae7d0",
"url": "https://api.github.com/repos/doctrine/migrations/zipball/37aacdae6507faad03c3df1624e7d3a6e6c1b388",
"reference": "37aacdae6507faad03c3df1624e7d3a6e6c1b388",
"shasum": ""
},
"require": {
"doctrine/dbal": "2.3.*",
"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",
"source": {
"type": "git",
"url": "https://github.com/doctrine/doctrine2.git",
"reference": "84373d05a4198ec380918d535abf83c454c3867f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/doctrine2/zipball/84373d05a4198ec380918d535abf83c454c3867f",
"reference": "84373d05a4198ec380918d535abf83c454c3867f",
"shasum": ""
},
"require": {
"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 +994,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/",
@@ -942,7 +1010,8 @@
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com",
"homepage": "http://www.jwage.com/"
"homepage": "http://www.jwage.com/",
"role": "Creator"
},
{
"name": "Guilherme Blanco",
@@ -964,7 +1033,7 @@
"database",
"orm"
],
"time": "2013-05-11 07:51:12"
"time": "2013-11-12 12:40:13"
},
{
"name": "evenement/evenement",
@@ -1635,16 +1704,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 +1721,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 +1762,7 @@
"logging",
"psr-3"
],
"time": "2013-11-14 19:48:31"
"time": "2013-07-28 22:38:30"
},
{
"name": "mrclay/minify",
@@ -2826,12 +2890,12 @@
"source": {
"type": "git",
"url": "https://github.com/symfony/symfony.git",
"reference": "4e9332b6b66d52750142e5b32cc754620f875fe7"
"reference": "587f35513761547e43c4538e44df485f62fcd92e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/symfony/zipball/4e9332b6b66d52750142e5b32cc754620f875fe7",
"reference": "4e9332b6b66d52750142e5b32cc754620f875fe7",
"url": "https://api.github.com/repos/symfony/symfony/zipball/587f35513761547e43c4538e44df485f62fcd92e",
"reference": "587f35513761547e43c4538e44df485f62fcd92e",
"shasum": ""
},
"require": {
@@ -2931,7 +2995,7 @@
"keywords": [
"framework"
],
"time": "2013-11-17 08:45:14"
"time": "2013-11-13 21:30:16"
},
{
"name": "themattharris/tmhoauth",
@@ -2939,12 +3003,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": {
@@ -3603,7 +3667,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",
@@ -4103,12 +4168,13 @@
"imagine/imagine": 20,
"silex/silex": 20,
"symfony/symfony": 20,
"doctrine/migrations": 20,
"doctrine/data-fixtures": 20,
"behat/behat": 20,
"behat/gherkin": 20
},
"platform": {
"php": ">=5.4"
"php": ">=5.3.3"
},
"platform-dev": [

View File

@@ -0,0 +1,34 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Core\CLIProvider;
use Silex\Application;
use Silex\ServiceProviderInterface;
use Doctrine\DBAL\Migrations\Configuration\YamlConfiguration;
class DoctrineMigrationServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
$app['doctrine-migration.configuration'] = $app->share(function ($app) {
$configuration = new YamlConfiguration($app['EM']->getConnection());
$configuration->load(__DIR__.'/../../../../conf.d/migrations.yml');
$configuration->setMigrationsDirectory(__DIR__.'/../../../../Alchemy/Phrasea/Setup/DoctrineMigration');
return $configuration;
});
}
public function boot(Application $app)
{
}
}

View File

@@ -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;

View File

@@ -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)

View File

@@ -0,0 +1,88 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Alchemy\Phrasea\Exception\RuntimeException;
use Doctrine\DBAL\Migrations\AbstractMigration as BaseMigration;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Migrations\Configuration;
use Doctrine\ORM\EntityManager;
abstract class AbstractMigration extends BaseMigration
{
/** @var EntityManager */
private $em;
/**
* Sets EntityManager.
*
* @param EntityManager $em
*
* @return AbstractMigration
*/
public function setEntityManager(EntityManager $em)
{
$this->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);
}

View File

@@ -0,0 +1,27 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
class AuthFailureMigration extends AbstractMigration
{
public function doUpSql(Schema $schema)
{
$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 doDownSql(Schema $schema)
{
$this->addSql("DROP TABLE AuthFailures");
}
}

View File

@@ -0,0 +1,62 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\ORM\Query\ResultSetMapping;
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)");
$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 doDownSql(Schema $schema)
{
$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");
$this->addSql("DROP TABLE AggregateTokens");
}
}

View File

@@ -0,0 +1,27 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
class FtpCredentialMigration extends AbstractMigration
{
public function doUpSql(Schema $schema)
{
$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");
}
public function doDownSql(Schema $schema)
{
$this->addSql("DROP TABLE FtpCredential");
}
}

View File

@@ -0,0 +1,31 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
class FtpExportMigration extends AbstractMigration
{
public function doUpSql(Schema $schema)
{
$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 doDownSql(Schema $schema)
{
$this->addSql("ALTER TABLE FtpExportElements DROP FOREIGN KEY FK_7BF0AE1264CDAF82");
$this->addSql("DROP TABLE FtpExportElements");
$this->addSql("DROP TABLE FtpExports");
}
}

View File

@@ -0,0 +1,39 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
class LazaretMigration extends AbstractMigration
{
public function doUpSql(Schema $schema)
{
$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 doDownSql(Schema $schema)
{
$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");
}
}

View File

@@ -0,0 +1,32 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
class OrderMigration extends AbstractMigration
{
public function doUpSql(Schema $schema)
{
$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 doDownSql(Schema $schema)
{
$this->addSql("ALTER TABLE OrderElements DROP FOREIGN KEY FK_8C7066C88D9F6D38");
$this->addSql("DROP TABLE Orders");
$this->addSql("DROP TABLE OrderElements");
}
}

View File

@@ -0,0 +1,31 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
class SessionMigration extends AbstractMigration
{
public function doUpSql(Schema $schema)
{
$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 doDownSql(Schema $schema)
{
$this->addSql("ALTER TABLE SessionModules DROP FOREIGN KEY FK_BA36EF49613FECDF");
$this->addSql("DROP TABLE SessionModules");
$this->addSql("DROP TABLE Sessions");
}
}

View File

@@ -0,0 +1,27 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
class TaskMigration extends AbstractMigration
{
public function doUpSql(Schema $schema)
{
$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 doDownSql(Schema $schema)
{
$this->addSql("DROP TABLE Tasks");
}
}

View File

@@ -0,0 +1,29 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
class UserMigration extends AbstractMigration
{
public function doUpSql(Schema $schema)
{
$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 doDownSql(Schema $schema)
{
$this->addSql("ALTER TABLE Users DROP FOREIGN KEY FK_D5428AEDC121714D");
$this->addSql("DROP TABLE Users");
}
}

View File

@@ -0,0 +1,28 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
class UserNotificationSettingMigration extends AbstractMigration
{
public function doUpSql(Schema $schema)
{
$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 doDownSql(Schema $schema)
{
$this->addSql("DROP TABLE UserNotificationSettings");
}
}

View File

@@ -0,0 +1,28 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
class UserQueryMigration extends AbstractMigration
{
public function doUpSql(Schema $schema)
{
$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 doDownSql(Schema $schema)
{
$this->addSql("DROP TABLE UserQueries");
}
}

View File

@@ -0,0 +1,28 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
class UserSettingMigration extends AbstractMigration
{
public function doUpSql(Schema $schema)
{
$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 doDownSql(Schema $schema)
{
$this->addSql("DROP TABLE UserSettings");
}
}

View File

@@ -0,0 +1,47 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
class WorkzoneMigration extends AbstractMigration
{
public function doUpSql(Schema $schema)
{
$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 doDownSql(Schema $schema)
{
$this->addSql("ALTER TABLE ValidationSessions DROP FOREIGN KEY FK_5B9DFB061BE1FB52");
$this->addSql("ALTER TABLE BasketElements DROP FOREIGN KEY FK_C0B7ECB71BE1FB52");
$this->addSql("ALTER TABLE ValidationParticipants DROP FOREIGN KEY FK_17850D7BF25B0F5B");
$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 ValidationDatas");
$this->addSql("DROP TABLE BasketElements");
$this->addSql("DROP TABLE ValidationParticipants");
}
}

View File

@@ -1,42 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\Version\PreSchemaUpgrade;
use Alchemy\Phrasea\Application;
/**
* Collection of Doctrine schema pre-upgrades
*/
class PreSchemaUpgradeCollection
{
/** @var PreSchemaUpgradeInterface[] */
private $upgrades = [];
public function __construct()
{
$this->upgrades[] = new Upgrade39();
}
/**
* Applies all applyable upgrades
*
* @param Application $app
*/
public function apply(Application $app)
{
foreach ($this->upgrades as $upgrade) {
if ($upgrade->isApplyable($app)) {
$upgrade->apply($app['EM']);
}
}
}
}

View File

@@ -1,38 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\Version\PreSchemaUpgrade;
use Doctrine\ORM\EntityManager;
use Alchemy\Phrasea\Application;
/**
* Interface for DB schema upgrade that have to be done before Doctrine schema
* upgrade
*/
interface PreSchemaUpgradeInterface
{
/**
* Applies the pre-upgrade/
*
* @param EntityManager $em
*/
public function apply(EntityManager $em);
/**
* Returns true if the Upgrade is applyable
*
* @param Application $app
*
* @return Boolean
*/
public function isApplyable(Application $app);
}

View File

@@ -1,44 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2013 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Setup\Version\PreSchemaUpgrade;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\EntityManager;
class Upgrade39 implements PreSchemaUpgradeInterface
{
/**
* {@inheritdoc}
*/
public function apply(EntityManager $em)
{
$em->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;
}
}

View File

@@ -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,15 +305,6 @@ 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 +380,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')) {

View File

@@ -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);
}

View File

@@ -11,53 +11,53 @@
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
*/
/** @var Array */
private $concern = [base::DATA_BOX];
/**
*
* @return string
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@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"
WHERE parent_record_id != "0"';
WHERE parent_record_id != "0"';
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
$stmt->closeCursor();

View File

@@ -11,57 +11,60 @@
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
*/
/** @var Array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
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();

View File

@@ -11,52 +11,52 @@
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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
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);

View File

@@ -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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$sql = 'UPDATE basusr SET nowatermark=1 WHERE needwatermark=0';

View File

@@ -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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
$sql = 'TRUNCATE metadatas';

View File

@@ -15,50 +15,52 @@ 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
*/
/** @var array */
private $concern = [base::APPLICATION_BOX];
/**
*
* @return string
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return ['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)
{
$feeds = [];
@@ -72,9 +74,10 @@ 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();
@@ -116,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);
@@ -139,7 +144,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();
@@ -202,9 +207,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();

View File

@@ -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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@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();
@@ -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) {

View File

@@ -11,60 +11,63 @@
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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
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();

View File

@@ -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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$sql = 'DELETE FROM basusr WHERE actif = "0"';

View File

@@ -10,49 +10,53 @@
*/
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
*/
/** @var array */
private $concern = [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 ['workzone', 'session'];
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$tables = ['StoryWZ', 'ValidationDatas', 'ValidationParticipants', 'ValidationSessions', 'BasketElements', 'Baskets'];
@@ -67,8 +71,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 +92,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 +122,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 +141,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 +193,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 +206,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 +218,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 +247,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();

View File

@@ -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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
try {

View File

@@ -11,54 +11,56 @@
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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$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();
$stmt->closeCursor();

View File

@@ -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
*/
/** @var array */
private $concern = [base::DATA_BOX];
/**
*
* @return string
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@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)
{
/**
@@ -60,16 +62,20 @@ 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 +94,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 +108,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 +120,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 = [];

View File

@@ -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
*/
/** @var array */
private $concern = [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 ['workzone'];
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$conn = $appbox->get_connection();

View File

@@ -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
*/
/** @var array */
private $concern = [base::DATA_BOX];
/**
*
* @return string
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@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();

View File

@@ -12,23 +12,12 @@
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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
try {
@@ -69,5 +71,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;
}
}

View File

@@ -11,51 +11,51 @@
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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
$sql = 'SELECT id, src FROM metadatas_structure';
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
@@ -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) {

View File

@@ -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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{

View File

@@ -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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
$structure = $databox->get_structure();

View File

@@ -15,48 +15,49 @@ 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
*/
/** @var array */
private $concern = [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 ['lazaret'];
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$conn = $appbox->get_connection();
@@ -150,7 +151,7 @@ class patch_370alpha7a implements patchInterface
$stmt->closeCursor();
return;
return true;
}
private function truncateTable(\Doctrine\ORM\EntityManager $em, $className)

View File

@@ -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
*/
/** @var array */
private $concern = [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 ['task'];
}
/**
* transform tasks 'workflow 01' to 'RecordMover'
* will group tasks(01) with same period to a single task(02)
@@ -67,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();

View File

@@ -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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@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)
{

View File

@@ -19,29 +19,35 @@ class patch_3715alpha1a implements patchInterface
*/
private $release = '3.7.15-alpha1';
/**
*
* @var Array
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function concern()
{
@@ -49,7 +55,7 @@ class patch_3715alpha1a implements patchInterface
}
/**
* @param base $databox
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{

View File

@@ -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
*/
/** @var array */
private $concern = [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,13 +44,22 @@ class patch_371alpha1a implements patchInterface
}
/**
* @param base $databox
* @param Application $app
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
foreach ($databox->get_meta_structure() as $databox_field) {
$databox_field->save();
}
return true;
}
}

View File

@@ -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
*/
private $release = '3.7.3-alpha1';
/** @var string */
private $release = '3.7.3-alpha.1';
/**
*
* @var Array
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function concern()
{
@@ -54,12 +52,12 @@ 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';
$sql = 'SELECT * FROM registry
WHERE `key` = :key';
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
$Regbinaries = [

View File

@@ -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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function concern()
{
@@ -49,12 +52,12 @@ class patch_379alpha1a implements patchInterface
}
/**
* @param base $appbox
* @param Application $app
* {@inheritdoc}
*/
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();

View File

@@ -27,6 +27,14 @@ class patch_380alpha10a implements patchInterface
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/
@@ -48,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) {
@@ -65,5 +75,7 @@ class patch_380alpha10a implements patchInterface
}
$stmt->closeCursor();
return true;
}
}

View File

@@ -45,6 +45,14 @@ class patch_380alpha11a implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return ['session'];
}
/**
* {@inheritdoc}
*/
@@ -60,7 +68,7 @@ class patch_380alpha11a implements patchInterface
$stmt->closeCursor();
} catch (\PDOException $e) {
// this may fail on oldest versions
return;
return false;
}
foreach ($rs as $row) {
@@ -112,5 +120,7 @@ class patch_380alpha11a implements patchInterface
}
$app['EM']->flush();
return true;
}
}

View File

@@ -27,6 +27,14 @@ class patch_380alpha13a implements patchInterface
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/

View File

@@ -35,6 +35,14 @@ class patch_380alpha14a implements patchInterface
return false;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/

View File

@@ -27,6 +27,13 @@ class patch_380alpha15a implements patchInterface
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/

View File

@@ -27,6 +27,14 @@ class patch_380alpha16a implements patchInterface
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/

View File

@@ -27,6 +27,14 @@ class patch_380alpha17a implements patchInterface
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/

View File

@@ -28,6 +28,14 @@ class patch_380alpha18a implements patchInterface
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/

View File

@@ -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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@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)
{
@@ -66,5 +64,7 @@ class patch_380alpha2a implements patchInterface
}
$app['configuration']->setConfig($config);
return true;
}
}

View File

@@ -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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@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)
{
@@ -70,6 +68,6 @@ class patch_380alpha2b implements patchInterface
$app['phraseanet.appbox']->get_connection()->exec($sql);
}
return;
return true;
}
}

View File

@@ -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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $databox, Application $app)
{
$conn = $databox->get_connection();
@@ -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);

View File

@@ -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
*/
/** @var array */
private $concern = [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 [];
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
@@ -64,5 +60,4 @@ class patch_380alpha3b implements patchInterface
return true;
}
}

View File

@@ -44,13 +44,24 @@ class patch_380alpha4a implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return ['auth-failure'];
}
/**
* {@inheritdoc}
*/
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);
@@ -78,5 +89,7 @@ class patch_380alpha4a implements patchInterface
$app['EM']->flush();
$app['EM']->clear();
return true;
}
}

View File

@@ -43,6 +43,14 @@ class patch_380alpha6a implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/
@@ -50,5 +58,7 @@ class patch_380alpha6a implements patchInterface
{
$app['configuration']->setDefault('registration-fields');
$app['configuration']->setDefault('authentication');
return true;
}
}

View File

@@ -43,6 +43,14 @@ class patch_380alpha8a implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/
@@ -50,14 +58,16 @@ 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);
$stmt->closeCursor();
if (!$row) {
return;
return false;
}
$sxe = simplexml_load_string($row['settings']);

View File

@@ -43,6 +43,14 @@ class patch_380alpha9a implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/
@@ -70,5 +78,7 @@ class patch_380alpha9a implements patchInterface
$dom->loadXML($sxe->asXML());
$databox->saveStructure($dom);
return true;
}
}

View File

@@ -35,6 +35,14 @@ class patch_381alpha1a implements patchInterface
return false;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/
@@ -49,8 +57,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);

View File

@@ -35,6 +35,14 @@ class patch_381alpha1b implements patchInterface
return false;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/

View File

@@ -35,6 +35,14 @@ class patch_381alpha2a implements patchInterface
return false;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/

View File

@@ -27,6 +27,14 @@ class patch_381alpha3a implements patchInterface
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/

View File

@@ -27,6 +27,14 @@ class patch_381alpha4a implements patchInterface
return $this->release;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return [];
}
/**
* {@inheritdoc}
*/
@@ -50,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) {

View File

@@ -44,6 +44,14 @@ class patch_390alpha1a implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return ['ftp-credential'];
}
/**
* {@inheritdoc}
*/
@@ -51,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();
@@ -85,5 +93,7 @@ class patch_390alpha1a implements patchInterface
$em->flush();
$em->clear();
return true;
}
}

View File

@@ -35,7 +35,7 @@ class patch_390alpha1b implements patchInterface
*/
public function require_all_upgrades()
{
return false;
return true;
}
/**
@@ -46,6 +46,14 @@ class patch_390alpha1b implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return ['order'];
}
/**
* {@inheritdoc}
*/
@@ -74,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);
@@ -120,5 +130,7 @@ class patch_390alpha1b implements patchInterface
$em->clear();
$em->getEventManager()->addEventSubscriber(new TimestampableListener());
return true;
}
}

View File

@@ -46,6 +46,14 @@ class patch_390alpha2a implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return ['user'];
}
/**
* {@inheritdoc}
*/
@@ -65,6 +73,8 @@ class patch_390alpha2a implements patchInterface
$this->updateModels($em, $conn);
$em->getEventManager()->addEventSubscriber(new TimestampableListener());
return true;
}
/**
@@ -73,10 +83,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);

View File

@@ -44,6 +44,14 @@ class patch_390alpha3a implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return ['user-query'];
}
/**
* {@inheritdoc}
*/
@@ -81,5 +89,7 @@ class patch_390alpha3a implements patchInterface
$em->flush();
$em->clear();
return true;
}
}

View File

@@ -44,6 +44,14 @@ class patch_390alpha4a implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return ['user-setting'];
}
/**
* {@inheritdoc}
*/
@@ -86,5 +94,7 @@ class patch_390alpha4a implements patchInterface
$em->flush();
$em->clear();
return true;
}
}

View File

@@ -44,6 +44,14 @@ class patch_390alpha5a implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return ['user-notif-setting'];
}
/**
* {@inheritdoc}
*/
@@ -55,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);
@@ -82,5 +91,7 @@ class patch_390alpha5a implements patchInterface
$em->flush();
$em->clear();
return true;
}
}

View File

@@ -46,6 +46,14 @@ class patch_390alpha6a implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return ['ftp-export'];
}
/**
* {@inheritdoc}
*/
@@ -77,8 +85,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);
@@ -149,5 +156,7 @@ class patch_390alpha6a implements patchInterface
$em->clear();
$em->getEventManager()->addEventSubscriber(new TimestampableListener());
return true;
}
}

View File

@@ -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,11 +50,23 @@ class patch_390alpha7a implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return ['feed'];
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
if (false === $this->hasFeedBackup($app)) {
return false;
}
$sql = 'DELETE FROM Feeds';
$stmt = $app['phraseanet.appbox']->get_connection()->prepare($sql);
$stmt->execute();
@@ -86,22 +99,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();
@@ -217,5 +214,29 @@ class patch_390alpha7a implements patchInterface
$em->flush();
$em->clear();
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;
}
}

View File

@@ -44,6 +44,14 @@ class patch_390alpha8a implements patchInterface
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function getDoctrineMigrations()
{
return ['task'];
}
/**
* {@inheritdoc}
*/

View File

@@ -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();
}

44
lib/conf.d/migrations.yml Normal file
View File

@@ -0,0 +1,44 @@
name: Phraseanet Migrations
migrations_namespace: Alchemy\Phrasea\Setup\DoctrineMigrations
table_name: doctrine_migration_versions
migrations:
migration1:
version: feed
class: Alchemy\Phrasea\Setup\DoctrineMigrations\FeedMigration
migration2:
version: workzone
class: Alchemy\Phrasea\Setup\DoctrineMigrations\WorkzoneMigration
migration3:
version: lazaret
class: Alchemy\Phrasea\Setup\DoctrineMigrations\LazaretMigration
migration4:
version: task
class: Alchemy\Phrasea\Setup\DoctrineMigrations\TaskMigration
migration5:
version: auth-failure
class: Alchemy\Phrasea\Setup\DoctrineMigrations\AuthFailureMigration
migration6:
version: session
class: Alchemy\Phrasea\Setup\DoctrineMigrations\SessionMigration
migration7:
version: ftp-credential
class: Alchemy\Phrasea\Setup\DoctrineMigrations\FtpCredentialMigration
migration8:
version: order
class: Alchemy\Phrasea\Setup\DoctrineMigrations\OrderMigration
migration9:
version: user
class: Alchemy\Phrasea\Setup\DoctrineMigrations\UserMigration
migration10:
version: user-query
class: Alchemy\Phrasea\Setup\DoctrineMigrations\UserQueryMigration
migration11:
version: user-setting
class: Alchemy\Phrasea\Setup\DoctrineMigrations\UserSettingMigration
migration12:
version: user-notif-setting
class: Alchemy\Phrasea\Setup\DoctrineMigrations\UserNotificationSettingMigration
migration13:
version: ftp-export
class: Alchemy\Phrasea\Setup\DoctrineMigrations\FtpExportMigration

View File

@@ -0,0 +1,17 @@
<?php
namespace Alchemy\Tests\Phrasea\Core\CLIProvider;
class DoctrineMigrationServiceProviderTest extends ServiceProviderTestCase
{
public function provideServiceDescription()
{
return [
[
'Alchemy\Phrasea\Core\CLIProvider\DoctrineMigrationServiceProvider',
'doctrine-migration.configuration',
'Doctrine\DBAL\Migrations\Configuration\YamlConfiguration'
]
];
}
}

View File

@@ -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],
];
}
}