Merge pull request #1 from wallabag/master

Keep up with the master again
This commit is contained in:
lizyn 2020-02-24 10:04:13 +08:00 committed by GitHub
commit b19df31d78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
345 changed files with 20149 additions and 3373 deletions

View File

@ -13,5 +13,5 @@ insert_final_newline = true
indent_style = space
indent_size = 2
[Makefile]
[*akefile]
indent_style = tab

View File

@ -1,11 +1,41 @@
# How to contribute
## Test it locally
### Using Docker
- Clone the repository
- Ensure your Docker daemon is running
- Launch `docker-compose up`
You'll then have:
- a web server (nginx)
- a PHP daemon (using FPM)
- a Redis database (to handle imports)
- a SQLite database to store articles
You can now access your wallabag instance using that url: `http://127.0.0.1:8000`
If you want to test using an other database than SQLite, uncomment the `postgres` or `mariadb` code from the `docker-compose.yml` file at the root of the repo. Also uncomment related line in the `php` section so the database will be linked to your PHP instance.
### Using your own PHP server
- Ensure you are running PHP > 7.1.
- Clone the repository
- Launch `composer install`
- If you got some errors, fix them (they might be related to some missing PHP extension from your machine)
- Then `php bin/console wallabag:install`
- If you got some errors, fix them (they might be related to some missing PHP extension from your machine)
- Run `php bin/console server:run`
You can now access your wallabag instance using that url: `http://127.0.0.1:8000`
## You found a bug
Please [open a new issue](https://github.com/wallabag/wallabag/issues/new).
To fix the bug quickly, we need some infos: please answer to the questions in the issue form.
If you have the skills, look for errors into php, server and application (see `var/logs`) logs.
If you have the skills, look for errors into PHP, server and application logs (see `var/logs`).
Note : If you have large portions of text, use [Github's Gist service](https://gist.github.com/) or other pastebin-like.

2
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,2 @@
# github: [nicosomb, j0k3r, tcitworld, Kdecherf]
liberapay: wallabag

7
.gitignore vendored
View File

@ -32,6 +32,7 @@ web/uploads/
# Build
/app/build
/build
/coverage
# Composer PHAR
/composer.phar
@ -43,9 +44,6 @@ data/db/wallabag*.sqlite
docker/logs/
docker/data/
# To avoid crazy stuff on some PR, we must manually FORCE ADD IT on each new release
composer.lock
# assets stuff
node_modules/
bin
@ -57,3 +55,6 @@ app/Resources/build/
admin-export.json
specialexport.json
/data/site-credentials-secret-key.txt
# Custom CSS file
web/custom.css

View File

@ -1,15 +1,11 @@
language: php
services:
- mysql
- postgresql
- rabbitmq
- redis
# used for HHVM
addons:
apt:
packages:
- tidy
# cache vendor dirs
cache:
apt: true
@ -21,10 +17,10 @@ cache:
- $HOME/.yarn-cache
php:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- nightly
node_js:
@ -38,9 +34,10 @@ env:
matrix:
fast_finish: true
include:
- php: 7.0
- php: 7.2
env: CS_FIXER=run VALIDATE_TRANSLATION_FILE=run ASSETS=build DB=sqlite
allow_failures:
- php: 7.4
- php: nightly
# exclude v1 branches
@ -58,31 +55,26 @@ install:
before_script:
- PHP=$TRAVIS_PHP_VERSION
- if [[ ! $PHP = hhvm* ]]; then echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;
# xdebug isn't enable for PHP 7.1
- if [[ ! $PHP = hhvm* ]]; then phpenv config-rm xdebug.ini || echo "xdebug not available"; fi
- echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- phpenv config-rm xdebug.ini || echo "xdebug not available"
- composer self-update --no-progress
- if [[ $DB = pgsql ]]; then psql -c 'create database wallabag_test;' -U postgres; fi;
# increase swap to avoid "proc_open(): fork failed - Cannot allocate memory"
# this should be removed when no more PHP 5 build will be defined
- sudo swapon -s
- sudo fallocate -l 4G /swapfile
- sudo chmod 600 /swapfile
- sudo mkswap /swapfile
- sudo swapon /swapfile
- sudo swapon -s
# install imagick
- pear config-set preferred_state beta
- pecl channel-update pecl.php.net
- yes | pecl install imagick
script:
- travis_wait bash composer install -o --no-interaction --no-progress --prefer-dist
- 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
- echo "travis_fold:end:fixtures"
- make fixtures
- if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then ./bin/simple-phpunit -v ; fi;
# PHPStan needs PHPUnit to be installed and cache app to be generated
- if [[ $VALIDATE_TRANSLATION_FILE = '' ]]; then php bin/phpstan analyse src tests --no-progress --level 1 ; fi;
- if [[ $CS_FIXER = run ]]; then php bin/php-cs-fixer fix --verbose --dry-run ; fi;
- if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi;
- if [[ $VALIDATE_TRANSLATION_FILE = run ]]; then php bin/console lint:yaml app/Resources/CraueConfigBundle/translations -v ; fi;

View File

@ -1,26 +0,0 @@
# see https://zappr.opensource.zalan.do/
autobranch: false
commit: false
approvals:
minimum: 1
ignore: pr_opener
pattern: "^(:\\+1:|👍)$"
veto:
pattern: "^(:\\-1:|👎)$"
from:
orgs:
- wallabag
collaborators: true
specification:
title:
minimum-length:
enabled: true
length: 8
body:
minimum-length:
enabled: true
length: 8
contains-url: false
contains-issue-number: false
template:
differs-from-body: true

View File

@ -1,5 +1,53 @@
# Changelog
## [2.3.8](https://github.com/wallabag/wallabag/tree/2.3.8)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.3.7...2.3.8)
### Fixes
- Jump to 2.3.8-dev [#3897](https://github.com/wallabag/wallabag/pull/3897)
- material: fix left padding on non-entry pages [#3901](https://github.com/wallabag/wallabag/pull/3901)
- Make dev/install/update script posix compatible [#3860](https://github.com/wallabag/wallabag/pull/3860)
- epub: fix exception when articles have the same title [#3908](https://github.com/wallabag/wallabag/pull/3908)
- Fix PHP warning [#3909](https://github.com/wallabag/wallabag/pull/3909)
- Add ability to match many domains for credentials [#3937](https://github.com/wallabag/wallabag/pull/3937)
- material: add metadata to list view [#3942](https://github.com/wallabag/wallabag/pull/3942)
- Enable no-referrer on img tags, enable strict-origin-when-cross-origin by default [#3943](https://github.com/wallabag/wallabag/pull/3943)
- Remove preview picture from share view page#3922
- Fix Intl Locale issue [#3964](https://github.com/wallabag/wallabag/pull/3964)
## [2.3.7](https://github.com/wallabag/wallabag/tree/2.3.7)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.3.6...2.3.7)
### Fixes
- Jump to 2.3.7-dev [#3837](https://github.com/wallabag/wallabag/pull/3837)
- Fix bad order parameter in the API [#3841](https://github.com/wallabag/wallabag/pull/3841)
- Update composer.json to add php-tidy (ext-tidy) [#3853](https://github.com/wallabag/wallabag/pull/3853)
- Add dedicated email for site config issue [#3861](https://github.com/wallabag/wallabag/pull/3861)
- Fix read & starred status in Pocket import [#3819](https://github.com/wallabag/wallabag/pull/3819)
- Fix broken 2 factor auth logo image [#3869](https://github.com/wallabag/wallabag/pull/3869)
- Fix CORS for API [#3882](https://github.com/wallabag/wallabag/pull/3882)
- Add support of expect parameter to change return object when deleting entry [#3887](https://github.com/wallabag/wallabag/pull/3887)
- epub export: fix missing cover image, only for exports of one article [#3886](https://github.com/wallabag/wallabag/pull/3886)
- Allow optional --ignore-root-warning [#3885](https://github.com/wallabag/wallabag/pull/3885)
- material: fix left padding of content on medium screens [#3893](https://github.com/wallabag/wallabag/pull/3893)
- material: hide creation date from card actions on specific sizes [#3894](https://github.com/wallabag/wallabag/pull/3894)
## [2.3.6](https://github.com/wallabag/wallabag/tree/2.3.6)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.3.5...2.3.6)
### Fixes
- Jump to 2.3.6-dev and update release process [#3814](https://github.com/wallabag/wallabag/pull/3814)
- Fix tag API leak [#3823](https://github.com/wallabag/wallabag/pull/3823)
- Validate imported entry to avoid error on import [#3816](https://github.com/wallabag/wallabag/pull/3816)
- Fix incorrect reading time calculation for entries with CJK characters [#3820](https://github.com/wallabag/wallabag/pull/3820)
- EntriesExport/epub: replace epub identifier with unique urn [#3827](https://github.com/wallabag/wallabag/pull/3827)
- Fix settings field inverted [#3833](https://github.com/wallabag/wallabag/pull/3833)
- Cast client id to avoid PG error [#3831](https://github.com/wallabag/wallabag/pull/3831)
- Rework of EPUB/PDF exports [#3826](https://github.com/wallabag/wallabag/pull/3826)
## [2.3.5](https://github.com/wallabag/wallabag/tree/2.3.5)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.3.4...2.3.5)

76
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,76 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at hello@wallabag.org. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@ -1,4 +1,4 @@
Copyright (c) 2013-2017 Nicolas Lœuillet
Copyright (c) 2013-current Nicolas Lœuillet
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -2,7 +2,14 @@ SHELL=bash
TMP_FOLDER=/tmp
RELEASE_FOLDER=wllbg-release
ENV ?= prod
# ensure the ENV variable is well defined
AVAILABLE_ENV := prod dev test
ifneq ($(filter $(ENV),$(AVAILABLE_ENV)),)
# all good
else
# not good, force it to "prod"
override ENV = prod
endif
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}'
@ -10,21 +17,26 @@ help: ## Display this help menu
clean: ## Clear the application cache
rm -rf var/cache/*
install: ## Install wallabag with the latest version
install: customcss ## Install wallabag with the latest version
@./scripts/install.sh $(ENV)
update: ## Update the wallabag installation to the latest version
@./scripts/update.sh $(ENV)
dev: ## Install the latest dev version
dev: ENV=dev
dev: build customcss ## Install the latest dev version
@./scripts/dev.sh
run: ## Run the wallabag built-in server
@php bin/console server:run --env=dev
build: ## Run webpack
@npm install
@npm run build:$(ENV)
customcss:
@touch web/custom.css
prepare: clean ## Prepare database for testsuite
ifdef DB
cp app/config/tests/parameters_test.$(DB).yml app/config/parameters_test.yml

View File

@ -19,10 +19,10 @@ Then you can install wallabag by executing the following commands:
```
git clone https://github.com/wallabag/wallabag.git
cd wallabag && make install
cd wallabag && make install
```
Now, [configure a virtual host](https://doc.wallabag.org/en/admin/installation/virtualhosts.html) to use your wallabag.
Now, [configure a virtual host](https://doc.wallabag.org/en/admin/installation/virtualhosts.html) to use your wallabag.
# Run on YunoHost
[![Install Wallabag with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=wallabag2)
@ -30,6 +30,6 @@ Now, [configure a virtual host](https://doc.wallabag.org/en/admin/installation/v
Wallabag app for [YunoHost](https://yunohost.org). See [here](https://github.com/YunoHost-Apps/wallabag2_ynh)
# License
Copyright © 2013-2018 Nicolas Lœuillet <nicolas@loeuillet.org>
Copyright © 2013-current Nicolas Lœuillet <nicolas@loeuillet.org>
This work is free. You can redistribute it and/or modify it under the
terms of the MIT License. See the COPYING file for more details.

View File

@ -22,58 +22,42 @@ During this documentation, we assume the release is `$LAST_WALLABAG_RELEASE` (li
git checkout master
git pull origin master
git checkout -b release-$LAST_WALLABAG_RELEASE
SYMFONY_ENV=prod composer up --no-dev
```
- Update `.travis.yml` file and replace the composer line with this one:
```diff
script:
- - travis_wait bash composer install -o --no-interaction --no-progress --prefer-dist
+ - travis_wait bash composer update -o --no-interaction --no-progress --prefer-dist
composer up
```
- Then continue with these commands:
```
git add --force composer.lock .travis.yml
git add composer.lock
git commit -m "Release wallabag $LAST_WALLABAG_RELEASE"
git push origin release-$LAST_WALLABAG_RELEASE
```
- Create a new pull request with this title `DON'T MERGE Release wallabag $LAST_WALLABAG_RELEASE`. This pull request is used to launch builds on Travis-CI.
- Run these command to create the package:
- Create a new pull request with this title `Release wallabag $LAST_WALLABAG_RELEASE`. This pull request is used to launch builds on Travis-CI.
- Once PR is green, merge it and delete the branch.
- Run this command to create the package:
```
make release VERSION=$LAST_WALLABAG_RELEASE
```
- [Create the new release on GitHub](https://github.com/wallabag/wallabag/releases/new) by targetting the `release-$LAST_WALLABAG_RELEASE` branch. You have to upload the package (generated previously).
- Close the previously created pull request (**DO NOT MERGE IT**) and delete the `release-$LAST_WALLABAG_RELEASE` branch.
- Update the URL shortener (used on `wllbg.org` to generate links like `https://wllbg.org/latest-v2-package` or `http://wllbg.org/latest-v2`)
- [Create the new release on GitHub](https://github.com/wallabag/wallabag/releases/new) by targetting the `master` branch or any appropriate branch (for instance backports). You have to upload the package (generated previously).
- Update the URL shortener (used on `wllbg.org` to update links like `https://wllbg.org/latest-v2-package` or `http://wllbg.org/latest-v2`)
- Update Dockerfile https://github.com/wallabag/docker (and create a new tag)
- Update wallabag.org website (downloads, MD5 sum, releases and new blog post)
- Put the next patch version suffixed with `-dev` in `app/config/wallabag.yml` (`wallabag_core.version`)
- Drink a :beer:!
### `composer.lock`
A release tag must contain a `composer.lock` file. It sets which dependencies were available at the time a release was done,
making it easier to fix issues after the release. It also speeds up `composer install` on stable versions a LOT, by skipping the
dependencies resolution part.
Since `composer.lock` is ignored by default, either it must be removed from `.gitignore` _in the release branch_,
or it must be added using `git add --force composer.lock`.
### Target PHP version
`composer.lock` is _always_ built for a particular version, by default the one it is generated (with `composer update`).
If the PHP version used to generate the .lock isn't a widely available one (like PHP 7), a more common one should
If the PHP version used to generate the .lock isn't a widely available one (like PHP 8), a more common one should
be locally specified in `composer.lock`:
```json
"config": {
"platform": {
"php": "5.5.9",
"php": "7.1.3",
"ext-something": "4.0"
}
}

View File

@ -1,6 +1,7 @@
<?php
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
@ -32,6 +33,9 @@ class AppKernel extends Kernel
new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(),
new FOS\JsRoutingBundle\FOSJsRoutingBundle(),
new BD\GuzzleSiteAuthenticatorBundle\BDGuzzleSiteAuthenticatorBundle(),
new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
new Http\HttplugBundle\HttplugBundle(),
new Sentry\SentryBundle\SentryBundle(),
// wallabag bundles
new Wallabag\CoreBundle\WallabagCoreBundle(),
@ -39,25 +43,32 @@ class AppKernel extends Kernel
new Wallabag\UserBundle\WallabagUserBundle(),
new Wallabag\ImportBundle\WallabagImportBundle(),
new Wallabag\AnnotationBundle\WallabagAnnotationBundle(),
new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
];
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
$bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
if ('test' === $this->getEnvironment()) {
$bundles[] = new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle();
}
if ('dev' === $this->getEnvironment()) {
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
$bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle();
}
}
return $bundles;
}
public function getRootDir()
{
return __DIR__;
}
public function getCacheDir()
{
return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
@ -70,7 +81,8 @@ class AppKernel extends Kernel
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load($this->getProjectDir() . '/app/config/config_' . $this->getEnvironment() . '.yml');
$loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
$loader->load(function ($container) {
if ($container->getParameter('use_webpack_dev_server')) {
$container->loadFromExtension('framework', [
@ -86,5 +98,11 @@ class AppKernel extends Kernel
]);
}
});
$loader->load(function (ContainerBuilder $container) {
// $container->setParameter('container.autowiring.strict_mode', true);
// $container->setParameter('container.dumper.inline_class_loader', true);
$container->addObjectResource($this);
});
}
}

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20160401000000 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->skipIf($schema->hasTable($this->getTable('entry')), 'Database already initialized');
@ -167,9 +164,6 @@ SQL
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql("DROP TABLE {$this->getTable('craue_config_setting')}");

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20160410190541 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -34,9 +31,6 @@ class Version20160410190541 extends WallabagMigration
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20160812120952 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
@ -34,9 +31,6 @@ class Version20160812120952 extends WallabagMigration
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$clientsTable = $schema->getTable($this->getTable('oauth2_clients'));

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20160911214952 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$redis = $this->container
@ -36,9 +33,6 @@ class Version20160911214952 extends WallabagMigration
$this->skipIf(false !== $rabbitmq && false !== $redis, 'It seems that you already played this migration.');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_redis';");

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20160916201049 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$configTable = $schema->getTable($this->getTable('config'));
@ -23,9 +20,6 @@ class Version20160916201049 extends WallabagMigration
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'pocket_consumer_key';");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$configTable = $schema->getTable($this->getTable('config'));

View File

@ -11,9 +11,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161001072726 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
@ -98,9 +95,6 @@ class Version20161001072726 extends WallabagMigration
$this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' ADD CONSTRAINT FK_annotation_entry FOREIGN KEY (entry_id) REFERENCES ' . $this->getTable('entry') . ' (id) ON DELETE CASCADE');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
throw new SkipMigrationException('Too complex ...');

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161022134138 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
@ -41,9 +38,6 @@ class Version20161022134138 extends WallabagMigration
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE `name` `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');

View File

@ -12,9 +12,6 @@ class Version20161024212538 extends WallabagMigration
{
private $constraintName = 'IDX_user_oauth_client';
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
@ -32,9 +29,6 @@ class Version20161024212538 extends WallabagMigration
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$clientsTable = $schema->getTable($this->getTable('oauth2_clients'));

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161031132655 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$images = $this->container
@ -25,9 +22,6 @@ class Version20161031132655 extends WallabagMigration
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('download_images_enabled', 0, 'misc')");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_images_enabled';");

View File

@ -12,9 +12,6 @@ class Version20161104073720 extends WallabagMigration
{
private $indexName = 'IDX_entry_created_at';
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -23,9 +20,6 @@ class Version20161104073720 extends WallabagMigration
$entryTable->addIndex(['created_at'], $this->indexName);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161106113822 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$configTable = $schema->getTable($this->getTable('config'));
@ -25,9 +22,6 @@ class Version20161106113822 extends WallabagMigration
]);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$configTable = $schema->getTable($this->getTable('config'));

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161117071626 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$share = $this->container
@ -36,9 +33,6 @@ class Version20161117071626 extends WallabagMigration
$this->skipIf(false !== $share && false !== $unmark, 'It seems that you already played this migration.');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_unmark';");

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161118134328 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -25,9 +22,6 @@ class Version20161118134328 extends WallabagMigration
]);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161122144743 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$access = $this->container
@ -25,9 +22,6 @@ class Version20161122144743 extends WallabagMigration
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('restricted_access', 0, 'entry')");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'restricted_access';");

View File

@ -18,9 +18,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161122203647 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$userTable = $schema->getTable($this->getTable('user'));
@ -31,9 +28,6 @@ class Version20161122203647 extends WallabagMigration
$userTable->dropColumn('credentials_expired');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$userTable = $schema->getTable($this->getTable('user'));

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161128084725 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$configTable = $schema->getTable($this->getTable('config'));
@ -21,9 +18,6 @@ class Version20161128084725 extends WallabagMigration
$configTable->addColumn('list_mode', 'integer', ['notnull' => false]);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$configTable = $schema->getTable($this->getTable('config'));

View File

@ -16,9 +16,6 @@ class Version20161128131503 extends WallabagMigration
'expires_at' => 'datetime',
];
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$userTable = $schema->getTable($this->getTable('user'));
@ -29,9 +26,6 @@ class Version20161128131503 extends WallabagMigration
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$userTable = $schema->getTable($this->getTable('user'));

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161214094402 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -35,9 +32,6 @@ class Version20161214094402 extends WallabagMigration
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -12,9 +12,6 @@ class Version20161214094403 extends WallabagMigration
{
private $indexName = 'IDX_entry_uid';
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -23,9 +20,6 @@ class Version20161214094403 extends WallabagMigration
$entryTable->addIndex(['uid'], $this->indexName);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -13,9 +13,6 @@ class Version20170127093841 extends WallabagMigration
private $indexStarredName = 'IDX_entry_starred';
private $indexArchivedName = 'IDX_entry_archived';
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -25,9 +22,6 @@ class Version20170127093841 extends WallabagMigration
$entryTable->addIndex(['is_archived'], $this->indexArchivedName);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170327194233 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$scuttle = $this->container
@ -26,9 +23,6 @@ class Version20170327194233 extends WallabagMigration
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('scuttle_url', 'http://scuttle.org', 'entry')");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_scuttle';");

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170405182620 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -30,9 +27,6 @@ class Version20170405182620 extends WallabagMigration
]);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170407200919 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -21,9 +18,6 @@ class Version20170407200919 extends WallabagMigration
$entryTable->dropColumn('is_public');
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -10,17 +10,11 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170420134133 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_pictures';");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$downloadPictures = $this->container

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170501115751 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->skipIf($schema->hasTable($this->getTable('site_credential')), 'It seems that you already played this migration.');
@ -34,9 +31,6 @@ class Version20170501115751 extends WallabagMigration
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$schema->dropTable($this->getTable('site_credential'));

View File

@ -17,9 +17,6 @@ class Version20170510082609 extends WallabagMigration
'email_canonical',
];
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
@ -29,9 +26,6 @@ class Version20170510082609 extends WallabagMigration
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170511115400 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -24,9 +21,6 @@ class Version20170511115400 extends WallabagMigration
]);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -13,19 +13,21 @@ class Version20170511211659 extends WallabagMigration
{
public function up(Schema $schema)
{
$tableName = $this->getTable('annotation');
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$annotationTableName = $this->getTable('annotation', true);
$userTableName = $this->getTable('user', true);
$entryTableName = $this->getTable('entry', true);
$this->addSql(<<<EOD
CREATE TEMPORARY TABLE __temp__wallabag_annotation AS
SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges
FROM ${tableName}
FROM ${annotationTableName}
EOD
);
$this->addSql('DROP TABLE ' . $tableName);
$this->addSql('DROP TABLE ' . $annotationTableName);
$this->addSql(<<<EOD
CREATE TABLE ${tableName}
CREATE TABLE ${annotationTableName}
(
id INTEGER PRIMARY KEY NOT NULL,
user_id INTEGER DEFAULT NULL,
@ -35,16 +37,16 @@ CREATE TABLE ${tableName}
updated_at DATETIME NOT NULL,
quote CLOB NOT NULL,
ranges CLOB NOT NULL,
CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES wallabag_user (id),
CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES wallabag_entry (id) ON DELETE CASCADE
CONSTRAINT FK_A7AED006A76ED395 FOREIGN KEY (user_id) REFERENCES ${userTableName} (id),
CONSTRAINT FK_A7AED006BA364942 FOREIGN KEY (entry_id) REFERENCES ${entryTableName} (id) ON DELETE CASCADE
);
CREATE INDEX IDX_A7AED006A76ED395 ON wallabag_annotation (user_id);
CREATE INDEX IDX_A7AED006BA364942 ON wallabag_annotation (entry_id);
CREATE INDEX IDX_A7AED006A76ED395 ON ${annotationTableName} (user_id);
CREATE INDEX IDX_A7AED006BA364942 ON ${annotationTableName} (entry_id);
EOD
);
$this->addSql(<<<EOD
INSERT INTO ${tableName} (id, user_id, entry_id, text, created_at, updated_at, quote, ranges)
INSERT INTO ${annotationTableName} (id, user_id, entry_id, text, created_at, updated_at, quote, ranges)
SELECT id, user_id, entry_id, text, created_at, updated_at, quote, ranges
FROM __temp__wallabag_annotation;
EOD
@ -52,10 +54,10 @@ EOD
$this->addSql('DROP TABLE __temp__wallabag_annotation');
break;
case 'mysql':
$this->addSql('ALTER TABLE ' . $tableName . ' MODIFY quote TEXT NOT NULL');
$this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' MODIFY quote TEXT NOT NULL');
break;
case 'postgresql':
$this->addSql('ALTER TABLE ' . $tableName . ' ALTER COLUMN quote TYPE TEXT');
$this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' ALTER COLUMN quote TYPE TEXT');
break;
}
}

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170602075214 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$apiUserRegistration = $this->container
@ -25,9 +22,6 @@ class Version20170602075214 extends WallabagMigration
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('api_user_registration', '0', 'api')");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'api_user_registration';");

View File

@ -11,9 +11,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170606155640 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$apiUserRegistration = $this->container
@ -26,9 +23,6 @@ class Version20170606155640 extends WallabagMigration
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('wallabag_url', 'wallabag.me', 'misc')");

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170719231144 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
@ -89,9 +86,6 @@ class Version20170719231144 extends WallabagMigration
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
throw new SkipMigrationException('Too complex ...');

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170824113337 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -37,9 +34,6 @@ class Version20170824113337 extends WallabagMigration
);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20171008195606 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
@ -29,9 +26,6 @@ class Version20171008195606 extends WallabagMigration
}
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20171105202000 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -24,9 +21,6 @@ class Version20171105202000 extends WallabagMigration
]);
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20171120163128 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$storeArticleHeaders = $this->container
@ -25,9 +22,6 @@ class Version20171120163128 extends WallabagMigration
$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';");

View File

@ -10,9 +10,6 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20171125164500 extends WallabagMigration
{
/**
* @param Schema $schema
*/
public function up(Schema $schema)
{
$shaarliShareOriginUrl = $this->container
@ -25,9 +22,6 @@ class Version20171125164500 extends WallabagMigration
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('shaarli_share_origin_url', '0', 'entry')");
}
/**
* @param Schema $schema
*/
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'shaarli_share_origin_url';");

View File

@ -0,0 +1,45 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Add archived_at column and set its value to updated_at for is_archived entries.
*/
class Version20180405182455 extends WallabagMigration
{
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf($entryTable->hasColumn('archived_at'), 'It seems that you already played this migration.');
$entryTable->addColumn('archived_at', 'datetime', [
'notnull' => false,
]);
}
public function postUp(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf(!$entryTable->hasColumn('archived_at'), 'Unable to add archived_at colum');
$this->connection->executeQuery(
'UPDATE ' . $this->getTable('entry') . ' SET archived_at = updated_at WHERE is_archived = :is_archived',
[
'is_archived' => true,
]
);
}
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf(!$entryTable->hasColumn('archived_at'), 'It seems that you already played this migration.');
$entryTable->dropColumn('archived_at');
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Fix varchar field from vendor to work with utf8mb4.
*/
class Version20181128203230 extends WallabagMigration
{
public function up(Schema $schema)
{
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(191)');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(191) NOT NULL');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(191)');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(191)');
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(191)');
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(191)');
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(191)');
}
public function down(Schema $schema)
{
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(255)');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(255) NOT NULL');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(255)');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(255)');
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(255)');
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(255)');
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(255)');
}
}

View File

@ -0,0 +1,76 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Add 2fa OTP stuff.
*/
final class Version20181202073750 extends WallabagMigration
{
public function up(Schema $schema): void
{
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('DROP INDEX UNIQ_1D63E7E5C05FB297');
$this->addSql('DROP INDEX UNIQ_1D63E7E5A0D96FBF');
$this->addSql('DROP INDEX UNIQ_1D63E7E592FC23A8');
$this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('user', true) . ' AS SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication FROM ' . $this->getTable('user', true) . '');
$this->addSql('DROP TABLE ' . $this->getTable('user', true) . '');
$this->addSql('CREATE TABLE ' . $this->getTable('user', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, username VARCHAR(180) NOT NULL COLLATE BINARY, username_canonical VARCHAR(180) NOT NULL COLLATE BINARY, email VARCHAR(180) NOT NULL COLLATE BINARY, email_canonical VARCHAR(180) NOT NULL COLLATE BINARY, enabled BOOLEAN NOT NULL, password VARCHAR(255) NOT NULL COLLATE BINARY, last_login DATETIME DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, name CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, emailTwoFactor BOOLEAN NOT NULL, salt VARCHAR(255) DEFAULT NULL, confirmation_token VARCHAR(180) DEFAULT NULL, roles CLOB NOT NULL --(DC2Type:array)
, googleAuthenticatorSecret VARCHAR(255) DEFAULT NULL, backupCodes CLOB DEFAULT NULL --(DC2Type:json_array)
)');
$this->addSql('INSERT INTO ' . $this->getTable('user', true) . ' (id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, emailTwoFactor) SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication FROM __temp__' . $this->getTable('user', true) . '');
$this->addSql('DROP TABLE __temp__' . $this->getTable('user', true) . '');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON ' . $this->getTable('user', true) . ' (confirmation_token)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON ' . $this->getTable('user', true) . ' (email_canonical)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON ' . $this->getTable('user', true) . ' (username_canonical)');
break;
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL');
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE twoFactorAuthentication emailTwoFactor BOOLEAN NOT NULL');
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP trusted');
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD backupCodes LONGTEXT DEFAULT NULL COMMENT \'(DC2Type:json_array)\'');
break;
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD googleAuthenticatorSecret VARCHAR(191) DEFAULT NULL');
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' RENAME COLUMN twofactorauthentication TO emailTwoFactor');
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP trusted');
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD backupCodes TEXT DEFAULT NULL');
break;
}
}
public function down(Schema $schema): void
{
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('DROP INDEX UNIQ_1D63E7E592FC23A8');
$this->addSql('DROP INDEX UNIQ_1D63E7E5A0D96FBF');
$this->addSql('DROP INDEX UNIQ_1D63E7E5C05FB297');
$this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('user', true) . ' AS SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, emailTwoFactor FROM "' . $this->getTable('user', true) . '"');
$this->addSql('DROP TABLE "' . $this->getTable('user', true) . '"');
$this->addSql('CREATE TABLE "' . $this->getTable('user', true) . '" (id INTEGER PRIMARY KEY AUTOINCREMENT 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, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, password_requested_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, salt VARCHAR(255) NOT NULL COLLATE BINARY, confirmation_token VARCHAR(255) DEFAULT NULL COLLATE BINARY, roles CLOB NOT NULL COLLATE BINARY, trusted CLOB DEFAULT NULL COLLATE BINARY)');
$this->addSql('INSERT INTO "' . $this->getTable('user', true) . '" (id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, twoFactorAuthentication) SELECT id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, emailTwoFactor FROM __temp__' . $this->getTable('user', true) . '');
$this->addSql('DROP TABLE __temp__' . $this->getTable('user', true) . '');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON "' . $this->getTable('user', true) . '" (username_canonical)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON "' . $this->getTable('user', true) . '" (email_canonical)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON "' . $this->getTable('user', true) . '" (confirmation_token)');
break;
case 'mysql':
$this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP googleAuthenticatorSecret');
$this->addSql('ALTER TABLE `' . $this->getTable('user') . '` CHANGE emailtwofactor twoFactorAuthentication BOOLEAN NOT NULL');
$this->addSql('ALTER TABLE `' . $this->getTable('user') . '` ADD trusted TEXT DEFAULT NULL');
$this->addSql('ALTER TABLE `' . $this->getTable('user') . '` DROP backupCodes');
break;
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP googleAuthenticatorSecret');
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' RENAME COLUMN emailTwoFactor TO twofactorauthentication');
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' ADD trusted TEXT DEFAULT NULL');
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' DROP backupCodes');
break;
}
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Add updated_at fields to site_credential table.
*/
final class Version20190117131816 extends WallabagMigration
{
public function up(Schema $schema): void
{
$siteCredentialTable = $schema->getTable($this->getTable('site_credential'));
$this->skipIf($siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.');
$siteCredentialTable->addColumn('updated_at', 'datetime', [
'notnull' => false,
]);
}
public function down(Schema $schema): void
{
$siteCredentialTable = $schema->getTable($this->getTable('site_credential'));
$this->skipIf(!$siteCredentialTable->hasColumn('updated_at'), 'It seems that you already played this migration.');
$siteCredentialTable->dropColumn('updated_at');
}
}

View File

@ -0,0 +1,141 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Add missing entries in craue_config_setting.
*/
final class Version20190129120000 extends WallabagMigration
{
private $settings = [
[
'name' => 'carrot',
'value' => '1',
'section' => 'entry',
],
[
'name' => 'share_diaspora',
'value' => '1',
'section' => 'entry',
],
[
'name' => 'diaspora_url',
'value' => 'http://diasporapod.com',
'section' => 'entry',
],
[
'name' => 'share_shaarli',
'value' => '1',
'section' => 'entry',
],
[
'name' => 'shaarli_url',
'value' => 'http://myshaarli.com',
'section' => 'entry',
],
[
'name' => 'share_mail',
'value' => '1',
'section' => 'entry',
],
[
'name' => 'share_twitter',
'value' => '1',
'section' => 'entry',
],
[
'name' => 'show_printlink',
'value' => '1',
'section' => 'entry',
],
[
'name' => 'export_epub',
'value' => '1',
'section' => 'export',
],
[
'name' => 'export_mobi',
'value' => '1',
'section' => 'export',
],
[
'name' => 'export_pdf',
'value' => '1',
'section' => 'export',
],
[
'name' => 'export_csv',
'value' => '1',
'section' => 'export',
],
[
'name' => 'export_json',
'value' => '1',
'section' => 'export',
],
[
'name' => 'export_txt',
'value' => '1',
'section' => 'export',
],
[
'name' => 'export_xml',
'value' => '1',
'section' => 'export',
],
[
'name' => 'piwik_enabled',
'value' => '0',
'section' => 'analytics',
],
[
'name' => 'piwik_host',
'value' => 'v2.wallabag.org',
'section' => 'analytics',
],
[
'name' => 'piwik_site_id',
'value' => '1',
'section' => 'analytics',
],
[
'name' => 'demo_mode_enabled',
'value' => '0',
'section' => 'misc',
],
[
'name' => 'demo_mode_username',
'value' => 'wallabag',
'section' => 'misc',
],
[
'name' => 'wallabag_support_url',
'value' => 'https://www.wallabag.org/pages/support.html',
'section' => 'misc',
],
];
public function up(Schema $schema)
{
foreach ($this->settings as $setting) {
$settingEnabled = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = '" . $setting['name'] . "'");
if (false !== $settingEnabled) {
continue;
}
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('" . $setting['name'] . "', '" . $setting['value'] . "', '" . $setting['section'] . "');");
}
}
public function down(Schema $schema)
{
$this->skipIf(true, 'These settings are required and should not be removed.');
}
}

View File

@ -0,0 +1,36 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Add hashed_url in entry.
*/
class Version20190401105353 extends WallabagMigration
{
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf($entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.');
$entryTable->addColumn('hashed_url', 'text', [
'length' => 40,
'notnull' => false,
]);
$entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id', [], ['lengths' => [null, 40]]);
}
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf(!$entryTable->hasColumn('hashed_url'), 'It seems that you already played this migration.');
$entryTable->dropIndex('hashed_url_user_id');
$entryTable->dropColumn('hashed_url');
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Rename rss_token & rss_limit to feed_token & feed_limit.
*/
final class Version20190425115043 extends WallabagMigration
{
public function up(Schema $schema): void
{
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('DROP INDEX UNIQ_87E64C53A76ED395');
$this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('config', true) . ' AS SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM ' . $this->getTable('config', true));
$this->addSql('DROP TABLE ' . $this->getTable('config', true));
$this->addSql('CREATE TABLE ' . $this->getTable('config', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL COLLATE BINARY, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL COLLATE BINARY, reading_speed DOUBLE PRECISION DEFAULT NULL, pocket_consumer_key VARCHAR(255) DEFAULT NULL COLLATE BINARY, action_mark_as_read INTEGER DEFAULT 0, list_mode INTEGER DEFAULT NULL, feed_token VARCHAR(255) DEFAULT NULL, feed_limit INTEGER DEFAULT NULL, CONSTRAINT FK_87E64C53A76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('user', true) . '" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO ' . $this->getTable('config', true) . ' (id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode) SELECT id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM __temp__' . $this->getTable('config', true));
$this->addSql('DROP TABLE __temp__' . $this->getTable('config', true));
$this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON ' . $this->getTable('config', true) . ' (user_id)');
break;
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE rss_token feed_token VARCHAR(255) DEFAULT NULL');
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE rss_limit feed_limit INT DEFAULT NULL');
break;
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN rss_token TO feed_token');
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN rss_limit TO feed_limit');
break;
}
}
public function down(Schema $schema): void
{
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('DROP INDEX UNIQ_87E64C53A76ED395');
$this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('config', true) . ' AS SELECT id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM "' . $this->getTable('config', true) . '"');
$this->addSql('DROP TABLE "' . $this->getTable('config', true) . '"');
$this->addSql('CREATE TABLE "' . $this->getTable('config', true) . '" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, theme VARCHAR(255) NOT NULL, items_per_page INTEGER NOT NULL, language VARCHAR(255) NOT NULL, reading_speed DOUBLE PRECISION DEFAULT NULL, pocket_consumer_key VARCHAR(255) DEFAULT NULL, action_mark_as_read INTEGER DEFAULT 0, list_mode INTEGER DEFAULT NULL, rss_token VARCHAR(255) DEFAULT NULL COLLATE BINARY, rss_limit INTEGER DEFAULT NULL)');
$this->addSql('INSERT INTO "' . $this->getTable('config', true) . '" (id, user_id, theme, items_per_page, language, rss_token, rss_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode) SELECT id, user_id, theme, items_per_page, language, feed_token, feed_limit, reading_speed, pocket_consumer_key, action_mark_as_read, list_mode FROM __temp__' . $this->getTable('config', true));
$this->addSql('DROP TABLE __temp__' . $this->getTable('config', true));
$this->addSql('CREATE UNIQUE INDEX UNIQ_87E64C53A76ED395 ON "' . $this->getTable('config', true) . '" (user_id)');
break;
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE feed_token rss_token');
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' CHANGE feed_limit rss_limit');
break;
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN feed_token TO rss_token');
$this->addSql('ALTER TABLE ' . $this->getTable('config') . ' RENAME COLUMN feed_limit TO rss_limit');
break;
}
}
}

View File

@ -0,0 +1,96 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\SkipMigrationException;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Enable cascade delete when deleting a user on:
* - oauth2_access_tokens
* - oauth2_clients
* - oauth2_refresh_tokens
* - oauth2_auth_codes.
*/
final class Version20190510141130 extends WallabagMigration
{
public function up(Schema $schema): void
{
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('DROP INDEX IDX_368A4209A76ED395');
$this->addSql('DROP INDEX IDX_368A420919EB6921');
$this->addSql('DROP INDEX UNIQ_368A42095F37A13B');
$this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_access_tokens', true) . ' AS SELECT id, client_id, user_id, token, expires_at, scope FROM ' . $this->getTable('oauth2_access_tokens', true));
$this->addSql('DROP TABLE ' . $this->getTable('oauth2_access_tokens', true));
$this->addSql('CREATE TABLE ' . $this->getTable('oauth2_access_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NULL, CONSTRAINT FK_368A420919EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('oauth2_clients', true) . '" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO ' . $this->getTable('oauth2_access_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_access_tokens', true));
$this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_access_tokens', true));
$this->addSql('CREATE INDEX IDX_368A4209A76ED395 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (user_id)');
$this->addSql('CREATE INDEX IDX_368A420919EB6921 ON ' . $this->getTable('oauth2_access_tokens', true) . ' (client_id)');
$this->addSql('DROP INDEX IDX_635D765EA76ED395');
$this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_clients', true) . ' AS SELECT id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name FROM ' . $this->getTable('oauth2_clients', true));
$this->addSql('DROP TABLE ' . $this->getTable('oauth2_clients', true));
$this->addSql('CREATE TABLE ' . $this->getTable('oauth2_clients', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, random_id VARCHAR(255) NOT NULL COLLATE BINARY, secret VARCHAR(255) NOT NULL COLLATE BINARY, name CLOB NOT NULL COLLATE BINARY, redirect_uris CLOB NOT NULL, allowed_grant_types CLOB NOT NULL, CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('oauth2_clients', true) . '" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO ' . $this->getTable('oauth2_clients', true) . ' (id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name) SELECT id, user_id, random_id, secret, redirect_uris, allowed_grant_types, name FROM __temp__' . $this->getTable('oauth2_clients', true));
$this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_clients', true));
$this->addSql('CREATE INDEX IDX_635D765EA76ED395 ON ' . $this->getTable('oauth2_clients', true) . ' (user_id)');
$this->addSql('DROP INDEX IDX_20C9FB24A76ED395');
$this->addSql('DROP INDEX IDX_20C9FB2419EB6921');
$this->addSql('DROP INDEX UNIQ_20C9FB245F37A13B');
$this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true) . ' AS SELECT id, client_id, user_id, token, expires_at, scope FROM ' . $this->getTable('oauth2_refresh_tokens', true));
$this->addSql('DROP TABLE ' . $this->getTable('oauth2_refresh_tokens', true));
$this->addSql('CREATE TABLE ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NULL, CONSTRAINT FK_20C9FB2419EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('oauth2_clients', true) . '" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO ' . $this->getTable('oauth2_refresh_tokens', true) . ' (id, client_id, user_id, token, expires_at, scope) SELECT id, client_id, user_id, token, expires_at, scope FROM __temp__' . $this->getTable('oauth2_refresh_tokens', true));
$this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_refresh_tokens', true));
$this->addSql('CREATE INDEX IDX_20C9FB24A76ED395 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (user_id)');
$this->addSql('CREATE INDEX IDX_20C9FB2419EB6921 ON ' . $this->getTable('oauth2_refresh_tokens', true) . ' (client_id)');
$this->addSql('DROP INDEX IDX_EE52E3FAA76ED395');
$this->addSql('DROP INDEX IDX_EE52E3FA19EB6921');
$this->addSql('DROP INDEX UNIQ_EE52E3FA5F37A13B');
$this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('oauth2_auth_codes', true) . ' AS SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM ' . $this->getTable('oauth2_auth_codes', true));
$this->addSql('DROP TABLE ' . $this->getTable('oauth2_auth_codes', true));
$this->addSql('CREATE TABLE ' . $this->getTable('oauth2_auth_codes', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, client_id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, redirect_uri CLOB NOT NULL COLLATE BINARY, expires_at INTEGER DEFAULT NULL, token VARCHAR(191) NOT NULL, scope VARCHAR(191) NULL, CONSTRAINT FK_EE52E3FA19EB6921 FOREIGN KEY (client_id) REFERENCES ' . $this->getTable('oauth2_clients', true) . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('oauth2_clients', true) . '" (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO ' . $this->getTable('oauth2_auth_codes', true) . ' (id, client_id, user_id, token, redirect_uri, expires_at, scope) SELECT id, client_id, user_id, token, redirect_uri, expires_at, scope FROM __temp__' . $this->getTable('oauth2_auth_codes', true));
$this->addSql('DROP TABLE __temp__' . $this->getTable('oauth2_auth_codes', true));
$this->addSql('CREATE INDEX IDX_EE52E3FAA76ED395 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (user_id)');
$this->addSql('CREATE INDEX IDX_EE52E3FA19EB6921 ON ' . $this->getTable('oauth2_auth_codes', true) . ' (client_id)');
break;
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' DROP FOREIGN KEY FK_368A4209A76ED395');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' DROP FOREIGN KEY IDX_user_oauth_client');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id)');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' DROP FOREIGN KEY FK_20C9FB24A76ED395');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' DROP FOREIGN KEY FK_EE52E3FAA76ED395');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) ON DELETE CASCADE');
break;
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' DROP CONSTRAINT FK_368A4209A76ED395');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' ADD CONSTRAINT FK_368A4209A76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' DROP CONSTRAINT idx_user_oauth_client');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_clients') . ' ADD CONSTRAINT FK_635D765EA76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' DROP CONSTRAINT FK_20C9FB24A76ED395');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' ADD CONSTRAINT FK_20C9FB24A76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' DROP CONSTRAINT FK_EE52E3FAA76ED395');
$this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' ADD CONSTRAINT FK_EE52E3FAA76ED395 FOREIGN KEY (user_id) REFERENCES ' . $this->getTable('user') . ' (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
break;
}
}
public function down(Schema $schema): void
{
throw new SkipMigrationException('Too complex ...');
}
}

View File

@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Convert tab label to utf8mb4_bin (MySQL only).
*/
final class Version20190511165128 extends WallabagMigration
{
public function up(Schema $schema): void
{
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
$this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `label` `label` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;');
$this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `slug` `slug` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;');
}
public function down(Schema $schema): void
{
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
$this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `slug` `slug` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
$this->addSql('ALTER TABLE ' . $this->getTable('tag') . ' CHANGE `label` `label` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
}
}

View File

@ -0,0 +1,48 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Added `given_url` & `hashed_given_url` field in entry table.
*/
class Version20190601125843 extends WallabagMigration
{
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
if (!$entryTable->hasColumn('given_url')) {
$entryTable->addColumn('given_url', 'text', [
'notnull' => false,
]);
}
if (!$entryTable->hasColumn('hashed_given_url')) {
$entryTable->addColumn('hashed_given_url', 'text', [
'length' => 40,
'notnull' => false,
]);
}
// 40 = length of sha1 field hashed_given_url
$entryTable->addIndex(['user_id', 'hashed_given_url'], 'hashed_given_url_user_id', [], ['lengths' => [null, 40]]);
}
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
if ($entryTable->hasColumn('given_url')) {
$entryTable->dropColumn('given_url');
}
if ($entryTable->hasColumn('hashed_given_url')) {
$entryTable->dropColumn('hashed_given_url');
}
$entryTable->dropIndex('hashed_given_url_user_id');
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Change reading_time field on SQLite to be integer NOT NULL
* It was forgotten in a previous migration (Version20171008195606.php).
*/
final class Version20190619093534 extends WallabagMigration
{
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->skipIf('sqlite' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'sqlite\'.');
$this->addSql('UPDATE ' . $this->getTable('entry', true) . ' SET reading_time = 0 WHERE reading_time IS NULL;');
$this->addSql('DROP INDEX hashed_given_url_user_id');
$this->addSql('DROP INDEX IDX_entry_uid');
$this->addSql('DROP INDEX IDX_F4D18282A76ED395');
$this->addSql('DROP INDEX IDX_entry_created_at');
$this->addSql('DROP INDEX IDX_entry_starred');
$this->addSql('DROP INDEX IDX_entry_archived');
$this->addSql('DROP INDEX hashed_url_user_id');
$this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('entry', true) . ' AS SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, uid, http_status, published_at, published_by, headers, starred_at, origin_url, archived_at, hashed_url, given_url, hashed_given_url FROM ' . $this->getTable('entry', true) . '');
$this->addSql('DROP TABLE ' . $this->getTable('entry', true) . '');
$this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, title CLOB DEFAULT NULL COLLATE BINARY, url CLOB DEFAULT NULL COLLATE BINARY, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL COLLATE BINARY, language CLOB DEFAULT NULL COLLATE BINARY, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, published_at DATETIME DEFAULT NULL, starred_at DATETIME DEFAULT NULL, origin_url CLOB DEFAULT NULL COLLATE BINARY, archived_at DATETIME DEFAULT NULL, given_url CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER NOT NULL, published_by CLOB DEFAULT NULL --(DC2Type:array)
, headers CLOB DEFAULT NULL --(DC2Type:array)
, hashed_url VARCHAR(40) DEFAULT NULL, hashed_given_url VARCHAR(40) DEFAULT NULL, CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "' . $this->getTable('user', true) . '" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO ' . $this->getTable('entry', true) . ' (id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, uid, http_status, published_at, published_by, headers, starred_at, origin_url, archived_at, hashed_url, given_url, hashed_given_url) SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, uid, http_status, published_at, published_by, headers, starred_at, origin_url, archived_at, hashed_url, given_url, hashed_given_url FROM __temp__' . $this->getTable('entry', true) . '');
$this->addSql('DROP TABLE __temp__' . $this->getTable('entry', true) . '');
$this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)');
$this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)');
$this->addSql('CREATE INDEX hashed_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_url)');
$this->addSql('CREATE INDEX created_at ON ' . $this->getTable('entry', true) . ' (created_at)');
$this->addSql('CREATE INDEX uid ON ' . $this->getTable('entry', true) . ' (uid)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->skipIf('sqlite' !== $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'sqlite\'.');
$this->addSql('DROP INDEX IDX_F4D18282A76ED395');
$this->addSql('DROP INDEX created_at');
$this->addSql('DROP INDEX uid');
$this->addSql('DROP INDEX hashed_url_user_id');
$this->addSql('DROP INDEX hashed_given_url_user_id');
$this->addSql('CREATE TEMPORARY TABLE __temp__' . $this->getTable('entry', true) . ' AS SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM "' . $this->getTable('entry', true) . '"');
$this->addSql('DROP TABLE "' . $this->getTable('entry', true) . '"');
$this->addSql('CREATE TABLE "' . $this->getTable('entry', true) . '" (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL, title CLOB DEFAULT NULL, url CLOB DEFAULT NULL, origin_url CLOB DEFAULT NULL, given_url CLOB DEFAULT NULL, is_archived BOOLEAN NOT NULL, archived_at DATETIME DEFAULT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, published_at DATETIME DEFAULT NULL, starred_at DATETIME DEFAULT NULL, mimetype CLOB DEFAULT NULL, language CLOB DEFAULT NULL, domain_name CLOB DEFAULT NULL, preview_picture CLOB DEFAULT NULL, http_status VARCHAR(3) DEFAULT NULL, hashed_url CLOB DEFAULT NULL COLLATE BINARY, hashed_given_url CLOB DEFAULT NULL COLLATE BINARY, published_by CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER DEFAULT NULL, headers CLOB DEFAULT NULL COLLATE BINARY)');
$this->addSql('INSERT INTO "' . $this->getTable('entry', true) . '" (id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers) SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM __temp__' . $this->getTable('entry', true) . '');
$this->addSql('DROP TABLE __temp__' . $this->getTable('entry', true) . '');
$this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON "' . $this->getTable('entry', true) . '" (user_id)');
$this->addSql('CREATE INDEX hashed_url_user_id ON "' . $this->getTable('entry', true) . '" (user_id, hashed_url)');
$this->addSql('CREATE INDEX hashed_given_url_user_id ON "' . $this->getTable('entry', true) . '" (user_id, hashed_given_url)');
$this->addSql('CREATE INDEX IDX_entry_starred ON "' . $this->getTable('entry', true) . '" (is_starred)');
$this->addSql('CREATE INDEX IDX_entry_archived ON "' . $this->getTable('entry', true) . '" (is_archived)');
$this->addSql('CREATE INDEX IDX_entry_uid ON "' . $this->getTable('entry', true) . '" (uid)');
$this->addSql('CREATE INDEX IDX_entry_created_at ON "' . $this->getTable('entry', true) . '" (created_at)');
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Change reading speed value.
*/
final class Version20190708122957 extends WallabagMigration
{
public function up(Schema $schema): void
{
$this->addSql('UPDATE ' . $this->getTable('config', true) . ' SET reading_speed = reading_speed*200');
}
public function down(Schema $schema): void
{
$this->addSql('UPDATE ' . $this->getTable('config', true) . ' SET reading_speed = reading_speed/200');
}
}

View File

@ -0,0 +1,116 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Adding more index to kill some slow queries:
* - user_language
* - user_archived
* - user_created
* - user_starred
* - tag_label
* - config_feed_token.
*/
final class Version20190806130304 extends WallabagMigration
{
public function up(Schema $schema): void
{
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('DROP INDEX uid');
$this->addSql('DROP INDEX created_at');
$this->addSql('DROP INDEX hashed_url_user_id');
$this->addSql('DROP INDEX IDX_F4D18282A76ED395');
$this->addSql('DROP INDEX hashed_given_url_user_id');
$this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, domain_name, preview_picture, uid, http_status, published_at, starred_at, origin_url, archived_at, given_url, reading_time, published_by, headers, hashed_url, hashed_given_url FROM ' . $this->getTable('entry', true));
$this->addSql('DROP TABLE ' . $this->getTable('entry', true));
$this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, title CLOB DEFAULT NULL COLLATE BINARY, url CLOB DEFAULT NULL COLLATE BINARY, is_archived BOOLEAN NOT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL COLLATE BINARY, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype CLOB DEFAULT NULL COLLATE BINARY, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, uid VARCHAR(23) DEFAULT NULL COLLATE BINARY, http_status VARCHAR(3) DEFAULT NULL COLLATE BINARY, published_at DATETIME DEFAULT NULL, starred_at DATETIME DEFAULT NULL, origin_url CLOB DEFAULT NULL COLLATE BINARY, archived_at DATETIME DEFAULT NULL, given_url CLOB DEFAULT NULL COLLATE BINARY, reading_time INTEGER NOT NULL, published_by CLOB DEFAULT NULL COLLATE BINARY --(DC2Type:array)
, headers CLOB DEFAULT NULL COLLATE BINARY --(DC2Type:array)
, hashed_url VARCHAR(40) DEFAULT NULL COLLATE BINARY, hashed_given_url VARCHAR(40) DEFAULT NULL COLLATE BINARY, language VARCHAR(20) DEFAULT NULL, CONSTRAINT FK_F4D18282A76ED395 FOREIGN KEY (user_id) REFERENCES "wallabag_user" (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO ' . $this->getTable('entry', true) . ' (id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, domain_name, preview_picture, uid, http_status, published_at, starred_at, origin_url, archived_at, given_url, reading_time, published_by, headers, hashed_url, hashed_given_url) SELECT id, user_id, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, domain_name, preview_picture, uid, http_status, published_at, starred_at, origin_url, archived_at, given_url, reading_time, published_by, headers, hashed_url, hashed_given_url FROM __temp__wallabag_entry');
$this->addSql('DROP TABLE __temp__wallabag_entry');
$this->addSql('CREATE INDEX uid ON ' . $this->getTable('entry', true) . ' (uid)');
$this->addSql('CREATE INDEX created_at ON ' . $this->getTable('entry', true) . ' (created_at)');
$this->addSql('CREATE INDEX hashed_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_url)');
$this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)');
$this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)');
$this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry', true) . ' (language, user_id)');
$this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry', true) . ' (user_id, is_archived, archived_at)');
$this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry', true) . ' (user_id, created_at)');
$this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry', true) . ' (user_id, is_starred, starred_at)');
$this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag', true) . ' (label)');
$this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config', true) . ' (feed_token)');
break;
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language VARCHAR(20) DEFAULT NULL');
$this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)');
$this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)');
$this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)');
$this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)');
$this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag') . ' (label (255))');
$this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config') . ' (feed_token (255))');
break;
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE VARCHAR(20)');
$this->addSql('CREATE INDEX user_language ON ' . $this->getTable('entry') . ' (language, user_id)');
$this->addSql('CREATE INDEX user_archived ON ' . $this->getTable('entry') . ' (user_id, is_archived, archived_at)');
$this->addSql('CREATE INDEX user_created ON ' . $this->getTable('entry') . ' (user_id, created_at)');
$this->addSql('CREATE INDEX user_starred ON ' . $this->getTable('entry') . ' (user_id, is_starred, starred_at)');
$this->addSql('CREATE INDEX tag_label ON ' . $this->getTable('tag') . ' (label)');
$this->addSql('CREATE INDEX config_feed_token ON ' . $this->getTable('config') . ' (feed_token)');
break;
}
}
public function down(Schema $schema): void
{
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('DROP INDEX IDX_F4D18282A76ED395');
$this->addSql('DROP INDEX created_at');
$this->addSql('DROP INDEX uid');
$this->addSql('DROP INDEX hashed_url_user_id');
$this->addSql('DROP INDEX hashed_given_url_user_id');
$this->addSql('DROP INDEX user_language');
$this->addSql('DROP INDEX user_archived');
$this->addSql('DROP INDEX user_created');
$this->addSql('DROP INDEX user_starred');
$this->addSql('DROP INDEX tag_label');
$this->addSql('DROP INDEX config_feed_token');
$this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM ' . $this->getTable('entry', true));
$this->addSql('DROP TABLE ' . $this->getTable('entry', true));
$this->addSql('CREATE TABLE ' . $this->getTable('entry', true) . ' (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, user_id INTEGER DEFAULT NULL, uid VARCHAR(23) DEFAULT NULL, title CLOB DEFAULT NULL, url CLOB DEFAULT NULL, hashed_url VARCHAR(40) DEFAULT NULL, origin_url CLOB DEFAULT NULL, given_url CLOB DEFAULT NULL, hashed_given_url VARCHAR(40) DEFAULT NULL, is_archived BOOLEAN NOT NULL, archived_at DATETIME DEFAULT NULL, is_starred BOOLEAN NOT NULL, content CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, published_at DATETIME DEFAULT NULL, published_by CLOB DEFAULT NULL --(DC2Type:array)
, starred_at DATETIME DEFAULT NULL, mimetype CLOB DEFAULT NULL, reading_time INTEGER NOT NULL, domain_name CLOB DEFAULT NULL, preview_picture CLOB DEFAULT NULL, http_status VARCHAR(3) DEFAULT NULL, headers CLOB DEFAULT NULL --(DC2Type:array)
, language CLOB DEFAULT NULL COLLATE BINARY)');
$this->addSql('INSERT INTO ' . $this->getTable('entry', true) . ' (id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers) SELECT id, user_id, uid, title, url, hashed_url, origin_url, given_url, hashed_given_url, is_archived, archived_at, is_starred, content, created_at, updated_at, published_at, published_by, starred_at, mimetype, language, reading_time, domain_name, preview_picture, http_status, headers FROM __temp__wallabag_entry');
$this->addSql('DROP TABLE __temp__wallabag_entry');
$this->addSql('CREATE INDEX IDX_F4D18282A76ED395 ON ' . $this->getTable('entry', true) . ' (user_id)');
$this->addSql('CREATE INDEX created_at ON ' . $this->getTable('entry', true) . ' (created_at)');
$this->addSql('CREATE INDEX uid ON ' . $this->getTable('entry', true) . ' (uid)');
$this->addSql('CREATE INDEX hashed_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_url)');
$this->addSql('CREATE INDEX hashed_given_url_user_id ON ' . $this->getTable('entry', true) . ' (user_id, hashed_given_url)');
break;
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' MODIFY language LONGTEXT DEFAULT NULL');
$this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry'));
$this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry'));
$this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry'));
$this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry'));
$this->addSql('DROP INDEX tag_label ON ' . $this->getTable('tag'));
$this->addSql('DROP INDEX config_feed_token ON ' . $this->getTable('config'));
break;
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER language TYPE TEXT');
$this->addSql('DROP INDEX user_language ON ' . $this->getTable('entry'));
$this->addSql('DROP INDEX user_archived ON ' . $this->getTable('entry'));
$this->addSql('DROP INDEX user_created ON ' . $this->getTable('entry'));
$this->addSql('DROP INDEX user_starred ON ' . $this->getTable('entry'));
$this->addSql('DROP INDEX tag_label ON ' . $this->getTable('tag'));
$this->addSql('DROP INDEX config_feed_token ON ' . $this->getTable('config'));
break;
}
}
}

View File

@ -0,0 +1,42 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Change the internal setting table name.
*/
final class Version20190808124957 extends WallabagMigration
{
public function up(Schema $schema): void
{
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting', true) . ' RENAME TO ' . $this->getTable('internal_setting', true));
break;
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' RENAME ' . $this->getTable('internal_setting'));
break;
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' RENAME TO ' . $this->getTable('internal_setting'));
break;
}
}
public function down(Schema $schema): void
{
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('ALTER TABLE ' . $this->getTable('internal_setting', true) . ' RENAME TO ' . $this->getTable('craue_config_setting', true));
break;
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' RENAME ' . $this->getTable('craue_config_setting'));
break;
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' RENAME TO ' . $this->getTable('craue_config_setting'));
break;
}
}
}

