Compare commits

..

1 Commits

Author SHA1 Message Date
af54ccea8a Add CodeQL build 2022-11-03 10:58:00 +01:00
461 changed files with 8045 additions and 15537 deletions

View File

@ -45,17 +45,3 @@ Note : If you have large portions of text, use [Github's Gist service](https://g
## You want to fix a bug or to add a feature
Please fork wallabag and work with **the master branch**.
## Run Tests and PHP formatter
All pull requests need to pass the tests and the code needs match the style guide.
To run the tests locally run:
- when testing using Docker: `docker-compose run --rm php make test`
- otherwise: `make test`
To run the PHP formatter:
- when testing using Docker: `docker-compose run --rm php bin/php-cs-fixer fix`
- otherwise: `php bin/php-cs-fixer fix`

View File

@ -22,10 +22,18 @@ updates:
- j0k3r
- tcitworld
- Kdecherf
labels:
- Ready for review
ignore:
- dependency-name: lcobucci/jwt
- dependency-name: doctrine/doctrine-migrations-bundle
versions:
- ">= 4.2.0"
- "> 1.3.2"
- dependency-name: friendsofsymfony/user-bundle
versions:
- "> 2.0.2"
- dependency-name: nelmio/api-doc-bundle
versions:
- "> 2.13.4"
- package-ecosystem: github-actions
directory: "/"
schedule:

View File

@ -5,7 +5,7 @@ on:
push:
branches:
- master
- "2.**"
- 2.*
permissions:
contents: read

42
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '22 9 * * 2'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@ -5,7 +5,7 @@ on:
push:
branches:
- master
- "2.**"
- 2.*
permissions:
contents: read
@ -49,6 +49,3 @@ jobs:
- name: "Run TwigCS"
run: "php bin/twigcs --severity=error --display=blocking --reporter checkstyle app/ src/ | cs2pr"
- name: "Run ergebnis/composer-normalize"
run: "composer normalize --dry-run --no-check-lock"

View File

@ -5,7 +5,7 @@ on:
push:
branches:
- master
- "2.**"
- 2.*
env:
PGPASSWORD: wallabagrocks
@ -32,7 +32,6 @@ jobs:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
database:
- "sqlite"
- "mysql"
@ -80,74 +79,3 @@ jobs:
- name: "Run PHPUnit"
run: "php bin/simple-phpunit -v"
phpunit_no_prefix:
name: "PHP ${{ matrix.php }} using ${{ matrix.database }} without prefix"
runs-on: "ubuntu-20.04"
services:
rabbitmq:
image: rabbitmq:3-alpine
ports:
- 5672:5672
redis:
image: redis:6-alpine
ports:
- 6379:6379
strategy:
fail-fast: true
matrix:
php:
- "8.2"
database:
- "sqlite"
- "mysql"
- "pgsql"
steps:
- name: "Checkout"
uses: "actions/checkout@v3"
with:
fetch-depth: 2
- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php }}"
coverage: none
tools: pecl
extensions: json, pdo, pdo_mysql, pdo_sqlite, pdo_pgsql, curl, imagick, pgsql, gd, tidy
ini-values: "date.timezone=Europe/Paris"
- name: "Remove database prefix"
run: |
pip install --user yq
yq -Y --in-place '.parameters.database_table_prefix = ""' app/config/parameters.yml.dist
- name: "Setup MySQL"
if: "${{ matrix.database == 'mysql' }}"
run: |
sudo systemctl start mysql.service
sudo mysql -u root -proot -h 127.0.0.1 -e "CREATE DATABASE wallabag_test"
- name: "Setup PostgreSQL"
if: "${{ matrix.database == 'pgsql' }}"
run: |
sudo systemctl start postgresql
sudo -u postgres psql -d template1 -c "CREATE USER wallabag WITH PASSWORD 'wallabagrocks' CREATEDB"
createdb -h localhost -p 5432 -U wallabag wallabag_test
pg_isready -d wallabag_test -h localhost -p 5432 -U wallabag
- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v2"
with:
composer-options: "--optimize-autoloader --prefer-dist"
- name: "Prepare database"
run: "make prepare DB=${{ matrix.database }}"
- name: "Prepare fixtures"
run: "make fixtures"
- name: "Run PHPUnit"
run: "php bin/simple-phpunit -v"

View File

@ -12,7 +12,7 @@ jobs:
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1.6.0
uses: dependabot/fetch-metadata@v1.3.4
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
- name: Approve and merge minor updates

View File

@ -5,7 +5,7 @@ on:
push:
branches:
- master
- "2.**"
- 2.*
permissions:
contents: read
@ -40,5 +40,11 @@ jobs:
with:
composer-options: "--optimize-autoloader --prefer-dist"
- name: "Validate translations"
run: "php bin/console lint:yaml translations -v"
- name: "Validate Core translations"
run: "php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v"
- name: "Validate CraueConfig translations"
run: "php bin/console lint:yaml app/Resources/CraueConfigBundle/translations -v"
- name: "Validate User translations"
run: "php bin/console lint:yaml src/Wallabag/UserBundle/Resources/translations -v"

1
.gitignore vendored
View File

@ -15,7 +15,6 @@
.php-cs-fixer.cache
.phpunit.result.cache
phpunit.xml
docker-compose.override.yml
# Parameters
/app/config/parameters.yml

View File

