]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #3419 from NatJNP/patch1
authorJérémy Benoist <j0k3r@users.noreply.github.com>
Sat, 25 Nov 2017 11:29:53 +0000 (12:29 +0100)
committerGitHub <noreply@github.com>
Sat, 25 Nov 2017 11:29:53 +0000 (12:29 +0100)
Add Thai language

61 files changed:
.travis.yml
Makefile
app/DoctrineMigrations/Version20160401000000.php [new file with mode: 0644]
app/DoctrineMigrations/Version20160812120952.php
app/DoctrineMigrations/Version20170824113337.php
app/DoctrineMigrations/Version20171008195606.php
app/DoctrineMigrations/Version20171105202000.php [new file with mode: 0644]
app/DoctrineMigrations/Version20171120163128.php [new file with mode: 0644]
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.da.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.de.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.en.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.es.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fa.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.fr.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.it.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.oc.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pl.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.pt.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ro.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.ru.yml
app/Resources/CraueConfigBundle/translations/CraueConfigBundle.tr.yml
app/config/wallabag.yml
build.xml [deleted file]
composer.json
data/sql/mysql_base.sql [deleted file]
data/sql/pgsql_base.sql [deleted file]
data/sql/sqlite_base.sql [deleted file]
src/Wallabag/ApiBundle/Controller/EntryRestController.php
src/Wallabag/CoreBundle/Command/InstallCommand.php
src/Wallabag/CoreBundle/Controller/SiteCredentialController.php
src/Wallabag/CoreBundle/DataFixtures/ORM/LoadEntryData.php
src/Wallabag/CoreBundle/Entity/Entry.php
src/Wallabag/CoreBundle/Form/Type/EditEntryType.php
src/Wallabag/CoreBundle/Helper/ContentProxy.php
src/Wallabag/CoreBundle/Resources/config/services.yml
src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
src/Wallabag/CoreBundle/Resources/views/themes/baggy/Entry/entry.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/edit.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig
src/Wallabag/CoreBundle/Twig/WallabagExtension.php
src/Wallabag/ImportBundle/Consumer/RedisEntryConsumer.php
src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml
tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
tests/Wallabag/CoreBundle/Command/InstallCommandTest.php
tests/Wallabag/CoreBundle/Controller/EntryControllerTest.php
tests/Wallabag/CoreBundle/Controller/SiteCredentialControllerTest.php
tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php
tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
tests/Wallabag/CoreBundle/Twig/WallabagExtensionTest.php

index 6b279ed676c149a35d7fbe4b855ac6de67ff75a0..c6c03dc3fce35b70ed498f93b7e0a1127f9693ad 100644 (file)
@@ -70,11 +70,9 @@ before_install:
 
 script:
     - travis_wait bash composer install -o  --no-interaction --no-progress --prefer-dist
-    - ant prepare-$DB
-
-    - echo "travis_fold:start:migrations"
-    - php bin/console doctrine:migrations:migrate --no-interaction --env=test
-    - echo "travis_fold:end:migrations"
+    - echo "travis_fold:start:prepare"
+    - make prepare DB=$DB
+    - echo "travis_fold:end:prepare"
 
     - echo "travis_fold:start:fixtures"
     - php bin/console doctrine:fixtures:load --no-interaction --env=test
index ffbe102a045c05f09ca3201322592e3ff153a111..0686454fc09c4c75ead74d09fe6a2124ddb8bb99 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,13 @@
 TMP_FOLDER=/tmp
 RELEASE_FOLDER=wllbg-release
 
-ifndef ENV
-       ENV=prod
-endif
+ENV ?= prod
 
 help: ## Display this help menu
        @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
 
 clean: ## Clear the application cache