View File

@ -4,6 +4,9 @@ import $ from 'jquery';
/* Annotations */
import annotator from 'annotator';
import ClipboardJS from 'clipboard';
import 'mathjax/es5/tex-svg';
/* Fonts */
import 'material-design-icons-iconfont/dist/material-design-icons.css';
import 'lato-font/css/lato-font.css';
@ -70,4 +73,47 @@ $(document).ready(() => {
retrievePercent(x.entryId, true);
});
}
document.querySelectorAll('[data-handler=tag-rename]').forEach((item) => {
const current = item;
current.wallabag_edit_mode = false;
current.onclick = (event) => {
const target = event.currentTarget;
if (target.wallabag_edit_mode === false) {
$(target.parentNode.querySelector('[data-handle=tag-link]')).addClass('hidden');
$(target.parentNode.querySelector('[data-handle=tag-rename-form]')).removeClass('hidden');
target.parentNode.querySelector('[data-handle=tag-rename-form] input').focus();
target.querySelector('.material-icons').innerHTML = 'done';
target.wallabag_edit_mode = true;
} else {
target.parentNode.querySelector('[data-handle=tag-rename-form]').submit();
}
};
});
// mimic radio button because emailTwoFactor is a boolean
$('#update_user_googleTwoFactor').on('change', () => {
$('#update_user_emailTwoFactor').prop('checked', false);
});
$('#update_user_emailTwoFactor').on('change', () => {
$('#update_user_googleTwoFactor').prop('checked', false);
});
// same mimic for super admin
$('#user_googleTwoFactor').on('change', () => {
$('#user_emailTwoFactor').prop('checked', false);
});
$('#user_emailTwoFactor').on('change', () => {
$('#user_googleTwoFactor').prop('checked', false);
});
// handle copy to clipboard for developer stuff
const clipboard = new ClipboardJS('.btn');
clipboard.on('success', (e) => {
e.clearSelection();
});
});