@ -1,203 +1,5 @@
# Changelog
## [2.6.7](https://github.com/wallabag/wallabag/tree/2.6.7)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.6.6...2.6.7)
### Security fix
* A user can disable her 2FA unintentionally by @kdecherf in https://github.com/wallabag/wallabag/commit/0cfdddc2eb0aee5ffb69bf499d377d75655ba157
### Fixes
* Fix deprecated null tag parameter by @Simounet in https://github.com/wallabag/wallabag/pull/6985
* Full clickable card on mass action by @Simounet in https://github.com/wallabag/wallabag/pull/6991
* Add tag form submit button always displayed by @Simounet in https://github.com/wallabag/wallabag/pull/6986
## [2.6.6](https://github.com/wallabag/wallabag/tree/2.6.6)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.6.5...2.6.6)
### Security fix
* Force secure cookie on HTTPS connection by @j0k3r in https://github.com/wallabag/wallabag/pull/6924
### Fixes
* Fix checkboxes pointer events issue by @Simounet in https://github.com/wallabag/wallabag/pull/6897
* Add Google mailer by @j0k3r in https://github.com/wallabag/wallabag/pull/6899
* Improve performance on homepage by @Simounet in https://github.com/wallabag/wallabag/pull/6909
* Mass action layout improved by @Simounet in https://github.com/wallabag/wallabag/pull/6912
## [2.6.5](https://github.com/wallabag/wallabag/tree/2.6.5)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.6.4...2.6.5)
### Fixes
* "Fix checkboxes pointer-events disabled" by @Simounet https://github.com/wallabag/wallabag/pull/6874
* "Fix nav input styles" by @Simounet https://github.com/wallabag/wallabag/pull/6877
* "Change domain status filters html types" by @Simounet https://github.com/wallabag/wallabag/pull/6888
## [2.6.4](https://github.com/wallabag/wallabag/tree/2.6.4)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.6.3...2.6.4)
### Fixes
* Fix API token generation by @nicosomb https://github.com/wallabag/wallabag/pull/6869
* Fix checkboxes which were broken by @nicosomb https://github.com/wallabag/wallabag/pull/6864
## [2.6.3](https://github.com/wallabag/wallabag/tree/2.6.3)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.6.2...2.6.3)
### Security fixes
* Replace GET way to POST way to reset data user by @nicosomb https://github.com/wallabag/wallabag/commit/78b0b55c40511e1f22d5bbb4897aa10fca68441c
* Replace GET way to POST way to delete API client by @nicosomb https://github.com/wallabag/wallabag/commit/ffcc5c9062fcc8cd922d7d6d65edbe5efae96806
### Improvement
* Add confirmation before reload entry by @nicosomb https://github.com/wallabag/wallabag/pull/6778
* Remove external dependencies on howto page by @viktoriussuwandi https://github.com/wallabag/wallabag/pull/6775
### Fixes
* Use Session instead of Referrer for Redirection by @Spoons https://github.com/wallabag/wallabag/pull/6119
* Reduce risk of collision for #content by @kdecherf https://github.com/wallabag/wallabag/pull/6829
* Update dependencies to fix vulnerabilities by @nicosomb https://github.com/wallabag/wallabag/pull/6783
* Fix failing randomly test by @nicosomb https://github.com/wallabag/wallabag/pull/6763
### Technical stuff
* Add check if git is installed by @nicosomb https://github.com/wallabag/wallabag/pull/6788
* Replace kernel.root_dir by kernel.project_dir by @yguedidi https://github.com/wallabag/wallabag/pull/6809
* Split symfony/symfony by @yguedidi https://github.com/wallabag/wallabag/pull/6817
* Make Crawler::extract get an array by @yguedidi https://github.com/wallabag/wallabag/pull/6812
* Use PSR-17 and PSR-18 by @yguedidi https://github.com/wallabag/wallabag/pull/6816
* Replace Client by KernelBrowser by @yguedidi https://github.com/wallabag/wallabag/pull/6813
* Replace Debug component by ErrorHandler component by @yguedidi https://github.com/wallabag/wallabag/pull/6810
* Make ImportController extends AbstractController by @yguedidi https://github.com/wallabag/wallabag/pull/6808
* Use Twig instead of templating by @yguedidi https://github.com/wallabag/wallabag/pull/6797
* Identify platforms by their class by @yguedidi https://github.com/wallabag/wallabag/pull/6799
* Move from transchoice to trans by @yguedidi https://github.com/wallabag/wallabag/pull/6800
* Replace GetResponseEvent by RequestEvent by @yguedidi https://github.com/wallabag/wallabag/pull/6811
* Ensure the kernel is shut down before calling createClient by @yguedidi https://github.com/wallabag/wallabag/pull/6803
* Ignore docker-compose.override.yml by @yguedidi https://github.com/wallabag/wallabag/pull/6814
* Add composer normalizer by @nicosomb https://github.com/wallabag/wallabag/pull/6762
## [2.6.2](https://github.com/wallabag/wallabag/tree/2.6.2)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.6.1...2.6.2)
### Fixes
* Fix mass action input on dark theme by @simounet https://github.com/wallabag/wallabag/pull/6673
* Fix undefined variable by @nicosomb https://github.com/wallabag/wallabag/pull/6672
* Fix table name in migration by @nicosomb https://github.com/wallabag/wallabag/pull/6653
### Technical stuff
* Add a new build to test when no database table prefix are defined by @j0k3r https://github.com/wallabag/wallabag/pull/6731
* Keep escaped table name while migrating by @Glandos https://github.com/wallabag/wallabag/pull/6710
* Remove twofactor_auth parameter by @nicosomb https://github.com/wallabag/wallabag/pull/6723
* ApiDoc: Add response description to UserRestController by @caspermeijn https://github.com/wallabag/wallabag/pull/6684
* ApiDoc: Add response description to WallabagRestController by @caspermeijn https://github.com/wallabag/wallabag/pull/6102
* Skip migration if the table was already renamed by @gramakri https://github.com/wallabag/wallabag/pull/6678
### Meta
* Document how to run tests and formatter for new contributors by @caspermeijn https://github.com/wallabag/wallabag/pull/6685
* Add link to wallabag ecosystem resources by @nicosomb https://github.com/wallabag/wallabag/pull/6700
## [2.6.1](https://github.com/wallabag/wallabag/tree/2.6.1)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.6.0...2.6.1)
### Fixes
* Do not autoload fixtures by @j0k3r https://github.com/wallabag/wallabag/pull/6648
* Add confirmation alert when deleting articles from list view by @nicosomb https://github.com/wallabag/wallabag/pull/6644
## [2.6.0](https://github.com/wallabag/wallabag/tree/2.6.0)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.5.4...2.6.0)
### Features
* Add tag deletion from tags list by @nicosomb https://github.com/wallabag/wallabag/pull/5861
* Add support of mass action to tag entries by @kdecherf https://github.com/wallabag/wallabag/pull/5838
* Mass action interface by @Simounet https://github.com/wallabag/wallabag/pull/6547
* Empty space on the top bar used for more add url toggle clickable target by @Simounet https://github.com/wallabag/wallabag/pull/6612
* Add new setting to show / hide articles thumbnails by @nicosomb https://github.com/wallabag/wallabag/pull/6609
### Fixes
* Add prefix for tag slugs by @kdecherf https://github.com/wallabag/wallabag/pull/6226
* Fix open all external links in new tab in Config by @wyntonfranklin https://github.com/wallabag/wallabag/pull/6256
* Fix dark theme for pre HTML tags by @Simounet https://github.com/wallabag/wallabag/pull/6495
* Fix dark mode top bar contrast by @Simounet https://github.com/wallabag/wallabag/pull/6510
* Dark mode contrast improved by @Simounet https://github.com/wallabag/wallabag/pull/6512
* Fix dark mode URL add input color by @Simounet https://github.com/wallabag/wallabag/pull/6525
* Fix round reading time in export by @mart-e https://github.com/wallabag/wallabag/pull/6545
* Fix images downloading with numeric HTML entity by @Simounet https://github.com/wallabag/wallabag/pull/6563
* Fix DownloadImages not following redirections by @Simounet https://github.com/wallabag/wallabag/pull/6562
* Fix auto dark theme detection flickering by @Simounet https://github.com/wallabag/wallabag/pull/6584
* Fix RSS feed_route not set by @Simounet https://github.com/wallabag/wallabag/pull/6606
* Add flash message when we try to add too much tags by @nicosomb https://github.com/wallabag/wallabag/pull/6607
* Changed default value for domain_name parameter by @nicosomb https://github.com/wallabag/wallabag/pull/6616
* Improved tags display by @Simounet https://github.com/wallabag/wallabag/pull/6613
* Fix mousetrap enter issue by @Simounet https://github.com/wallabag/wallabag/pull/6624
* Fix duplicate tags creation when assigning search results to tag by @nicosomb https://github.com/wallabag/wallabag/pull/6629
### Meta
* Removed Carrot & Scuttle share by @nicosomb https://github.com/wallabag/wallabag/pull/6047
* Remove old, not so maintained and buggy baggy theme by @nicosomb https://github.com/wallabag/wallabag/pull/4332
* Remove Scrutinizer badge by @j0k3r https://github.com/wallabag/wallabag/pull/6179
* Add mention to unofficial linux client by @imhemish https://github.com/wallabag/wallabag/pull/6203
### Technical stuff
* Remove SensioDistributionBundle by @yguedidi https://github.com/wallabag/wallabag/pull/5761
* Back to latest composer version by @yguedidi https://github.com/wallabag/wallabag/pull/5810
* Clean composer.lock after SensioDistributionBundle removal by @yguedidi https://github.com/wallabag/wallabag/pull/5839
* Remove transitive dependencies by @yguedidi https://github.com/wallabag/wallabag/pull/5784
* Register missed commands by @yguedidi https://github.com/wallabag/wallabag/pull/5928
* Extend right FOSRestBundle controller class by @yguedidi https://github.com/wallabag/wallabag/pull/5929
* Remove PHP-CS-Fixer deprecations by @yguedidi https://github.com/wallabag/wallabag/pull/5914
* Upgrade FOSUserBundle to 2.1 by @yguedidi https://github.com/wallabag/wallabag/pull/5782
* Add TwigCS by @yguedidi https://github.com/wallabag/wallabag/pull/5759
* Use FQCN as service name by @yguedidi https://github.com/wallabag/wallabag/pull/5748
* Migrate to new template reference notation by @yguedidi https://github.com/wallabag/wallabag/pull/5758
* Migrate from old colon notation to FQCN by @yguedidi https://github.com/wallabag/wallabag/pull/5943
* Use autowiring by @yguedidi https://github.com/wallabag/wallabag/pull/5946
* Use FQCN to fetch services by @yguedidi https://github.com/wallabag/wallabag/pull/5951
* Run tests without memory limit by @yguedidi https://github.com/wallabag/wallabag/pull/5953
* Import used classes by @yguedidi https://github.com/wallabag/wallabag/pull/5952
* Rework command tests by @yguedidi https://github.com/wallabag/wallabag/pull/5954
* Switch to Swagger for api documentation by @caspermeijn https://github.com/wallabag/wallabag/pull/6062
* Remove some deprecation by @j0k3r https://github.com/wallabag/wallabag/pull/6085
* Remove deprecated options from FOSRest by @j0k3r https://github.com/wallabag/wallabag/pull/6095
* Remove LiipThemeBundle by @j0k3r https://github.com/wallabag/wallabag/pull/6097
* Upgrade PHPStan and move to level 2 with baseline by @j0k3r https://github.com/wallabag/wallabag/pull/6098
* Upgrade to Symfony 4.4 by @j0k3r https://github.com/wallabag/wallabag/pull/6099
* Update to FOSUserBundle 3.1 by @j0k3r https://github.com/wallabag/wallabag/pull/6136
* Update to scheb/2fa-bundle by @j0k3r https://github.com/wallabag/wallabag/pull/6144
* Upgrade to Twig 3 by @j0k3r https://github.com/wallabag/wallabag/pull/6151
* Move translations files to /translations by @j0k3r https://github.com/wallabag/wallabag/pull/6153
* Fix EventDispatcher & events by @j0k3r https://github.com/wallabag/wallabag/pull/6154
* Replace SwiftMailer by Symfony Mailer by @j0k3r https://github.com/wallabag/wallabag/pull/6150
* Remove ContainerAwareCommand from commands by @j0k3r https://github.com/wallabag/wallabag/pull/6152
* Update all Doctrine deps by @j0k3r https://github.com/wallabag/wallabag/pull/6143
* Update PagerFanta by @j0k3r https://github.com/wallabag/wallabag/pull/6145
* Move to controller as a service by @j0k3r https://github.com/wallabag/wallabag/pull/6159
* Add RabbitMQConsumerTotalProxy to lazy RabbitMQ services for messages by @j0k3r https://github.com/wallabag/wallabag/pull/6166
* Properly handle json_array type removal by @j0k3r https://github.com/wallabag/wallabag/pull/6171
* Fix database_path in Docker env by @j0k3r https://github.com/wallabag/wallabag/pull/6174
* Docker: database_table_prefix may be configured from environment by @fcatt https://github.com/wallabag/wallabag/pull/6196
* Update annotations to OpenApi 3 by @caspermeijn https://github.com/wallabag/wallabag/pull/6182
* Fix public folder for Symfony 4+ by @kdecherf https://github.com/wallabag/wallabag/pull/6217
* Fix API allowed_registration by @caspermeijn https://github.com/wallabag/wallabag/pull/6315
* Enable PHP 8.2 in CI by @j0k3r https://github.com/wallabag/wallabag/pull/6469
* Fix/build stylelint error by @Simounet https://github.com/wallabag/wallabag/pull/6586
## [2.5.4](https://github.com/wallabag/wallabag/tree/2.5.4)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.5.3...2.5.4)
### Security fixes
* Fix adding tag to entries from other people by @j0k3r in https://github.com/wallabag/wallabag/pull/6290
* Fix XSS on username on share page by @j0k3r in https://github.com/wallabag/wallabag/pull/6288
* Fix CSRF on user deletion by @j0k3r in https://github.com/wallabag/wallabag/pull/6289
### Meta
* Fix release script by @j0k3r in https://github.com/wallabag/wallabag/pull/6275
## [2.5.3](https://github.com/wallabag/wallabag/tree/2.5.3)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.5.2...2.5.3)
### Security fixes
* Fix GHSA-qwx8-mxxx-mg96 https://github.com/wallabag/wallabag/commit/0f7460dbab9e29f4f7d2944aca20210f828b6abb by @Kdecherf, thanks to @bAuh0lz
* Fix GHSA-mrqx-mjc4-vfh3 https://github.com/wallabag/wallabag/commit/5ac6b6bff9e2e3a87fd88c2904ff3c6aac40722e by @Kdecherf, thanks to @bAuh0lz
### Meta
* Update deps before 2.5.3 by @j0k3r in https://github.com/wallabag/wallabag/pull/6241
## [2.5.2](https://github.com/wallabag/wallabag/tree/2.5.2)
[Full Changelog](https://github.com/wallabag/wallabag/compare/2.5.1...2.5.2)

View File

@ -40,7 +40,7 @@ ifdef DB
endif
-php bin/console doctrine:database:drop --force --env=test
php bin/console doctrine:database:create --env=test
php bin/console doctrine:migrations:migrate --no-interaction --env=test -vv
php bin/console doctrine:migrations:migrate --no-interaction --env=test
fixtures: ## Load fixtures into database
php bin/console doctrine:fixtures:load --no-interaction --env=test

View File

@ -1,6 +1,7 @@
# wallabag
![CI](https://github.com/wallabag/wallabag/workflows/CI/badge.svg)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/wallabag/wallabag/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/wallabag/wallabag/?branch=master)
[![Gitter](https://badges.gitter.im/gitterHQ/gitter.svg)](https://gitter.im/wallabag/wallabag)
[![Donation Status](https://img.shields.io/liberapay/goal/wallabag.svg?logo=liberapay)](https://liberapay.com/wallabag/donate)
[![Translation status](https://hosted.weblate.org/widgets/wallabag/-/svg-badge.svg)](https://hosted.weblate.org/engage/wallabag/?utm_source=widget)
@ -17,8 +18,6 @@ You can install it on your own server, or you can create an account on [wallabag
* Android app: [wallabag/android-app](https://github.com/wallabag/android-app)
* iOS app: [wallabag/ios-app](https://github.com/wallabag/ios-app)
* Browser extension: [wallabag/wallabagger](https://github.com/wallabag/wallabagger)
* GNOME (Linux) app: [read-it-later](https://gitlab.gnome.org/World/read-it-later) (not maintained by this project)
* All resources about wallabag ecosystem are listed here: https://github.com/wallabag/wallabag/wiki/wallabag-ecosystem
## Documentation

View File

@ -17,8 +17,9 @@ During this documentation, we assume the release is `$LAST_WALLABAG_RELEASE` (li
#### Create a new release on GitHub
- [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).
- Update [website](https://github.com/wallabag/website) to change MD5 sum and create the release blog post (based on the changelog).
- Update nginx config to change the redirect rule for `https://wllbg.org/latest-v2-package` & `http://wllbg.org/latest-v2` (they both redirect to the asset of the GitHub release)
- 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:!

View File

@ -13,6 +13,7 @@ class AppKernel extends Kernel
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new FOS\RestBundle\FOSRestBundle(),
@ -20,6 +21,7 @@ class AppKernel extends Kernel
new JMS\SerializerBundle\JMSSerializerBundle(),
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
new Nelmio\CorsBundle\NelmioCorsBundle(),
new Liip\ThemeBundle\LiipThemeBundle(),
new Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle(),
new Lexik\Bundle\FormFilterBundle\LexikFormFilterBundle(),
new FOS\OAuthServerBundle\FOSOAuthServerBundle(),
@ -34,7 +36,6 @@ class AppKernel extends Kernel
new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
new Http\HttplugBundle\HttplugBundle(),
new Sentry\SentryBundle\SentryBundle(),
new Twig\Extra\TwigExtraBundle\TwigExtraBundle(),
// wallabag bundles
new Wallabag\CoreBundle\WallabagCoreBundle(),
@ -62,6 +63,11 @@ class AppKernel extends Kernel
return $bundles;
}
public function getRootDir()
{
return __DIR__;
}
public function getCacheDir()
{
return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
@ -74,7 +80,7 @@ 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')) {

View File

@ -2,9 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -13,14 +10,12 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20160401000000 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$this->skipIf($schema->hasTable($this->getTable('entry')), 'Database already initialized');
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$sql = <<<SQL
CREATE TABLE {$this->getTable('craue_config_setting')} (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, PRIMARY KEY(name));
CREATE UNIQUE INDEX UNIQ_5D9649505E237E06 ON {$this->getTable('craue_config_setting')} (name);
@ -63,7 +58,7 @@ SQL
}
break;
case $platform instanceof MySQLPlatform:
case 'mysql':
$sql = <<<SQL
CREATE TABLE {$this->getTable('craue_config_setting')} (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_5D9649505E237E06 (name), PRIMARY KEY(name)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
CREATE TABLE {$this->getTable('entry')} (id INT AUTO_INCREMENT NOT NULL, user_id INT DEFAULT NULL, title LONGTEXT DEFAULT NULL, url LONGTEXT DEFAULT NULL, is_archived TINYINT(1) NOT NULL, is_starred TINYINT(1) NOT NULL, content LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, mimetype LONGTEXT DEFAULT NULL, language LONGTEXT DEFAULT NULL, reading_time INT DEFAULT NULL, domain_name LONGTEXT DEFAULT NULL, preview_picture LONGTEXT DEFAULT NULL, is_public TINYINT(1) DEFAULT '0', INDEX IDX_F4D18282A76ED395 (user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB;
@ -96,7 +91,7 @@ SQL
$this->addSql($query);
}
break;
case $platform instanceof PostgreSQLPlatform:
case 'postgresql':
$sql = <<<SQL
CREATE TABLE {$this->getTable('craue_config_setting')} (name VARCHAR(255) NOT NULL, value VARCHAR(255) DEFAULT NULL, section VARCHAR(255) DEFAULT NULL, PRIMARY KEY(name));
CREATE UNIQUE INDEX UNIQ_5D9649505E237E06 ON {$this->getTable('craue_config_setting')} (name);
@ -169,7 +164,7 @@ SQL
}
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$this->addSql("DROP TABLE {$this->getTable('craue_config_setting')}");
$this->addSql("DROP TABLE {$this->getTable('tagging_rule')}");

View File

@ -10,7 +10,7 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20160410190541 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -24,14 +24,14 @@ class Version20160410190541 extends WallabagMigration
$sharePublic = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_public'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_public'");
if (false === $sharePublic) {
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('share_public', '1', 'entry')");
}
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$entryTable->dropColumn('uid');

View File

@ -2,7 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -11,12 +10,12 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20160812120952 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
$this->skipIf($clientsTable->hasColumn('name'), 'It seems that you already played this migration.');
if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
if ('sqlite' === $this->connection->getDatabasePlatform()->getName()) {
// Can't use $clientsTable->addColumn('name', 'blob');
// because of the error:
// SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL
@ -32,11 +31,11 @@ class Version20160812120952 extends WallabagMigration
}
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
if ('sqlite' === $this->connection->getDatabasePlatform()->getName()) {
$databaseTablePrefix = $this->container->getParameter('database_table_prefix');
$this->addSql('DROP INDEX IDX_635D765EA76ED395');
$this->addSql('CREATE TEMPORARY TABLE __temp__' . $databaseTablePrefix . 'oauth2_clients AS SELECT id, random_id, redirect_uris, secret, allowed_grant_types FROM ' . $databaseTablePrefix . 'oauth2_clients');

View File

@ -10,12 +10,12 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20160911214952 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$redis = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_redis'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_redis'");
if (false === $redis) {
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('import_with_redis', 0, 'import')");
@ -24,7 +24,7 @@ class Version20160911214952 extends WallabagMigration
$rabbitmq = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_rabbitmq'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_rabbitmq'");
if (false === $rabbitmq) {
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('import_with_rabbitmq', 0, 'import')");
@ -33,7 +33,7 @@ class Version20160911214952 extends WallabagMigration
$this->skipIf(false !== $rabbitmq && false !== $redis, 'It seems that you already played this migration.');
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_redis';");
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'import_with_rabbitmq';");

View File

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

View File

@ -3,9 +3,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\SkipMigrationException;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -14,27 +11,26 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161001072726 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$platform = $this->connection->getDatabasePlatform();
$this->skipIf($platform instanceof SqlitePlatform, 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
$this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
// remove all FK from entry_tag
switch (true) {
case $platform instanceof MySQLPlatform:
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'mysql':
$query = $this->connection->query("
SELECT CONSTRAINT_NAME
FROM information_schema.key_column_usage
WHERE TABLE_NAME = '" . $this->getTable('entry_tag', WallabagMigration::UN_ESCAPED_TABLE) . "' AND CONSTRAINT_NAME LIKE 'FK_%'
AND TABLE_SCHEMA = '" . $this->connection->getDatabase() . "'"
);
$query->execute();
foreach ($query->fetchAllAssociative() as $fk) {
foreach ($query->fetchAll() as $fk) {
$this->addSql('ALTER TABLE ' . $this->getTable('entry_tag') . ' DROP FOREIGN KEY ' . $fk['CONSTRAINT_NAME']);
}
break;
case $platform instanceof PostgreSQLPlatform:
case 'postgresql':
// http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk
$query = $this->connection->query("
SELECT conrelid::regclass AS table_from
@ -46,8 +42,9 @@ class Version20161001072726 extends WallabagMigration
AND conrelid::regclass::text = '" . $this->getTable('entry_tag', WallabagMigration::UN_ESCAPED_TABLE) . "'
AND n.nspname = 'public';"
);
$query->execute();
foreach ($query->fetchAllAssociative() as $fk) {
foreach ($query->fetchAll() as $fk) {
$this->addSql('ALTER TABLE ' . $this->getTable('entry_tag') . ' DROP CONSTRAINT ' . $fk['conname']);
}
break;
@ -58,8 +55,8 @@ class Version20161001072726 extends WallabagMigration
// remove entry FK from annotation
switch (true) {
case $platform instanceof MySQLPlatform:
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'mysql':
$query = $this->connection->query("
SELECT CONSTRAINT_NAME
FROM information_schema.key_column_usage
@ -68,12 +65,13 @@ class Version20161001072726 extends WallabagMigration
AND COLUMN_NAME = 'entry_id'
AND TABLE_SCHEMA = '" . $this->connection->getDatabase() . "'"
);
$query->execute();
foreach ($query->fetchAllAssociative() as $fk) {
foreach ($query->fetchAll() as $fk) {
$this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' DROP FOREIGN KEY ' . $fk['CONSTRAINT_NAME']);
}
break;
case $platform instanceof PostgreSQLPlatform:
case 'postgresql':
// http://dba.stackexchange.com/questions/36979/retrieving-all-pk-and-fk
$query = $this->connection->query("
SELECT conrelid::regclass AS table_from
@ -86,8 +84,9 @@ class Version20161001072726 extends WallabagMigration
AND n.nspname = 'public'
AND pg_get_constraintdef(c.oid) LIKE '%entry_id%';"
);
$query->execute();
foreach ($query->fetchAllAssociative() as $fk) {
foreach ($query->fetchAll() as $fk) {
$this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' DROP CONSTRAINT ' . $fk['conname']);
}
break;
@ -96,7 +95,7 @@ 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');
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
throw new SkipMigrationException('Too complex ...');
}

View File

@ -2,7 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -11,9 +10,9 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161022134138 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$this->skipIf(!$this->connection->getDatabasePlatform() instanceof MySQLPlatform, 'This migration only apply to MySQL');
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
$this->addSql('ALTER DATABASE `' . $this->connection->getParams()['dbname'] . '` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;');
@ -39,9 +38,9 @@ class Version20161022134138 extends WallabagMigration
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE `name` `name` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$this->skipIf(!$this->connection->getDatabasePlatform() instanceof MySQLPlatform, 'This migration only apply to MySQL');
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
$this->addSql('ALTER DATABASE `' . $this->connection->getParams()['dbname'] . '` CHARACTER SET = utf8 COLLATE = utf8_unicode_ci;');

View File

@ -2,7 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -13,7 +12,7 @@ class Version20161024212538 extends WallabagMigration
{
private $constraintName = 'IDX_user_oauth_client';
public function up(Schema $schema): void
public function up(Schema $schema)
{
$clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
@ -30,7 +29,7 @@ class Version20161024212538 extends WallabagMigration
);
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$clientsTable = $schema->getTable($this->getTable('oauth2_clients'));
@ -38,7 +37,7 @@ class Version20161024212538 extends WallabagMigration
$clientsTable->dropColumn('user_id', 'integer');
if (!$this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
if ('sqlite' !== $this->connection->getDatabasePlatform()->getName()) {
$clientsTable->removeForeignKey($this->constraintName);
}
}

View File

@ -10,19 +10,19 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161031132655 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$images = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_images_enabled'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_images_enabled'");
$this->skipIf(false !== $images, 'It seems that you already played this migration.');
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('download_images_enabled', 0, 'misc')");
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_images_enabled';");
}

View File

@ -12,7 +12,7 @@ class Version20161104073720 extends WallabagMigration
{
private $indexName = 'IDX_entry_created_at';
public function up(Schema $schema): void
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf($entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.');
@ -20,7 +20,7 @@ class Version20161104073720 extends WallabagMigration
$entryTable->addIndex(['created_at'], $this->indexName);
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf(false === $entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.');

View File

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

View File

@ -10,12 +10,12 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161117071626 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$share = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_unmark'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_unmark'");
if (false === $share) {
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('share_unmark', 0, 'entry')");
@ -24,7 +24,7 @@ class Version20161117071626 extends WallabagMigration
$unmark = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'unmark_url'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'unmark_url'");
if (false === $unmark) {
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('unmark_url', 'https://unmark.it', 'entry')");
@ -33,7 +33,7 @@ class Version20161117071626 extends WallabagMigration
$this->skipIf(false !== $share && false !== $unmark, 'It seems that you already played this migration.');
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_unmark';");
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'unmark_url';");

View File

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

View File

@ -10,19 +10,19 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161122144743 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$access = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'restricted_access'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'restricted_access'");
$this->skipIf(false !== $access, 'It seems that you already played this migration.');
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('restricted_access', 0, 'entry')");
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'restricted_access';");
}

View File

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

View File

@ -10,7 +10,7 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161128084725 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$configTable = $schema->getTable($this->getTable('config'));
$this->skipIf($configTable->hasColumn('list_mode'), 'It seems that you already played this migration.');
@ -18,7 +18,7 @@ class Version20161128084725 extends WallabagMigration
$configTable->addColumn('list_mode', 'integer', ['notnull' => false]);
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$configTable = $schema->getTable($this->getTable('config'));
$configTable->dropColumn('list_mode');

View File

@ -16,7 +16,7 @@ class Version20161128131503 extends WallabagMigration
'expires_at' => 'datetime',
];
public function up(Schema $schema): void
public function up(Schema $schema)
{
$userTable = $schema->getTable($this->getTable('user'));
@ -26,7 +26,7 @@ class Version20161128131503 extends WallabagMigration
}
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$userTable = $schema->getTable($this->getTable('user'));

View File

@ -2,9 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -13,46 +10,42 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20161214094402 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf($entryTable->hasColumn('uid'), 'It seems that you already played this migration.');
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_entry AS SELECT id, user_id, uuid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public FROM ' . $this->getTable('entry'));
$this->addSql('DROP TABLE ' . $this->getTable('entry'));
$this->addSql('CREATE TABLE ' . $this->getTable('entry') . ' (id INTEGER NOT NULL, user_id INTEGER DEFAULT NULL, uid CLOB DEFAULT NULL COLLATE BINARY, 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, reading_time INTEGER DEFAULT NULL, domain_name CLOB DEFAULT NULL COLLATE BINARY, preview_picture CLOB DEFAULT NULL COLLATE BINARY, is_public BOOLEAN DEFAULT "0", PRIMARY KEY(id));');
$this->addSql('INSERT INTO ' . $this->getTable('entry') . ' (id, user_id, uid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public) SELECT id, user_id, uuid, title, url, is_archived, is_starred, content, created_at, updated_at, mimetype, language, reading_time, domain_name, preview_picture, is_public FROM __temp__wallabag_entry;');
$this->addSql('DROP TABLE __temp__wallabag_entry');
break;
case $platform instanceof MySQLPlatform:
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE uuid uid VARCHAR(23)');
break;
case $platform instanceof PostgreSQLPlatform:
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' RENAME uuid TO uid');
}
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf($entryTable->hasColumn('uuid'), 'It seems that you already played this migration.');
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
throw new SkipMigrationException('Too complex ...');
break;
case $platform instanceof MySQLPlatform:
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE uid uuid VARCHAR(23)');
break;
case $platform instanceof PostgreSQLPlatform:
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' RENAME uid TO uuid');
}
}

View File

@ -12,7 +12,7 @@ class Version20161214094403 extends WallabagMigration
{
private $indexName = 'IDX_entry_uid';
public function up(Schema $schema): void
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf($entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.');
@ -20,7 +20,7 @@ class Version20161214094403 extends WallabagMigration
$entryTable->addIndex(['uid'], $this->indexName);
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf(false === $entryTable->hasIndex($this->indexName), 'It seems that you already played this migration.');

View File

@ -13,7 +13,7 @@ class Version20170127093841 extends WallabagMigration
private $indexStarredName = 'IDX_entry_starred';
private $indexArchivedName = 'IDX_entry_archived';
public function up(Schema $schema): void
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf($entryTable->hasIndex($this->indexStarredName) && $entryTable->hasIndex($this->indexArchivedName), 'It seems that you already played this migration.');
@ -22,7 +22,7 @@ class Version20170127093841 extends WallabagMigration
$entryTable->addIndex(['is_archived'], $this->indexArchivedName);
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf(false === $entryTable->hasIndex($this->indexStarredName) && false === $entryTable->hasIndex($this->indexArchivedName), 'It seems that you already played this migration.');

View File

@ -10,12 +10,12 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170327194233 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$scuttle = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_scuttle'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_scuttle'");
$this->skipIf(false !== $scuttle, 'It seems that you already played this migration.');
@ -23,7 +23,7 @@ class Version20170327194233 extends WallabagMigration
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('scuttle_url', 'http://scuttle.org', 'entry')");
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'share_scuttle';");
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'scuttle_url';");

View File

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

View File

@ -10,7 +10,7 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170407200919 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf(!$entryTable->hasColumn('is_public'), 'It seems that you already played this migration.');
@ -18,7 +18,7 @@ class Version20170407200919 extends WallabagMigration
$entryTable->dropColumn('is_public');
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf($entryTable->hasColumn('is_public'), 'It seems that you already played this migration.');

View File

@ -10,17 +10,17 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170420134133 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_pictures';");
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$downloadPictures = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_pictures'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'download_pictures'");
$this->skipIf(false !== $downloadPictures, 'It seems that you already played this migration.');

View File

@ -2,7 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -11,7 +10,7 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170501115751 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$this->skipIf($schema->hasTable($this->getTable('site_credential')), 'It seems that you already played this migration.');
@ -26,13 +25,13 @@ class Version20170501115751 extends WallabagMigration
$table->setPrimaryKey(['id']);
$table->addForeignKeyConstraint($this->getTable('user'), ['user_id'], ['id'], [], 'fk_user');
if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) {
if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) {
$schema->dropSequence('site_credential_id_seq');
$schema->createSequence('site_credential_id_seq');
}
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$schema->dropTable($this->getTable('site_credential'));
}

View File

@ -2,7 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -18,18 +17,18 @@ class Version20170510082609 extends WallabagMigration
'email_canonical',
];
public function up(Schema $schema): void
public function up(Schema $schema)
{
$this->skipIf(!$this->connection->getDatabasePlatform() instanceof MySQLPlatform, 'This migration only apply to MySQL');
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
foreach ($this->fields as $field) {
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE ' . $field . ' ' . $field . ' VARCHAR(180) NOT NULL;');
}
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$this->skipIf(!$this->connection->getDatabasePlatform() instanceof MySQLPlatform, 'This migration only apply to MySQL');
$this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration only apply to MySQL');
foreach ($this->fields as $field) {
$this->addSql('ALTER TABLE ' . $this->getTable('user') . ' CHANGE ' . $field . ' ' . $field . ' VARCHAR(255) NOT NULL;');

View File

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

View File

@ -3,9 +3,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\SkipMigrationException;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -14,12 +11,10 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170511211659 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$annotationTableName = $this->getTable('annotation', true);
$userTableName = $this->getTable('user', true);
$entryTableName = $this->getTable('entry', true);
@ -58,29 +53,27 @@ EOD
);
$this->addSql('DROP TABLE __temp__wallabag_annotation');
break;
case $platform instanceof MySQLPlatform:
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' MODIFY quote TEXT NOT NULL');
break;
case $platform instanceof PostgreSQLPlatform:
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('annotation') . ' ALTER COLUMN quote TYPE TEXT');
break;
}
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$tableName = $this->getTable('annotation');
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
throw new SkipMigrationException('Too complex ...');
break;
case $platform instanceof MySQLPlatform:
case 'mysql':
$this->addSql('ALTER TABLE ' . $tableName . ' MODIFY quote VARCHAR(255) NOT NULL');
break;
case $platform instanceof PostgreSQLPlatform:
case 'postgresql':
$this->addSql('ALTER TABLE ' . $tableName . ' ALTER COLUMN quote TYPE VARCHAR(255)');
break;
}

View File

@ -10,19 +10,19 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170602075214 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$apiUserRegistration = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'api_user_registration'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'api_user_registration'");
$this->skipIf(false !== $apiUserRegistration, 'It seems that you already played this migration.');
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('api_user_registration', '0', 'api')");
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'api_user_registration';");
}

View File

@ -11,21 +11,19 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170606155640 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$this->skipIf(!$schema->hasTable($this->getTable('craue_config_setting')), 'Table already renamed');
$apiUserRegistration = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'");
$this->skipIf(false === $apiUserRegistration, 'It seems that you already played this migration.');
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'wallabag_url'");
}
public function down(Schema $schema): void
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

@ -2,7 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -11,9 +10,9 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170719231144 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$this->skipIf($this->connection->getDatabasePlatform() instanceof SqlitePlatform, 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
$this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
// Find tags which need to be merged
$dupTags = $this->connection->query('
@ -22,12 +21,13 @@ class Version20170719231144 extends WallabagMigration
GROUP BY LOWER(label)
HAVING COUNT(*) > 1'
);
$dupTags->execute();
foreach ($dupTags->fetchAllAssociative() as $duplicates) {
foreach ($dupTags->fetchAll() as $duplicates) {
$label = $duplicates['lower_label'];
// Retrieve all duplicate tags for a given tag
$tags = $this->connection->query('
$tags = $this->connection->executeQuery('
SELECT id
FROM ' . $this->getTable('tag') . '
WHERE LOWER(label) = :label
@ -41,7 +41,7 @@ class Version20170719231144 extends WallabagMigration
$newId = null;
$ids = [];
foreach ($tags->fetchAllAssociative() as $tag) {
foreach ($tags->fetchAll() as $tag) {
// Ignore the first tag as we use it as the new reference tag
if ($first) {
$first = false;
@ -86,7 +86,7 @@ class Version20170719231144 extends WallabagMigration
);
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
throw new SkipMigrationException('Too complex ...');
}

View File

@ -10,7 +10,7 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20170824113337 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -21,7 +21,7 @@ class Version20170824113337 extends WallabagMigration
]);
}
public function postUp(Schema $schema): void
public function postUp(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf(!$entryTable->hasColumn('starred_at'), 'Unable to add starred_at colum');
@ -34,7 +34,7 @@ class Version20170824113337 extends WallabagMigration
);
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -2,9 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -13,35 +10,31 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20171008195606 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$platform = $this->connection->getDatabasePlatform();
$this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
$this->skipIf($platform instanceof SqlitePlatform, 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
switch (true) {
case $platform instanceof MySQLPlatform:
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'mysql':
$this->addSql('UPDATE ' . $this->getTable('entry') . ' SET reading_time = 0 WHERE reading_time IS NULL;');
$this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE reading_time reading_time INT(11) NOT NULL;');
break;
case $platform instanceof PostgreSQLPlatform:
case 'postgresql':
$this->addSql('UPDATE ' . $this->getTable('entry') . ' SET reading_time = 0 WHERE reading_time IS NULL;');
$this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER COLUMN reading_time SET NOT NULL;');
break;
}
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$platform = $this->connection->getDatabasePlatform();
$this->skipIf('sqlite' === $this->connection->getDatabasePlatform()->getName(), 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
$this->skipIf($platform instanceof SqlitePlatform, 'Migration can only be executed safely on \'mysql\' or \'postgresql\'.');
switch (true) {
case $platform instanceof MySQLPlatform:
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' CHANGE reading_time reading_time INT(11);');
break;
case $platform instanceof PostgreSQLPlatform:
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('entry') . ' ALTER COLUMN reading_time DROP NOT NULL;');
break;
}

View File

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

View File

@ -10,19 +10,19 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20171120163128 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$storeArticleHeaders = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'store_article_headers'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'store_article_headers'");
$this->skipIf(false !== $storeArticleHeaders, 'It seems that you already played this migration.');
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('store_article_headers', '0', 'entry')");
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'store_article_headers';");
}

View File

@ -10,19 +10,19 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20171125164500 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$shaarliShareOriginUrl = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'shaarli_share_origin_url'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'shaarli_share_origin_url'");
$this->skipIf(false !== $shaarliShareOriginUrl, 'It seems that you already played this migration.');
$this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('shaarli_share_origin_url', '0', 'entry')");
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'shaarli_share_origin_url';");
}

View File

@ -10,7 +10,7 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20180405182455 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -21,7 +21,7 @@ class Version20180405182455 extends WallabagMigration
]);
}
public function postUp(Schema $schema): void
public function postUp(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
$this->skipIf(!$entryTable->hasColumn('archived_at'), 'Unable to add archived_at colum');
@ -34,7 +34,7 @@ class Version20180405182455 extends WallabagMigration
);
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -2,7 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -11,9 +10,9 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20181128203230 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$this->skipIf(!$this->connection->getDatabasePlatform() instanceof MySQLPlatform, 'This migration can only be applied on \'mysql\'.');
$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)');
@ -26,9 +25,9 @@ class Version20181128203230 extends WallabagMigration
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(191)');
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$this->skipIf(!$this->connection->getDatabasePlatform() instanceof MySQLPlatform, 'This migration can only be applied on \'mysql\'.');
$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)');

View File

@ -2,9 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -15,10 +12,8 @@ final class Version20181202073750 extends WallabagMigration
{
public function up(Schema $schema): void
{
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
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');
@ -33,13 +28,13 @@ final class Version20181202073750 extends WallabagMigration
$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 $platform instanceof MySQLPlatform:
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 $platform instanceof PostgreSQLPlatform:
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');
@ -50,10 +45,8 @@ final class Version20181202073750 extends WallabagMigration
public function down(Schema $schema): void
{
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
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');
@ -66,13 +59,13 @@ final class Version20181202073750 extends WallabagMigration
$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 $platform instanceof MySQLPlatform:
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 $platform instanceof PostgreSQLPlatform:
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');

View File

@ -118,13 +118,13 @@ final class Version20190129120000 extends WallabagMigration
],
];
public function up(Schema $schema): void
public function up(Schema $schema)
{
foreach ($this->settings as $setting) {
$settingEnabled = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = '" . $setting['name'] . "'");
->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = '" . $setting['name'] . "'");
if (false !== $settingEnabled) {
continue;
@ -134,7 +134,7 @@ final class Version20190129120000 extends WallabagMigration
}
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$this->skipIf(true, 'These settings are required and should not be removed.');
}

View File

@ -10,7 +10,7 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20190401105353 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -24,7 +24,7 @@ class Version20190401105353 extends WallabagMigration
$entryTable->addIndex(['user_id', 'hashed_url'], 'hashed_url_user_id', [], ['lengths' => [null, 40]]);
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -2,9 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -15,10 +12,8 @@ final class Version20190425115043 extends WallabagMigration
{
public function up(Schema $schema): void
{
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
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));
@ -27,11 +22,11 @@ final class Version20190425115043 extends WallabagMigration
$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 $platform instanceof MySQLPlatform:
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 $platform instanceof PostgreSQLPlatform:
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;
@ -40,10 +35,8 @@ final class Version20190425115043 extends WallabagMigration
public function down(Schema $schema): void
{
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
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) . '"');
@ -52,11 +45,11 @@ final class Version20190425115043 extends WallabagMigration
$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 $platform instanceof MySQLPlatform:
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 $platform instanceof PostgreSQLPlatform:
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

@ -3,9 +3,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\SkipMigrationException;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -20,10 +17,8 @@ final class Version20190510141130 extends WallabagMigration
{
public function up(Schema $schema): void
{
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
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');
@ -65,7 +60,7 @@ final class Version20190510141130 extends WallabagMigration
$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 $platform instanceof MySQLPlatform:
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');
@ -80,7 +75,7 @@ final class Version20190510141130 extends WallabagMigration
$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 $platform instanceof PostgreSQLPlatform:
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');

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -15,7 +14,7 @@ final class Version20190511165128 extends WallabagMigration
{
public function up(Schema $schema): void
{
$this->skipIf(!$this->connection->getDatabasePlatform() instanceof MySQLPlatform, 'This migration only apply to MySQL');
$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;');
@ -23,7 +22,7 @@ final class Version20190511165128 extends WallabagMigration
public function down(Schema $schema): void
{
$this->skipIf(!$this->connection->getDatabasePlatform() instanceof MySQLPlatform, 'This migration only apply to MySQL');
$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

@ -10,7 +10,7 @@ use Wallabag\CoreBundle\Doctrine\WallabagMigration;
*/
class Version20190601125843 extends WallabagMigration
{
public function up(Schema $schema): void
public function up(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));
@ -31,7 +31,7 @@ class Version20190601125843 extends WallabagMigration
$entryTable->addIndex(['user_id', 'hashed_given_url'], 'hashed_given_url_user_id', [], ['lengths' => [null, 40]]);
}
public function down(Schema $schema): void
public function down(Schema $schema)
{
$entryTable = $schema->getTable($this->getTable('entry'));

View File

@ -2,7 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -15,7 +14,7 @@ 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(!$this->connection->getDatabasePlatform() instanceof SqlitePlatform, 'Migration can only be executed safely on \'sqlite\'.');
$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;');
@ -43,7 +42,7 @@ final class Version20190619093534 extends WallabagMigration
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->skipIf(!$this->connection->getDatabasePlatform() instanceof SqlitePlatform, 'Migration can only be executed safely on \'sqlite\'.');
$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');

View File

@ -2,9 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -21,10 +18,8 @@ final class Version20190806130304 extends WallabagMigration
{
public function up(Schema $schema): void
{
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
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');
@ -49,7 +44,7 @@ final class Version20190806130304 extends WallabagMigration
$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 $platform instanceof MySQLPlatform:
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)');
@ -58,7 +53,7 @@ final class Version20190806130304 extends WallabagMigration
$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 $platform instanceof PostgreSQLPlatform:
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)');
@ -72,10 +67,8 @@ final class Version20190806130304 extends WallabagMigration
public function down(Schema $schema): void
{
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
switch ($this->connection->getDatabasePlatform()->getName()) {
case 'sqlite':
$this->addSql('DROP INDEX IDX_F4D18282A76ED395');
$this->addSql('DROP INDEX created_at');
$this->addSql('DROP INDEX uid');
@ -100,7 +93,7 @@ final class Version20190806130304 extends WallabagMigration
$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 $platform instanceof MySQLPlatform:
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'));
@ -109,7 +102,7 @@ final class Version20190806130304 extends WallabagMigration
$this->addSql('DROP INDEX tag_label ON ' . $this->getTable('tag'));
$this->addSql('DROP INDEX config_feed_token ON ' . $this->getTable('config'));
break;
case $platform instanceof PostgreSQLPlatform:
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'));

View File

@ -2,9 +2,6 @@
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -15,16 +12,14 @@ final class Version20190808124957 extends WallabagMigration
{
public function up(Schema $schema): void
{
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
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 $platform instanceof MySQLPlatform:
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' RENAME ' . $this->getTable('internal_setting'));
break;
case $platform instanceof PostgreSQLPlatform:
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' RENAME TO ' . $this->getTable('internal_setting'));
break;
}
@ -32,16 +27,14 @@ final class Version20190808124957 extends WallabagMigration
public function down(Schema $schema): void
{
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
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 $platform instanceof MySQLPlatform:
case 'mysql':
$this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' RENAME ' . $this->getTable('craue_config_setting'));
break;
case $platform instanceof PostgreSQLPlatform:
case 'postgresql':
$this->addSql('ALTER TABLE ' . $this->getTable('internal_setting') . ' RENAME TO ' . $this->getTable('craue_config_setting'));
break;
}

View File

@ -4,7 +4,6 @@ declare(strict_types=1);
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
@ -24,7 +23,7 @@ final class Version20190826204730 extends WallabagMigration
$userTable->setPrimaryKey(['id']);
$userTable->addForeignKeyConstraint($this->getTable('config'), ['config_id'], ['id'], [], 'fk_config');
if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) {
if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) {
$schema->dropSequence('ignore_origin_user_rule_id_seq');
$schema->createSequence('ignore_origin_user_rule_id_seq');
}
@ -36,7 +35,7 @@ final class Version20190826204730 extends WallabagMigration
$instanceTable->addColumn('rule', 'string', ['length' => 255]);
$instanceTable->setPrimaryKey(['id']);
if ($this->connection->getDatabasePlatform() instanceof PostgreSQLPlatform) {
if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) {
$schema->dropSequence('ignore_origin_instance_rule_id_seq');
$schema->createSequence('ignore_origin_instance_rule_id_seq');
}
@ -49,7 +48,7 @@ final class Version20190826204730 extends WallabagMigration
$previous_rule = $this->container
->get('doctrine.orm.default_entity_manager')
->getConnection()
->fetchOne('SELECT * FROM ' . $this->getTable('ignore_origin_instance_rule') . " WHERE rule = '" . $entity['rule'] . "'");
->fetchArray('SELECT * FROM ' . $this->getTable('ignore_origin_instance_rule') . " WHERE rule = '" . $entity['rule'] . "'");
if (false === $previous_rule) {
$this->addSql('INSERT INTO ' . $this->getTable('ignore_origin_instance_rule') . " (rule) VALUES ('" . $entity['rule'] . "');");

View File

@ -1,32 +0,0 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Drop theme fields from config table.
*/
final class Version20221123132612 extends WallabagMigration
{
public function up(Schema $schema): void
{
$configTable = $schema->getTable($this->getTable('config'));
$this->skipIf(!$configTable->hasColumn('theme'), 'It seems that you already played this migration.');
$configTable->dropColumn('theme');
}
public function down(Schema $schema): void
{
$configTable = $schema->getTable($this->getTable('config'));
$this->skipIf($configTable->hasColumn('theme'), 'It seems that you already played this migration.');
$configTable->addColumn('theme', 'string', [
'notnull' => true,
]);
}
}

View File

@ -1,69 +0,0 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Remove the deprecated (and removed in DBAL v3) `json_array` type.
*/
final class Version20221221092957 extends WallabagMigration
{
public function up(Schema $schema): void
{
$userTable = $this->getTable('user');
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
$this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_user AS SELECT id, username, username_canonical, email, email_canonical, enabled, password, last_login, password_requested_at, name, created_at, updated_at, authCode, emailTwoFactor, salt, confirmation_token, roles, googleAuthenticatorSecret, backupCodes FROM ' . $userTable);
$this->addSql('DROP TABLE ' . $userTable);
$this->addSql('CREATE TABLE ' . $userTable . ' (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, salt VARCHAR(255) DEFAULT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, confirmation_token VARCHAR(180) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles CLOB NOT NULL --(DC2Type:array)
, name CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, googleAuthenticatorSecret VARCHAR(255) DEFAULT NULL, backupCodes CLOB DEFAULT NULL --(DC2Type:json)
, emailTwoFactor BOOLEAN NOT NULL)');
$this->addSql('INSERT INTO ' . $userTable . ' (id, username, username_canonical, email, email_canonical, enabled, password, last_login, password_requested_at, name, created_at, updated_at, authCode, emailTwoFactor, salt, confirmation_token, roles, googleAuthenticatorSecret, backupCodes) SELECT id, username, username_canonical, email, email_canonical, enabled, password, last_login, password_requested_at, name, created_at, updated_at, authCode, emailTwoFactor, salt, confirmation_token, roles, googleAuthenticatorSecret, backupCodes FROM __temp__wallabag_user');
$this->addSql('DROP TABLE __temp__wallabag_user');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON ' . $userTable . ' (username_canonical)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON ' . $userTable . ' (email_canonical)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON ' . $userTable . ' (confirmation_token)');
break;
case $platform instanceof MySQLPlatform:
$this->addSql('ALTER TABLE ' . $userTable . ' CHANGE backupCodes backupCodes JSON DEFAULT NULL');
break;
case $platform instanceof PostgreSQLPlatform:
$this->addSql('ALTER TABLE ' . $userTable . ' ALTER backupcodes TYPE JSON USING backupcodes::json');
break;
}
}
public function down(Schema $schema): void
{
$userTable = $this->getTable('user');
$platform = $this->connection->getDatabasePlatform();
switch (true) {
case $platform instanceof SqlitePlatform:
$this->addSql('CREATE TEMPORARY TABLE __temp__wallabag_user 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, googleAuthenticatorSecret, backupCodes, emailTwoFactor FROM ' . $userTable);
$this->addSql('DROP TABLE ' . $userTable);
$this->addSql('CREATE TABLE ' . $userTable . ' (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, salt VARCHAR(255) DEFAULT NULL, password VARCHAR(255) NOT NULL, last_login DATETIME DEFAULT NULL, confirmation_token VARCHAR(180) DEFAULT NULL, password_requested_at DATETIME DEFAULT NULL, roles CLOB NOT NULL --(DC2Type:array)
, name CLOB DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, authCode INTEGER DEFAULT NULL, googleAuthenticatorSecret VARCHAR(255) DEFAULT NULL, backupCodes CLOB DEFAULT NULL --(DC2Type:json_array)
, emailTwoFactor BOOLEAN NOT NULL)');
$this->addSql('INSERT INTO ' . $userTable . ' (id, username, username_canonical, email, email_canonical, enabled, salt, password, last_login, confirmation_token, password_requested_at, roles, name, created_at, updated_at, authCode, googleAuthenticatorSecret, backupCodes, 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, googleAuthenticatorSecret, backupCodes, emailTwoFactor FROM __temp__wallabag_user');
$this->addSql('DROP TABLE __temp__wallabag_user');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E592FC23A8 ON ' . $userTable . ' (username_canonical)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5A0D96FBF ON ' . $userTable . ' (email_canonical)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D63E7E5C05FB297 ON ' . $userTable . ' (confirmation_token)');
break;
case $platform instanceof MySQLPlatform:
$this->addSql('ALTER TABLE ' . $userTable . ' CHANGE backupCodes backupCodes JSON DEFAULT NULL COMMENT \'(DC2Type:json_array)\'');
break;
case $platform instanceof PostgreSQLPlatform:
$this->addSql('ALTER TABLE ' . $userTable . ' ALTER backupCodes TYPE TEXT');
break;
}
}
}

View File

@ -1,30 +0,0 @@
<?php
namespace Application\Migrations;
use Doctrine\DBAL\Schema\Schema;
use Wallabag\CoreBundle\Doctrine\WallabagMigration;
/**
* Added a new setting to display or not thumbnails.
*/
final class Version20230613121354 extends WallabagMigration
{
public function up(Schema $schema): void
{
$configTable = $schema->getTable($this->getTable('config'));
$this->skipIf($configTable->hasColumn('display_thumbnails'), 'It seems that you already played this migration.');
$configTable->addColumn('display_thumbnails', 'integer', [
'default' => 1,
'notnull' => false,
]);
}
public function down(Schema $schema): void
{
$configTable = $schema->getTable($this->getTable('config'));
$configTable->dropColumn('display_thumbnails');
}
}

View File

@ -2,7 +2,7 @@ settings_changed: Configuración actualizada
download_pictures: Descargar imágenes en el servidor
diaspora_url: URL de diaspora*, si el servicio está activado
export_epub: Activar exportación a ePub
export_mobi: Activar exportación a .mobi (deprecado, se eliminará pronto)
export_mobi: Activar exportación a .mobi
export_pdf: Activar exportación a PDF
export_csv: Activar exportación a CSV
export_json: Activar exportación a JSON

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