aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2019-06-21 12:46:53 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-06-21 12:46:53 +0200
commita2f4efe6d2a90d8a2b84a275f48a07dc8aa0a84f (patch)
tree85c658988b4a769c535e8d3c7a34b573e40818c6
parent0a01a5f195fa00be0290be1871b6f4798e55d0be (diff)
downloadwallabag-a2f4efe6d2a90d8a2b84a275f48a07dc8aa0a84f.tar.gz
wallabag-a2f4efe6d2a90d8a2b84a275f48a07dc8aa0a84f.tar.zst
wallabag-a2f4efe6d2a90d8a2b84a275f48a07dc8aa0a84f.zip
Use Twig 2.0
`mnapoli/piwik-twig-extension` locked Twig to the 1.10 version. The new version is compatible with Twig 2.0
-rw-r--r--composer.json2
-rw-r--r--composer.lock49
-rw-r--r--src/Wallabag/CoreBundle/Controller/FeedController.php2
-rw-r--r--src/Wallabag/CoreBundle/Twig/WallabagExtension.php23
-rw-r--r--src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php15
-rw-r--r--tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php4
6 files changed, 56 insertions, 39 deletions
diff --git a/composer.json b/composer.json
index 44ac3474..46dc409b 100644
--- a/composer.json
+++ b/composer.json
@@ -78,7 +78,7 @@
78 "guzzlehttp/guzzle": "^5.3.1", 78 "guzzlehttp/guzzle": "^5.3.1",
79 "doctrine/doctrine-migrations-bundle": "^1.3", 79 "doctrine/doctrine-migrations-bundle": "^1.3",
80 "craue/config-bundle": "dev-utf8mb4", 80 "craue/config-bundle": "dev-utf8mb4",
81 "mnapoli/piwik-twig-extension": "^1.0", 81 "mnapoli/piwik-twig-extension": "^2.0",
82 "ocramius/proxy-manager": "^2.1.1", 82 "ocramius/proxy-manager": "^2.1.1",
83 "white-october/pagerfanta-bundle": "^1.1", 83 "white-october/pagerfanta-bundle": "^1.1",
84 "php-amqplib/rabbitmq-bundle": "^1.14", 84 "php-amqplib/rabbitmq-bundle": "^1.14",
diff --git a/composer.lock b/composer.lock
index 094613cd..8ff8fba8 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5 "This file is @generated automatically" 5 "This file is @generated automatically"
6 ], 6 ],
7 "content-hash": "7e872d70c69629db503d9b8ed18e0f40", 7 "content-hash": "7b43c6d21bc5016660c4e95aa0fdbc12",
8 "packages": [ 8 "packages": [
9 { 9 {
10 "name": "bdunogier/guzzle-site-authenticator", 10 "name": "bdunogier/guzzle-site-authenticator",
@@ -4783,24 +4783,25 @@
4783 }, 4783 },
4784 { 4784 {
4785 "name": "mnapoli/piwik-twig-extension", 4785 "name": "mnapoli/piwik-twig-extension",
4786 "version": "1.0.0", 4786 "version": "2.0.0",
4787 "source": { 4787 "source": {
4788 "type": "git", 4788 "type": "git",
4789 "url": "https://github.com/mnapoli/PiwikTwigExtension.git", 4789 "url": "https://github.com/mnapoli/PiwikTwigExtension.git",
4790 "reference": "5171ab7221830a9d377add03dd60dbe6bd7b331f" 4790 "reference": "95cafbaca13e436b1939fe0e70079f6db893fd51"
4791 }, 4791 },
4792 "dist": { 4792 "dist": {
4793 "type": "zip", 4793 "type": "zip",
4794 "url": "https://api.github.com/repos/mnapoli/PiwikTwigExtension/zipball/5171ab7221830a9d377add03dd60dbe6bd7b331f", 4794 "url": "https://api.github.com/repos/mnapoli/PiwikTwigExtension/zipball/95cafbaca13e436b1939fe0e70079f6db893fd51",
4795 "reference": "5171ab7221830a9d377add03dd60dbe6bd7b331f", 4795 "reference": "95cafbaca13e436b1939fe0e70079f6db893fd51",
4796 "shasum": "" 4796 "shasum": ""
4797 }, 4797 },
4798 "require": { 4798 "require": {
4799 "php": ">=5.4", 4799 "php": ">=7.0",
4800 "twig/twig": "~1.10" 4800 "twig/twig": "~2.10"
4801 }, 4801 },
4802 "require-dev": { 4802 "require-dev": {
4803 "phpunit/phpunit": "~4.0" 4803 "php-coveralls/php-coveralls": "^2.0",
4804 "symfony/phpunit-bridge": "^4.2"
4804 }, 4805 },
4805 "type": "library", 4806 "type": "library",
4806 "autoload": { 4807 "autoload": {
@@ -4812,7 +4813,7 @@
4812 "license": [ 4813 "license": [
4813 "MIT" 4814 "MIT"
4814 ], 4815 ],
4815 "time": "2014-09-16T06:51:19+00:00" 4816 "time": "2019-06-21T10:24:22+00:00"
4816 }, 4817 },
4817 { 4818 {
4818 "name": "monolog/monolog", 4819 "name": "monolog/monolog",
@@ -8602,16 +8603,16 @@
8602 }, 8603 },
8603 { 8604 {
8604 "name": "symfony/swiftmailer-bundle", 8605 "name": "symfony/swiftmailer-bundle",
8605 "version": "v3.2.6", 8606 "version": "v3.2.8",
8606 "source": { 8607 "source": {
8607 "type": "git", 8608 "type": "git",
8608 "url": "https://github.com/symfony/swiftmailer-bundle.git", 8609 "url": "https://github.com/symfony/swiftmailer-bundle.git",
8609 "reference": "7a83160b50a2479d37eb74ba71577380b9afe4f5" 8610 "reference": "cb125b3648f132fb8070b55393f20cb310907d3b"
8610 }, 8611 },
8611 "dist": { 8612 "dist": {
8612 "type": "zip", 8613 "type": "zip",
8613 "url": "https://api.github.com/repos/symfony/swiftmailer-bundle/zipball/7a83160b50a2479d37eb74ba71577380b9afe4f5", 8614 "url": "https://api.github.com/repos/symfony/swiftmailer-bundle/zipball/cb125b3648f132fb8070b55393f20cb310907d3b",
8614 "reference": "7a83160b50a2479d37eb74ba71577380b9afe4f5", 8615 "reference": "cb125b3648f132fb8070b55393f20cb310907d3b",
8615 "shasum": "" 8616 "shasum": ""
8616 }, 8617 },
8617 "require": { 8618 "require": {
@@ -8621,6 +8622,9 @@
8621 "symfony/dependency-injection": "~2.7|~3.3|~4.0", 8622 "symfony/dependency-injection": "~2.7|~3.3|~4.0",
8622 "symfony/http-kernel": "~2.7|~3.3|~4.0" 8623 "symfony/http-kernel": "~2.7|~3.3|~4.0"
8623 }, 8624 },
8625 "conflict": {
8626 "twig/twig": "<1.41|<2.10"
8627 },
8624 "require-dev": { 8628 "require-dev": {
8625 "symfony/console": "~2.7|~3.3|~4.0", 8629 "symfony/console": "~2.7|~3.3|~4.0",
8626 "symfony/framework-bundle": "~2.7|~3.3|~4.0", 8630 "symfony/framework-bundle": "~2.7|~3.3|~4.0",
@@ -8660,7 +8664,7 @@
8660 ], 8664 ],
8661 "description": "Symfony SwiftmailerBundle", 8665 "description": "Symfony SwiftmailerBundle",
8662 "homepage": "http://symfony.com", 8666 "homepage": "http://symfony.com",
8663 "time": "2019-04-18T15:52:54+00:00" 8667 "time": "2019-06-18T15:27:04+00:00"
8664 }, 8668 },
8665 { 8669 {
8666 "name": "symfony/symfony", 8670 "name": "symfony/symfony",
@@ -8920,21 +8924,22 @@
8920 }, 8924 },
8921 { 8925 {
8922 "name": "twig/twig", 8926 "name": "twig/twig",
8923 "version": "v1.42.2", 8927 "version": "v2.11.3",
8924 "source": { 8928 "source": {
8925 "type": "git", 8929 "type": "git",
8926 "url": "https://github.com/twigphp/Twig.git", 8930 "url": "https://github.com/twigphp/Twig.git",
8927 "reference": "21707d6ebd05476854805e4f91b836531941bcd4" 8931 "reference": "699ed2342557c88789a15402de5eb834dedd6792"
8928 }, 8932 },
8929 "dist": { 8933 "dist": {
8930 "type": "zip", 8934 "type": "zip",
8931 "url": "https://api.github.com/repos/twigphp/Twig/zipball/21707d6ebd05476854805e4f91b836531941bcd4", 8935 "url": "https://api.github.com/repos/twigphp/Twig/zipball/699ed2342557c88789a15402de5eb834dedd6792",
8932 "reference": "21707d6ebd05476854805e4f91b836531941bcd4", 8936 "reference": "699ed2342557c88789a15402de5eb834dedd6792",
8933 "shasum": "" 8937 "shasum": ""
8934 }, 8938 },
8935 "require": { 8939 "require": {
8936 "php": ">=5.4.0", 8940 "php": "^7.0",
8937 "symfony/polyfill-ctype": "^1.8" 8941 "symfony/polyfill-ctype": "^1.8",
8942 "symfony/polyfill-mbstring": "^1.3"
8938 }, 8943 },
8939 "require-dev": { 8944 "require-dev": {
8940 "psr/container": "^1.0", 8945 "psr/container": "^1.0",
@@ -8944,7 +8949,7 @@
8944 "type": "library", 8949 "type": "library",
8945 "extra": { 8950 "extra": {
8946 "branch-alias": { 8951 "branch-alias": {
8947 "dev-master": "1.42-dev" 8952 "dev-master": "2.11-dev"
8948 } 8953 }
8949 }, 8954 },
8950 "autoload": { 8955 "autoload": {
@@ -8982,7 +8987,7 @@
8982 "keywords": [ 8987 "keywords": [
8983 "templating" 8988 "templating"
8984 ], 8989 ],
8985 "time": "2019-06-18T15:35:16+00:00" 8990 "time": "2019-06-18T15:37:11+00:00"
8986 }, 8991 },
8987 { 8992 {
8988 "name": "wallabag/php-mobi", 8993 "name": "wallabag/php-mobi",
diff --git a/src/Wallabag/CoreBundle/Controller/FeedController.php b/src/Wallabag/CoreBundle/Controller/FeedController.php
index 8d422a90..9f671735 100644
--- a/src/Wallabag/CoreBundle/Controller/FeedController.php
+++ b/src/Wallabag/CoreBundle/Controller/FeedController.php
@@ -176,7 +176,7 @@ class FeedController extends Controller
176 $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false); 176 $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false);
177 $entries = new Pagerfanta($pagerAdapter); 177 $entries = new Pagerfanta($pagerAdapter);
178 178
179 $perPage = $user->getConfig()->getFeedLimit() ?: $this->getParameter('wallabag_core.Feed_limit'); 179 $perPage = $user->getConfig()->getFeedLimit() ?: $this->getParameter('wallabag_core.feed_limit');
180 $entries->setMaxPerPage($perPage); 180 $entries->setMaxPerPage($perPage);
181 181
182 $url = $this->generateUrl( 182 $url = $this->generateUrl(
diff --git a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
index 536185d4..02f17f50 100644
--- a/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
+++ b/src/Wallabag/CoreBundle/Twig/WallabagExtension.php
@@ -4,10 +4,14 @@ namespace Wallabag\CoreBundle\Twig;
4 4
5use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; 5use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
6use Symfony\Component\Translation\TranslatorInterface; 6use Symfony\Component\Translation\TranslatorInterface;
7use Twig\Extension\AbstractExtension;
8use Twig\Extension\GlobalsInterface;
9use Twig\TwigFilter;
10use Twig\TwigFunction;
7use Wallabag\CoreBundle\Repository\EntryRepository; 11use Wallabag\CoreBundle\Repository\EntryRepository;
8use Wallabag\CoreBundle\Repository\TagRepository; 12use Wallabag\CoreBundle\Repository\TagRepository;
9 13
10class WallabagExtension extends \Twig_Extension implements \Twig_Extension_GlobalsInterface 14class WallabagExtension extends AbstractExtension implements GlobalsInterface
11{ 15{
12 private $tokenStorage; 16 private $tokenStorage;
13 private $entryRepository; 17 private $entryRepository;
@@ -24,21 +28,26 @@ class WallabagExtension extends \Twig_Extension implements \Twig_Extension_Globa
24 $this->translator = $translator; 28 $this->translator = $translator;
25 } 29 }
26 30
31 public function getGlobals()
32 {
33 return [];
34 }
35
27 public function getFilters() 36 public function getFilters()
28 { 37 {
29 return [ 38 return [
30 new \Twig_SimpleFilter('removeWww', [$this, 'removeWww']), 39 new TwigFilter('removeWww', [$this, 'removeWww']),
31 new \Twig_SimpleFilter('removeScheme', [$this, 'removeScheme']), 40 new TwigFilter('removeScheme', [$this, 'removeScheme']),
32 new \Twig_SimpleFilter('removeSchemeAndWww', [$this, 'removeSchemeAndWww']), 41 new TwigFilter('removeSchemeAndWww', [$this, 'removeSchemeAndWww']),
33 ]; 42 ];
34 } 43 }
35 44
36 public function getFunctions() 45 public function getFunctions()
37 { 46 {
38 return [ 47 return [
39 new \Twig_SimpleFunction('count_entries', [$this, 'countEntries']), 48 new TwigFunction('count_entries', [$this, 'countEntries']),
40 new \Twig_SimpleFunction('count_tags', [$this, 'countTags']), 49 new TwigFunction('count_tags', [$this, 'countTags']),
41 new \Twig_SimpleFunction('display_stats', [$this, 'displayStats']), 50 new TwigFunction('display_stats', [$this, 'displayStats']),
42 ]; 51 ];
43 } 52 }
44 53
diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
index 2797efde..e131deb6 100644
--- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
+++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
@@ -4,6 +4,7 @@ namespace Wallabag\UserBundle\Mailer;
4 4
5use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; 5use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface;
6use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; 6use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface;
7use Twig\Environment;
7 8
8/** 9/**
9 * Custom mailer for TwoFactorBundle email. 10 * Custom mailer for TwoFactorBundle email.
@@ -56,14 +57,14 @@ class AuthCodeMailer implements AuthCodeMailerInterface
56 /** 57 /**
57 * Initialize the auth code mailer with the SwiftMailer object. 58 * Initialize the auth code mailer with the SwiftMailer object.
58 * 59 *
59 * @param \Swift_Mailer $mailer 60 * @param \Swift_Mailer $mailer
60 * @param \Twig_Environment $twig 61 * @param Environment $twig
61 * @param string $senderEmail 62 * @param string $senderEmail
62 * @param string $senderName 63 * @param string $senderName
63 * @param string $supportUrl wallabag support url 64 * @param string $supportUrl wallabag support url
64 * @param string $wallabagUrl wallabag instance url 65 * @param string $wallabagUrl wallabag instance url
65 */ 66 */
66 public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl) 67 public function __construct(\Swift_Mailer $mailer, Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl)
67 { 68 {
68 $this->mailer = $mailer; 69 $this->mailer = $mailer;
69 $this->twig = $twig; 70 $this->twig = $twig;
diff --git a/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php b/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php
index 1713c10c..4f93a92c 100644
--- a/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php
+++ b/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php
@@ -3,6 +3,8 @@
3namespace Tests\Wallabag\UserBundle\Mailer; 3namespace Tests\Wallabag\UserBundle\Mailer;
4 4
5use PHPUnit\Framework\TestCase; 5use PHPUnit\Framework\TestCase;
6use Twig\Environment;
7use Twig\Loader\ArrayLoader;
6use Wallabag\UserBundle\Entity\User; 8use Wallabag\UserBundle\Entity\User;
7use Wallabag\UserBundle\Mailer\AuthCodeMailer; 9use Wallabag\UserBundle\Mailer\AuthCodeMailer;
8 10
@@ -27,7 +29,7 @@ class AuthCodeMailerTest extends TestCase
27{% block body_text %}text body {{ support_url }}{% endblock %} 29{% block body_text %}text body {{ support_url }}{% endblock %}
28TWIG; 30TWIG;
29 31
30 $this->twig = new \Twig_Environment(new \Twig_Loader_Array(['WallabagUserBundle:TwoFactor:email_auth_code.html.twig' => $twigTemplate])); 32 $this->twig = new Environment(new ArrayLoader(['WallabagUserBundle:TwoFactor:email_auth_code.html.twig' => $twigTemplate]));
31 } 33 }
32 34
33 public function testSendEmail() 35 public function testSendEmail()