Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Application\Migrations; use Doctrine\DBAL\Schema\Schema; use Wallabag\Do..

Decoded Output download

<?php

namespace Application\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Wallabag\Doctrine\WallabagMigration;

/**
 * Added the internal setting to share articles to linkding.
 */
final class Version20240521152037 extends WallabagMigration
{
    public function up(Schema $schema): void
    {
        $share = $this->container
            ->get('doctrine.orm.default_entity_manager')
            ->getConnection()
            ->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()
            ->fetchOne('SELECT * FROM ' . $this->getTable('internal_setting') . " WHERE name = 'linkding_url'");

        if (false === $linkding) {
            $this->addSql('INSERT INTO ' . $this->getTable('internal_setting') . " (name, value, section) VALUES ('linkding_url', 'https://linkding.example.com', 'entry')");
        }

        $this->skipIf(false !== $share && false !== $linkding, 'It seems that you already played this migration.');
    }

    public function down(Schema $schema): void
    {
        $this->addSql('DELETE FROM ' . $this->getTable('internal_setting') . " WHERE name = 'share_linkding';");
        $this->addSql('DELETE FROM ' . $this->getTable('internal_setting') . " WHERE name = 'linkding_url';");
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Application\Migrations;

use Doctrine\DBAL\Schema\Schema;
use Wallabag\Doctrine\WallabagMigration;

/**
 * Added the internal setting to share articles to linkding.
 */
final class Version20240521152037 extends WallabagMigration
{
    public function up(Schema $schema): void
    {
        $share = $this->container
            ->get('doctrine.orm.default_entity_manager')
            ->getConnection()
            ->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()
            ->fetchOne('SELECT * FROM ' . $this->getTable('internal_setting') . " WHERE name = 'linkding_url'");

        if (false === $linkding) {
            $this->addSql('INSERT INTO ' . $this->getTable('internal_setting') . " (name, value, section) VALUES ('linkding_url', 'https://linkding.example.com', 'entry')");
        }

        $this->skipIf(false !== $share && false !== $linkding, 'It seems that you already played this migration.');
    }

    public function down(Schema $schema): void
    {
        $this->addSql('DELETE FROM ' . $this->getTable('internal_setting') . " WHERE name = 'share_linkding';");
        $this->addSql('DELETE FROM ' . $this->getTable('internal_setting') . " WHERE name = 'linkding_url';");
    }
}

Function Calls

None

Variables

None

Stats

MD5 3ecd7e32e87830aa2faaffeb80b35fbd
Eval Count 0
Decode Time 83 ms