-       @rm -rf var/cache/*
+       rm -rf var/cache/*
 
 install: ## Install wallabag with the latest version
        @sh scripts/install.sh $(ENV)
@@ -26,8 +24,19 @@ run: ## Run the wallabag built-in server
 build: ## Run webpack
        @npm run build:$(ENV)
 
-test: ## Launch wallabag testsuite
-       @ant prepare && bin/simple-phpunit -v
+prepare: clean ## Prepare database for testsuite
+ifdef DB
+       cp app/config/tests/parameters_test.$(DB).yml app/config/parameters_test.yml
+endif
+       -php bin/console doctrine:database:drop --force --env=test
+       php bin/console doctrine:database:create --env=test
+       php bin/console doctrine:migrations:migrate --no-interaction --env=test
+
+fixtures: ## Load fixtures into database
+       php bin/console doctrine:fixtures:load --no-interaction --env=test
+
+test: prepare fixtures ## Launch wallabag testsuite
+       bin/simple-phpunit -v
 
 release: ## Create a package. Need a VERSION parameter (eg: `make release VERSION=master`).
 ifndef VERSION
@@ -35,11 +44,9 @@ ifndef VERSION
 endif
        @sh scripts/release.sh $(VERSION) $(TMP_FOLDER) $(RELEASE_FOLDER) $(ENV)
 
-travis: ## Make some stuff for Travis-CI
-
 deploy: ## Deploy wallabag
        @bundle exec cap staging deploy
 
-.PHONY: help clean install update build test release travis deploy run dev
+.PHONY: help clean prepare install fixtures update build test release deploy run dev
 
 .DEFAULT_GOAL := install
diff --git a/app/DoctrineMigrations/Version20160401000000.php b/app/DoctrineMigrations/Version20160401000000.php
new file mode 100644 (file)
index 0000000..a8603ab
--- /dev/null
@@ -0,0 +1,191 @@
+<?php
+
+namespace Application\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration;
+use Doctrine\DBAL\Schema\Schema;
+
+/**
+ * Initial database structure.
+ */
+class Version20160401000000 extends AbstractMigration
+{
+    /**
+     * @param Schema $schema
+     */
+    public function up(Schema $schema)
+    {
+        if ($this->version->getConfiguration()->getNumberOfExecutedMigrations() > 0) {
+            $this->version->markMigrated();
+            $this->skipIf(true, 'Database already initialized');
+        }
+
+        switch ($this->connection->getDatabasePlatform()->getName()) {
+            case 'sqlite':
+                $sql = <<<'SQL'
+CREATE TABLE wallabag_craue_config_setting (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, PRIMARY KEY(name));
+CREATE UNIQUE INDEX UNIQ_5D9649505E237E06 ON wallabag_craue_config_setting (name);
+CREATE TABLE "wallabag_tagging_rule" (id INTEGER NOT NULL, config_id INTEGER DEFAULT NULL, rule VARCHAR(255) NOT NULL, tags CLOB NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_2D9B3C5424DB0683 FOREIGN KEY (config_id) REFERENCES "wallabag_config" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
+CREATE INDEX IDX_2D9B3C5424DB0683 ON "wallabag_tagging_rule" (config_id);
+CREATE TABLE "wallabag_tag" (id INTEGER NOT NULL, label CLOB NOT NULL, slug VARCHAR(128) NOT NULL, PRIMARY KEY(id));
+CREATE UNIQUE INDEX UNIQ_4CA58A8C989D9B62 ON "wallabag_tag" (slug);
+CREATE TABLE "wallabag_entry" (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, title CLOB DEFAULT NULL, url CLOB DEFAULT NULL, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL, language CLOB DEFAULT NULL, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL, preview_picture CLOB DEFAULT NULL, is_public BOOLEAN DEFAULT '0', PRIMARY KEY(id), CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
+CREATE INDEX IDX_F4D18282A76ED395 ON "wallabag_entry" (user_id);
+CREATE TABLE wallabag_entry_tag (entry_id INTEGER NOT NULL, tag_id INTEGER NOT NULL, PRIMARY KEY(entry_id, tag_id), CONSTRAINT FK_C9F0DD7CBA364942 FOREIGN KEY (entry_id) REFERENCES "wallabag_entry" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_C9F0DD7CBAD26311 FOREIGN KEY (tag_id) REFERENCES "wallabag_tag" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
+CREATE INDEX IDX_C9F0DD7CBA364942 ON wallabag_entry_tag (entry_id);
+CREATE INDEX IDX_C9F0DD7CBAD26311 ON wallabag_entry_tag (tag_id);
+CREATE TABLE "wallabag_config" (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL, rss_token VARCHAR(255) DEFAULT NULL, rss_limit INTEGER DEFAULT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
+CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "wallabag_config" (user_id);
+CREATE TABLE wallabag_oauth2_refresh_tokens (id INTEGER NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INTEGER DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
+CREATE UNIQUE INDEX UNIQ_20C9FB245F37A13B ON wallabag_oauth2_refresh_tokens (token);
+CREATE INDEX IDX_20C9FB2419EB6921 ON wallabag_oauth2_refresh_tokens (client_id);
+CREATE INDEX IDX_20C9FB24A76ED395 ON wallabag_oauth2_refresh_tokens (user_id);
+CREATE TABLE wallabag_oauth2_access_tokens (id INTEGER NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INTEGER DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
+CREATE UNIQUE INDEX UNIQ_368A42095F37A13B ON wallabag_oauth2_access_tokens (token);
+CREATE INDEX IDX_368A420919EB6921 ON wallabag_oauth2_access_tokens (client_id);
+CREATE INDEX IDX_368A4209A76ED395 ON wallabag_oauth2_access_tokens (user_id);
+CREATE TABLE wallabag_oauth2_auth_codes (id INTEGER NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, token VARCHAR(255) NOT NULL, redirect_uri CLOB NOT NULL, expires_at INTEGER DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
+CREATE UNIQUE INDEX UNIQ_EE52E3FA5F37A13B ON wallabag_oauth2_auth_codes (token);
+CREATE INDEX IDX_EE52E3FA19EB6921 ON wallabag_oauth2_auth_codes (client_id);
+CREATE INDEX IDX_EE52E3FAA76ED395 ON wallabag_oauth2_auth_codes (user_id);
+CREATE TABLE wallabag_oauth2_clients (id INTEGER NOT NULL, random_id VARCHAR(255) NOT NULL, redirect_uris CLOB NOT NULL, secret VARCHAR(255) NOT NULL, allowed_grant_types CLOB NOT NULL, PRIMARY KEY(id));
+CREATE TABLE "wallabag_user" (id INTEGER NOT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled BOOLEAN NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, locked BOOLEAN NOT NULL, expired BOOLEAN NOT NULL, expires_at DATETIME DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles CLOB NOT NULL, credentials_expired BOOLEAN NOT NULL, credentials_expire_at DATETIME DEFAULT NULL, name CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, twoFactorAuthentication BOOLEAN NOT NULL, trusted CLOB DEFAULT NULL, PRIMARY KEY(id));
+CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON "wallabag_user" (username_canonical);
+CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON "wallabag_user" (email_canonical);
+CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON "wallabag_user" (confirmation_token);
+CREATE TABLE wallabag_annotation (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, entry_id INTEGER DEFAULT NULL, text CLOB NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, quote VARCHAR(255) NOT NULL, ranges CLOB NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES "wallabag_entry" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
+CREATE INDEX IDX_A7AED006A76ED395 ON wallabag_annotation (user_id);
+CREATE INDEX IDX_A7AED006BA364942 ON wallabag_annotation (entry_id);
+SQL
+                ;
+
+                foreach (explode("\n", $sql) as $query) {
+                    $this->addSql($query);
+                }
+
+                break;
+            case 'mysql':
+                $sql = <<<'SQL'
+CREATE TABLE wallabag_craue_config_setting (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_5D9649505E237E06 (name), PRIMARY KEY(name)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
+CREATE TABLE `wallabag_entry` (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, title LONGTEXT DEFAULT NULL, url LONGTEXT DEFAULT NULL, is_archived TINYINT(1) NOT NULL, is_starred TINYINT(1) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype LONGTEXT DEFAULT NULL, language LONGTEXT DEFAULT NULL, reading_time INT DEFAULT NULL, domain_name LONGTEXT DEFAULT NULL, preview_picture LONGTEXT DEFAULT NULL, is_public TINYINT(1) DEFAULT '0', INDEX IDX_F4D18282A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
+CREATE TABLE wallabag_entry_tag (entry_id INT NOT NULL, tag_id INT NOT NULL, INDEX IDX_C9F0DD7CBA364942 (entry_id), INDEX IDX_C9F0DD7CBAD26311 (tag_id), PRIMARY KEY(entry_id, tag_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
+CREATE TABLE `wallabag_config` (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INT NOT NULL, language VARCHAR(255) NOT NULL, rss_token VARCHAR(255) DEFAULT NULL, rss_limit INT DEFAULT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, UNIQUE INDEX UNIQ_87E64C53A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
+CREATE TABLE `wallabag_tagging_rule` (id INT AUTO_INCREMENT NOT NULL, config_id INT DEFAULT NULL, rule VARCHAR(255) NOT NULL, tags LONGTEXT NOT NULL COMMENT '(DC2Type:simple_array)', INDEX IDX_2D9B3C5424DB0683 (config_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
+CREATE TABLE `wallabag_tag` (id INT AUTO_INCREMENT NOT NULL, `label` LONGTEXT NOT NULL, slug VARCHAR(128) NOT NULL, UNIQUE INDEX UNIQ_4CA58A8C989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
+CREATE TABLE wallabag_oauth2_clients (id INT AUTO_INCREMENT NOT NULL, random_id VARCHAR(255) NOT NULL, redirect_uris LONGTEXT NOT NULL COMMENT '(DC2Type:array)', secret VARCHAR(255) NOT NULL, allowed_grant_types LONGTEXT NOT NULL COMMENT '(DC2Type:array)', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
+CREATE TABLE wallabag_oauth2_access_tokens (id INT AUTO_INCREMENT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_368A42095F37A13B (token), INDEX IDX_368A420919EB6921 (client_id), INDEX IDX_368A4209A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
+CREATE TABLE wallabag_oauth2_refresh_tokens (id INT AUTO_INCREMENT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_20C9FB245F37A13B (token), INDEX IDX_20C9FB2419EB6921 (client_id), INDEX IDX_20C9FB24A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
+CREATE TABLE wallabag_oauth2_auth_codes (id INT AUTO_INCREMENT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, redirect_uri LONGTEXT NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_EE52E3FA5F37A13B (token), INDEX IDX_EE52E3FA19EB6921 (client_id), INDEX IDX_EE52E3FAA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
+CREATE TABLE `wallabag_user` (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled TINYINT(1) NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, locked TINYINT(1) NOT NULL, expired TINYINT(1) NOT NULL, expires_at DATETIME DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles LONGTEXT NOT NULL COMMENT '(DC2Type:array)', credentials_expired TINYINT(1) NOT NULL, credentials_expire_at DATETIME DEFAULT NULL, name LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INT DEFAULT NULL, twoFactorAuthentication TINYINT(1) NOT NULL, trusted LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json_array)', UNIQUE INDEX UNIQ_1D63E7E592FC23A8 (username_canonical), UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF (email_canonical), UNIQUE INDEX UNIQ_1D63E7E5C05FB297 (confirmation_token), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
+CREATE TABLE wallabag_annotation (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, entry_id INT DEFAULT NULL, text LONGTEXT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, quote VARCHAR(255) NOT NULL, ranges LONGTEXT NOT NULL COMMENT '(DC2Type:array)', INDEX IDX_A7AED006A76ED395 (user_id), INDEX IDX_A7AED006BA364942 (entry_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
+ALTER TABLE `wallabag_entry` ADD CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
+ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBA364942 FOREIGN KEY (entry_id) REFERENCES `wallabag_entry` (id);
+ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBAD26311 FOREIGN KEY (tag_id) REFERENCES `wallabag_tag` (id);
+ALTER TABLE `wallabag_config` ADD CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
+ALTER TABLE `wallabag_tagging_rule` ADD CONSTRAINT FK_2D9B3C5424DB0683 FOREIGN KEY (config_id) REFERENCES `wallabag_config` (id);
+ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id);
+ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
+ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id);
+ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
+ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id);
+ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
+ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
+ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES `wallabag_entry` (id);
+SQL
+                ;
+                foreach (explode("\n", $sql) as $query) {
+                    $this->addSql($query);
+                }
+                break;
+            case 'postgresql':
+                $sql = <<<'SQL'
+CREATE TABLE wallabag_craue_config_setting (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, PRIMARY KEY(name));
+CREATE UNIQUE INDEX UNIQ_5D9649505E237E06 ON wallabag_craue_config_setting (name);
+CREATE TABLE "wallabag_entry" (id INT NOT NULL, user_id INT DEFAULT NULL, title TEXT DEFAULT NULL, url TEXT DEFAULT NULL, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content TEXT DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, mimetype TEXT DEFAULT NULL, language TEXT DEFAULT NULL, reading_time INT DEFAULT NULL, domain_name TEXT DEFAULT NULL, preview_picture TEXT DEFAULT NULL, is_public BOOLEAN DEFAULT 'false', PRIMARY KEY(id));
+CREATE INDEX IDX_F4D18282A76ED395 ON "wallabag_entry" (user_id);
+CREATE TABLE wallabag_entry_tag (entry_id INT NOT NULL, tag_id INT NOT NULL, PRIMARY KEY(entry_id, tag_id));
+CREATE INDEX IDX_C9F0DD7CBA364942 ON wallabag_entry_tag (entry_id);
+CREATE INDEX IDX_C9F0DD7CBAD26311 ON wallabag_entry_tag (tag_id);
+CREATE TABLE "wallabag_config" (id INT NOT NULL, user_id INT DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INT NOT NULL, language VARCHAR(255) NOT NULL, rss_token VARCHAR(255) DEFAULT NULL, rss_limit INT DEFAULT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(id));
+CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "wallabag_config" (user_id);
+CREATE TABLE "wallabag_tagging_rule" (id INT NOT NULL, config_id INT DEFAULT NULL, rule VARCHAR(255) NOT NULL, tags TEXT NOT NULL, PRIMARY KEY(id));
+CREATE INDEX IDX_2D9B3C5424DB0683 ON "wallabag_tagging_rule" (config_id);
+COMMENT ON COLUMN "wallabag_tagging_rule".tags IS '(DC2Type:simple_array)';
+CREATE TABLE "wallabag_tag" (id INT NOT NULL, label TEXT NOT NULL, slug VARCHAR(128) NOT NULL, PRIMARY KEY(id));
+CREATE UNIQUE INDEX UNIQ_4CA58A8C989D9B62 ON "wallabag_tag" (slug);
+CREATE TABLE wallabag_oauth2_clients (id INT NOT NULL, random_id VARCHAR(255) NOT NULL, redirect_uris TEXT NOT NULL, secret VARCHAR(255) NOT NULL, allowed_grant_types TEXT NOT NULL, PRIMARY KEY(id));
+COMMENT ON COLUMN wallabag_oauth2_clients.redirect_uris IS '(DC2Type:array)';
+COMMENT ON COLUMN wallabag_oauth2_clients.allowed_grant_types IS '(DC2Type:array)';
+CREATE TABLE wallabag_oauth2_access_tokens (id INT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id));
+CREATE UNIQUE INDEX UNIQ_368A42095F37A13B ON wallabag_oauth2_access_tokens (token);
+CREATE INDEX IDX_368A420919EB6921 ON wallabag_oauth2_access_tokens (client_id);
+CREATE INDEX IDX_368A4209A76ED395 ON wallabag_oauth2_access_tokens (user_id);
+CREATE TABLE wallabag_oauth2_refresh_tokens (id INT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id));
+CREATE UNIQUE INDEX UNIQ_20C9FB245F37A13B ON wallabag_oauth2_refresh_tokens (token);
+CREATE INDEX IDX_20C9FB2419EB6921 ON wallabag_oauth2_refresh_tokens (client_id);
+CREATE INDEX IDX_20C9FB24A76ED395 ON wallabag_oauth2_refresh_tokens (user_id);
+CREATE TABLE wallabag_oauth2_auth_codes (id INT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, redirect_uri TEXT NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id));
+CREATE UNIQUE INDEX UNIQ_EE52E3FA5F37A13B ON wallabag_oauth2_auth_codes (token);
+CREATE INDEX IDX_EE52E3FA19EB6921 ON wallabag_oauth2_auth_codes (client_id);
+CREATE INDEX IDX_EE52E3FAA76ED395 ON wallabag_oauth2_auth_codes (user_id);
+CREATE TABLE "wallabag_user" (id INT NOT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled BOOLEAN NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, locked BOOLEAN NOT NULL, expired BOOLEAN NOT NULL, expires_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, roles TEXT NOT NULL, credentials_expired BOOLEAN NOT NULL, credentials_expire_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, name TEXT DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, authCode INT DEFAULT NULL, twoFactorAuthentication BOOLEAN NOT NULL, trusted TEXT DEFAULT NULL, PRIMARY KEY(id));
+CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON "wallabag_user" (username_canonical);
+CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON "wallabag_user" (email_canonical);
+CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON "wallabag_user" (confirmation_token);
+COMMENT ON COLUMN "wallabag_user".roles IS '(DC2Type:array)';
+COMMENT ON COLUMN "wallabag_user".trusted IS '(DC2Type:json_array)';
+CREATE TABLE wallabag_annotation (id INT NOT NULL, user_id INT DEFAULT NULL, entry_id INT DEFAULT NULL, text TEXT NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, quote VARCHAR(255) NOT NULL, ranges TEXT NOT NULL, PRIMARY KEY(id));
+CREATE INDEX IDX_A7AED006A76ED395 ON wallabag_annotation (user_id);
+CREATE INDEX IDX_A7AED006BA364942 ON wallabag_annotation (entry_id);
+COMMENT ON COLUMN wallabag_annotation.ranges IS '(DC2Type:array)';
+CREATE SEQUENCE "entry_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
+CREATE SEQUENCE "config_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
+CREATE SEQUENCE "tagging_rule_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
+CREATE SEQUENCE "tag_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
+CREATE SEQUENCE oauth2_clients_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
+CREATE SEQUENCE oauth2_access_tokens_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
+CREATE SEQUENCE oauth2_refresh_tokens_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
+CREATE SEQUENCE oauth2_auth_codes_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
+CREATE SEQUENCE "user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
+CREATE SEQUENCE annotation_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
+ALTER TABLE "wallabag_entry" ADD CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
+ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBA364942 FOREIGN KEY (entry_id) REFERENCES "wallabag_entry" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
+ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBAD26311 FOREIGN KEY (tag_id) REFERENCES "wallabag_tag" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
+ALTER TABLE "wallabag_config" ADD CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
+ALTER TABLE "wallabag_tagging_rule" ADD CONSTRAINT FK_2D9B3C5424DB0683 FOREIGN KEY (config_id) REFERENCES "wallabag_config" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
+ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
+ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
+ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
+ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
+ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
+ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
+ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
+ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES "wallabag_entry" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;                
+SQL
+                ;
+                foreach (explode("\n", $sql) as $query) {
+                    $this->addSql($query);
+                }
+                break;
+        }
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function down(Schema $schema)
+    {
+        $this->addSql('DROP TABLE wallabag_craue_config_setting');
+        $this->addSql('DROP TABLE "wallabag_tagging_rule"');
+        $this->addSql('DROP TABLE "wallabag_config"');
+        $this->addSql('DROP TABLE "wallabag_entry"');
+        $this->addSql('DROP TABLE wallabag_entry_tag');
+        $this->addSql('DROP TABLE "wallabag_tag"');
+        $this->addSql('DROP TABLE wallabag_oauth2_refresh_tokens');
+        $this->addSql('DROP TABLE wallabag_oauth2_access_tokens');
+        $this->addSql('DROP TABLE wallabag_oauth2_clients');
+        $this->addSql('DROP TABLE wallabag_oauth2_auth_codes');
+        $this->addSql('DROP TABLE "wallabag_user"');
+        $this->addSql('DROP TABLE wallabag_annotation');
+    }
+}
index 677f30c32c788ecadf51e4587d3939a9dc2c07fd..d28f3a71d0728eca50b92c83bba90506d26b1ddf 100644 (file)
@@ -30,7 +30,20 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI
         $clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
         $this->skipIf($clientsTable->hasColumn('name'), 'It seems that you already played this migration.');
 
-        $clientsTable->addColumn('name', 'blob');
+        if ('sqlite' === $this->connection->getDatabasePlatform()->getName()) {
+            // Can't use $clientsTable->addColumn('name', 'blob');
+            // because of the error:
+            // SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL
+            $databaseTablePrefix = $this->container->getParameter('database_table_prefix');
+            $this->addSql('CREATE TEMPORARY TABLE __temp__' . $databaseTablePrefix . 'oauth2_clients AS SELECT id, random_id, redirect_uris, secret, allowed_grant_types FROM ' . $databaseTablePrefix . 'oauth2_clients');
+            $this->addSql('DROP TABLE ' . $databaseTablePrefix . 'oauth2_clients');
+            $this->addSql('CREATE TABLE ' . $databaseTablePrefix . 'oauth2_clients (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, random_id VARCHAR(255) NOT NULL COLLATE BINARY, secret VARCHAR(255) NOT NULL COLLATE BINARY, redirect_uris CLOB NOT NULL, allowed_grant_types CLOB NOT NULL, name CLOB NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "' . $databaseTablePrefix . 'user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
+            $this->addSql('INSERT INTO ' . $databaseTablePrefix . 'oauth2_clients (id, random_id, redirect_uris, secret, allowed_grant_types) SELECT id, random_id, redirect_uris, secret, allowed_grant_types FROM __temp__' . $databaseTablePrefix . 'oauth2_clients');
+            $this->addSql('DROP TABLE __temp__' . $databaseTablePrefix . 'oauth2_clients');
+            $this->addSql('CREATE INDEX IDX_635D765EA76ED395 ON ' . $databaseTablePrefix . 'oauth2_clients (user_id)');
+        } else {
+            $clientsTable->addColumn('name', 'blob');
+        }
     }
 
     /**
@@ -39,7 +52,18 @@ class Version20160812120952 extends AbstractMigration implements ContainerAwareI
     public function down(Schema $schema)
     {
         $clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
-        $clientsTable->dropColumn('name');
+
+        if ('sqlite' === $this->connection->getDatabasePlatform()->getName()) {
+            $databaseTablePrefix = $this->container->getParameter('database_table_prefix');
+            $this->addSql('DROP INDEX IDX_635D765EA76ED395');
+            $this->addSql('CREATE TEMPORARY TABLE __temp__' . $databaseTablePrefix . 'oauth2_clients AS SELECT id, random_id, redirect_uris, secret, allowed_grant_types FROM ' . $databaseTablePrefix . 'oauth2_clients');
+            $this->addSql('DROP TABLE ' . $databaseTablePrefix . 'oauth2_clients');
+            $this->addSql('CREATE TABLE ' . $databaseTablePrefix . 'oauth2_clients (id INTEGER NOT NULL, random_id VARCHAR(255) NOT NULL, secret VARCHAR(255) NOT NULL, redirect_uris CLOB NOT NULL COLLATE BINARY, allowed_grant_types CLOB NOT NULL COLLATE BINARY, PRIMARY KEY(id))');
+            $this->addSql('INSERT INTO ' . $databaseTablePrefix . 'oauth2_clients (id, random_id, redirect_uris, secret, allowed_grant_types) SELECT id, random_id, redirect_uris, secret, allowed_grant_types FROM __temp__' . $databaseTablePrefix . 'oauth2_clients');
+            $this->addSql('DROP TABLE __temp__' . $databaseTablePrefix . 'oauth2_clients');
+        } else {
+            $clientsTable->dropColumn('name');
+        }
     }
 
     private function getTable($tableName)
index 7393d683dbf95c571436b6a3daea5bb5225dbb85..e54a9bcf7ea2bcfcd407b72ffa0de63ab9c531a3 100644 (file)
@@ -41,7 +41,12 @@ class Version20170824113337 extends AbstractMigration implements ContainerAwareI
         $entryTable = $schema->getTable($this->getTable('entry'));
         $this->skipIf(!$entryTable->hasColumn('starred_at'), 'Unable to add starred_at colum');
 
-        $this->connection->executeQuery('UPDATE ' . $this->getTable('entry') . ' SET starred_at = updated_at WHERE is_starred = true');
+        $this->connection->executeQuery(
+            'UPDATE ' . $this->getTable('entry') . ' SET starred_at = updated_at WHERE is_starred = :is_starred',
+            [
+                'is_starred' => true,
+            ]
+        );
     }
 
     /**
index c190f4ed38324a6ee07ca759de1953b25dd90a3d..f09726c8532dbf72e0eea8e22ba164273861399c 100644 (file)
@@ -31,6 +31,7 @@ class Version20171008195606 extends AbstractMigration implements ContainerAwareI
 
         switch ($this->connection->getDatabasePlatform()->getName()) {
             case 'mysql':
+                $this->addSql('UPDATE ' . $this->getTable('entry') . ' SET reading_time = 0 WHERE reading_time IS NULL;');
                 $this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE reading_time reading_time INT(11) NOT NULL;');
                 break;
             case 'postgresql':
diff --git a/app/DoctrineMigrations/Version20171105202000.php b/app/DoctrineMigrations/Version20171105202000.php
new file mode 100644 (file)
index 0000000..3769045
--- /dev/null
@@ -0,0 +1,55 @@
+<?php
+
+namespace Application\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration;
+use Doctrine\DBAL\Schema\Schema;
+use Symfony\Component\DependencyInjection\ContainerAwareInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Add origin_url column.
+ */
+class Version20171105202000 extends AbstractMigration implements ContainerAwareInterface
+{
+    /**
+     * @var ContainerInterface
+     */
+    private $container;
+
+    public function setContainer(ContainerInterface $container = null)
+    {
+        $this->container = $container;
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function up(Schema $schema)
+    {
+        $entryTable = $schema->getTable($this->getTable('entry'));
+
+        $this->skipIf($entryTable->hasColumn('origin_url'), 'It seems that you already played this migration.');
+
+        $entryTable->addColumn('origin_url', 'text', [
+            'notnull' => false,
+        ]);
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function down(Schema $schema)
+    {
+        $entryTable = $schema->getTable($this->getTable('entry'));
+
+        $this->skipIf(!$entryTable->hasColumn('origin_url'), 'It seems that you already played this migration.');
+
+        $entryTable->dropColumn('origin_url');
+    }
+
+    private function getTable($tableName)
+    {
+        return $this->container->getParameter('database_table_prefix') . $tableName;
+    }
+}
diff --git a/app/DoctrineMigrations/Version20171120163128.php b/app/DoctrineMigrations/Version20171120163128.php
new file mode 100644 (file)
index 0000000..fc3d4c3
--- /dev/null
@@ -0,0 +1,52 @@
+<?php
+
+namespace Application\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration;
+use Doctrine\DBAL\Schema\Schema;
+use Symfony\Component\DependencyInjection\ContainerAwareInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Add store_article_headers in craue_config_setting.
+ */
+class Version20171120163128 extends AbstractMigration implements ContainerAwareInterface
+{
+    /**
+     * @var ContainerInterface
+     */
+    private $container;
+
+    public function setContainer(ContainerInterface $container = null)
+    {
+        $this->container = $container;
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function up(Schema $schema)
+    {
+        $storeArticleHeaders = $this->container
+            ->get('doctrine.orm.default_entity_manager')
+            ->getConnection()
+            ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'store_article_headers'");
+
+        $this->skipIf(false !== $storeArticleHeaders, 'It seems that you already played this migration.');
+
+        $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('store_article_headers', '0', 'entry')");
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function down(Schema $schema)
+    {
+        $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'store_article_headers';");
+    }
+
+    private function getTable($tableName)
+    {
+        return $this->container->getParameter('database_table_prefix') . $tableName;
+    }
+}
index 5475e571e94ff317c2de2664e14b4c5d29ffa615..c3fd843f2df3bf3e6b267c69f3e4a6add717020b 100644 (file)
@@ -12,6 +12,8 @@ export_xml: Aktiver eksport til XML
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: Shaarli-URL, hvis tjenesten er aktiv
+scuttle_url: Scuttle-URL, hvis tjenesten er aktiv
+unmark_url: Unmark-URL, hvis tjenesten er aktiv
 share_diaspora: Aktiver deling til Diaspora
 share_mail: Aktiver deling med email
 share_shaarli: Aktiver deling gennem Shaarli
@@ -34,3 +36,4 @@ demo_mode_username: "Demobruger"
 # download_images_enabled: Download images locally
 # restricted_access: Enable authentication for websites with paywall
 # api_user_registration: Enable user to be registered using the API
+# store_article_headers: Enable if wallabag stores HTTP headers for each article
index a066c8e3fa4a0b68cd6d98fa97f866a9bd06dab9..37da383e9cb094c94de4586e3628801b68106629 100644 (file)
@@ -12,6 +12,8 @@ export_xml: 'XML-Export aktivieren'
 import_with_rabbitmq: 'Aktiviere RabbitMQ, um Artikel asynchron zu importieren'
 import_with_redis: 'Aktiviere Redis, um Artikel asynchron zu importieren'
 shaarli_url: 'Shaarli-URL, sofern der Service aktiviert ist'
+scuttle_url: 'Scuttle-URL, sofern der Service aktiviert ist'
+unmark_url: 'Unmark-URL, sofern der Service aktiviert ist'
 share_diaspora: 'Teilen zu Diaspora aktiveren'
 share_mail: 'Teilen via E-Mail aktiveren'
 share_shaarli: 'Teilen zu Shaarli aktiveren'
@@ -34,3 +36,4 @@ share_public: 'Erlaube eine öffentliche URL für Einträge'
 download_images_enabled: 'Bilder lokal herunterladen'
 restricted_access: 'Authentifizierung für Webseiten mit Paywall aktivieren'
 api_user_registration: 'Registrierung eines Benutzers über die API ermöglichen'
+# store_article_headers: Enable if wallabag stores HTTP headers for each article
index 1e4f46688ccf21d2f43d392067e064db2855286b..0a89ce2ccdcfa60bf60057a33798c86920a5412e 100644 (file)
@@ -1,7 +1,7 @@
 settings_changed: Configuration updated
 download_pictures: Download pictures on your server
 carrot: Enable share to Carrot
-diaspora_url: Diaspora URL, if the service is enabled
+diaspora_url: diaspora* URL, if the service is enabled
 export_epub: Enable ePub export
 export_mobi: Enable .mobi export
 export_pdf: Enable PDF export
@@ -12,12 +12,14 @@ export_xml: Enable XML export
 import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: Shaarli URL, if the service is enabled
-share_diaspora: Enable share to Diaspora
-share_mail: Enable share by email
-share_shaarli: Enable share to Shaarli
-share_scuttle: Enable share to Scuttle
-share_twitter: Enable share to Twitter
-share_unmark: Enable share to Unmark.it
+scuttle_url: Scuttle URL, if the service is enabled
+unmark_url: Unmark URL, if the service is enabled
+share_diaspora: Enable share to diaspora*
+share_mail: Enable share by e-mail
+share_shaarli: Enable sharing to Shaarli
+share_scuttle: Enable sharing to Scuttle
+share_twitter: Enable sharing to Twitter
+share_unmark: Enable sharing to Unmark.it
 show_printlink: Display a link to print content
 wallabag_support_url: Support URL for wallabag
 entry: "article"
@@ -28,9 +30,10 @@ modify_settings: "apply"
 piwik_host: Host of your website in Piwik (without http:// ou https://)
 piwik_site_id: ID of your website in Piwik
 piwik_enabled: Enable Piwik
-demo_mode_enabled: "Enable demo mode ? (only used for the wallabag public demo)"
+demo_mode_enabled: "Enable demo mode? (Only used for the public wallabag demo)"
 demo_mode_username: "Demo user"
-share_public: Allow public url for entries
+share_public: Allow public URL for entries
 download_images_enabled: Download images locally
-restricted_access: Enable authentication for websites with paywall
+restricted_access: Enable authentication for paywalled websites
 api_user_registration: Enable user to be registered using the API
+store_article_headers: Enable if wallabag stores HTTP headers for each article
index 46ed40406be823142eb322f0021ac2b804dce218..db5858d694fb0401d96ef6aea5c5da73bb5c8452 100644 (file)
@@ -12,6 +12,8 @@ export_xml: Activar exportación a XML
 import_with_rabbitmq: Activar RabbitMQ para importar datos de forma asíncrona
 import_with_redis: Activar Redis para importar datos de forma asíncrona
 shaarli_url: URL de Shaarli, si el servicio está activado
+scuttle_url: URL de Scuttle, si el servicio está activado
+unmark_url: URL de Unmark, si el servicio está activado
 share_diaspora: Activar compartir con Diaspora
 share_mail: Activar compartir con Email
 share_shaarli: Activar compartir con Shaarli
@@ -34,3 +36,4 @@ share_public: Permitir URL pública para los artículos
 download_images_enabled: Descargar imágenes localmente
 restricted_access: Activar autenticación para websites con paywall
 # api_user_registration: Enable user to be registered using the API
+# store_article_headers: Enable if wallabag stores HTTP headers for each article
index f8da4acff629803ea32533181ab401fe5d6e163e..11cc601b7493e927e4b2434ec0268c38b988d60b 100644 (file)
@@ -12,6 +12,8 @@ export_xml:  فعال‌سازی برون‌سپاری به XML
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: نشانی Shaarli، اگر فعال بود
+scuttle_url: نشانی Scuttle، اگر فعال بود
+unmark_url: نشانی Unmark، اگر فعال بود
 share_diaspora: فعال‌سازی هم‌رسانی به Diaspora
 share_mail:  فعال‌سازی هم‌رسانی با ایمیل
 share_shaarli:  فعال‌سازی هم‌رسانی به Shaarli
@@ -34,3 +36,4 @@ modify_settings: "اعمال"
 # download_images_enabled: Download images locally
 # restricted_access: Enable authentication for websites with paywall
 # api_user_registration: Enable user to be registered using the API
+# store_article_headers: Enable if wallabag stores HTTP headers for each article
index a79409b428fffab7f6ce412f6ddc2dc326df2a21..f23b5bf966703e0528fc3e565c45836b172d32b2 100644 (file)
@@ -12,6 +12,8 @@ export_xml: Activer l'export XML
 import_with_rabbitmq: Activer RabbitMQ pour gérer les imports de façon asynchrone
 import_with_redis: Activer Redis pour gérer les imports de façon asynchrone
 shaarli_url: URL de Shaarli, si le service Shaarli est activé
+scuttle_url: URL de Scuttle, si le service Scuttle est activé
+unmark_url: URL de Unmark, si le service Unmark est activé
 share_diaspora: Activer le partage vers Diaspora
 share_mail: Activer le partage par email
 share_shaarli: Activer le partage vers Shaarli
@@ -34,3 +36,4 @@ share_public: Autoriser une URL publique pour les articles
 download_images_enabled: Télécharger les images en local
 restricted_access: Activer l'authentification pour les articles derrière un paywall
 api_user_registration: Activer la création de compte depuis l'API
+store_article_headers: Activer le stockage des en-têtes HTTP de chaque article
index dd4def4bffbb9246889e8a6496fbaee630b60f3f..ade6f7da90ee02e41890eaa7b3c7be5d1cca4dc4 100644 (file)
@@ -12,6 +12,8 @@ export_xml: Abilita esportazione XML
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: Shaarli URL, se il servizio è abilitato
+scuttle_url: Scuttle URL, se il servizio è abilitato
+unmark_url: Unmark URL, se il servizio è abilitato
 share_diaspora: Abilita la condivisione con Diaspora
 share_mail: Abilita la condivisione per email
 share_shaarli: Abilita la condivisione con Shaarli
@@ -34,3 +36,4 @@ demo_mode_username: "Utente Demo"
 # download_images_enabled: Download images locally
 # restricted_access: Enable authentication for websites with paywall
 api_user_registration: Abilita la registrazione dell'utente attraverso l'API
+# store_article_headers: Enable if wallabag stores HTTP headers for each article
index fb163ce768c14a5ec37ecd2971b78c2433b21841..999866426655f2c0b8dccc5228f5677be7361921 100644 (file)
@@ -12,6 +12,8 @@ export_xml: Activar l'expòrt XML
 import_with_rabbitmq: Activar RabbitMQ per importar de donadas de manièra asincròna
 import_with_redis: Activar Redis per importar de donadas de manièra asincròna
 shaarli_url: URL de Shaarli, se lo servici Shaarli es activat
+scuttle_url: URL de Scuttle, se lo servici Scuttle es activat
+unmark_url: URL de Unmark, se lo servici Scuttle es activat
 share_diaspora: Activar lo partatge cap a Diaspora*
 share_mail: Activar lo partatge per corrièl
 share_shaarli: Activar lo partatge cap a Shaarli
@@ -34,3 +36,4 @@ share_public: Autorizar una URL publica pels articles
 download_images_enabled: Telecargar los imatges en local
 restricted_access: Activar l'autenticacion pels sites amb peatge
 api_user_registration: Autorizar los utilizaires a se marcar amb l'API
+# store_article_headers: Enable if wallabag stores HTTP headers for each article
index 04ad4fd3c58ffb893f8462ec9cbe0b8310ba3989..8b8f2ebdf9152f48ae4bde8cff254c5b7ec5272e 100644 (file)
@@ -12,6 +12,7 @@ export_xml: Włącz eksport do XML
 import_with_rabbitmq: Włącz RabbitMQ dla asynchronicznego importu danych
 import_with_redis: Włącz Redis dla asynchronicznego importu danych
 shaarli_url: Adress URL Shaarli, jeżeli usługa jest włączona
+scuttle_url: Adress URL Scuttle, jeżeli usługa jest włączona
 share_diaspora: Włącz udostępnianie dla Diaspora
 share_mail: Włącz udostępnianie przez email
 share_shaarli: Włącz udostępnianie dla Shaarli
@@ -34,3 +35,4 @@ share_public: Zezwalaj na publiczny adres url dla wpisow
 download_images_enabled: Pobierz obrazy lokalnie
 restricted_access: Włącz autoryzację dla stron z paywallem
 api_user_registration: Włącz rejestrację użytkownika przy użyciu API
+# store_article_headers: Enable if wallabag stores HTTP headers for each article
index 77e22b375464d5939ad4e77b34d918cbd4319336..76cb01747e38eb6cdc0037b45a9d9abfd9145131 100644 (file)
@@ -12,6 +12,8 @@ export_xml: Habilita exportação para XML
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: URL Shaarli, se o serviço está habilitado
+scuttle_url: URL Scuttle, se o serviço está habilitado
+unmark_url: URL Unmark, se o serviço está habilitado
 share_diaspora: Habilitar compartilhamento para o Diaspora
 share_mail: Habilitar compartilhamento por e-mail
 share_shaarli: Habilitar compartilhamento para o Shaarli
@@ -34,3 +36,4 @@ demo_mode_username: "Usuário demo"
 # download_images_enabled: Download images locally
 # restricted_access: Enable authentication for websites with paywall
 # api_user_registration: Enable user to be registered using the API
+# store_article_headers: Enable if wallabag stores HTTP headers for each article
index 1b4bfb5bcc5550ffb1a7e2486b75c73d750fda9d..8300cec8f6cf7c1622017e844a0efd0025a6b2b6 100644 (file)
@@ -12,6 +12,8 @@ export_xml: Permite exportare XML
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 shaarli_url: Shaarli URL, dacă serviciul este permis
+scuttle_url: Scuttle URL, dacă serviciul este permis
+unmark_url: Unmark URL, dacă serviciul este permis
 share_diaspora: Permite share către Diaspora
 share_mail: Permite share prin email
 share_shaarli: Permite share către Shaarli
@@ -34,3 +36,4 @@ modify_settings: "aplică"
 # download_images_enabled: Download images locally
 # restricted_access: Enable authentication for websites with paywall
 # api_user_registration: Enable user to be registered using the API
+# store_article_headers: Enable if wallabag stores HTTP headers for each article
index 37b4bbfdaeb48301cba7b293746d1b7679fb0bb8..8fed84ae0df7ab4de9d0b960bb1e6612820268b4 100644 (file)
@@ -12,6 +12,8 @@ export_xml: "Включить XML экспорт"
 import_with_rabbitmq: "Включить RabbitMQ для импорта данных(асинхронно)"
 import_with_redis: "Включить Redis для импорта данных(асинхронно)"
 shaarli_url: "Shaarli URL, если сервис включен"
+scuttle_url: "Scuttle URL, если сервис включен"
+unmark_url: "Unmark URL, если сервис включен"
 share_diaspora: "Включить возможность поделиться в соц.сети Diaspora"
 share_mail: "Включить возможность поделиться по email"
 share_shaarli: "Включить возможность поделиться в Shaarli"
@@ -33,3 +35,5 @@ demo_mode_username: "Демо пользователь"
 share_public: "Разрешить публичные ссылки на записи"
 download_images_enabled: "Скачивать изображения локально"
 restricted_access: "Включить авторизацию на сайте с помощью paywall"
+# api_user_registration: Enable user to be registered using the API
+# store_article_headers: Enable if wallabag stores HTTP headers for each article
index 1579366d2ed609e7e11ae29cf111b03144fdc95d..b992ccc215b26177826af65977a8f6ce2dd04f2a 100644 (file)
@@ -12,6 +12,8 @@
 # import_with_rabbitmq: Enable RabbitMQ to import data asynchronously
 # import_with_redis: Enable Redis to import data asynchronously
 # shaarli_url: Shaarli URL, if the service is enabled
+# scuttle_url: Scuttle URL, if the service is enabled
+# unmark_url: Unmark URL, if the service is enabled
 # share_diaspora: Enable share to Diaspora
 # share_mail: Enable share by email
 # share_shaarli: Enable share to Shaarli
@@ -35,3 +37,4 @@
 # download_images_enabled: Download images locally
 # restricted_access: Enable authentication for websites with paywall
 # api_user_registration: Enable user to be registered using the API
+# store_article_headers: Enable if wallabag stores HTTP headers for each article
index 19401aa7fe235ee71c35be5b4b2736da5c9ac4a8..ec6aae63a72fd07811922d06799abbfc3b53e8be 100644 (file)
@@ -154,6 +154,10 @@ wallabag_core:
             name: api_user_registration
             value: 0
             section: api
+        -
+            name: store_article_headers
+            value: 0
+            section: entry
 
 wallabag_user:
     registration_enabled: "%fosuser_registration%"
diff --git a/build.xml b/build.xml
deleted file mode 100644 (file)
index b9fe613..0000000
--- a/build.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="wallabag" default="build">
-    <target name="build" depends="clean,prepare,phpunit"/>
-    <target name="prepare-mysql" depends="clean,prepare_mysql"/>
-    <target name="prepare-sqlite" depends="clean,prepare_sqlite"/>
-    <target name="prepare-pgsql" depends="clean,prepare_pgsql"/>
-
-    <target name="clean" description="Cleanup build artifacts">
-        <delete dir="${basedir}/var/cache"/>
-    </target>
-
-    <target name="prepare" description="Prepare for build">
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="doctrine:database:drop"/>
-            <arg value="--force"/>
-            <arg value="--env=test"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="doctrine:database:create"/>
-            <arg value="--env=test"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="doctrine:schema:create"/>
-            <arg value="--env=test"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="doctrine:fixtures:load"/>
-            <arg value="--no-interaction"/>
-            <arg value="--env=test"/>
-        </exec>
-    </target>
-
-    <target name="prepare_mysql" description="Run test for MySQL">
-        <delete dir="${basedir}/app/config/parameters.yml"/>
-        <exec executable="cp">
-            <arg value="${basedir}/app/config/tests/parameters_test.mysql.yml"/>
-            <arg value="${basedir}/app/config/parameters_test.yml"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="cache:clear"/>
-            <arg value="--env=test"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="doctrine:database:drop"/>
-            <arg value="--force"/>
-            <arg value="--env=test"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="doctrine:database:create"/>
-            <arg value="--env=test"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="doctrine:database:import"/>
-            <arg value="data/sql/mysql_base.sql"/>
-            <arg value="--env=test"/>
-        </exec>
-    </target>
-
-    <target name="prepare_sqlite" description="Run test for SQLite">
-        <delete dir="${basedir}/app/config/parameters.yml"/>
-        <exec executable="cp">
-            <arg value="${basedir}/app/config/tests/parameters_test.sqlite.yml"/>
-            <arg value="${basedir}/app/config/parameters_test.yml"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="cache:clear"/>
-            <arg value="--env=test"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="doctrine:database:drop"/>
-            <arg value="--force"/>
-            <arg value="--env=test"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="doctrine:database:create"/>
-            <arg value="--env=test"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="doctrine:schema:create"/>
-            <arg value="--env=test"/>
-        </exec>
-    </target>
-
-    <target name="prepare_pgsql" description="Run test for PostgreSQL">
-        <delete dir="${basedir}/app/config/parameters.yml"/>
-        <exec executable="cp">
-            <arg value="${basedir}/app/config/tests/parameters_test.pgsql.yml"/>
-            <arg value="${basedir}/app/config/parameters_test.yml"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="cache:clear"/>
-            <arg value="--env=test"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="doctrine:database:drop"/>
-            <arg value="--force"/>
-            <arg value="--env=test"/>
-        </exec>
-        <exec executable="php">
-            <arg value="${basedir}/bin/console"/>
-            <arg value="doctrine:database:create"/>
-            <arg value="--env=test"/>
-        </exec>
-        <exec executable="psql">
-            <arg value="-h"/>
-            <arg value="localhost"/>
-            <arg value="-d"/>
-            <arg value="wallabag_test"/>
-            <arg value="-U"/>
-            <arg value="travis"/>
-            <arg value="-f"/>
-            <arg value="data/sql/pgsql_base.sql"/>
-        </exec>
-    </target>
-
-    <target name="phpunit" description="Run unit tests with PHPUnit + HTML Coverage">
-        <exec executable="phpunit" failonerror="true">
-            <arg value="--coverage-html"/>
-            <arg value="build/coverage"/>
-        </exec>
-    </target>
-</project>
index d1f970c79704956bb8beb94becbc8e2490ab6634..23c7cdc2b16fba8035577d5475f8b38839113d43 100644 (file)
         "ext-iconv": "*",
         "ext-tokenizer": "*",
         "ext-pdo": "*",
-        "symfony/symfony": "3.3.*",
-        "doctrine/orm": "^2.5",
-        "doctrine/doctrine-bundle": "^1.6",
-        "doctrine/doctrine-cache-bundle": "^1.2",
-        "twig/extensions": "~1.0",
-        "symfony/swiftmailer-bundle": "^2.3",
-        "symfony/monolog-bundle": "^3.0",
-        "sensio/distribution-bundle": "^5.0",
-        "sensio/framework-extra-bundle": "^3.0",
-        "incenteev/composer-parameter-handler": "^2.0",
-        "nelmio/cors-bundle": "~1.4",
+        "symfony/symfony": "~3.3.13",
+        "doctrine/orm": "^2.5.12",
+        "doctrine/doctrine-bundle": "^1.8.0",
+        "doctrine/doctrine-cache-bundle": "^1.3.2",
+        "twig/extensions": "^1.5.1",
+        "symfony/swiftmailer-bundle": "^2.6.7",
+        "symfony/monolog-bundle": "^3.1.2",
+        "sensio/distribution-bundle": "^5.0.21",
+        "sensio/framework-extra-bundle": "^3.0.28",
+        "incenteev/composer-parameter-handler": "^2.1.2",
+        "nelmio/cors-bundle": "~1.5",
         "friendsofsymfony/rest-bundle": "~2.1",
         "jms/serializer-bundle": "~2.2",
-        "nelmio/api-doc-bundle": "~2.7",
+        "nelmio/api-doc-bundle": "^2.13.2",
         "mgargano/simplehtmldom": "~1.5",
-        "wallabag/tcpdf": "^6.2",
+        "wallabag/tcpdf": "^6.2.15",
         "simplepie/simplepie": "~1.5",
-        "willdurand/hateoas-bundle": "~1.0",
-        "liip/theme-bundle": "~1.1",
-        "lexik/form-filter-bundle": "~5.0",
+        "willdurand/hateoas-bundle": "~1.3",
+        "liip/theme-bundle": "^1.4.6",
+        "lexik/form-filter-bundle": "^5.0.4",
         "j0k3r/graby": "^1.0",
-        "friendsofsymfony/user-bundle": "^2.0",
-        "friendsofsymfony/oauth-server-bundle": "^1.5",
+        "friendsofsymfony/user-bundle": "^2.0.1",
+        "friendsofsymfony/oauth-server-bundle": "^1.5.2",
         "stof/doctrine-extensions-bundle": "^1.2",
-        "scheb/two-factor-bundle": "~2.0",
-        "grandt/phpepub": "~4.0",
+        "scheb/two-factor-bundle": "^2.14.0",
+        "grandt/phpepub": "^4.0.7",
         "wallabag/php-mobi": "~1.0.0",
         "kphoen/rulerz-bundle": "~0.13",
         "guzzlehttp/guzzle": "^5.3.1",
-        "doctrine/doctrine-migrations-bundle": "^1.0",
-        "paragonie/random_compat": "~2.0",
+        "doctrine/doctrine-migrations-bundle": "^1.3",
+        "paragonie/random_compat": "^2.0.11",
         "craue/config-bundle": "~2.0",
         "mnapoli/piwik-twig-extension": "^1.0",
-        "ocramius/proxy-manager": "1.*",
-        "white-october/pagerfanta-bundle": "^1.0",
-        "php-amqplib/rabbitmq-bundle": "^1.8",
-        "predis/predis": "^1.0",
-        "javibravo/simpleue": "^1.0",
-        "symfony/dom-crawler": "^3.1",
-        "friendsofsymfony/jsrouting-bundle": "^1.6",
+        "ocramius/proxy-manager": "^1.0.2",
+        "white-october/pagerfanta-bundle": "^1.1.0",
+        "php-amqplib/rabbitmq-bundle": "^1.14",
+        "predis/predis": "^1.1.1",
+        "javibravo/simpleue": "^2.0",
+        "symfony/dom-crawler": "^3.3.13",
+        "friendsofsymfony/jsrouting-bundle": "^1.6.3",
         "bdunogier/guzzle-site-authenticator": "^1.0.0@dev",
         "defuse/php-encryption": "^2.1",
         "html2text/html2text": "^4.1"
diff --git a/data/sql/mysql_base.sql b/data/sql/mysql_base.sql
deleted file mode 100644 (file)
index 13fa630..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-CREATE TABLE wallabag_craue_config_setting (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_5D9649505E237E06 (name), PRIMARY KEY(name)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
-CREATE TABLE `wallabag_entry` (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, title LONGTEXT DEFAULT NULL, url LONGTEXT DEFAULT NULL, is_archived TINYINT(1) NOT NULL, is_starred TINYINT(1) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype LONGTEXT DEFAULT NULL, language LONGTEXT DEFAULT NULL, reading_time INT DEFAULT NULL, domain_name LONGTEXT DEFAULT NULL, preview_picture LONGTEXT DEFAULT NULL, is_public TINYINT(1) DEFAULT '0', INDEX IDX_F4D18282A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
-CREATE TABLE wallabag_entry_tag (entry_id INT NOT NULL, tag_id INT NOT NULL, INDEX IDX_C9F0DD7CBA364942 (entry_id), INDEX IDX_C9F0DD7CBAD26311 (tag_id), PRIMARY KEY(entry_id, tag_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
-CREATE TABLE `wallabag_config` (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INT NOT NULL, language VARCHAR(255) NOT NULL, rss_token VARCHAR(255) DEFAULT NULL, rss_limit INT DEFAULT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, UNIQUE INDEX UNIQ_87E64C53A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
-CREATE TABLE `wallabag_tagging_rule` (id INT AUTO_INCREMENT NOT NULL, config_id INT DEFAULT NULL, rule VARCHAR(255) NOT NULL, tags LONGTEXT NOT NULL COMMENT '(DC2Type:simple_array)', INDEX IDX_2D9B3C5424DB0683 (config_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
-CREATE TABLE `wallabag_tag` (id INT AUTO_INCREMENT NOT NULL, `label` LONGTEXT NOT NULL, slug VARCHAR(128) NOT NULL, UNIQUE INDEX UNIQ_4CA58A8C989D9B62 (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
-CREATE TABLE wallabag_oauth2_clients (id INT AUTO_INCREMENT NOT NULL, random_id VARCHAR(255) NOT NULL, redirect_uris LONGTEXT NOT NULL COMMENT '(DC2Type:array)', secret VARCHAR(255) NOT NULL, allowed_grant_types LONGTEXT NOT NULL COMMENT '(DC2Type:array)', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
-CREATE TABLE wallabag_oauth2_access_tokens (id INT AUTO_INCREMENT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_368A42095F37A13B (token), INDEX IDX_368A420919EB6921 (client_id), INDEX IDX_368A4209A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
-CREATE TABLE wallabag_oauth2_refresh_tokens (id INT AUTO_INCREMENT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_20C9FB245F37A13B (token), INDEX IDX_20C9FB2419EB6921 (client_id), INDEX IDX_20C9FB24A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
-CREATE TABLE wallabag_oauth2_auth_codes (id INT AUTO_INCREMENT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, redirect_uri LONGTEXT NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_EE52E3FA5F37A13B (token), INDEX IDX_EE52E3FA19EB6921 (client_id), INDEX IDX_EE52E3FAA76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
-CREATE TABLE `wallabag_user` (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled TINYINT(1) NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, locked TINYINT(1) NOT NULL, expired TINYINT(1) NOT NULL, expires_at DATETIME DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles LONGTEXT NOT NULL COMMENT '(DC2Type:array)', credentials_expired TINYINT(1) NOT NULL, credentials_expire_at DATETIME DEFAULT NULL, name LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INT DEFAULT NULL, twoFactorAuthentication TINYINT(1) NOT NULL, trusted LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json_array)', UNIQUE INDEX UNIQ_1D63E7E592FC23A8 (username_canonical), UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF (email_canonical), UNIQUE INDEX UNIQ_1D63E7E5C05FB297 (confirmation_token), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
-CREATE TABLE wallabag_annotation (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, entry_id INT DEFAULT NULL, text LONGTEXT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, quote VARCHAR(255) NOT NULL, ranges LONGTEXT NOT NULL COMMENT '(DC2Type:array)', INDEX IDX_A7AED006A76ED395 (user_id), INDEX IDX_A7AED006BA364942 (entry_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
-ALTER TABLE `wallabag_entry` ADD CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
-ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBA364942 FOREIGN KEY (entry_id) REFERENCES `wallabag_entry` (id);
-ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBAD26311 FOREIGN KEY (tag_id) REFERENCES `wallabag_tag` (id);
-ALTER TABLE `wallabag_config` ADD CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
-ALTER TABLE `wallabag_tagging_rule` ADD CONSTRAINT FK_2D9B3C5424DB0683 FOREIGN KEY (config_id) REFERENCES `wallabag_config` (id);
-ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id);
-ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
-ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id);
-ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
-ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id);
-ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
-ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES `wallabag_user` (id);
-ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES `wallabag_entry` (id);
diff --git a/data/sql/pgsql_base.sql b/data/sql/pgsql_base.sql
deleted file mode 100644 (file)
index 6688fe8..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-CREATE TABLE wallabag_craue_config_setting (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, PRIMARY KEY(name));
-CREATE UNIQUE INDEX UNIQ_5D9649505E237E06 ON wallabag_craue_config_setting (name);
-CREATE TABLE "wallabag_entry" (id INT NOT NULL, user_id INT DEFAULT NULL, title TEXT DEFAULT NULL, url TEXT DEFAULT NULL, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content TEXT DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, mimetype TEXT DEFAULT NULL, language TEXT DEFAULT NULL, reading_time INT DEFAULT NULL, domain_name TEXT DEFAULT NULL, preview_picture TEXT DEFAULT NULL, is_public BOOLEAN DEFAULT 'false', PRIMARY KEY(id));
-CREATE INDEX IDX_F4D18282A76ED395 ON "wallabag_entry" (user_id);
-CREATE TABLE wallabag_entry_tag (entry_id INT NOT NULL, tag_id INT NOT NULL, PRIMARY KEY(entry_id, tag_id));
-CREATE INDEX IDX_C9F0DD7CBA364942 ON wallabag_entry_tag (entry_id);
-CREATE INDEX IDX_C9F0DD7CBAD26311 ON wallabag_entry_tag (tag_id);
-CREATE TABLE "wallabag_config" (id INT NOT NULL, user_id INT DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INT NOT NULL, language VARCHAR(255) NOT NULL, rss_token VARCHAR(255) DEFAULT NULL, rss_limit INT DEFAULT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(id));
-CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "wallabag_config" (user_id);
-CREATE TABLE "wallabag_tagging_rule" (id INT NOT NULL, config_id INT DEFAULT NULL, rule VARCHAR(255) NOT NULL, tags TEXT NOT NULL, PRIMARY KEY(id));
-CREATE INDEX IDX_2D9B3C5424DB0683 ON "wallabag_tagging_rule" (config_id);
-COMMENT ON COLUMN "wallabag_tagging_rule".tags IS '(DC2Type:simple_array)';
-CREATE TABLE "wallabag_tag" (id INT NOT NULL, label TEXT NOT NULL, slug VARCHAR(128) NOT NULL, PRIMARY KEY(id));
-CREATE UNIQUE INDEX UNIQ_4CA58A8C989D9B62 ON "wallabag_tag" (slug);
-CREATE TABLE wallabag_oauth2_clients (id INT NOT NULL, random_id VARCHAR(255) NOT NULL, redirect_uris TEXT NOT NULL, secret VARCHAR(255) NOT NULL, allowed_grant_types TEXT NOT NULL, PRIMARY KEY(id));
-COMMENT ON COLUMN wallabag_oauth2_clients.redirect_uris IS '(DC2Type:array)';
-COMMENT ON COLUMN wallabag_oauth2_clients.allowed_grant_types IS '(DC2Type:array)';
-CREATE TABLE wallabag_oauth2_access_tokens (id INT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id));
-CREATE UNIQUE INDEX UNIQ_368A42095F37A13B ON wallabag_oauth2_access_tokens (token);
-CREATE INDEX IDX_368A420919EB6921 ON wallabag_oauth2_access_tokens (client_id);
-CREATE INDEX IDX_368A4209A76ED395 ON wallabag_oauth2_access_tokens (user_id);
-CREATE TABLE wallabag_oauth2_refresh_tokens (id INT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id));
-CREATE UNIQUE INDEX UNIQ_20C9FB245F37A13B ON wallabag_oauth2_refresh_tokens (token);
-CREATE INDEX IDX_20C9FB2419EB6921 ON wallabag_oauth2_refresh_tokens (client_id);
-CREATE INDEX IDX_20C9FB24A76ED395 ON wallabag_oauth2_refresh_tokens (user_id);
-CREATE TABLE wallabag_oauth2_auth_codes (id INT NOT NULL, client_id INT NOT NULL, user_id INT DEFAULT NULL, token VARCHAR(255) NOT NULL, redirect_uri TEXT NOT NULL, expires_at INT DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id));
-CREATE UNIQUE INDEX UNIQ_EE52E3FA5F37A13B ON wallabag_oauth2_auth_codes (token);
-CREATE INDEX IDX_EE52E3FA19EB6921 ON wallabag_oauth2_auth_codes (client_id);
-CREATE INDEX IDX_EE52E3FAA76ED395 ON wallabag_oauth2_auth_codes (user_id);
-CREATE TABLE "wallabag_user" (id INT NOT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled BOOLEAN NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, locked BOOLEAN NOT NULL, expired BOOLEAN NOT NULL, expires_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, roles TEXT NOT NULL, credentials_expired BOOLEAN NOT NULL, credentials_expire_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, name TEXT DEFAULT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, authCode INT DEFAULT NULL, twoFactorAuthentication BOOLEAN NOT NULL, trusted TEXT DEFAULT NULL, PRIMARY KEY(id));
-CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON "wallabag_user" (username_canonical);
-CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON "wallabag_user" (email_canonical);
-CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON "wallabag_user" (confirmation_token);
-COMMENT ON COLUMN "wallabag_user".roles IS '(DC2Type:array)';
-COMMENT ON COLUMN "wallabag_user".trusted IS '(DC2Type:json_array)';
-CREATE TABLE wallabag_annotation (id INT NOT NULL, user_id INT DEFAULT NULL, entry_id INT DEFAULT NULL, text TEXT NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, quote VARCHAR(255) NOT NULL, ranges TEXT NOT NULL, PRIMARY KEY(id));
-CREATE INDEX IDX_A7AED006A76ED395 ON wallabag_annotation (user_id);
-CREATE INDEX IDX_A7AED006BA364942 ON wallabag_annotation (entry_id);
-COMMENT ON COLUMN wallabag_annotation.ranges IS '(DC2Type:array)';
-CREATE SEQUENCE "entry_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
-CREATE SEQUENCE "config_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
-CREATE SEQUENCE "tagging_rule_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
-CREATE SEQUENCE "tag_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
-CREATE SEQUENCE oauth2_clients_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
-CREATE SEQUENCE oauth2_access_tokens_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
-CREATE SEQUENCE oauth2_refresh_tokens_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
-CREATE SEQUENCE oauth2_auth_codes_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
-CREATE SEQUENCE "user_id_seq" INCREMENT BY 1 MINVALUE 1 START 1;
-CREATE SEQUENCE annotation_id_seq INCREMENT BY 1 MINVALUE 1 START 1;
-ALTER TABLE "wallabag_entry" ADD CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
-ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBA364942 FOREIGN KEY (entry_id) REFERENCES "wallabag_entry" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
-ALTER TABLE wallabag_entry_tag ADD CONSTRAINT FK_C9F0DD7CBAD26311 FOREIGN KEY (tag_id) REFERENCES "wallabag_tag" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
-ALTER TABLE "wallabag_config" ADD CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
-ALTER TABLE "wallabag_tagging_rule" ADD CONSTRAINT FK_2D9B3C5424DB0683 FOREIGN KEY (config_id) REFERENCES "wallabag_config" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
-ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
-ALTER TABLE wallabag_oauth2_access_tokens ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
-ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
-ALTER TABLE wallabag_oauth2_refresh_tokens ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
-ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
-ALTER TABLE wallabag_oauth2_auth_codes ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
-ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
-ALTER TABLE wallabag_annotation ADD CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES "wallabag_entry" (id) NOT DEFERRABLE INITIALLY IMMEDIATE;
diff --git a/data/sql/sqlite_base.sql b/data/sql/sqlite_base.sql
deleted file mode 100644 (file)
index d2780d9..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-CREATE TABLE wallabag_craue_config_setting (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, PRIMARY KEY(name));
-CREATE UNIQUE INDEX UNIQ_5D9649505E237E06 ON wallabag_craue_config_setting (name);
-CREATE TABLE "wallabag_tagging_rule" (id INTEGER NOT NULL, config_id INTEGER DEFAULT NULL, rule VARCHAR(255) NOT NULL, tags CLOB NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_2D9B3C5424DB0683 FOREIGN KEY (config_id) REFERENCES "wallabag_config" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
-CREATE INDEX IDX_2D9B3C5424DB0683 ON "wallabag_tagging_rule" (config_id);
-CREATE TABLE "wallabag_tag" (id INTEGER NOT NULL, label CLOB NOT NULL, slug VARCHAR(128) NOT NULL, PRIMARY KEY(id));
-CREATE UNIQUE INDEX UNIQ_4CA58A8C989D9B62 ON "wallabag_tag" (slug);
-CREATE TABLE "wallabag_entry" (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, title CLOB DEFAULT NULL, url CLOB DEFAULT NULL, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL, language CLOB DEFAULT NULL, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL, preview_picture CLOB DEFAULT NULL, is_public BOOLEAN DEFAULT '0', PRIMARY KEY(id), CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
-CREATE INDEX IDX_F4D18282A76ED395 ON "wallabag_entry" (user_id);
-CREATE TABLE wallabag_entry_tag (entry_id INTEGER NOT NULL, tag_id INTEGER NOT NULL, PRIMARY KEY(entry_id, tag_id), CONSTRAINT FK_C9F0DD7CBA364942 FOREIGN KEY (entry_id) REFERENCES "wallabag_entry" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_C9F0DD7CBAD26311 FOREIGN KEY (tag_id) REFERENCES "wallabag_tag" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
-CREATE INDEX IDX_C9F0DD7CBA364942 ON wallabag_entry_tag (entry_id);
-CREATE INDEX IDX_C9F0DD7CBAD26311 ON wallabag_entry_tag (tag_id);
-CREATE TABLE "wallabag_config" (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL, rss_token VARCHAR(255) DEFAULT NULL, rss_limit INTEGER DEFAULT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
-CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "wallabag_config" (user_id);
-CREATE TABLE wallabag_oauth2_refresh_tokens (id INTEGER NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INTEGER DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
-CREATE UNIQUE INDEX UNIQ_20C9FB245F37A13B ON wallabag_oauth2_refresh_tokens (token);
-CREATE INDEX IDX_20C9FB2419EB6921 ON wallabag_oauth2_refresh_tokens (client_id);
-CREATE INDEX IDX_20C9FB24A76ED395 ON wallabag_oauth2_refresh_tokens (user_id);
-CREATE TABLE wallabag_oauth2_access_tokens (id INTEGER NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, token VARCHAR(255) NOT NULL, expires_at INTEGER DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
-CREATE UNIQUE INDEX UNIQ_368A42095F37A13B ON wallabag_oauth2_access_tokens (token);
-CREATE INDEX IDX_368A420919EB6921 ON wallabag_oauth2_access_tokens (client_id);
-CREATE INDEX IDX_368A4209A76ED395 ON wallabag_oauth2_access_tokens (user_id);
-CREATE TABLE wallabag_oauth2_auth_codes (id INTEGER NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, token VARCHAR(255) NOT NULL, redirect_uri CLOB NOT NULL, expires_at INTEGER DEFAULT NULL, scope VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id), CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES wallabag_oauth2_clients (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
-CREATE UNIQUE INDEX UNIQ_EE52E3FA5F37A13B ON wallabag_oauth2_auth_codes (token);
-CREATE INDEX IDX_EE52E3FA19EB6921 ON wallabag_oauth2_auth_codes (client_id);
-CREATE INDEX IDX_EE52E3FAA76ED395 ON wallabag_oauth2_auth_codes (user_id);
-CREATE TABLE wallabag_oauth2_clients (id INTEGER NOT NULL, random_id VARCHAR(255) NOT NULL, redirect_uris CLOB NOT NULL, secret VARCHAR(255) NOT NULL, allowed_grant_types CLOB NOT NULL, PRIMARY KEY(id));
-CREATE TABLE "wallabag_user" (id INTEGER NOT NULL, username VARCHAR(180) NOT NULL, username_canonical VARCHAR(180) NOT NULL, email VARCHAR(180) NOT NULL, email_canonical VARCHAR(180) NOT NULL, enabled BOOLEAN NOT NULL, salt VARCHAR(255) NOT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, locked BOOLEAN NOT NULL, expired BOOLEAN NOT NULL, expires_at DATETIME DEFAULT NULL, confirmation_token VARCHAR(255) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles CLOB NOT NULL, credentials_expired BOOLEAN NOT NULL, credentials_expire_at DATETIME DEFAULT NULL, name CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, twoFactorAuthentication BOOLEAN NOT NULL, trusted CLOB DEFAULT NULL, PRIMARY KEY(id));
-CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON "wallabag_user" (username_canonical);
-CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON "wallabag_user" (email_canonical);
-CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON "wallabag_user" (confirmation_token);
-CREATE TABLE wallabag_annotation (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, entry_id INTEGER DEFAULT NULL, text CLOB NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, quote VARCHAR(255) NOT NULL, ranges CLOB NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES "wallabag_entry" (id) NOT DEFERRABLE INITIALLY IMMEDIATE);
-CREATE INDEX IDX_A7AED006A76ED395 ON wallabag_annotation (user_id);
-CREATE INDEX IDX_A7AED006BA364942 ON wallabag_annotation (entry_id);
index 6f161a081eb436431a26d7854988e1c6d3b7cb6c..7d820c7e606195e15697cd652442308e56643e8d 100644 (file)
@@ -309,6 +309,7 @@ class EntryRestController extends WallabagRestController
      *          {"name"="published_at", "dataType"="datetime|integer", "format"="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", "required"=false, "description"="Published date of the entry"},
      *          {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"},
      *          {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"},
+     *          {"name"="origin_url", "dataType"="string", "required"=false, "format"="http://www.test.com/article.html", "description"="Origin url for the entry (from where you found it)."},
      *       }
      * )
      *
@@ -368,6 +369,10 @@ class EntryRestController extends WallabagRestController
             $this->get('wallabag_core.tags_assigner')->assignTagsToEntry($entry, $data['tags']);
         }
 
+        if (!empty($data['origin_url'])) {
+            $entry->setOriginUrl($data['origin_url']);
+        }
+
         if (null !== $data['isPublic']) {
             if (true === (bool) $data['isPublic'] && null === $entry->getUid()) {
                 $entry->generateUid();
@@ -404,6 +409,7 @@ class EntryRestController extends WallabagRestController
      *          {"name"="published_at", "dataType"="datetime|integer", "format"="YYYY-MM-DDTHH:II:SS+TZ or a timestamp", "required"=false, "description"="Published date of the entry"},
      *          {"name"="authors", "dataType"="string", "format"="Name Firstname,author2,author3", "required"=false, "description"="Authors of the entry"},
      *          {"name"="public", "dataType"="integer", "required"=false, "format"="1 or 0", "description"="will generate a public link for the entry"},
+     *          {"name"="origin_url", "dataType"="string", "required"=false, "format"="http://www.test.com/article.html", "description"="Origin url for the entry (from where you found it)."},
      *      }
      * )
      *
@@ -480,6 +486,10 @@ class EntryRestController extends WallabagRestController
             }
         }
 
+        if (!empty($data['origin_url'])) {
+            $entry->setOriginUrl($data['origin_url']);
+        }
+
         $em = $this->getDoctrine()->getManager();
         $em->persist($entry);
         $em->flush();
@@ -778,6 +788,7 @@ class EntryRestController extends WallabagRestController
             'picture' => $request->request->get('preview_picture'),
             'publishedAt' => $request->request->get('published_at'),
             'authors' => $request->request->get('authors', ''),
+            'origin_url' => $request->request->get('origin_url', ''),
         ];
     }
 
index 877dbfa27a65ee6d8c50763d341a65e05e8b6234..dec2bf9c15c7e6477a65b088a20fb3c6b3212c05 100644 (file)
@@ -61,7 +61,6 @@ class InstallCommand extends ContainerAwareCommand
             ->setupDatabase()
             ->setupAdmin()
             ->setupConfig()
-            ->runMigrations()
         ;
 
         $this->io->success('Wallabag has been successfully installed.');
@@ -70,7 +69,7 @@ class InstallCommand extends ContainerAwareCommand
 
     protected function checkRequirements()
     {
-        $this->io->section('Step 1 of 5: Checking system requirements.');
+        $this->io->section('Step 1 of 4: Checking system requirements.');
 
         $doctrineManager = $this->getContainer()->get('doctrine')->getManager();
 
@@ -169,7 +168,7 @@ class InstallCommand extends ContainerAwareCommand
 
     protected function setupDatabase()
     {
-        $this->io->section('Step 2 of 5: Setting up database.');
+        $this->io->section('Step 2 of 4: Setting up database.');
 
         // user want to reset everything? Don't care about what is already here
         if (true === $this->defaultInput->getOption('reset')) {
@@ -178,7 +177,7 @@ class InstallCommand extends ContainerAwareCommand
             $this
                 ->runCommand('doctrine:database:drop', ['--force' => true])
                 ->runCommand('doctrine:database:create')
-                ->runCommand('doctrine:schema:create')
+                ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true])
                 ->runCommand('cache:clear')
             ;
 
@@ -192,7 +191,7 @@ class InstallCommand extends ContainerAwareCommand
 
             $this
                 ->runCommand('doctrine:database:create')
-                ->runCommand('doctrine:schema:create')
+                ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true])
                 ->runCommand('cache:clear')
             ;
 
@@ -207,7 +206,7 @@ class InstallCommand extends ContainerAwareCommand
             $this
                 ->runCommand('doctrine:database:drop', ['--force' => true])
                 ->runCommand('doctrine:database:create')
-                ->runCommand('doctrine:schema:create')
+                ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true])
             ;
         } elseif ($this->isSchemaPresent()) {
             if ($this->io->confirm('Seems like your database contains schema. Do you want to reset it?', false)) {
@@ -215,14 +214,14 @@ class InstallCommand extends ContainerAwareCommand
 
                 $this
                     ->runCommand('doctrine:schema:drop', ['--force' => true])
-                    ->runCommand('doctrine:schema:create')
+                    ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true])
                 ;
             }
         } else {
             $this->io->text('Creating schema...');
 
             $this
-                ->runCommand('doctrine:schema:create')
+                ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true])
             ;
         }
 
@@ -237,7 +236,7 @@ class InstallCommand extends ContainerAwareCommand
 
     protected function setupAdmin()
     {
-        $this->io->section('Step 3 of 5: Administration setup.');
+        $this->io->section('Step 3 of 4: Administration setup.');
 
         if (!$this->io->confirm('Would you like to create a new admin user (recommended)?', true)) {
             return $this;
@@ -272,7 +271,7 @@ class InstallCommand extends ContainerAwareCommand
 
     protected function setupConfig()
     {
-        $this->io->section('Step 4 of 5: Config setup.');
+        $this->io->section('Step 4 of 4: Config setup.');
         $em = $this->getContainer()->get('doctrine.orm.entity_manager');
 
         // cleanup before insert new stuff
@@ -293,18 +292,6 @@ class InstallCommand extends ContainerAwareCommand
         return $this;
     }
 
-    protected function runMigrations()
-    {
-        $this->io->section('Step 5 of 5: Run migrations.');
-
-        $this
-            ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true]);
-
-        $this->io->text('<info>Migrations successfully executed.</info>');
-
-        return $this;
-    }
-
     /**
      * Run a command.
      *
index fa2066dccafe8e6de988b64ec5f066962547bf7d..548de74486287c3076311338065cabcd660ede50 100644 (file)
@@ -24,6 +24,8 @@ class SiteCredentialController extends Controller
      */
     public function indexAction()
     {
+        $this->isSiteCredentialsEnabled();
+
         $credentials = $this->get('wallabag_core.site_credential_repository')->findByUser($this->getUser());
 
         return $this->render('WallabagCoreBundle:SiteCredential:index.html.twig', [
@@ -43,6 +45,8 @@ class SiteCredentialController extends Controller
      */
     public function newAction(Request $request)
     {
+        $this->isSiteCredentialsEnabled();
+
         $credential = new SiteCredential($this->getUser());
 
         $form = $this->createForm('Wallabag\CoreBundle\Form\Type\SiteCredentialType', $credential);
@@ -83,6 +87,8 @@ class SiteCredentialController extends Controller
      */
     public function editAction(Request $request, SiteCredential $siteCredential)
     {
+        $this->isSiteCredentialsEnabled();
+
         $this->checkUserAction($siteCredential);
 
         $deleteForm = $this->createDeleteForm($siteCredential);
@@ -125,6 +131,8 @@ class SiteCredentialController extends Controller
      */
     public function deleteAction(Request $request, SiteCredential $siteCredential)
     {
+        $this->isSiteCredentialsEnabled();
+
         $this->checkUserAction($siteCredential);
 
         $form = $this->createDeleteForm($siteCredential);
@@ -144,6 +152,16 @@ class SiteCredentialController extends Controller
         return $this->redirectToRoute('site_credentials_index');
     }
 
+    /**
+     * Throw a 404 if the feature is disabled.
+     */
+    private function isSiteCredentialsEnabled()
+    {
+        if (!$this->get('craue_config')->get('restricted_access')) {
+            throw $this->createNotFoundException('Feature "restricted_access" is disabled, controllers too.');
+        }
+    }
+
     /**
      * Creates a form to delete a site credential entity.
      *
index fedad00993f6b3b5ff354f72c74bcea76e3e9c46..0e1510a29bf450f7c8e9e6067fb7c6ee2af84012 100644 (file)
@@ -37,6 +37,7 @@ class LoadEntryData extends AbstractFixture implements OrderedFixtureInterface
         $entry2->setMimetype('text/html');
         $entry2->setTitle('test title entry2');
         $entry2->setContent('This is my content /o/');
+        $entry2->setOriginUrl('ftp://oneftp.tld');
         $entry2->setLanguage('fr');
 
         $manager->persist($entry2);
index cfb8db75275c2e42d1b994e5f037a58220bd31d5..2b1f2e050799c24495611d2ba75212e37944f4d5 100644 (file)
@@ -245,6 +245,15 @@ class Entry
      */
     private $tags;
 
+    /**
+     * @var string
+     *
+     * @ORM\Column(name="origin_url", type="text", nullable=true)
+     *
+     * @Groups({"entries_for_user", "export_all"})
+     */
+    private $originUrl;
+
     /*
      * @param User     $user
      */
@@ -831,4 +840,28 @@ class Entry
 
         return $this;
     }
+
+    /**
+     * Set origin url.
+     *
+     * @param string $originUrl
+     *
+     * @return Entry
+     */
+    public function setOriginUrl($originUrl)
+    {
+        $this->originUrl = $originUrl;
+
+        return $this;
+    }
+
+    /**
+     * Get origin url.
+     *
+     * @return string
+     */
+    public function getOriginUrl()
+    {
+        return $this->originUrl;
+    }
 }
index 1627cc445e60035047fa9d1926a1e0866750e3e2..083559286477d5bf53fe8d91cb0f716f37adec8a 100644 (file)
@@ -5,6 +5,7 @@ namespace Wallabag\CoreBundle\Form\Type;
 use Symfony\Component\Form\AbstractType;
 use Symfony\Component\Form\Extension\Core\Type\SubmitType;
 use Symfony\Component\Form\Extension\Core\Type\TextType;
+use Symfony\Component\Form\Extension\Core\Type\UrlType;
 use Symfony\Component\Form\FormBuilderInterface;
 use Symfony\Component\OptionsResolver\OptionsResolver;
 
@@ -17,11 +18,16 @@ class EditEntryType extends AbstractType
                 'required' => true,
                 'label' => 'entry.edit.title_label',
             ])
-            ->add('url', TextType::class, [
+            ->add('url', UrlType::class, [
                 'disabled' => true,
                 'required' => false,
                 'label' => 'entry.edit.url_label',
             ])
+            ->add('origin_url', UrlType::class, [
+                'required' => false,
+                'property_path' => 'originUrl',
+                'label' => 'entry.edit.origin_url_label',
+            ])
             ->add('save', SubmitType::class, [
                 'label' => 'entry.edit.save_label',
             ])
index 854acb6ae3c540d433d7863517b597db566d53ac..4cc20c9cc4c2c2cb3115538bf0d5259ddc3f23f8 100644 (file)
@@ -24,8 +24,9 @@ class ContentProxy
     protected $mimeGuesser;
     protected $fetchingErrorMessage;
     protected $eventDispatcher;
+    protected $storeArticleHeaders;
 
-    public function __construct(Graby $graby, RuleBasedTagger $tagger, ValidatorInterface $validator, LoggerInterface $logger, $fetchingErrorMessage)
+    public function __construct(Graby $graby, RuleBasedTagger $tagger, ValidatorInterface $validator, LoggerInterface $logger, $fetchingErrorMessage, $storeArticleHeaders = false)
     {
         $this->graby = $graby;
         $this->tagger = $tagger;
@@ -33,6 +34,7 @@ class ContentProxy
         $this->logger = $logger;
         $this->mimeGuesser = new MimeTypeExtensionGuesser();
         $this->fetchingErrorMessage = $fetchingErrorMessage;
+        $this->storeArticleHeaders = $storeArticleHeaders;
     }
 
     /**
@@ -185,7 +187,7 @@ class ContentProxy
             $entry->setPublishedBy($content['authors']);
         }
 
-        if (!empty($content['all_headers'])) {
+        if (!empty($content['all_headers']) && $this->storeArticleHeaders) {
             $entry->setHeaders($content['all_headers']);
         }
 
index 31b16739f064a1412cc867c2d4bb83ac2c36ec5b..85306276db9c24d1290a000834576b0e7285a9fb 100644 (file)
@@ -94,6 +94,7 @@ services:
             - "@validator"
             - "@logger"
             - '%wallabag_core.fetching_error_message%'
+            - '@=service(''craue_config'').get(''store_article_headers'')'
 
     wallabag_core.tags_assigner:
         class: Wallabag\CoreBundle\Helper\TagsAssigner
index d0a38f7e3b25b6321f59f72fa1b39d2b5d697fbe..27dbb3885468db74c42f1864d673f8a80d819d20 100644 (file)
@@ -233,6 +233,7 @@ entry:
         created_at: 'Oprettelsesdato'
         # published_at: 'Publication date'
         # published_by: 'Published by'
+        # provided_by: 'Provided by'
     new:
         page_title: 'Gem ny artikel'
         placeholder: 'http://website.com'
@@ -244,6 +245,7 @@ entry:
         # page_title: 'Edit an entry'
         # title_label: 'Title'
         url_label: 'Url'
+        # origin_url_label: 'Origin url (from where you found that entry)'
         save_label: 'Gem'
     public:
         # shared_by_wallabag: "This article has been shared by %username% with <a href='%wallabag_instance%'>wallabag</a>"
index 158762a97b6a2d7a57b6f5f7e2beb1d84792d2f9..d47986e5bac8ccf6490c220f0a3b2b0b01c43f8d 100644 (file)
@@ -233,6 +233,7 @@ entry:
         created_at: 'Erstellungsdatum'
         published_at: 'Erscheinungsdatum'
         published_by: 'Veröffentlicht von'
+        # provided_by: 'Provided by'
     new:
         page_title: 'Neuen Artikel speichern'
         placeholder: 'https://website.de'
@@ -244,6 +245,7 @@ entry:
         page_title: 'Eintrag bearbeiten'
         title_label: 'Titel'
         url_label: 'URL'
+        # origin_url_label: 'Origin url (from where you found that entry)'
         save_label: 'Speichern'
     public:
         shared_by_wallabag: 'Dieser Artikel wurde von %username% mittels <a href="%wallabag_instance%">wallabag</a> geteilt'
index de3e11fe27bd1b1994f0141a6dabd6091f0a5344..bbaecb24a01204117f425b167e5a98c48c15a083 100644 (file)
@@ -233,6 +233,7 @@ entry:
         created_at: 'Creation date'
         published_at: 'Publication date'
         published_by: 'Published by'
+        provided_by: 'Provided by'
     new:
         page_title: 'Save new entry'
         placeholder: 'http://website.com'
@@ -244,6 +245,7 @@ entry:
         page_title: 'Edit an entry'
         title_label: 'Title'
         url_label: 'Url'
+        origin_url_label: 'Origin url (from where you found that entry)'
         save_label: 'Save'
     public:
         shared_by_wallabag: "This article has been shared by %username% with <a href='%wallabag_instance%'>wallabag</a>"
index 6dfc1525e2892130bb47f020910b7cf160ba824a..e3b625f7a61f566ea8ad727829811d916dce4ebf 100644 (file)
@@ -233,6 +233,7 @@ entry:
         created_at: 'Fecha de creación'
         # published_at: 'Publication date'
         # published_by: 'Published by'
+        # provided_by: 'Provided by'
     new:
         page_title: 'Guardar un nuevo artículo'
         placeholder: 'http://sitioweb.com'
@@ -244,6 +245,7 @@ entry:
         page_title: 'Editar un artículo'
         title_label: 'Título'
         url_label: 'URL'
+        # origin_url_label: 'Origin url (from where you found that entry)'
         save_label: 'Guardar'
     public:
         shared_by_wallabag: "Este artículo se ha compartido con <a href='%wallabag_instance%'>wallabag</a>"
index ffc48933a09378d6146b848471d2f4764cb97e1e..c03cca464720a2d379e4e6679967c024bef28a72 100644 (file)
@@ -233,6 +233,7 @@ entry:
         created_at: 'زمان ساخت'
         # published_at: 'Publication date'
         # published_by: 'Published by'
+        # provided_by: 'Provided by'
     new:
         page_title: 'ذخیرهٔ مقالهٔ تازه'
         placeholder: 'http://website.com'
@@ -244,6 +245,7 @@ entry:
         page_title: 'ویرایش مقاله'
         title_label: 'عنوان'
         url_label: 'نشانی'
+        # origin_url_label: 'Origin url (from where you found that entry)'
         save_label: 'ذخیره'
     public:
         # shared_by_wallabag: "This article has been shared by %username% with <a href='%wallabag_instance%'>wallabag</a>"
index c9d95e2bcdc6708e0f95b5762e946bb8f5eccc9b..b0037ad277db75e32a20912f7d15905bd0db3ba4 100644 (file)
@@ -233,6 +233,7 @@ entry:
         created_at: "Date de création"
         published_at: "Date de publication"
         published_by: "Publié par"
+        provided_by: "Fourni par"
     new:
         page_title: "Sauvegarder un nouvel article"
         placeholder: "http://website.com"
@@ -244,6 +245,7 @@ entry:
         page_title: "Éditer un article"
         title_label: "Titre"
         url_label: "Adresse"
+        origin_url_label: "Adresse d'origine (d'où vous avez trouvé cet article)"
         save_label: "Enregistrer"
     public:
         shared_by_wallabag: "Cet article a été partagé par %username% avec <a href=\"%wallabag_instance%\">wallabag</a>"
index c53266ca360fc548d9ac873d4b991a75b0b68218..56cf341bdf10c2f4a38607efb087ae2cbb48dfc0 100644 (file)
@@ -233,6 +233,7 @@ entry:
         created_at: 'Data di creazione'
         published_at: 'Data di pubblicazione'
         published_by: 'Pubblicato da'
+        # provided_by: 'Provided by'
     new:
         page_title: 'Salva un nuovo contenuto'
         placeholder: 'http://website.com'
@@ -244,6 +245,7 @@ entry:
         page_title: 'Modifica voce'
         title_label: 'Titolo'
         url_label: 'Url'
+        # origin_url_label: 'Origin url (from where you found that entry)'
         save_label: 'Salva'
     public:
         shared_by_wallabag: "Questo articolo è stato condiviso da %username% con <a href='%wallabag_instance%'>wallabag</a>"
index 3ae64c49f73e7f8c69fd0e1660f7ea16a417f3e3..1b5b221fade65ee20a64141cd82c87e95f268f4d 100644 (file)
@@ -233,6 +233,7 @@ entry:
         created_at: 'Data de creacion'
         published_at: 'Data de publicacion'
         published_by: 'Publicat per'
+        # provided_by: 'Provided by'
     new:
         page_title: 'Enregistrar un novèl article'
         placeholder: 'http://website.com'
@@ -244,6 +245,7 @@ entry:
         page_title: 'Modificar un article'
         title_label: 'Títol'
         url_label: 'Url'
+        # origin_url_label: 'Origin url (from where you found that entry)'
         save_label: 'Enregistrar'
     public:
         shared_by_wallabag: "Aqueste article es estat partejat per <a href='%wallabag_instance%'>wallabag</a>"
index e642c5307a35a5fe863fd448e803d876b9530a10..88f35738d89e31d54224207b905b0f1b2a0cdfeb 100644 (file)
@@ -233,6 +233,7 @@ entry:
         created_at: 'Czas stworzenia'
         published_at: 'Data publikacji'
         published_by: 'Opublikowane przez'
+        # provided_by: 'Provided by'
     new:
         page_title: 'Zapisz nowy wpis'
         placeholder: 'http://website.com'
@@ -244,6 +245,7 @@ entry:
         page_title: 'Edytuj wpis'
         title_label: 'Tytuł'
         url_label: 'Adres URL'
+        # origin_url_label: 'Origin url (from where you found that entry)'
         save_label: 'Zapisz'
     public:
         shared_by_wallabag: "Ten artykuł został udostępniony przez <a href='%wallabag_instance%'>wallabag</a>"
index 9b3fea6b0e1dae9957f138cff2dda6858138f8a7..3987cec3dc51df6a312c402886bb05662aa2e24e 100644 (file)
@@ -233,6 +233,7 @@ entry:
         created_at: 'Data de criação'
         # published_at: 'Publication date'
         # published_by: 'Published by'
+        # provided_by: 'Provided by'
     new:
         page_title: 'Salvar nova entrada'
         placeholder: 'http://website.com'
@@ -244,6 +245,7 @@ entry:
         page_title: 'Editar uma entrada'
         title_label: 'Título'
         url_label: 'Url'
+        # origin_url_label: 'Origin url (from where you found that entry)'
         save_label: 'Salvar'
     public:
         shared_by_wallabag: "Este artigo foi compartilhado pelo <a href='%wallabag_instance%'>wallabag</a>"
index 673ca183a87273c80bfc95e93201f8938bf3a58a..4d2fd5693d9d85ef91774d6a1933577a385e0810 100644 (file)
@@ -233,6 +233,7 @@ entry:
         created_at: 'Data creării'
         # published_at: 'Publication date'
         # published_by: 'Published by'
+        # provided_by: 'Provided by'
     new:
         page_title: 'Salvează un nou articol'
         placeholder: 'http://website.com'
@@ -244,6 +245,7 @@ entry:
         # page_title: 'Edit an entry'
         # title_label: 'Title'
         url_label: 'Url'
+        # origin_url_label: 'Origin url (from where you found that entry)'
         save_label: 'Salvează'
     public:
         # shared_by_wallabag: "This article has been shared by %username% with <a href='%wallabag_instance%'>wallabag</a>"
index eceecabfbf6f16e8fbc553e6b27f1bed24254caf..a560e58df106e8bc633ae4278d4b6baae02b102c 100644 (file)
@@ -223,6 +223,7 @@ entry:
         original_article: 'оригинал'
         annotations_on_the_entry: '{0} Нет аннотации|{1} Одна аннотация|]1,Inf[ %count% аннотаций'
         created_at: 'Дата создания'
+        # provided_by: 'Provided by'
     new:
         page_title: 'Сохранить новую запись'
         placeholder: 'http://website.com'
@@ -234,6 +235,7 @@ entry:
         page_title: 'Изменить запись'
         title_label: 'Название'
         url_label: 'Ссылка'
+        # origin_url_label: 'Origin url (from where you found that entry)'
         is_public_label: 'Публичная'
         save_label: 'Сохранить'
     public:
index 563bc50b05a6d4bc0ffe56fb70c1d1fd87cb34d9..0fd6e989096a7e77b064164baf19736153c28d11 100644 (file)
@@ -231,6 +231,7 @@ entry:
         created_at: 'Oluşturulma tarihi'
         # published_at: 'Publication date'
         # published_by: 'Published by'
+        # provided_by: 'Provided by'
     new:
         page_title: 'Yeni makaleyi kaydet'
         placeholder: 'http://website.com'
@@ -242,6 +243,7 @@ entry:
         page_title: 'Makaleyi düzenle'
         title_label: 'Başlık'
         url_label: 'Url'
+        # origin_url_label: 'Origin url (from where you found that entry)'
         save_label: 'Kaydet'
     public:
         # shared_by_wallabag: "This article has been shared by %username% with <a href='%wallabag_instance%'>wallabag</a>"
index f8723189b725592fd6a9721e363dc7fbaab7d125..0c7cbaa6e4183a46d2d08e7876a503d5215490c4 100644 (file)
             </i>
 
             <span class="tool link"><i class="material-icons link">comment</i> {{ 'entry.view.annotations_on_the_entry'|transchoice(entry.annotations | length) }}</span>
+
+            {% if entry.originUrl is not empty %}
+                <i class="material-icons" title="{{ 'entry.view.provided_by'|trans }}">launch</i>
+                <a href="{{ entry.originUrl|e }}" target="_blank" class="tool">
+                    {{ entry.originUrl|striptags|removeSchemeAndWww|truncate(32) }}
+                </a>
+            {% endif %}
+
             <aside class="tags">
                 <div class="card-entry-tags">
                 {% for tag in entry.tags %}
index b95379758dc5de2cb15bf7e0d4ebd66cd9e7db10..ed225957ce6af81e007c2c8ea334b2a7061daa0d 100644 (file)
                             {{ form_label(form.url) }}
                             {{ form_widget(form.url) }}
                         </div>
+
+                        <div class="input-field s12">
+                            {{ form_label(form.origin_url) }}
+                            {{ form_widget(form.origin_url) }}
+                        </div>
                         <br>
 
                         {{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
index 4cff7bf2db489491618b6a61eb35c31086366ec4..019569f793978acc94e644704760ab7b3d80c42e 100644 (file)
                     {% endif %}
                     {% if craue_setting('share_shaarli') %}
                         <li>
-                        <a href="{{ craue_setting('shaarli_url') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|striptags|url_encode }}&amp;tags={{ entry.tags|join(',')|striptags|url_encode }}" target="_blank" title="shaarli" class="tool icon-image shaarli">
+                        <a href="{{ craue_setting('shaarli_url') }}/index.php?post={{ entry.url|url_encode }}&amp;title={{ entry.title|striptags|url_encode }}&amp;tags={{ entry.tags|join(',')|striptags|url_encode }}&amp;lf_original_url={{ entry.originUrl|url_encode }}" target="_blank" title="shaarli" class="tool icon-image shaarli">
                                 <span>shaarli</span>
                             </a>
                         </li>
                         <i class="material-icons link">comment</i>
                         {{ 'entry.view.annotations_on_the_entry'|transchoice(entry.annotations | length) }}
                     </li>
+                    {% if entry.originUrl is not empty %}
+                        <li>
+                            <i class="material-icons" title="{{ 'entry.view.provided_by'|trans }}">launch</i>
+                            <a href="{{ entry.originUrl|e }}" target="_blank" class="tool">
+                                {{ entry.originUrl|striptags|removeSchemeAndWww|truncate(32) }}
+                            </a>
+                        </li>
+                    {% endif %}
                 </ul>
                 <ul class="tags">
                     {% for tag in entry.tags %}
index 351172c460f2fc24ba76c37e85e76b14ac958c57..8992117e62baef07228a517238ca44aa06ddf2e6 100644 (file)
@@ -28,6 +28,7 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa
     {
         return [
             new \Twig_SimpleFilter('removeWww', [$this, 'removeWww']),
+            new \Twig_SimpleFilter('removeSchemeAndWww', [$this, 'removeSchemeAndWww']),
         ];
     }
 
@@ -45,6 +46,13 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa
         return preg_replace('/^www\./i', '', $url);
     }
 
+    public function removeSchemeAndWww($url)
+    {
+        return $this->removeWww(
+            preg_replace('@^https?://@i', '', $url)
+        );
+    }
+
     /**
      * Return number of entries depending of the type (unread, archive, starred or all).
      *
index 450b71ffdfcb2a554370a09fa193ad08cc888337..862d0c43cee1d77bbee944405e717deaaba3e24f 100644 (file)
@@ -21,9 +21,26 @@ class RedisEntryConsumer extends AbstractConsumer implements Job
     /**
      * Should tell if the given job will kill the worker.
      * We don't want to stop it :).
+     *
+     * @param string $job Content of the message (directly from Redis)
+     *
+     * @return false
      */
     public function isStopJob($job)
     {
         return false;
     }
+
+    /**
+     * This abstract method is only used when we use one queue for multiple job type.
+     * We don't do that, so we'll always return true.
+     *
+     * @param string $job Content of the message (directly from Redis)
+     *
+     * @return true
+     */
+    public function isMyJob($job)
+    {
+        return true;
+    }
 }
index ee0a27d57af9cf5e9d436a3dcf8ac7614ea9abaf..5fc576178fe5390c78ddec7526f2a8b8b1c00379 100644 (file)
@@ -5,7 +5,7 @@ auth_code:
         subject: 'wallabag authentication code'
         body:
             hello: "Hi %user%,"
-            first_para: "Since you enable two factor authentication on your wallabag account and you just logged in from a new device (computer, phone, etc.), we send you a code to validate your connection."
+            first_para: "Since you require two factor authentication to log in on your wallabag account, and a new device just used it, we send you a code to validate its connection."
             second_para: "Here is the code:"
             support: "Please don't hesitate to contact us if you have any problems:"
             signature: "The wallabag team"
index 95c64501c0e94cca146c0cfe3a6f4c1244c8d24d..b0d4c4e1a609bfb8778fc1da9b310fe6cb64b082 100644 (file)
@@ -36,6 +36,25 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $this->assertSame('application/json', $this->client->getResponse()->headers->get('Content-Type'));
     }
 
+    public function testGetOneEntryWithOriginUrl()
+    {
+        $entry = $this->client->getContainer()
+            ->get('doctrine.orm.entity_manager')
+            ->getRepository('WallabagCoreBundle:Entry')
+            ->findOneBy(['user' => 1, 'url' => 'http://0.0.0.0/entry2']);
+
+        if (!$entry) {
+            $this->markTestSkipped('No content found in db.');
+        }
+
+        $this->client->request('GET', '/api/entries/' . $entry->getId() . '.json');
+        $this->assertSame(200, $this->client->getResponse()->getStatusCode());
+
+        $content = json_decode($this->client->getResponse()->getContent(), true);
+
+        $this->assertSame($entry->getOriginUrl(), $content['origin_url']);
+    }
+
     public function testExportEntry()
     {
         $entry = $this->client->getContainer()
@@ -421,6 +440,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $this->assertSame('New title for my article', $content['title']);
         $this->assertSame(1, $content['user_id']);
         $this->assertCount(2, $content['tags']);
+        $this->assertNull($content['origin_url']);
         $this->assertSame('my content', $content['content']);
         $this->assertSame('de', $content['language']);
         $this->assertSame('2016-09-08T11:55:58+0200', $content['published_at']);
@@ -531,6 +551,29 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $this->assertSame(1, $content['is_starred']);
     }
 
+    public function testPostEntryWithOriginUrl()
+    {
+        $this->client->request('POST', '/api/entries.json', [
+            'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html',
+            'tags' => 'google',
+            'title' => 'New title for my article',
+            'content' => 'my content',
+            'language' => 'de',
+            'published_at' => '2016-09-08T11:55:58+0200',
+            'authors' => 'bob,helen',
+            'public' => 1,
+            'origin_url' => 'http://mysource.tld',
+        ]);
+
+        $this->assertSame(200, $this->client->getResponse()->getStatusCode());
+
+        $content = json_decode($this->client->getResponse()->getContent(), true);
+
+        $this->assertGreaterThan(0, $content['id']);
+        $this->assertSame('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']);
+        $this->assertSame('http://mysource.tld', $content['origin_url']);
+    }
+
     public function testPatchEntry()
     {
         $entry = $this->client->getContainer()
@@ -607,6 +650,91 @@ class EntryRestControllerTest extends WallabagApiTestCase
         $this->assertSame($previousLanguage, $content['language'], 'Ensure language has not moved');
     }
 
+    public function testPatchEntryWithOriginUrl()
+    {
+        $entry = $this->client->getContainer()
+            ->get('doctrine.orm.entity_manager')
+            ->getRepository('WallabagCoreBundle:Entry')
+            ->findOneByUser(1);
+
+        if (!$entry) {
+            $this->markTestSkipped('No content found in db.');
+        }
+
+        $previousContent = $entry->getContent();
+        $previousLanguage = $entry->getLanguage();
+
+        $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [
+            'title' => 'Another awesome title just for profit',
+            'origin_url' => 'https://myawesomesource.example.com',
+        ]);
+
+        $this->assertSame(200, $this->client->getResponse()->getStatusCode());
+
+        $content = json_decode($this->client->getResponse()->getContent(), true);
+
+        $this->assertSame($entry->getId(), $content['id']);
+        $this->assertSame($entry->getUrl(), $content['url']);
+        $this->assertSame('https://myawesomesource.example.com', $content['origin_url']);
+        $this->assertEmpty($content['published_by'], 'Authors were not saved because of an array instead of a string');
+        $this->assertSame($previousContent, $content['content'], 'Ensure content has not moved');
+        $this->assertSame($previousLanguage, $content['language'], 'Ensure language has not moved');
+    }
+
+    public function testPatchEntryRemoveOriginUrl()
+    {
+        $entry = $this->client->getContainer()
+        ->get('doctrine.orm.entity_manager')
+        ->getRepository('WallabagCoreBundle:Entry')
+        ->findOneByUser(1);
+
+        if (!$entry) {
+            $this->markTestSkipped('No content found in db.');
+        }
+
+        $previousContent = $entry->getContent();
+        $previousLanguage = $entry->getLanguage();
+        $previousTitle = $entry->getTitle();
+
+        $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [
+            'origin_url' => '',
+        ]);
+
+        $this->assertSame(200, $this->client->getResponse()->getStatusCode());
+
+        $content = json_decode($this->client->getResponse()->getContent(), true);
+
+        $this->assertSame($entry->getId(), $content['id']);
+        $this->assertSame($entry->getUrl(), $content['url']);
+        $this->assertEmpty($content['origin_url']);
+        $this->assertEmpty($content['published_by'], 'Authors were not saved because of an array instead of a string');
+        $this->assertSame($previousContent, $content['content'], 'Ensure content has not moved');
+        $this->assertSame($previousLanguage, $content['language'], 'Ensure language has not moved');
+        $this->assertSame($previousTitle, $content['title'], 'Ensure title has not moved');
+    }
+
+    public function testPatchEntryNullOriginUrl()
+    {
+        $entry = $this->client->getContainer()
+            ->get('doctrine.orm.entity_manager')
+            ->getRepository('WallabagCoreBundle:Entry')
+            ->findOneByUser(1);
+
+        if (!$entry) {
+            $this->markTestSkipped('No content found in db.');
+        }
+
+        $this->client->request('PATCH', '/api/entries/' . $entry->getId() . '.json', [
+                'origin_url' => null,
+            ]);
+
+        $this->assertSame(200, $this->client->getResponse()->getStatusCode());
+
+        $content = json_decode($this->client->getResponse()->getContent(), true);
+
+        $this->assertNull($content['origin_url']);
+    }
+
     public function testGetTagsEntry()
     {
         $entry = $this->client->getContainer()
@@ -855,7 +983,7 @@ class EntryRestControllerTest extends WallabagApiTestCase
 
         $content = json_decode($this->client->getResponse()->getContent(), true);
 
-        $this->assertSame(false, $content['exists']);
+        $this->assertFalse($content['exists']);
     }
 
     public function testGetEntriesExistsWithNoUrl()
index f684a20690c43501e55d300e2c967861f0c9a8b4..bd351b187fd2671480c9a5bc262b600e26c572d7 100644 (file)
@@ -5,6 +5,7 @@ namespace Tests\Wallabag\CoreBundle\Command;
 use DAMA\DoctrineTestBundle\Doctrine\DBAL\StaticDriver;
 use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
 use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
+use Doctrine\Bundle\MigrationsBundle\Command\MigrationsMigrateDoctrineCommand;
 use Doctrine\DBAL\Platforms\PostgreSqlPlatform;
 use Doctrine\DBAL\Platforms\SqlitePlatform;
 use Symfony\Bundle\FrameworkBundle\Console\Application;
@@ -98,7 +99,6 @@ class InstallCommandTest extends WallabagCoreTestCase
         $this->assertContains('Setting up database.', $tester->getDisplay());
         $this->assertContains('Administration setup.', $tester->getDisplay());
         $this->assertContains('Config setup.', $tester->getDisplay());
-        $this->assertContains('Run migrations.', $tester->getDisplay());
     }
 
     public function testRunInstallCommandWithReset()
@@ -125,7 +125,6 @@ class InstallCommandTest extends WallabagCoreTestCase
         $this->assertContains('Dropping database, creating database and schema, clearing the cache', $tester->getDisplay());
         $this->assertContains('Administration setup.', $tester->getDisplay());
         $this->assertContains('Config setup.', $tester->getDisplay());
-        $this->assertContains('Run migrations.', $tester->getDisplay());
 
         // we force to reset everything
         $this->assertContains('Dropping database, creating database and schema, clearing the cache', $tester->getDisplay());
@@ -171,7 +170,6 @@ class InstallCommandTest extends WallabagCoreTestCase
         $this->assertContains('Setting up database.', $tester->getDisplay());
         $this->assertContains('Administration setup.', $tester->getDisplay());
         $this->assertContains('Config setup.', $tester->getDisplay());
-        $this->assertContains('Run migrations.', $tester->getDisplay());
 
         // the current database doesn't already exist
         $this->assertContains('Creating database and schema, clearing the cache', $tester->getDisplay());
@@ -198,7 +196,6 @@ class InstallCommandTest extends WallabagCoreTestCase
         $this->assertContains('Setting up database.', $tester->getDisplay());
         $this->assertContains('Administration setup.', $tester->getDisplay());
         $this->assertContains('Config setup.', $tester->getDisplay());
-        $this->assertContains('Run migrations.', $tester->getDisplay());
 
         $this->assertContains('Dropping schema and creating schema', $tester->getDisplay());
     }
@@ -209,6 +206,7 @@ class InstallCommandTest extends WallabagCoreTestCase
         $application->add(new InstallCommand());
         $application->add(new DropDatabaseDoctrineCommand());
         $application->add(new CreateDatabaseDoctrineCommand());
+        $application->add(new MigrationsMigrateDoctrineCommand());
 
         // drop database first, so the install command won't ask to reset things
         $command = new DropDatabaseDoctrineCommand();
@@ -242,7 +240,6 @@ class InstallCommandTest extends WallabagCoreTestCase
         $this->assertContains('Setting up database.', $tester->getDisplay());
         $this->assertContains('Administration setup.', $tester->getDisplay());
         $this->assertContains('Config setup.', $tester->getDisplay());
-        $this->assertContains('Run migrations.', $tester->getDisplay());
 
         $this->assertContains('Creating schema', $tester->getDisplay());
     }
@@ -265,6 +262,5 @@ class InstallCommandTest extends WallabagCoreTestCase
         $this->assertContains('Setting up database.', $tester->getDisplay());
         $this->assertContains('Administration setup.', $tester->getDisplay());
         $this->assertContains('Config setup.', $tester->getDisplay());
-        $this->assertContains('Run migrations.', $tester->getDisplay());
     }
 }
index 6e8065539045166165cc0022a250e91be936f8ad..4ac4548b2624b2f75035e525a4f4e0fb5ec577f9 100644 (file)
@@ -137,6 +137,8 @@ class EntryControllerTest extends WallabagCoreTestCase
         $this->logInAs('admin');
         $client = $this->getClient();
 
+        $client->getContainer()->get('craue_config')->set('store_article_headers', 1);
+
         $crawler = $client->request('GET', '/new');
 
         $this->assertSame(200, $client->getResponse()->getStatusCode());
@@ -165,6 +167,7 @@ class EntryControllerTest extends WallabagCoreTestCase
         $this->assertSame('2015-03-28 11:43:19', $content->getPublishedAt()->format('Y-m-d H:i:s'));
         $this->assertSame('Morgane Tual', $author[0]);
         $this->assertArrayHasKey('x-varnish1', $content->getHeaders());
+        $client->getContainer()->get('craue_config')->set('store_article_headers', 0);
     }
 
     public function testPostWithMultipleAuthors()
@@ -475,6 +478,40 @@ class EntryControllerTest extends WallabagCoreTestCase
 
         $data = [
             'entry[title]' => 'My updated title hehe :)',
+            'entry[origin_url]' => 'https://example.io',
+        ];
+
+        $client->submit($form, $data);
+
+        $this->assertSame(302, $client->getResponse()->getStatusCode());
+
+        $crawler = $client->followRedirect();
+
+        $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text']));
+        $this->assertContains('My updated title hehe :)', $title[0]);
+        $this->assertGreaterThan(1, $stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text']));
+        $this->assertContains('example.io', trim($stats[1]));
+    }
+
+    public function testEditRemoveOriginUrl()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        $entry = new Entry($this->getLoggedInUser());
+        $entry->setUrl($this->url);
+        $this->getEntityManager()->persist($entry);
+        $this->getEntityManager()->flush();
+
+        $crawler = $client->request('GET', '/edit/' . $entry->getId());
+
+        $this->assertSame(200, $client->getResponse()->getStatusCode());
+
+        $form = $crawler->filter('button[type=submit]')->form();
+
+        $data = [
+            'entry[title]' => 'My updated title hehe :)',
+            'entry[origin_url]' => '',
         ];
 
         $client->submit($form, $data);
@@ -483,8 +520,10 @@ class EntryControllerTest extends WallabagCoreTestCase
 
         $crawler = $client->followRedirect();
 
-        $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(['_text']));
-        $this->assertContains('My updated title hehe :)', $alert[0]);
+        $this->assertGreaterThan(1, $title = $crawler->filter('div[id=article] h1')->extract(['_text']));
+        $this->assertContains('My updated title hehe :)', $title[0]);
+        $this->assertSame(1, count($stats = $crawler->filter('div[class=tools] ul[class=stats] li a[class=tool]')->extract(['_text'])));
+        $this->assertNotContains('example.io', trim($stats[0]));
     }
 
     public function testToggleArchive()
index 87ea286712ece3a3631a560e90c81d29ffb256c3..f50744039fa85bb1b476c62abf21ec2dafa9051e 100644 (file)
@@ -8,6 +8,20 @@ use Wallabag\CoreBundle\Entity\SiteCredential;
 
 class SiteCredentialControllerTest extends WallabagCoreTestCase
 {
+    public function testAccessDeniedBecauseFeatureDisabled()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        $client->getContainer()->get('craue_config')->set('restricted_access', 0);
+
+        $client->request('GET', '/site-credentials/');
+
+        $this->assertSame(404, $client->getResponse()->getStatusCode());
+
+        $client->getContainer()->get('craue_config')->set('restricted_access', 1);
+    }
+
     public function testListSiteCredential()
     {
         $this->logInAs('admin');
index 5d6a29fec9fcd9ec3efef558c8c51e87adb9d89d..5aee9f5c0003d04324cd9403b7f6322492460679 100644 (file)
@@ -68,7 +68,7 @@ class GrabySiteConfigBuilderTest extends \PHPUnit_Framework_TestCase
         $config = $this->builder->buildForHost('www.example.com');
 
         $this->assertSame('example.com', $config->getHost());
-        $this->assertSame(true, $config->requiresLogin());
+        $this->assertTrue($config->requiresLogin());
         $this->assertSame('http://www.example.com/login', $config->getLoginUri());
         $this->assertSame('login', $config->getUsernameField());
         $this->assertSame('password', $config->getPasswordField());
index f94c2137252d44f011c3eecd874576f8d983d952..5c99e4618970b30e7ba81fc6f3fbc68de3f61986 100644 (file)
@@ -51,7 +51,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
         $this->assertEmpty($entry->getMimetype());
         $this->assertEmpty($entry->getLanguage());
         $this->assertSame(0.0, $entry->getReadingTime());
-        $this->assertSame(null, $entry->getDomainName());
+        $this->assertNull($entry->getDomainName());
     }
 
     public function testWithEmptyContent()
@@ -311,7 +311,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
         $tagger->expects($this->once())
             ->method('tag');
 
-        $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage);
+        $proxy = new ContentProxy((new Graby()), $tagger, $this->getValidator(), $this->getLogger(), $this->fetchingErrorMessage, true);
         $entry = new Entry(new User());
         $proxy->updateEntry(
             $entry,
@@ -341,6 +341,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
         $this->assertContains('Jeremy', $entry->getPublishedBy());
         $this->assertContains('Nico', $entry->getPublishedBy());
         $this->assertContains('Thomas', $entry->getPublishedBy());
+        $this->assertNotNull($entry->getHeaders(), 'Headers are stored, so value is not null');
         $this->assertContains('no-cache', $entry->getHeaders());
     }
 
index ceec4b37b7a91316dcb8884cb074481d82e38606..82336060fb79356447b868a342e2de40d5791631 100644 (file)
@@ -30,4 +30,31 @@ class WallabagExtensionTest extends \PHPUnit_Framework_TestCase
         $this->assertSame('lemonde.fr', $extension->removeWww('lemonde.fr'));
         $this->assertSame('gist.github.com', $extension->removeWww('gist.github.com'));
     }
+
+    public function testRemoveSchemeAndWww()
+    {
+        $entryRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $tagRepository = $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $tokenStorage = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $translator = $this->getMockBuilder('Symfony\Component\Translation\TranslatorInterface')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $extension = new WallabagExtension($entryRepository, $tagRepository, $tokenStorage, 0, $translator);
+
+        $this->assertSame('lemonde.fr', $extension->removeSchemeAndWww('www.lemonde.fr'));
+        $this->assertSame('lemonde.fr', $extension->removeSchemeAndWww('http://lemonde.fr'));
+        $this->assertSame('lemonde.fr', $extension->removeSchemeAndWww('https://www.lemonde.fr'));
+        $this->assertSame('gist.github.com', $extension->removeSchemeAndWww('https://gist.github.com'));
+        $this->assertSame('ftp://gist.github.com', $extension->removeSchemeAndWww('ftp://gist.github.com'));
+    }
 }