1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-06-27 16:36:00 +00:00

Stop using ContainerAwareInterface in migrations

This commit is contained in:
Yassine Guedidi 2025-01-18 14:44:31 +01:00
parent bcf0f2f52c
commit e715da7e91
19 changed files with 83 additions and 66 deletions

View file

@ -21,9 +21,7 @@ class Version20160410190541 extends WallabagMigration
'length' => 23,
]);
$sharePublic = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$sharePublic = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_public'");
if (false === $sharePublic) {

View file

@ -12,18 +12,14 @@ class Version20160911214952 extends WallabagMigration
{
public function up(Schema $schema): void
{
$redis = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$redis = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_redis'");
if (false === $redis) {
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('import_with_redis', 0, 'import')");
}
$rabbitmq = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$rabbitmq = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_rabbitmq'");
if (false === $rabbitmq) {

View file

@ -12,9 +12,7 @@ class Version20161031132655 extends WallabagMigration
{
public function up(Schema $schema): void
{
$images = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$images = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_images_enabled'");
$this->skipIf(false !== $images, 'It seems that you already played this migration.');

View file

@ -12,18 +12,14 @@ class Version20161117071626 extends WallabagMigration
{
public function up(Schema $schema): void
{
$share = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$share = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_unmark'");
if (false === $share) {
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('share_unmark', 0, 'entry')");
}
$unmark = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$unmark = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'unmark_url'");
if (false === $unmark) {

View file

@ -12,9 +12,7 @@ class Version20161122144743 extends WallabagMigration
{
public function up(Schema $schema): void
{
$access = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$access = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'restricted_access'");
$this->skipIf(false !== $access, 'It seems that you already played this migration.');

View file

@ -12,9 +12,7 @@ class Version20170327194233 extends WallabagMigration
{
public function up(Schema $schema): void
{
$scuttle = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$scuttle = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_scuttle'");
$this->skipIf(false !== $scuttle, 'It seems that you already played this migration.');

View file

@ -17,9 +17,7 @@ class Version20170420134133 extends WallabagMigration
public function down(Schema $schema): void
{
$downloadPictures = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$downloadPictures = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_pictures'");
$this->skipIf(false !== $downloadPictures, 'It seems that you already played this migration.');

View file

@ -12,9 +12,7 @@ class Version20170602075214 extends WallabagMigration
{
public function up(Schema $schema): void
{
$apiUserRegistration = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$apiUserRegistration = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'api_user_registration'");
$this->skipIf(false !== $apiUserRegistration, 'It seems that you already played this migration.');

View file

@ -19,9 +19,7 @@ class Version20170606155640 extends WallabagMigration
return;
}
$apiUserRegistration = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$apiUserRegistration = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'");
if (false === $apiUserRegistration) {

View file

@ -12,9 +12,7 @@ class Version20171120163128 extends WallabagMigration
{
public function up(Schema $schema): void
{
$storeArticleHeaders = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$storeArticleHeaders = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'store_article_headers'");
$this->skipIf(false !== $storeArticleHeaders, 'It seems that you already played this migration.');

View file

@ -12,9 +12,7 @@ class Version20171125164500 extends WallabagMigration
{
public function up(Schema $schema): void
{
$shaarliShareOriginUrl = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$shaarliShareOriginUrl = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'shaarli_share_origin_url'");
$this->skipIf(false !== $shaarliShareOriginUrl, 'It seems that you already played this migration.');

View file

@ -121,9 +121,7 @@ final class Version20190129120000 extends WallabagMigration
public function up(Schema $schema): void
{
foreach ($this->settings as $setting) {
$settingEnabled = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$settingEnabled = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = '" . $setting['name'] . "'");
if (false !== $settingEnabled) {

View file

@ -45,10 +45,8 @@ final class Version20190826204730 extends WallabagMigration
public function postUp(Schema $schema): void
{
foreach ($this->container->getParameter('wallabag.default_ignore_origin_instance_rules') as $entity) {
$previous_rule = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
foreach ($this->defaultIgnoreOriginInstanceRules as $entity) {
$previous_rule = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('ignore_origin_instance_rule') . " WHERE rule = '" . $entity['rule'] . "'");
if (false === $previous_rule) {

View file

@ -37,7 +37,7 @@ final class Version20230728093912 extends WallabagMigration
'UPDATE ' . $this->getTable('entry') . ' SET is_not_parsed = :isNotParsed WHERE content LIKE :content',
[
'isNotParsed' => true,
'content' => str_replace("\n", '', addslashes($this->container->getParameter('wallabag.fetching_error_message'))) . '%',
'content' => str_replace("\n", '', addslashes($this->fetchingErrorMessage)) . '%',
]
);
}

View file

@ -12,18 +12,14 @@ final class Version20240521152037 extends WallabagMigration
{
public function up(Schema $schema): void
{
$share = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$share = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('internal_setting') . " WHERE name = 'share_linkding'");
if (false === $share) {
$this->addSql('INSERT INTO ' . $this->getTable('internal_setting') . " (name, value, section) VALUES ('share_linkding', 0, 'entry')");
}
$linkding = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
$linkding = $this->connection
->fetchOne('SELECT * FROM ' . $this->getTable('internal_setting') . " WHERE name = 'linkding_url'");
if (false === $linkding) {