aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/Resources/CraueConfigBundle/views/Settings/modify.html.twig10
-rw-r--r--app/config/config.yml1
-rw-r--r--app/config/services.yml8
-rw-r--r--composer.json2
-rw-r--r--src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php9
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/services.yml1
-rw-r--r--tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php27
-rw-r--r--var/SymfonyRequirements.php6
8 files changed, 49 insertions, 15 deletions
diff --git a/app/Resources/CraueConfigBundle/views/Settings/modify.html.twig b/app/Resources/CraueConfigBundle/views/Settings/modify.html.twig
index c4e735ee..b81b8651 100644
--- a/app/Resources/CraueConfigBundle/views/Settings/modify.html.twig
+++ b/app/Resources/CraueConfigBundle/views/Settings/modify.html.twig
@@ -20,12 +20,10 @@
20 20
21 {% for section in sections | craue_sortSections %} 21 {% for section in sections | craue_sortSections %}
22 <div id="set-{{ section }}" class="col s12"> 22 <div id="set-{{ section }}" class="col s12">
23 {% for setting in form.settings if setting.section.vars.value == section %} 23 {% for setting in form.settings if setting.vars.value.section == section %}
24 {{ form_row(setting.name) }} 24 {{ form_row(setting.value, {
25 {{ form_row(setting.section) }} 25 'label': setting.vars.value.name | trans({}, 'CraueConfigBundle'),
26 {{ form_row(setting.value, { 26 }) }}
27 'label': setting.name.vars.value | trans({}, 'CraueConfigBundle'),
28 }) }}
29 {% endfor %} 27 {% endfor %}
30 </div> 28 </div>
31 {% endfor %} 29 {% endfor %}
diff --git a/app/config/config.yml b/app/config/config.yml
index 116bb04c..28abe734 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -6,6 +6,7 @@ imports:
6parameters: 6parameters:
7 # Allows to use the live reload feature for changes in assets 7 # Allows to use the live reload feature for changes in assets
8 use_webpack_dev_server: false 8 use_webpack_dev_server: false
9 craue_config.cache_adapter.class: Craue\ConfigBundle\CacheAdapter\SymfonyCacheComponentAdapter
9 10
10framework: 11framework:
11 #esi: ~ 12 #esi: ~
diff --git a/app/config/services.yml b/app/config/services.yml
index 9a1ce80b..7b85d846 100644
--- a/app/config/services.yml
+++ b/app/config/services.yml
@@ -42,3 +42,11 @@ services:
42 arguments: ["@session"] 42 arguments: ["@session"]
43 tags: 43 tags:
44 - { name: kernel.event_listener, event: security.interactive_login, method: onInteractiveLogin } 44 - { name: kernel.event_listener, event: security.interactive_login, method: onInteractiveLogin }
45
46 craue_config_cache_provider:
47 class: Symfony\Component\Cache\Adapter\FilesystemAdapter
48 public: false
49 arguments:
50 - 'craue_config'
51 - 0
52 - '%kernel.cache_dir%'
diff --git a/composer.json b/composer.json
index bfd42339..02a79853 100644
--- a/composer.json
+++ b/composer.json
@@ -75,7 +75,7 @@
75 "guzzlehttp/guzzle": "^5.3.1", 75 "guzzlehttp/guzzle": "^5.3.1",
76 "doctrine/doctrine-migrations-bundle": "^1.0", 76 "doctrine/doctrine-migrations-bundle": "^1.0",
77 "paragonie/random_compat": "~1.0", 77 "paragonie/random_compat": "~1.0",
78 "craue/config-bundle": "~1.4", 78 "craue/config-bundle": "~2.0",
79 "mnapoli/piwik-twig-extension": "^1.0", 79 "mnapoli/piwik-twig-extension": "^1.0",
80 "ocramius/proxy-manager": "1.*", 80 "ocramius/proxy-manager": "1.*",
81 "white-october/pagerfanta-bundle": "^1.0", 81 "white-october/pagerfanta-bundle": "^1.0",
diff --git a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
index b490e209..add27db2 100644
--- a/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
+++ b/src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
@@ -8,6 +8,7 @@ use Wallabag\CoreBundle\Entity\Tag;
8use Wallabag\CoreBundle\Repository\EntryRepository; 8use Wallabag\CoreBundle\Repository\EntryRepository;
9use Wallabag\CoreBundle\Repository\TagRepository; 9use Wallabag\CoreBundle\Repository\TagRepository;
10use Wallabag\UserBundle\Entity\User; 10use Wallabag\UserBundle\Entity\User;
11use Psr\Log\LoggerInterface;
11 12
12class RuleBasedTagger 13class RuleBasedTagger
13{ 14{
@@ -15,11 +16,12 @@ class RuleBasedTagger
15 private $tagRepository; 16 private $tagRepository;
16 private $entryRepository; 17 private $entryRepository;
17 18
18 public function __construct(RulerZ $rulerz, TagRepository $tagRepository, EntryRepository $entryRepository) 19 public function __construct(RulerZ $rulerz, TagRepository $tagRepository, EntryRepository $entryRepository, LoggerInterface $logger)
19 { 20 {
20 $this->rulerz = $rulerz; 21 $this->rulerz = $rulerz;
21 $this->tagRepository = $tagRepository; 22 $this->tagRepository = $tagRepository;
22 $this->entryRepository = $entryRepository; 23 $this->entryRepository = $entryRepository;
24 $this->logger = $logger;
23 } 25 }
24 26
25 /** 27 /**
@@ -36,6 +38,11 @@ class RuleBasedTagger
36 continue; 38 continue;
37 } 39 }
38 40
41 $this->logger->info('Matching rule.', [
42 'rule' => $rule->getRule(),
43 'tags' => $rule->getTags(),
44 ]);
45
39 foreach ($rule->getTags() as $label) { 46 foreach ($rule->getTags() as $label) {
40 $tag = $this->getTag($label); 47 $tag = $this->getTag($label);
41 48
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml
index 6c9195ce..a9134ac3 100644
--- a/src/Wallabag/CoreBundle/Resources/config/services.yml
+++ b/src/Wallabag/CoreBundle/Resources/config/services.yml
@@ -99,6 +99,7 @@ services:
99 - "@rulerz" 99 - "@rulerz"
100 - "@wallabag_core.tag_repository" 100 - "@wallabag_core.tag_repository"
101 - "@wallabag_core.entry_repository" 101 - "@wallabag_core.entry_repository"
102 - "@logger"
102 103
103 # repository as a service 104 # repository as a service
104 wallabag_core.entry_repository: 105 wallabag_core.entry_repository:
diff --git a/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php b/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php
index 17b08c2a..1e21f400 100644
--- a/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/RuleBasedTaggerTest.php
@@ -2,6 +2,8 @@
2 2
3namespace Tests\Wallabag\CoreBundle\Helper; 3namespace Tests\Wallabag\CoreBundle\Helper;
4 4
5use Monolog\Handler\TestHandler;
6use Monolog\Logger;
5use Wallabag\CoreBundle\Entity\Config; 7use Wallabag\CoreBundle\Entity\Config;
6use Wallabag\CoreBundle\Entity\Entry; 8use Wallabag\CoreBundle\Entity\Entry;
7use Wallabag\CoreBundle\Entity\Tag; 9use Wallabag\CoreBundle\Entity\Tag;
@@ -15,14 +17,19 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
15 private $tagRepository; 17 private $tagRepository;
16 private $entryRepository; 18 private $entryRepository;
17 private $tagger; 19 private $tagger;
20 private $logger;
21 private $handler;
18 22
19 public function setUp() 23 public function setUp()
20 { 24 {
21 $this->rulerz = $this->getRulerZMock(); 25 $this->rulerz = $this->getRulerZMock();
22 $this->tagRepository = $this->getTagRepositoryMock(); 26 $this->tagRepository = $this->getTagRepositoryMock();
23 $this->entryRepository = $this->getEntryRepositoryMock(); 27 $this->entryRepository = $this->getEntryRepositoryMock();
28 $this->logger = $this->getLogger();
29 $this->handler = new TestHandler();
30 $this->logger->pushHandler($this->handler);
24 31
25 $this->tagger = new RuleBasedTagger($this->rulerz, $this->tagRepository, $this->entryRepository); 32 $this->tagger = new RuleBasedTagger($this->rulerz, $this->tagRepository, $this->entryRepository, $this->logger);
26 } 33 }
27 34
28 public function testTagWithNoRule() 35 public function testTagWithNoRule()
@@ -32,6 +39,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
32 $this->tagger->tag($entry); 39 $this->tagger->tag($entry);
33 40
34 $this->assertTrue($entry->getTags()->isEmpty()); 41 $this->assertTrue($entry->getTags()->isEmpty());
42 $records = $this->handler->getRecords();
43 $this->assertCount(0, $records);
35 } 44 }
36 45
37 public function testTagWithNoMatchingRule() 46 public function testTagWithNoMatchingRule()
@@ -49,6 +58,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
49 $this->tagger->tag($entry); 58 $this->tagger->tag($entry);
50 59
51 $this->assertTrue($entry->getTags()->isEmpty()); 60 $this->assertTrue($entry->getTags()->isEmpty());
61 $records = $this->handler->getRecords();
62 $this->assertCount(0, $records);
52 } 63 }
53 64
54 public function testTagWithAMatchingRule() 65 public function testTagWithAMatchingRule()
@@ -70,6 +81,9 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
70 $tags = $entry->getTags(); 81 $tags = $entry->getTags();
71 $this->assertSame('foo', $tags[0]->getLabel()); 82 $this->assertSame('foo', $tags[0]->getLabel());
72 $this->assertSame('bar', $tags[1]->getLabel()); 83 $this->assertSame('bar', $tags[1]->getLabel());
84
85 $records = $this->handler->getRecords();
86 $this->assertCount(1, $records);
73 } 87 }
74 88
75 public function testTagWithAMixOfMatchingRules() 89 public function testTagWithAMixOfMatchingRules()
@@ -90,6 +104,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
90 104
91 $tags = $entry->getTags(); 105 $tags = $entry->getTags();
92 $this->assertSame('foo', $tags[0]->getLabel()); 106 $this->assertSame('foo', $tags[0]->getLabel());
107 $records = $this->handler->getRecords();
108 $this->assertCount(1, $records);
93 } 109 }
94 110
95 public function testWhenTheTagExists() 111 public function testWhenTheTagExists()
@@ -118,6 +134,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
118 134
119 $tags = $entry->getTags(); 135 $tags = $entry->getTags();
120 $this->assertSame($tag, $tags[0]); 136 $this->assertSame($tag, $tags[0]);
137 $records = $this->handler->getRecords();
138 $this->assertCount(1, $records);
121 } 139 }
122 140
123 public function testSameTagWithDifferentfMatchingRules() 141 public function testSameTagWithDifferentfMatchingRules()
@@ -138,6 +156,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
138 156
139 $tags = $entry->getTags(); 157 $tags = $entry->getTags();
140 $this->assertCount(1, $tags); 158 $this->assertCount(1, $tags);
159 $records = $this->handler->getRecords();
160 $this->assertCount(2, $records);
141 } 161 }
142 162
143 public function testTagAllEntriesForAUser() 163 public function testTagAllEntriesForAUser()
@@ -209,4 +229,9 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
209 ->disableOriginalConstructor() 229 ->disableOriginalConstructor()
210 ->getMock(); 230 ->getMock();
211 } 231 }
232
233 private function getLogger()
234 {
235 return new Logger('foo');
236 }
212} 237}
diff --git a/var/SymfonyRequirements.php b/var/SymfonyRequirements.php
index 7e7a99de..3b14a402 100644
--- a/var/SymfonyRequirements.php
+++ b/var/SymfonyRequirements.php
@@ -634,12 +634,6 @@ class SymfonyRequirements extends RequirementCollection
634 ); 634 );
635 635
636 $this->addRecommendation( 636 $this->addRecommendation(
637 function_exists('iconv'),
638 'iconv() should be available',
639 'Install and enable the <strong>iconv</strong> extension.'
640 );
641
642 $this->addRecommendation(
643 function_exists('utf8_decode'), 637 function_exists('utf8_decode'),
644 'utf8_decode() should be available', 638 'utf8_decode() should be available',
645 'Install and enable the <strong>XML</strong> extension.' 639 'Install and enable the <strong>XML</strong> extension.'