View File

@ -85,7 +85,7 @@ blockquote {
color: #999;
}
.icon-rss {
.icon-feed {
background-color: #000;
color: #fff;
padding: 0.2em 0.5em;
@ -101,8 +101,8 @@ blockquote {
margin-bottom: 0.5em;
}
.icon-rss:hover,
.icon-rss:focus {
.icon-feed:hover,
.icon-feed:focus {
background-color: #fff;
color: #000;
text-decoration: none;

View File

@ -295,6 +295,15 @@ div.pagination ul {
}
}
.hide {
.card-tag-form {
display: inline-block;
}
.card-tag-form input[type="text"] {
min-width: 20em;
}
.hide,
.hidden {
display: none;
}

View File

@ -170,3 +170,9 @@
width: 100%;
}
}
@media only print {
header h1.logo {
display: none;
}
}

View File

@ -136,7 +136,7 @@
content: "\ea3a";
}
.icon-rss::before {
.icon-feed::before {
content: "\e808";
}

View File

@ -5,6 +5,7 @@
#article {
font-size: 20px;
margin: 0 auto;
padding-bottom: 80px;
max-width: 45em;
article {
@ -172,18 +173,18 @@
&:hover {
width: 260px !important;
.collapsible-body {
height: auto;
li a i.material-icons {
margin: auto 5px auto -8px;
}
}
span {
opacity: 1;
}
}
.collapsible-body {
height: auto;
li a i.material-icons {
margin: auto 5px auto -8px;
}
}
}
.progress {

View File

@ -18,6 +18,24 @@ main {
overflow: hidden;
}
@mixin mixin-reading-time {
.reading-time {
display: inline-flex;
vertical-align: middle;
.card-reading-time,
.card-created-at {
display: inline-flex;
}
span {
margin-right: 5px;
}
@content;
}
}
.card {
.card-content .card-title,
.card-reveal .card-title {
@ -98,14 +116,7 @@ main {
margin-right: 5px !important;
}
.reading-time {
display: inline-flex;
vertical-align: middle;
span {
margin-right: 5px;
}
}
@include mixin-reading-time;
}
.card-image {
@ -186,6 +197,17 @@ a.original:not(.waves-effect) {
flex-grow: 1;
}
.card-tag-form {
display: flex;
min-width: 100px;
flex-grow: 1;
}
.card-tag-form input {
margin-bottom: 0;
height: 2rem;
}
.card-tag-rss {
display: flex;
}
@ -219,10 +241,18 @@ a.original:not(.waves-effect) {
}
div.metadata {
overflow: hidden;
height: 1.5em;
display: flex;
ul.tags {
margin-left: 4px;
}
.chip {
background-color: $blueAccentColor;
padding: 0 7px;
margin: auto 2px;
margin: auto 1px;
border-radius: 6px;
line-height: 22px;
height: 22px;
@ -239,6 +269,16 @@ a.original:not(.waves-effect) {
padding-left: 8px;
}
}
@include mixin-reading-time {
padding: 0 5px;
flex-wrap: wrap;
margin-left: auto;
i.material-icons {
font-size: 20px;
}
}
}
div.card-content {
@ -272,9 +312,3 @@ a.original:not(.waves-effect) {
.settings .div_tabs {
padding-bottom: 15px;
}
@media only screen and (min-width: 992px) {
.card-tag-labels li {
max-width: 50%;
}
}

View File

@ -12,6 +12,16 @@
.pagination {
margin-left: auto;
}
.card-tag-labels li {
max-width: 50%;
}
}
@media screen and (min-width: 993px) {
body.entry main #content {
padding-left: 70px;
}
}
@media only screen and (max-width: 992px) {
@ -163,4 +173,23 @@
.row .col {
padding: 0;
}
.card-stacked div.metadata .reading-time {
display: none;
}
}
@media screen and (max-width: 310px),
screen and (min-width: 601px) and (max-width: 660px),
screen and (min-width: 993px) and (max-width: 1050px),
screen and (min-width: 1201px) and (max-width: 1250px) {
.card .card-action .reading-time .card-created-at {
display: none;
}
}
@media only print {
body {
display: block;
}
}

View File

@ -131,6 +131,11 @@ nav {
display: none;
}
.entry-nav-top--sticky {
position: sticky;
top: 0;
}
@media (min-width: 993px) {
.button-collapse {
display: none;

View File

@ -8,7 +8,7 @@ import 'materialize-css/dist/js/materialize';
import '../_global/index';
/* Tools */
import { initExport, initFilters } from './js/tools';
import { initExport, initFilters, initRandom } from './js/tools';
/* Import shortcuts */
import './js/shortcuts/main';
@ -17,6 +17,36 @@ import './js/shortcuts/entry';
/* Theme style */
import './css/index.scss';
const stickyNav = () => {
const nav = $('.js-entry-nav-top');
$('[data-toggle="actions"]').click(() => {
nav.toggleClass('entry-nav-top--sticky');
});
};
const articleScroll = () => {
const articleEl = $('#article');
if (articleEl.length > 0) {
$(window).scroll(() => {
const s = $(window).scrollTop();
const d = $(document).height();
const c = $(window).height();
const articleElBottom = articleEl.offset().top + articleEl.height();
const scrollPercent = (s / (d - c)) * 100;
$('.progress .determinate').css('width', `${scrollPercent}%`);
const fixedActionBtn = $('.js-fixed-action-btn');
const toggleScrollDataName = 'toggle-auto';
if ((s + c) > articleElBottom) {
fixedActionBtn.data(toggleScrollDataName, true);
fixedActionBtn.openFAB();
} else if (fixedActionBtn.data(toggleScrollDataName) === true) {
fixedActionBtn.data(toggleScrollDataName, false);
fixedActionBtn.closeFAB();
}
});
}
};
$(document).ready(() => {
// sideNav
$('.button-collapse').sideNav();
@ -32,8 +62,12 @@ $(document).ready(() => {
format: 'dd/mm/yyyy',
container: 'body',
});
initFilters();
initExport();
initRandom();
stickyNav();
articleScroll();
const toggleNav = (toShow, toFocus) => {
$('.nav-panel-actions').hide(100);
@ -48,30 +82,27 @@ $(document).ready(() => {
$('#tag_label').focus();
return false;
});
$('#nav-btn-add').on('click', () => {
toggleNav('.nav-panel-add', '#entry_url');
return false;
});
const materialAddForm = $('.nav-panel-add');
materialAddForm.on('submit', () => {
materialAddForm.addClass('disabled');
$('input#entry_url', materialAddForm).prop('readonly', true).trigger('blur');
});
$('#nav-btn-search').on('click', () => {
toggleNav('.nav-panel-search', '#search_entry_term');
return false;
});
$('.close').on('click', (e) => {
$(e.target).parent('.nav-panel-item').hide(100);
$('.nav-panel-actions').show(100);
$('.nav-panels').css('background', 'transparent');
return false;
});
$(window).scroll(() => {
const s = $(window).scrollTop();
const d = $(document).height();
const c = $(window).height();
const scrollPercent = (s / (d - c)) * 100;
$('.progress .determinate').css('width', `${scrollPercent}%`);
});
});

View File

@ -8,6 +8,7 @@ function initFilters() {
$('#clear_form_filters').on('click', () => {
$('#filters input').val('');
$('#filters :checked').removeAttr('checked');
return false;
});
}
@ -21,4 +22,15 @@ function initExport() {
}
}
export { initExport, initFilters };
function initRandom() {
// no display if export (ie: entries) not available
if ($('div').is('#export')) {
$('#button_random').show();
}
}
export {
initExport,
initFilters,
initRandom,
};

View File

@ -1,13 +0,0 @@
<?php
use Composer\Autoload\ClassLoader;
use Doctrine\Common\Annotations\AnnotationRegistry;
/**
* @var ClassLoader
*/
$loader = require __DIR__ . '/../vendor/autoload.php';
AnnotationRegistry::registerLoader([$loader, 'loadClass']);
return $loader;

View File

@ -46,7 +46,6 @@ twig:
doctrine:
dbal:
driver: "%database_driver%"
driver_class: "%database_driver_class%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
@ -55,7 +54,6 @@ doctrine:
charset: "%database_charset%"
path: "%database_path%"
unix_socket: "%database_socket%"
server_version: 5.6
orm:
auto_generate_proxy_classes: "%kernel.debug%"
@ -79,10 +77,13 @@ doctrine_migrations:
# Swiftmailer Configuration
swiftmailer:
transport: "%mailer_transport%"
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
transport: "%mailer_transport%"
username: "%mailer_user%"
password: "%mailer_password%"
host: "%mailer_host%"
port: "%mailer_port%"
encryption: "%mailer_encryption%"
auth_mode: "%mailer_auth_mode%"
spool:
type: memory
@ -147,18 +148,18 @@ nelmio_cors:
paths:
'^/api/':
allow_origin: ['*']
allow_headers: ['X-Custom-Auth']
allow_headers: ['Authorization','content-type']
allow_methods: ['POST', 'PUT', 'PATCH','GET', 'DELETE']
max_age: 3600
'^/oauth/':
allow_origin: ['*']
allow_headers: ['X-Custom-Auth']
allow_headers: ['Authorization','content-type']
allow_methods: ['POST', 'PUT', 'GET', 'DELETE']
max_age: 3600
'^/':
#origin_regex: true
allow_origin: ['^http://localhost:[0-9]+']
allow_headers: ['X-Custom-Auth']
allow_origin: ['*']
allow_headers: ['Authorization','content-type']
allow_methods: ['POST', 'PUT', 'GET', 'DELETE']
max_age: 3600
hosts: ['^api\.']
@ -197,10 +198,17 @@ fos_oauth_server:
refresh_token_lifetime: 1209600
scheb_two_factor:
trusted_computer:
trusted_device:
enabled: true
cookie_name: wllbg_trusted_computer
cookie_lifetime: 2592000
lifetime: 2592000
backup_codes:
enabled: "%twofactor_auth%"
google:
enabled: "%twofactor_auth%"
template: WallabagUserBundle:Authentication:form.html.twig
email:
enabled: "%twofactor_auth%"
@ -253,6 +261,11 @@ old_sound_rabbit_mq:
exchange_options:
name: 'wallabag.import.wallabag_v2'
type: topic
import_elcurator:
connection: default
exchange_options:
name: 'wallabag.import.elcurator'
type: topic
import_firefox:
connection: default
exchange_options:
@ -318,6 +331,15 @@ old_sound_rabbit_mq:
name: 'wallabag.import.wallabag_v2'
callback: wallabag_import.consumer.amqp.wallabag_v2
qos_options: {prefetch_count: "%rabbitmq_prefetch_count%"}
import_elcurator:
connection: default
exchange_options:
name: 'wallabag.import.elcurator'
type: topic
queue_options:
name: 'wallabag.import.elcurator'
callback: wallabag_import.consumer.amqp.elcurator
qos_options: {prefetch_count: "%rabbitmq_prefetch_count%"}
import_firefox:
connection: default
exchange_options:
@ -357,3 +379,34 @@ jms_serializer:
# see: https://github.com/schmittjoh/JMSSerializerBundle/pull/494
datetime:
default_format: "Y-m-d\\TH:i:sO" # ATOM
# see https://github.com/symfony/symfony-standard/pull/1133
sensio_framework_extra:
router:
annotations: false
httplug:
clients:
wallabag_core:
factory: 'wallabag_core.http_client_factory'
config:
defaults:
timeout: 10
plugins: ['httplug.plugin.logger']
wallabag_core.entry.download_images:
factory: 'httplug.factory.auto'
plugins: ['httplug.plugin.logger']
wallabag_import.pocket.client:
factory: 'httplug.factory.auto'
plugins:
- 'httplug.plugin.logger'
- header_defaults:
headers:
'content-type': 'application/json'
'X-Accept': 'application/json'
discovery:
client: false
# define custom entity so we can override length attribute to fix utf8mb4 issue
craue_config:
entity_name: Wallabag\CoreBundle\Entity\InternalSetting

View File

@ -36,7 +36,7 @@ monolog:
channels: [doctrine]
swiftmailer:
# see http://mailcatcher.me/
# see https://mailcatcher.me/
transport: smtp
host: 'localhost'
port: 1025

View File

@ -23,3 +23,6 @@ monolog:
level: debug
console:
type: console
sentry:
dsn: "%sentry_dsn%"

View File

@ -1,6 +1,7 @@
imports:
- { resource: config_dev.yml }
- { resource: parameters_test.yml }
- { resource: services_test.yml }
framework:
test: ~
@ -23,7 +24,6 @@ swiftmailer:
doctrine:
dbal:
driver: "%test_database_driver%"
driver_class: "%test_database_driver_class%"
host: "%test_database_host%"
port: "%test_database_port%"
dbname: "%test_database_name%"

View File

@ -11,8 +11,6 @@ parameters:
# database_password: %env.database_password%
database_driver: pdo_mysql
database_driver_class: ~
# database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver
database_host: 127.0.0.1
database_port: ~
database_name: wallabag
@ -27,15 +25,18 @@ parameters:
domain_name: https://your-wallabag-url-instance.com
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: ~
mailer_password: ~
mailer_transport: smtp
mailer_user: ~
mailer_password: ~
mailer_host: 127.0.0.1
mailer_port: false
mailer_encryption: ~
mailer_auth_mode: ~
locale: en
# A secret key that's used to generate certain security-related tokens
secret: ovmpmAWXRCabNlMgzlzFXDYmCFfzGv
secret: CHANGE_ME_TO_SOMETHING_SECRET_AND_RANDOM
# two factor stuff
twofactor_auth: true
@ -62,3 +63,6 @@ parameters:
redis_port: 6379
redis_path: null
redis_password: null
# sentry logging
sentry_dsn: ~

View File

@ -8,4 +8,3 @@ parameters:
test_database_path: "%env(TEST_DATABASE_PATH)%"
env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite"
test_database_charset: utf8
test_database_driver_class: ~

View File

@ -51,3 +51,47 @@ craue_config_settings_modify:
fos_js_routing:
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
2fa_login:
path: /2fa
defaults:
_controller: "scheb_two_factor.form_controller:form"
2fa_login_check:
path: /2fa_check
# redirect RSS feed to Atom
rss_to_atom_unread:
path: /{username}/{token}/unread.xml
defaults:
_controller: FrameworkBundle:Redirect:redirect
route: unread_feed
permanent: true
rss_to_atom_archive:
path: /{username}/{token}/archive.xml
defaults:
_controller: FrameworkBundle:Redirect:redirect
route: archive_feed
permanent: true
rss_to_atom_starred:
path: /{username}/{token}/starred.xml
defaults:
_controller: FrameworkBundle:Redirect:redirect
route: starred_feed
permanent: true
rss_to_atom_all:
path: /{username}/{token}/all.xml
defaults:
_controller: FrameworkBundle:Redirect:redirect
route: all_feed
permanent: true
rss_to_atom_tags:
path: /{username}/{token}/tags/{slug}.xml
defaults:
_controller: FrameworkBundle:Redirect:redirect
route: tag_feed
permanent: true

View File

@ -31,12 +31,15 @@ security:
fos_oauth: true
stateless: true
anonymous: true
provider: fos_userbundle
login_firewall:
logout_on_user_change: true
pattern: ^/login$
anonymous: ~
secured_area:
logout_on_user_change: true
pattern: ^/
form_login:
provider: fos_userbundle
@ -53,17 +56,27 @@ security:
path: /logout
target: /
two_factor:
provider: fos_userbundle
auth_form_path: 2fa_login
check_path: 2fa_login_check
access_control:
- { path: ^/api/doc, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/api/version, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/api/user, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/api/(doc|version|info|user), roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
# force role for logout otherwise when 2fa enable, you won't be able to logout
# https://github.com/scheb/two-factor-bundle/issues/168#issuecomment-430822478
- { path: ^/logout, roles: [IS_AUTHENTICATED_ANONYMOUSLY, IS_AUTHENTICATED_2FA_IN_PROGRESS] }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: /(unread|starred|archive|all).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/locale, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: /tags/(.*).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/feed, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: /(unread|starred|archive).xml$, roles: IS_AUTHENTICATED_ANONYMOUSLY } # For backwards compatibility
- { path: ^/share, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/settings, roles: ROLE_SUPER_ADMIN }
- { path: ^/annotations, roles: ROLE_USER }
- { path: ^/2fa, role: IS_AUTHENTICATED_2FA_IN_PROGRESS }
- { path: ^/users, roles: ROLE_SUPER_ADMIN }
- { path: ^/, roles: ROLE_USER }

View File

@ -2,12 +2,6 @@ parameters:
lexik_form_filter.get_filter.doctrine_orm.class: Wallabag\CoreBundle\Event\Subscriber\CustomDoctrineORMSubscriber
services:
# used for tests
filesystem_cache:
class: Doctrine\Common\Cache\FilesystemCache
arguments:
- "%kernel.cache_dir%/doctrine/metadata"
twig.extension.text:
class: Twig_Extensions_Extension_Text
tags:

View File

@ -0,0 +1,38 @@
services:
# see https://github.com/symfony/symfony/issues/24543
fos_user.user_manager.test:
alias: fos_user.user_manager
public: true
fos_user.security.login_manager.test:
alias: fos_user.security.login_manager
public: true
wallabag_core.entry_repository.test:
alias: wallabag_core.entry_repository
public: true
wallabag_user.user_repository.test:
alias: wallabag_user.user_repository
public: true
filesystem_cache:
class: Doctrine\Common\Cache\FilesystemCache
arguments:
- "%kernel.cache_dir%/doctrine/metadata"
# fixtures
Wallabag\UserBundle\DataFixtures\:
resource: '../../src/Wallabag/UserBundle/DataFixtures/*'
tags: ['doctrine.fixture.orm']
autowire: true
Wallabag\CoreBundle\DataFixtures\:
resource: '../../src/Wallabag/CoreBundle/DataFixtures/*'
tags: ['doctrine.fixture.orm']
autowire: true
Wallabag\AnnotationBundle\DataFixtures\:
resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/*'
tags: ['doctrine.fixture.orm']
autowire: true

View File

@ -1,6 +1,5 @@
parameters:
test_database_driver: pdo_mysql
test_database_driver_class: ~
test_database_host: localhost
test_database_port: 3306
test_database_name: wallabag_test

View File

@ -1,6 +1,5 @@
parameters:
test_database_driver: pdo_pgsql
test_database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver
test_database_host: localhost
test_database_port:
test_database_name: wallabag_test

View File

@ -1,6 +1,5 @@
parameters:
test_database_driver: pdo_sqlite
test_database_driver_class: ~
test_database_host: localhost
test_database_port:
test_database_name: ~

View File

@ -1,5 +1,5 @@
wallabag_core:
version: 2.3.6-dev
version: 2.4.0-dev
paypal_url: "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=9UBA65LG3FX9Y&lc=gb"
languages:
en: 'English'
@ -20,13 +20,13 @@ wallabag_core:
theme: material
language: '%locale%'
rss_limit: 50
reading_speed: 1
reading_speed: 200
cache_lifetime: 10
action_mark_as_read: 1
list_mode: 0
fetching_error_message_title: 'No title found'
fetching_error_message: |
wallabag can't retrieve contents for this article. Please <a href="http://doc.wallabag.org/en/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.
wallabag can't retrieve contents for this article. Please <a href="https://doc.wallabag.org/en/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.
api_limit_mass_actions: 10
encryption_key_path: "%kernel.project_dir%/data/site-credentials-secret-key.txt"
default_internal_settings:
@ -44,7 +44,7 @@ wallabag_core:
section: entry
-
name: diaspora_url
value: http://diasporapod.com
value: https://diasporapod.com
section: entry
-
name: share_unmark
@ -64,11 +64,11 @@ wallabag_core:
section: entry
-
name: shaarli_url
value: http://myshaarli.com
value: https://myshaarli.com
section: entry
-
name: scuttle_url
value: http://scuttle.org
value: https://scuttle.org
section: entry
-
name: share_mail

View File

@ -6,19 +6,17 @@ use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
// for more information
//umask(0000);
set_time_limit(0);
/**
* @var Composer\Autoload\ClassLoader $loader
*/
$loader = require __DIR__.'/../app/autoload.php';
require __DIR__.'/../vendor/autoload.php';
$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev', true);
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption('--no-debug', true) && $env !== 'prod';
if ($debug) {
Debug::enable();

View File

@ -2,7 +2,10 @@
"name": "wallabag/wallabag",
"type": "project",
"description": "open source self hostable read-it-later web application",
"keywords": ["read-it-later","read it later"],
"keywords": [
"read-it-later",
"read it later"
],
"homepage": "https://github.com/wallabag/wallabag",
"license": "MIT",
"authors": [
@ -28,7 +31,7 @@
"issues": "https://github.com/wallabag/wallabag/issues"
},
"require": {
"php": ">=5.6.0",
"php": ">=7.1.3",
"ext-pcre": "*",
"ext-dom": "*",
"ext-curl": "*",
@ -43,58 +46,70 @@
"ext-iconv": "*",
"ext-tokenizer": "*",
"ext-pdo": "*",
"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",
"ext-tidy": "*",
"symfony/symfony": "3.4.*",
"doctrine/orm": "^2.6",
"doctrine/doctrine-bundle": "^1.9",
"doctrine/doctrine-cache-bundle": "^1.3",
"doctrine/dbal": "2.9.2",
"twig/extensions": "^1.5",
"symfony/swiftmailer-bundle": "^3.2",
"symfony/monolog-bundle": "^3.1",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^5.2",
"incenteev/composer-parameter-handler": "^2.1",
"nelmio/cors-bundle": "~1.5",
"friendsofsymfony/rest-bundle": "~2.1",
"jms/serializer-bundle": "~2.2",
"nelmio/api-doc-bundle": "^2.13.2",
"mgargano/simplehtmldom": "~1.5",
"wallabag/tcpdf": "^6.2.15",
"simplepie/simplepie": "~1.5",
"wallabag/tcpdf": "^6.2.26",
"willdurand/hateoas-bundle": "~1.3",
"liip/theme-bundle": "^1.4.6",
"lexik/form-filter-bundle": "^5.0.4",
"j0k3r/graby": "^1.0",
"j0k3r/graby": "^2.0",
"php-http/guzzle5-adapter": "^2.0",
"friendsofsymfony/user-bundle": "2.0.*",
"friendsofsymfony/oauth-server-bundle": "^1.5.2",
"friendsofsymfony/oauth-server-bundle": "^1.5",
"stof/doctrine-extensions-bundle": "^1.2",
"scheb/two-factor-bundle": "^2.14.0",
"grandt/phpepub": "^4.0.7",
"wallabag/php-mobi": "~1.0.0",
"scheb/two-factor-bundle": "^4.4",
"grandt/phpepub": "dev-master",
"wallabag/php-mobi": "~1.0",
"kphoen/rulerz-bundle": "~0.13",
"guzzlehttp/guzzle": "^5.3.1",
"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.0.2",
"white-october/pagerfanta-bundle": "^1.1.0",
"craue/config-bundle": "^2.3.0",
"mnapoli/piwik-twig-extension": "^2.0",
"ocramius/proxy-manager": "^2.1.1",
"white-october/pagerfanta-bundle": "^1.1",
"php-amqplib/rabbitmq-bundle": "^1.14",
"predis/predis": "^1.1.1",
"predis/predis": "v1.1.x-dev",
"javibravo/simpleue": "^2.0",
"symfony/dom-crawler": "^3.3.13",
"friendsofsymfony/jsrouting-bundle": "^1.6.3",
"symfony/dom-crawler": "^3.4",
"friendsofsymfony/jsrouting-bundle": "^2.2",
"bdunogier/guzzle-site-authenticator": "^1.0.0",
"defuse/php-encryption": "^2.1",
"html2text/html2text": "^4.1"
"html2text/html2text": "^4.1",
"pragmarx/recovery": "^0.1.0",
"php-http/httplug-bundle": "^1.14",
"sentry/sentry-symfony": "^3.0"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "~2.2",
"doctrine/data-fixtures": "~1.1",
"doctrine/doctrine-fixtures-bundle": "~3.0",
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "3.4.x-dev",
"friendsofphp/php-cs-fixer": "~2.0",
"m6web/redis-mock": "^2.0",
"dama/doctrine-test-bundle": "^4.0"
"symfony/phpunit-bridge": "~4.3.8",
"friendsofphp/php-cs-fixer": "~2.13",
"m6web/redis-mock": "^5.0",
"dama/doctrine-test-bundle": "^5.0",
"phpstan/phpstan": "^0.11.0",
"phpstan/phpstan-phpunit": "^0.11.0",
"phpstan/phpstan-symfony": "^0.11.0",
"phpstan/phpstan-doctrine": "^0.11.0",
"php-http/mock-client": "^1.0",
"guzzlehttp/psr7": "^1.0"
},
"suggest": {
"ext-imagick": "To keep GIF animation when downloading image is enabled"
},
"scripts": {
"post-cmd": [
@ -123,18 +138,35 @@
}
},
"autoload": {
"psr-4": { "Wallabag\\": "src/Wallabag/" },
"classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
"psr-4": {
"Wallabag\\": "src/Wallabag/"
},
"classmap": [
"app/AppKernel.php",
"app/AppCache.php"
]
},
"autoload-dev": {
"psr-4": { "Tests\\": "tests/" }
"psr-4": {
"Tests\\": "tests/"
},
"files": [
"vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php"
]
},
"config": {
"bin-dir": "bin",
"platform": {
"php": "5.6.0"
"php": "7.1.3"
}
},
"minimum-stability": "dev",
"prefer-stable": true
"prefer-stable": true,
"repositories": [
{
"type": "vcs",
"url": "https://github.com/Daniel-KM/PHPePub",
"comment": "The most up-to-date PHPePub as of now"
}
]
}

11547
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
version: '2'
services:
nginx:
image: nginx
image: nginx:alpine
ports:
- "8080:80"
- "8000:80"
volumes:
- ./docker/nginx/nginx.conf:/nginx.conf
- ./docker/logs/nginx:/var/log/nginx
@ -16,7 +16,7 @@ services:
build:
context: docker/php
args:
# Set here your timezone using one of this: http://php.net/manual/en/timezones.php
# Set here your timezone using one of this: https://php.net/manual/en/timezones.php
timezone: 'Europe/Monaco'
ports:
- "9000:9000"
@ -32,8 +32,8 @@ services:
# - ./docker/postgres/env
# - ./docker/mariadb/env
#postgres:
# image: postgres:9
# postgres:
# image: postgres:11-alpine
# ports:
# - "5432:5432"
# volumes:
@ -41,7 +41,7 @@ services:
# env_file:
# - ./docker/postgres/env
#mariadb:
# mariadb:
# image: mariadb:10
# ports:
# - "3306:3306"
@ -50,12 +50,12 @@ services:
# env_file:
# - ./docker/mariadb/env
rabbitmq:
image: rabbitmq:3-management
ports:
- "15672:15672"
# rabbitmq:
# image: rabbitmq:3-management-alpine
# ports:
# - "15672:15672"
redis:
image: redis
image: redis:4-alpine
ports:
- "6379:6379"

View File

@ -1,15 +1,39 @@
FROM php:fpm
FROM php:7.2-fpm
# Default timezone. To change it, use the argument in the docker-compose.yml file
ARG timezone='Europe/Paris'
ARG memorylimit='512M'
RUN apt-get update && apt-get install -y \
libmcrypt-dev libicu-dev libpq-dev libxml2-dev libpng-dev libjpeg-dev \
&& /usr/local/bin/docker-php-ext-configure gd --with-jpeg-dir=/usr/include \
&& docker-php-ext-install \
iconv mbstring intl pdo pdo_mysql pdo_pgsql gd
libmcrypt-dev \
libicu-dev \
libpq-dev \
libxml2-dev \
libpng-dev \
libjpeg-dev \
libsqlite3-dev \
imagemagick \
libmagickwand-dev \
libtidy-dev \
git
RUN docker-php-ext-install \
iconv \
mbstring \
gd \
intl \
pdo \
pdo_mysql \
pdo_pgsql \
pdo_sqlite \
sockets \
tidy \
bcmath \
zip
RUN printf "\n" | pecl install imagick && docker-php-ext-enable imagick
RUN echo "date.timezone="$timezone > /usr/local/etc/php/conf.d/date_timezone.ini
RUN echo "memory_limit ="$memorylimit > /usr/local/etc/php/conf.d/memory_limit.ini
RUN usermod -u 1000 www-data

View File

@ -1,9 +1,9 @@
POSTGRES_USER=wallabag
POSTGRES_PASSWORD=wallapass
POSTGRES_DB=wallabag
export SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql
export SYMFONY__ENV__DATABASE_HOST=rdbms
export SYMFONY__ENV__DATABASE_PORT=5432
export SYMFONY__ENV__DATABASE_NAME=wallabag
export SYMFONY__ENV__DATABASE_USER=wallabag
export SYMFONY__ENV__DATABASE_PASSWORD=wallapass
SYMFONY__ENV__DATABASE_HOST=rdbms
SYMFONY__ENV__DATABASE_PORT=5432
SYMFONY__ENV__DATABASE_NAME=wallabag
SYMFONY__ENV__DATABASE_USER=wallabag
SYMFONY__ENV__DATABASE_PASSWORD=wallapass
SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql

View File

@ -64,14 +64,16 @@
},
"dependencies": {
"annotator": "git://github.com/wallabag/annotator.git#0f076c7d371ed25eb0793346f46982d90f2c4c85",
"clipboard": "^2.0.4",
"hammerjs": "^2.0.8",
"highlight.js": "^9.12.0",
"icomoon-free-npm": "^0.0.0",
"jquery": "^2.1.4",
"jquery.cookie": "^1.4.1",
"jr-qrcode": "^1.0.7",
"material-design-icons-iconfont": "^3.0.3",
"material-design-icons-iconfont": "^5.0.1",
"materialize-css": "^0.98.1",
"mathjax": "^3.0.0",
"mousetrap": "^1.6.0",
"ptsans-npm-webfont": "^0.0.4",
"roboto-fontface": "^0.7.0",

15
phpstan.neon Normal file
View File

@ -0,0 +1,15 @@
includes:
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-symfony/extension.neon
- vendor/phpstan/phpstan-doctrine/extension.neon
- vendor/phpstan/phpstan-phpunit/rules.neon
parameters:
symfony:
container_xml_path: %rootDir%/../../../var/cache/test/appTestDebugProjectContainer.xml
# https://github.com/phpstan/phpstan/issues/694#issuecomment-350724288
autoload_files:
- vendor/bin/.phpunit/phpunit-7.4/vendor/autoload.php
inferPrivatePropertyTypeFromConstructor: true

View File

@ -4,7 +4,7 @@
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="app/autoload.php"
bootstrap="vendor/autoload.php"
>
<testsuites>
@ -15,7 +15,7 @@
<php>
<ini name="error_reporting" value="-1" />
<server name="KERNEL_DIR" value="app/" />
<server name="KERNEL_CLASS" value="AppKernel" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
</php>

View File

@ -3,11 +3,18 @@
# eg: `sh dev.sh`
COMPOSER_COMMAND='composer'
REQUIRE_FILE='scripts/require.sh'
DIR="${BASH_SOURCE}"
if [ ! -d "$DIR" ]; then DIR="$PWD/scripts"; fi
. "$DIR/require.sh"
if [ ! -f "$REQUIRE_FILE" ]; then
echo "Cannot find $REQUIRE_FILE"
exit 1
fi
. "$REQUIRE_FILE"
$COMPOSER_COMMAND install
php bin/console wallabag:install
php bin/console server:run
if [ -z "$SKIP_WALLABAG_INITIALIZATION" ]
then
php bin/console wallabag:install
fi
php bin/console server:run $HOST

View File

@ -5,9 +5,17 @@
IGNORE_ROOT_ARG="--ignore-root-warning"
IGNORE_ROOT=0
if [ "$1" == "$IGNORE_ROOT_ARG" ]; then
IGNORE_ROOT=1
fi
while :; do
case $1 in
$IGNORE_ROOT_ARG) IGNORE_ROOT=1
;;
*[a-zA-Z]) ENV=$1
;;
*) break
;;
esac
shift
done
# Abort running this script if root
if [ "$IGNORE_ROOT" -eq 0 ] && [ "$EUID" == "0" ]; then
@ -17,12 +25,15 @@ if [ "$IGNORE_ROOT" -eq 0 ] && [ "$EUID" == "0" ]; then
fi
COMPOSER_COMMAND='composer'
REQUIRE_FILE='scripts/require.sh'
DIR="${BASH_SOURCE}"
if [ ! -d "$DIR" ]; then DIR="$PWD/scripts"; fi
. "$DIR/require.sh"
if [ ! -f "$REQUIRE_FILE" ]; then
echo "Cannot find $REQUIRE_FILE"
exit 1
fi
. "$REQUIRE_FILE"
ENV=$1
TAG=$(git describe --tags $(git rev-list --tags --max-count=1))
git checkout $TAG

Some files were not shown because too many files have changed in this diff Show More