diff options
author | Jeremy Benoist <j0k3r@users.noreply.github.com> | 2016-11-03 16:22:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-03 16:22:07 +0100 |
commit | da4136557963018287cae61226e9006c3c741747 (patch) | |
tree | 6bf23c0d32f3780843798ae47c65377ae1ff961a /src/Wallabag/CoreBundle | |
parent | 816c0940d142f8ec69bdd3f302c9751033cce7e2 (diff) | |
parent | ca08d02f2f17c0e4ec0152a701c540f62713a428 (diff) | |
download | wallabag-da4136557963018287cae61226e9006c3c741747.tar.gz wallabag-da4136557963018287cae61226e9006c3c741747.tar.zst wallabag-da4136557963018287cae61226e9006c3c741747.zip |
Merge pull request #2180 from wallabag/download-pictures
Download pictures
Diffstat (limited to 'src/Wallabag/CoreBundle')
24 files changed, 526 insertions, 10 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 277f8524..9fe90357 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php | |||
@@ -370,7 +370,7 @@ class InstallCommand extends ContainerAwareCommand | |||
370 | ], | 370 | ], |
371 | [ | 371 | [ |
372 | 'name' => 'wallabag_url', | 372 | 'name' => 'wallabag_url', |
373 | 'value' => 'http://v2.wallabag.org', | 373 | 'value' => '', |
374 | 'section' => 'misc', | 374 | 'section' => 'misc', |
375 | ], | 375 | ], |
376 | [ | 376 | [ |
@@ -398,6 +398,11 @@ class InstallCommand extends ContainerAwareCommand | |||
398 | 'value' => 'wallabag', | 398 | 'value' => 'wallabag', |
399 | 'section' => 'misc', | 399 | 'section' => 'misc', |
400 | ], | 400 | ], |
401 | [ | ||
402 | 'name' => 'download_images_enabled', | ||
403 | 'value' => '0', | ||
404 | 'section' => 'misc', | ||
405 | ], | ||
401 | ]; | 406 | ]; |
402 | 407 | ||
403 | foreach ($settings as $setting) { | 408 | foreach ($settings as $setting) { |
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 97bb3d12..3f4eb17d 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -13,6 +13,8 @@ use Wallabag\CoreBundle\Form\Type\EntryFilterType; | |||
13 | use Wallabag\CoreBundle\Form\Type\EditEntryType; | 13 | use Wallabag\CoreBundle\Form\Type\EditEntryType; |
14 | use Wallabag\CoreBundle\Form\Type\NewEntryType; | 14 | use Wallabag\CoreBundle\Form\Type\NewEntryType; |
15 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; | 15 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache; |
16 | use Wallabag\CoreBundle\Event\EntrySavedEvent; | ||
17 | use Wallabag\CoreBundle\Event\EntryDeletedEvent; | ||
16 | 18 | ||
17 | class EntryController extends Controller | 19 | class EntryController extends Controller |
18 | { | 20 | { |
@@ -81,6 +83,9 @@ class EntryController extends Controller | |||
81 | $em->persist($entry); | 83 | $em->persist($entry); |
82 | $em->flush(); | 84 | $em->flush(); |
83 | 85 | ||
86 | // entry saved, dispatch event about it! | ||
87 | $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); | ||
88 | |||
84 | return $this->redirect($this->generateUrl('homepage')); | 89 | return $this->redirect($this->generateUrl('homepage')); |
85 | } | 90 | } |
86 | 91 | ||
@@ -107,6 +112,9 @@ class EntryController extends Controller | |||
107 | $em = $this->getDoctrine()->getManager(); | 112 | $em = $this->getDoctrine()->getManager(); |
108 | $em->persist($entry); | 113 | $em->persist($entry); |
109 | $em->flush(); | 114 | $em->flush(); |
115 | |||
116 | // entry saved, dispatch event about it! | ||
117 | $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); | ||
110 | } | 118 | } |
111 | 119 | ||
112 | return $this->redirect($this->generateUrl('homepage')); | 120 | return $this->redirect($this->generateUrl('homepage')); |
@@ -343,6 +351,9 @@ class EntryController extends Controller | |||
343 | $em->persist($entry); | 351 | $em->persist($entry); |
344 | $em->flush(); | 352 | $em->flush(); |
345 | 353 | ||
354 | // entry saved, dispatch event about it! | ||
355 | $this->get('event_dispatcher')->dispatch(EntrySavedEvent::NAME, new EntrySavedEvent($entry)); | ||
356 | |||
346 | return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); | 357 | return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); |
347 | } | 358 | } |
348 | 359 | ||
@@ -431,6 +442,9 @@ class EntryController extends Controller | |||
431 | UrlGeneratorInterface::ABSOLUTE_PATH | 442 | UrlGeneratorInterface::ABSOLUTE_PATH |
432 | ); | 443 | ); |
433 | 444 | ||
445 | // entry deleted, dispatch event about it! | ||
446 | $this->get('event_dispatcher')->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); | ||
447 | |||
434 | $em = $this->getDoctrine()->getManager(); | 448 | $em = $this->getDoctrine()->getManager(); |
435 | $em->remove($entry); | 449 | $em->remove($entry); |
436 | $em->flush(); | 450 | $em->flush(); |
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php index a5e1be65..d0085660 100644 --- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSettingData.php | |||
@@ -140,6 +140,11 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface | |||
140 | 'value' => 'wallabag', | 140 | 'value' => 'wallabag', |
141 | 'section' => 'misc', | 141 | 'section' => 'misc', |
142 | ], | 142 | ], |
143 | [ | ||
144 | 'name' => 'download_images_enabled', | ||
145 | 'value' => '0', | ||
146 | 'section' => 'misc', | ||
147 | ], | ||
143 | ]; | 148 | ]; |
144 | 149 | ||
145 | foreach ($settings as $setting) { | 150 | foreach ($settings as $setting) { |
@@ -158,6 +163,6 @@ class LoadSettingData extends AbstractFixture implements OrderedFixtureInterface | |||
158 | */ | 163 | */ |
159 | public function getOrder() | 164 | public function getOrder() |
160 | { | 165 | { |
161 | return 50; | 166 | return 29; |
162 | } | 167 | } |
163 | } | 168 | } |
diff --git a/src/Wallabag/CoreBundle/Event/EntryDeletedEvent.php b/src/Wallabag/CoreBundle/Event/EntryDeletedEvent.php new file mode 100644 index 00000000..e9061d04 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/EntryDeletedEvent.php | |||
@@ -0,0 +1,26 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event; | ||
4 | |||
5 | use Symfony\Component\EventDispatcher\Event; | ||
6 | use Wallabag\CoreBundle\Entity\Entry; | ||
7 | |||
8 | /** | ||
9 | * This event is fired as soon as an entry is deleted. | ||
10 | */ | ||
11 | class EntryDeletedEvent extends Event | ||
12 | { | ||
13 | const NAME = 'entry.deleted'; | ||
14 | |||
15 | protected $entry; | ||
16 | |||
17 | public function __construct(Entry $entry) | ||
18 | { | ||
19 | $this->entry = $entry; | ||
20 | } | ||
21 | |||
22 | public function getEntry() | ||
23 | { | ||
24 | return $this->entry; | ||
25 | } | ||
26 | } | ||
diff --git a/src/Wallabag/CoreBundle/Event/EntrySavedEvent.php b/src/Wallabag/CoreBundle/Event/EntrySavedEvent.php new file mode 100644 index 00000000..5fdb5221 --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/EntrySavedEvent.php | |||
@@ -0,0 +1,26 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event; | ||
4 | |||
5 | use Symfony\Component\EventDispatcher\Event; | ||
6 | use Wallabag\CoreBundle\Entity\Entry; | ||
7 | |||
8 | /** | ||
9 | * This event is fired as soon as an entry was saved. | ||
10 | */ | ||
11 | class EntrySavedEvent extends Event | ||
12 | { | ||
13 | const NAME = 'entry.saved'; | ||
14 | |||
15 | protected $entry; | ||
16 | |||
17 | public function __construct(Entry $entry) | ||
18 | { | ||
19 | $this->entry = $entry; | ||
20 | } | ||
21 | |||
22 | public function getEntry() | ||
23 | { | ||
24 | return $this->entry; | ||
25 | } | ||
26 | } | ||
diff --git a/src/Wallabag/CoreBundle/EventListener/LocaleListener.php b/src/Wallabag/CoreBundle/Event/Listener/LocaleListener.php index a1c7e5ab..b435d99e 100644 --- a/src/Wallabag/CoreBundle/EventListener/LocaleListener.php +++ b/src/Wallabag/CoreBundle/Event/Listener/LocaleListener.php | |||
@@ -1,6 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\EventListener; | 3 | namespace Wallabag\CoreBundle\Event\Listener; |
4 | 4 | ||
5 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; | 5 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
6 | use Symfony\Component\HttpKernel\Event\GetResponseEvent; | 6 | use Symfony\Component\HttpKernel\Event\GetResponseEvent; |
diff --git a/src/Wallabag/CoreBundle/EventListener/UserLocaleListener.php b/src/Wallabag/CoreBundle/Event/Listener/UserLocaleListener.php index 82d1a63a..367cdfb0 100644 --- a/src/Wallabag/CoreBundle/EventListener/UserLocaleListener.php +++ b/src/Wallabag/CoreBundle/Event/Listener/UserLocaleListener.php | |||
@@ -1,6 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\EventListener; | 3 | namespace Wallabag\CoreBundle\Event\Listener; |
4 | 4 | ||
5 | use Symfony\Component\HttpFoundation\Session\Session; | 5 | use Symfony\Component\HttpFoundation\Session\Session; |
6 | use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; | 6 | use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; |
diff --git a/src/Wallabag/CoreBundle/Event/Subscriber/DownloadImagesSubscriber.php b/src/Wallabag/CoreBundle/Event/Subscriber/DownloadImagesSubscriber.php new file mode 100644 index 00000000..4ebe837b --- /dev/null +++ b/src/Wallabag/CoreBundle/Event/Subscriber/DownloadImagesSubscriber.php | |||
@@ -0,0 +1,121 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Event\Subscriber; | ||
4 | |||
5 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
6 | use Psr\Log\LoggerInterface; | ||
7 | use Wallabag\CoreBundle\Helper\DownloadImages; | ||
8 | use Wallabag\CoreBundle\Entity\Entry; | ||
9 | use Wallabag\CoreBundle\Event\EntrySavedEvent; | ||
10 | use Wallabag\CoreBundle\Event\EntryDeletedEvent; | ||
11 | use Doctrine\ORM\EntityManager; | ||
12 | |||
13 | class DownloadImagesSubscriber implements EventSubscriberInterface | ||
14 | { | ||
15 | private $em; | ||
16 | private $downloadImages; | ||
17 | private $enabled; | ||
18 | private $logger; | ||
19 | |||
20 | public function __construct(EntityManager $em, DownloadImages $downloadImages, $enabled, LoggerInterface $logger) | ||
21 | { | ||
22 | $this->em = $em; | ||
23 | $this->downloadImages = $downloadImages; | ||
24 | $this->enabled = $enabled; | ||
25 | $this->logger = $logger; | ||
26 | } | ||
27 | |||
28 | public static function getSubscribedEvents() | ||
29 | { | ||
30 | return [ | ||
31 | EntrySavedEvent::NAME => 'onEntrySaved', | ||
32 | EntryDeletedEvent::NAME => 'onEntryDeleted', | ||
33 | ]; | ||
34 | } | ||
35 | |||
36 | /** | ||
37 | * Download images and updated the data into the entry. | ||
38 | * | ||
39 | * @param EntrySavedEvent $event | ||
40 | */ | ||
41 | public function onEntrySaved(EntrySavedEvent $event) | ||
42 | { | ||
43 | if (!$this->enabled) { | ||
44 | $this->logger->debug('DownloadImagesSubscriber: disabled.'); | ||
45 | |||
46 | return; | ||
47 | } | ||
48 | |||
49 | $entry = $event->getEntry(); | ||
50 | |||
51 | $html = $this->downloadImages($entry); | ||
52 | if (false !== $html) { | ||
53 | $this->logger->debug('DownloadImagesSubscriber: updated html.'); | ||
54 | |||
55 | $entry->setContent($html); | ||
56 | } | ||
57 | |||
58 | // update preview picture | ||
59 | $previewPicture = $this->downloadPreviewImage($entry); | ||
60 | if (false !== $previewPicture) { | ||
61 | $this->logger->debug('DownloadImagesSubscriber: update preview picture.'); | ||
62 | |||
63 | $entry->setPreviewPicture($previewPicture); | ||
64 | } | ||
65 | |||
66 | $this->em->persist($entry); | ||
67 | $this->em->flush(); | ||
68 | } | ||
69 | |||
70 | /** | ||
71 | * Remove images related to the entry. | ||
72 | * | ||
73 | * @param EntryDeletedEvent $event | ||
74 | */ | ||
75 | public function onEntryDeleted(EntryDeletedEvent $event) | ||
76 | { | ||
77 | if (!$this->enabled) { | ||
78 | $this->logger->debug('DownloadImagesSubscriber: disabled.'); | ||
79 | |||
80 | return; | ||
81 | } | ||
82 | |||
83 | $this->downloadImages->removeImages($event->getEntry()->getId()); | ||
84 | } | ||
85 | |||
86 | /** | ||
87 | * Download all images from the html. | ||
88 | * | ||
89 | * @todo If we want to add async download, it should be done in that method | ||
90 | * | ||
91 | * @param Entry $entry | ||
92 | * | ||
93 | * @return string|false False in case of async | ||
94 | */ | ||
95 | private function downloadImages(Entry $entry) | ||
96 | { | ||
97 | return $this->downloadImages->processHtml( | ||
98 | $entry->getId(), | ||
99 | $entry->getContent(), | ||
100 | $entry->getUrl() | ||
101 | ); | ||
102 | } | ||
103 | |||
104 | /** | ||
105 | * Download the preview picture. | ||
106 | * | ||
107 | * @todo If we want to add async download, it should be done in that method | ||
108 | * | ||
109 | * @param Entry $entry | ||
110 | * | ||
111 | * @return string|false False in case of async | ||
112 | */ | ||
113 | private function downloadPreviewImage(Entry $entry) | ||
114 | { | ||
115 | return $this->downloadImages->processSingleImage( | ||
116 | $entry->getId(), | ||
117 | $entry->getPreviewPicture(), | ||
118 | $entry->getUrl() | ||
119 | ); | ||
120 | } | ||
121 | } | ||
diff --git a/src/Wallabag/CoreBundle/Subscriber/SQLiteCascadeDeleteSubscriber.php b/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php index f7210bd3..3b4c4cf9 100644 --- a/src/Wallabag/CoreBundle/Subscriber/SQLiteCascadeDeleteSubscriber.php +++ b/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php | |||
@@ -1,6 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Subscriber; | 3 | namespace Wallabag\CoreBundle\Event\Subscriber; |
4 | 4 | ||
5 | use Doctrine\Common\EventSubscriber; | 5 | use Doctrine\Common\EventSubscriber; |
6 | use Doctrine\ORM\Event\LifecycleEventArgs; | 6 | use Doctrine\ORM\Event\LifecycleEventArgs; |
diff --git a/src/Wallabag/CoreBundle/Subscriber/TablePrefixSubscriber.php b/src/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriber.php index 0379ad6a..9013328f 100644 --- a/src/Wallabag/CoreBundle/Subscriber/TablePrefixSubscriber.php +++ b/src/Wallabag/CoreBundle/Event/Subscriber/TablePrefixSubscriber.php | |||
@@ -1,6 +1,6 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Subscriber; | 3 | namespace Wallabag\CoreBundle\Event\Subscriber; |
4 | 4 | ||
5 | use Doctrine\Common\EventSubscriber; | 5 | use Doctrine\Common\EventSubscriber; |
6 | use Doctrine\ORM\Event\LoadClassMetadataEventArgs; | 6 | use Doctrine\ORM\Event\LoadClassMetadataEventArgs; |
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php index 8019df42..1986ab33 100644 --- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php +++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php | |||
@@ -3,7 +3,7 @@ | |||
3 | namespace Wallabag\CoreBundle\Helper; | 3 | namespace Wallabag\CoreBundle\Helper; |
4 | 4 | ||
5 | use Graby\Graby; | 5 | use Graby\Graby; |
6 | use Psr\Log\LoggerInterface as Logger; | 6 | use Psr\Log\LoggerInterface; |
7 | use Wallabag\CoreBundle\Entity\Entry; | 7 | use Wallabag\CoreBundle\Entity\Entry; |
8 | use Wallabag\CoreBundle\Entity\Tag; | 8 | use Wallabag\CoreBundle\Entity\Tag; |
9 | use Wallabag\CoreBundle\Tools\Utils; | 9 | use Wallabag\CoreBundle\Tools\Utils; |
@@ -20,7 +20,7 @@ class ContentProxy | |||
20 | protected $logger; | 20 | protected $logger; |
21 | protected $tagRepository; | 21 | protected $tagRepository; |
22 | 22 | ||
23 | public function __construct(Graby $graby, RuleBasedTagger $tagger, TagRepository $tagRepository, Logger $logger) | 23 | public function __construct(Graby $graby, RuleBasedTagger $tagger, TagRepository $tagRepository, LoggerInterface $logger) |
24 | { | 24 | { |
25 | $this->graby = $graby; | 25 | $this->graby = $graby; |
26 | $this->tagger = $tagger; | 26 | $this->tagger = $tagger; |
@@ -66,6 +66,7 @@ class ContentProxy | |||
66 | $entry->setUrl($content['url'] ?: $url); | 66 | $entry->setUrl($content['url'] ?: $url); |
67 | $entry->setTitle($title); | 67 | $entry->setTitle($title); |
68 | $entry->setContent($html); | 68 | $entry->setContent($html); |
69 | |||
69 | $entry->setLanguage($content['language']); | 70 | $entry->setLanguage($content['language']); |
70 | $entry->setMimetype($content['content_type']); | 71 | $entry->setMimetype($content['content_type']); |
71 | $entry->setReadingTime(Utils::getReadingTime($html)); | 72 | $entry->setReadingTime(Utils::getReadingTime($html)); |
diff --git a/src/Wallabag/CoreBundle/Helper/DownloadImages.php b/src/Wallabag/CoreBundle/Helper/DownloadImages.php new file mode 100644 index 00000000..c5298236 --- /dev/null +++ b/src/Wallabag/CoreBundle/Helper/DownloadImages.php | |||
@@ -0,0 +1,233 @@ | |||
1 | <?php | ||
2 | |||
3 | namespace Wallabag\CoreBundle\Helper; | ||
4 | |||
5 | use Psr\Log\LoggerInterface; | ||
6 | use Symfony\Component\DomCrawler\Crawler; | ||
7 | use GuzzleHttp\Client; | ||
8 | use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeExtensionGuesser; | ||
9 | use Symfony\Component\Finder\Finder; | ||
10 | |||
11 | class DownloadImages | ||
12 | { | ||
13 | const REGENERATE_PICTURES_QUALITY = 80; | ||
14 | |||
15 | private $client; | ||
16 | private $baseFolder; | ||
17 | private $logger; | ||
18 | private $mimeGuesser; | ||
19 | private $wallabagUrl; | ||
20 | |||
21 | public function __construct(Client $client, $baseFolder, $wallabagUrl, LoggerInterface $logger) | ||
22 | { | ||
23 | $this->client = $client; | ||
24 | $this->baseFolder = $baseFolder; | ||
25 | $this->wallabagUrl = rtrim($wallabagUrl, '/'); | ||
26 | $this->logger = $logger; | ||
27 | $this->mimeGuesser = new MimeTypeExtensionGuesser(); | ||
28 | |||
29 | $this->setFolder(); | ||
30 | } | ||
31 | |||
32 | /** | ||
33 | * Setup base folder where all images are going to be saved. | ||
34 | */ | ||
35 | private function setFolder() | ||
36 | { | ||
37 | // if folder doesn't exist, attempt to create one and store the folder name in property $folder | ||
38 | if (!file_exists($this->baseFolder)) { | ||
39 | mkdir($this->baseFolder, 0777, true); | ||
40 | } | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * Process the html and extract image from it, save them to local and return the updated html. | ||
45 | * | ||
46 | * @param int $entryId ID of the entry | ||
47 | * @param string $html | ||
48 | * @param string $url Used as a base path for relative image and folder | ||
49 | * | ||
50 | * @return string | ||
51 | */ | ||
52 | public function processHtml($entryId, $html, $url) | ||
53 | { | ||
54 | $crawler = new Crawler($html); | ||
55 | $result = $crawler | ||
56 | ->filterXpath('//img') | ||
57 | ->extract(array('src')); | ||
58 | |||
59 | $relativePath = $this->getRelativePath($entryId); | ||
60 | |||
61 | // download and save the image to the folder | ||
62 | foreach ($result as $image) { | ||
63 | $imagePath = $this->processSingleImage($entryId, $image, $url, $relativePath); | ||
64 | |||
65 | if (false === $imagePath) { | ||
66 | continue; | ||
67 | } | ||
68 | |||
69 | $html = str_replace($image, $imagePath, $html); | ||
70 | } | ||
71 | |||
72 | return $html; | ||
73 | } | ||
74 | |||
75 | /** | ||
76 | * Process a single image: | ||
77 | * - retrieve it | ||
78 | * - re-saved it (for security reason) | ||
79 | * - return the new local path. | ||
80 | * | ||
81 | * @param int $entryId ID of the entry | ||
82 | * @param string $imagePath Path to the image to retrieve | ||
83 | * @param string $url Url from where the image were found | ||
84 | * @param string $relativePath Relative local path to saved the image | ||
85 | * | ||
86 | * @return string Relative url to access the image from the web | ||
87 | */ | ||
88 | public function processSingleImage($entryId, $imagePath, $url, $relativePath = null) | ||
89 | { | ||
90 | if (null === $relativePath) { | ||
91 | $relativePath = $this->getRelativePath($entryId); | ||
92 | } | ||
93 | |||
94 | $this->logger->debug('DownloadImages: working on image: '.$imagePath); | ||
95 | |||
96 | $folderPath = $this->baseFolder.'/'.$relativePath; | ||
97 | |||
98 | // build image path | ||
99 | $absolutePath = $this->getAbsoluteLink($url, $imagePath); | ||
100 | if (false === $absolutePath) { | ||
101 | $this->logger->error('DownloadImages: Can not determine the absolute path for that image, skipping.'); | ||
102 | |||
103 | return false; | ||
104 | } | ||
105 | |||
106 | try { | ||
107 | $res = $this->client->get($absolutePath); | ||
108 | } catch (\Exception $e) { | ||
109 | $this->logger->error('DownloadImages: Can not retrieve image, skipping.', ['exception' => $e]); | ||
110 | |||
111 | return false; | ||
112 | } | ||
113 | |||
114 | $ext = $this->mimeGuesser->guess($res->getHeader('content-type')); | ||
115 | $this->logger->debug('DownloadImages: Checking extension', ['ext' => $ext, 'header' => $res->getHeader('content-type')]); | ||
116 | if (!in_array($ext, ['jpeg', 'jpg', 'gif', 'png'], true)) { | ||
117 | $this->logger->error('DownloadImages: Processed image with not allowed extension. Skipping '.$imagePath); | ||
118 | |||
119 | return false; | ||
120 | } | ||
121 | $hashImage = hash('crc32', $absolutePath); | ||
122 | $localPath = $folderPath.'/'.$hashImage.'.'.$ext; | ||
123 | |||
124 | try { | ||
125 | $im = imagecreatefromstring($res->getBody()); | ||
126 | } catch (\Exception $e) { | ||
127 | $im = false; | ||
128 | } | ||
129 | |||
130 | if (false === $im) { | ||
131 | $this->logger->error('DownloadImages: Error while regenerating image', ['path' => $localPath]); | ||
132 | |||
133 | return false; | ||
134 | } | ||
135 | |||
136 | switch ($ext) { | ||
137 | case 'gif': | ||
138 | $result = imagegif($im, $localPath); | ||
139 | $this->logger->debug('DownloadImages: Re-creating gif'); | ||
140 | break; | ||
141 | case 'jpeg': | ||
142 | case 'jpg': | ||
143 | $result = imagejpeg($im, $localPath, self::REGENERATE_PICTURES_QUALITY); | ||
144 | $this->logger->debug('DownloadImages: Re-creating jpg'); | ||
145 | break; | ||
146 | case 'png': | ||
147 | $result = imagepng($im, $localPath, ceil(self::REGENERATE_PICTURES_QUALITY / 100 * 9)); | ||
148 | $this->logger->debug('DownloadImages: Re-creating png'); | ||
149 | } | ||
150 | |||
151 | imagedestroy($im); | ||
152 | |||
153 | return $this->wallabagUrl.'/assets/images/'.$relativePath.'/'.$hashImage.'.'.$ext; | ||
154 | } | ||
155 | |||
156 | /** | ||
157 | * Remove all images for the given entry id. | ||
158 | * | ||
159 | * @param int $entryId ID of the entry | ||
160 | */ | ||
161 | public function removeImages($entryId) | ||
162 | { | ||
163 | $relativePath = $this->getRelativePath($entryId); | ||
164 | $folderPath = $this->baseFolder.'/'.$relativePath; | ||
165 | |||
166 | $finder = new Finder(); | ||
167 | $finder | ||
168 | ->files() | ||
169 | ->ignoreDotFiles(true) | ||
170 | ->in($folderPath); | ||
171 | |||
172 | foreach ($finder as $file) { | ||
173 | @unlink($file->getRealPath()); | ||
174 | } | ||
175 | |||
176 | @rmdir($folderPath); | ||
177 | } | ||
178 | |||
179 | /** | ||
180 | * Generate the folder where we are going to save images based on the entry url. | ||
181 | * | ||
182 | * @param int $entryId ID of the entry | ||
183 | * | ||
184 | * @return string | ||
185 | */ | ||
186 | private function getRelativePath($entryId) | ||
187 | { | ||
188 | $hashId = hash('crc32', $entryId); | ||
189 | $relativePath = $hashId[0].'/'.$hashId[1].'/'.$hashId; | ||
190 | $folderPath = $this->baseFolder.'/'.$relativePath; | ||
191 | |||
192 | if (!file_exists($folderPath)) { | ||
193 | mkdir($folderPath, 0777, true); | ||
194 | } | ||
195 | |||
196 | $this->logger->debug('DownloadImages: Folder used for that Entry id', ['folder' => $folderPath, 'entryId' => $entryId]); | ||
197 | |||
198 | return $relativePath; | ||
199 | } | ||
200 | |||
201 | /** | ||
202 | * Make an $url absolute based on the $base. | ||
203 | * | ||
204 | * @see Graby->makeAbsoluteStr | ||
205 | * | ||
206 | * @param string $base Base url | ||
207 | * @param string $url Url to make it absolute | ||
208 | * | ||
209 | * @return false|string | ||
210 | */ | ||
211 | private function getAbsoluteLink($base, $url) | ||
212 | { | ||
213 | if (preg_match('!^https?://!i', $url)) { | ||
214 | // already absolute | ||
215 | return $url; | ||
216 | } | ||
217 | |||
218 | $base = new \SimplePie_IRI($base); | ||
219 | |||
220 | // remove '//' in URL path (causes URLs not to resolve properly) | ||
221 | if (isset($base->ipath)) { | ||
222 | $base->ipath = preg_replace('!//+!', '/', $base->ipath); | ||
223 | } | ||
224 | |||
225 | if ($absolute = \SimplePie_IRI::absolutize($base, $url)) { | ||
226 | return $absolute->get_uri(); | ||
227 | } | ||
228 | |||
229 | $this->logger->error('DownloadImages: Can not make an absolute link', ['base' => $base, 'url' => $url]); | ||
230 | |||
231 | return false; | ||
232 | } | ||
233 | } | ||
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index cc5f9e9a..56d776ad 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml | |||
@@ -30,7 +30,7 @@ services: | |||
30 | - "@doctrine" | 30 | - "@doctrine" |
31 | 31 | ||
32 | wallabag_core.subscriber.table_prefix: | 32 | wallabag_core.subscriber.table_prefix: |
33 | class: Wallabag\CoreBundle\Subscriber\TablePrefixSubscriber | 33 | class: Wallabag\CoreBundle\Event\Subscriber\TablePrefixSubscriber |
34 | arguments: | 34 | arguments: |
35 | - "%database_table_prefix%" | 35 | - "%database_table_prefix%" |
36 | tags: | 36 | tags: |
@@ -131,8 +131,29 @@ services: | |||
131 | - '%kernel.debug%' | 131 | - '%kernel.debug%' |
132 | 132 | ||
133 | wallabag_core.subscriber.sqlite_cascade_delete: | 133 | wallabag_core.subscriber.sqlite_cascade_delete: |
134 | class: Wallabag\CoreBundle\Subscriber\SQLiteCascadeDeleteSubscriber | 134 | class: Wallabag\CoreBundle\Event\Subscriber\SQLiteCascadeDeleteSubscriber |
135 | arguments: | 135 | arguments: |
136 | - "@doctrine" | 136 | - "@doctrine" |
137 | tags: | 137 | tags: |
138 | - { name: doctrine.event_subscriber } | 138 | - { name: doctrine.event_subscriber } |
139 | |||
140 | wallabag_core.subscriber.download_images: | ||
141 | class: Wallabag\CoreBundle\Event\Subscriber\DownloadImagesSubscriber | ||
142 | arguments: | ||
143 | - "@doctrine.orm.default_entity_manager" | ||
144 | - "@wallabag_core.entry.download_images" | ||
145 | - '@=service(''craue_config'').get(''download_images_enabled'')' | ||
146 | - "@logger" | ||
147 | tags: | ||
148 | - { name: kernel.event_subscriber } | ||
149 | |||
150 | wallabag_core.entry.download_images: | ||
151 | class: Wallabag\CoreBundle\Helper\DownloadImages | ||
152 | arguments: | ||
153 | - "@wallabag_core.entry.download_images.client" | ||
154 | - "%kernel.root_dir%/../web/assets/images" | ||
155 | - '@=service(''craue_config'').get(''wallabag_url'')' | ||
156 | - "@logger" | ||
157 | |||
158 | wallabag_core.entry.download_images.client: | ||
159 | class: GuzzleHttp\Client | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 9b0eecce..21c26079 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml | |||
@@ -368,6 +368,7 @@ import: | |||
368 | # how_to: 'Please select your Readability export and click on the below button to upload and import it.' | 368 | # how_to: 'Please select your Readability export and click on the below button to upload and import it.' |
369 | worker: | 369 | worker: |
370 | # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" | 370 | # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" |
371 | # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We <strong>strongly recommend</strong> to enable asynchronous import to avoid errors." | ||
371 | # firefox: | 372 | # firefox: |
372 | # page_title: 'Import > Firefox' | 373 | # page_title: 'Import > Firefox' |
373 | # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." | 374 | # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." |
@@ -505,3 +506,8 @@ flashes: | |||
505 | notice: | 506 | notice: |
506 | # client_created: 'New client created.' | 507 | # client_created: 'New client created.' |
507 | # client_deleted: 'Client deleted' | 508 | # client_deleted: 'Client deleted' |
509 | user: | ||
510 | notice: | ||
511 | # added: 'User "%username%" added' | ||
512 | # updated: 'User "%username%" updated' | ||
513 | # deleted: 'User "%username%" deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index a156c54a..ff70cbee 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml | |||
@@ -368,6 +368,7 @@ import: | |||
368 | how_to: 'Bitte wähle deinen Readability Export aus und klicke den unteren Button für das Hochladen und Importieren dessen.' | 368 | how_to: 'Bitte wähle deinen Readability Export aus und klicke den unteren Button für das Hochladen und Importieren dessen.' |
369 | worker: | 369 | worker: |
370 | enabled: "Der Import erfolgt asynchron. Sobald der Import gestartet ist, wird diese Aufgabe extern abgearbeitet. Der aktuelle Service dafür ist:" | 370 | enabled: "Der Import erfolgt asynchron. Sobald der Import gestartet ist, wird diese Aufgabe extern abgearbeitet. Der aktuelle Service dafür ist:" |
371 | # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We <strong>strongly recommend</strong> to enable asynchronous import to avoid errors." | ||
371 | firefox: | 372 | firefox: |
372 | page_title: 'Aus Firefox importieren' | 373 | page_title: 'Aus Firefox importieren' |
373 | description: "Dieser Import wird all deine Lesezeichen aus Firefox importieren. Gehe zu deinen Lesezeichen (Strg+Shift+O), dann auf \"Importen und Sichern\", wähle \"Sichern…\". Du erhälst eine .json Datei." | 374 | description: "Dieser Import wird all deine Lesezeichen aus Firefox importieren. Gehe zu deinen Lesezeichen (Strg+Shift+O), dann auf \"Importen und Sichern\", wähle \"Sichern…\". Du erhälst eine .json Datei." |
@@ -505,3 +506,8 @@ flashes: | |||
505 | notice: | 506 | notice: |
506 | client_created: 'Neuer Client erstellt.' | 507 | client_created: 'Neuer Client erstellt.' |
507 | client_deleted: 'Client gelöscht' | 508 | client_deleted: 'Client gelöscht' |
509 | user: | ||
510 | notice: | ||
511 | # added: 'User "%username%" added' | ||
512 | # updated: 'User "%username%" updated' | ||
513 | # deleted: 'User "%username%" deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 049959a0..36382b6f 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml | |||
@@ -368,6 +368,7 @@ import: | |||
368 | how_to: 'Please select your Readability export and click on the below button to upload and import it.' | 368 | how_to: 'Please select your Readability export and click on the below button to upload and import it.' |
369 | worker: | 369 | worker: |
370 | enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" | 370 | enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" |
371 | download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We <strong>strongly recommend</strong> to enable asynchronous import to avoid errors." | ||
371 | firefox: | 372 | firefox: |
372 | page_title: 'Import > Firefox' | 373 | page_title: 'Import > Firefox' |
373 | description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." | 374 | description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." |
@@ -471,6 +472,7 @@ flashes: | |||
471 | rss_updated: 'RSS information updated' | 472 | rss_updated: 'RSS information updated' |
472 | tagging_rules_updated: 'Tagging rules updated' | 473 | tagging_rules_updated: 'Tagging rules updated' |
473 | tagging_rules_deleted: 'Tagging rule deleted' | 474 | tagging_rules_deleted: 'Tagging rule deleted' |
475 | # user_added: 'User "%username%" added' | ||
474 | rss_token_updated: 'RSS token updated' | 476 | rss_token_updated: 'RSS token updated' |
475 | annotations_reset: Annotations reset | 477 | annotations_reset: Annotations reset |
476 | tags_reset: Tags reset | 478 | tags_reset: Tags reset |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index 79c13ff0..2c80fe8f 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml | |||
@@ -368,6 +368,7 @@ import: | |||
368 | # how_to: 'Please select your Readability export and click on the below button to upload and import it.' | 368 | # how_to: 'Please select your Readability export and click on the below button to upload and import it.' |
369 | worker: | 369 | worker: |
370 | # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" | 370 | # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" |
371 | # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We <strong>strongly recommend</strong> to enable asynchronous import to avoid errors." | ||
371 | firefox: | 372 | firefox: |
372 | page_title: 'Importar > Firefox' | 373 | page_title: 'Importar > Firefox' |
373 | # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." | 374 | # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." |
@@ -505,3 +506,8 @@ flashes: | |||
505 | notice: | 506 | notice: |
506 | client_created: 'Nuevo cliente creado.' | 507 | client_created: 'Nuevo cliente creado.' |
507 | client_deleted: 'Cliente suprimido' | 508 | client_deleted: 'Cliente suprimido' |
509 | user: | ||
510 | notice: | ||
511 | # added: 'User "%username%" added' | ||
512 | # updated: 'User "%username%" updated' | ||
513 | # deleted: 'User "%username%" deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index e81513aa..6b6211d6 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml | |||
@@ -285,6 +285,7 @@ quickstart: | |||
285 | paragraph_2: 'ادامه دهید!' | 285 | paragraph_2: 'ادامه دهید!' |
286 | configure: | 286 | configure: |
287 | title: 'برنامه را تنظیم کنید' | 287 | title: 'برنامه را تنظیم کنید' |
288 | # description: 'In order to have an application which suits you, have a look into the configuration of wallabag.' | ||
288 | language: 'زبان و نمای برنامه را تغییر دهید' | 289 | language: 'زبان و نمای برنامه را تغییر دهید' |
289 | rss: 'خوراک آر-اس-اس را فعال کنید' | 290 | rss: 'خوراک آر-اس-اس را فعال کنید' |
290 | tagging_rules: 'قانونهای برچسبگذاری خودکار مقالههایتان را تعریف کنید' | 291 | tagging_rules: 'قانونهای برچسبگذاری خودکار مقالههایتان را تعریف کنید' |
@@ -367,6 +368,7 @@ import: | |||
367 | # how_to: 'Please select your Readability export and click on the below button to upload and import it.' | 368 | # how_to: 'Please select your Readability export and click on the below button to upload and import it.' |
368 | worker: | 369 | worker: |
369 | # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" | 370 | # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" |
371 | # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We <strong>strongly recommend</strong> to enable asynchronous import to avoid errors." | ||
370 | firefox: | 372 | firefox: |
371 | page_title: 'درونریزی > Firefox' | 373 | page_title: 'درونریزی > Firefox' |
372 | # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." | 374 | # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." |
@@ -504,3 +506,8 @@ flashes: | |||
504 | notice: | 506 | notice: |
505 | # client_created: 'New client created.' | 507 | # client_created: 'New client created.' |
506 | # client_deleted: 'Client deleted' | 508 | # client_deleted: 'Client deleted' |
509 | user: | ||
510 | notice: | ||
511 | # added: 'User "%username%" added' | ||
512 | # updated: 'User "%username%" updated' | ||
513 | # deleted: 'User "%username%" deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index ac7c112d..74d59e1a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -368,6 +368,7 @@ import: | |||
368 | how_to: "Choisissez le fichier de votre export Readability et cliquez sur le bouton ci-dessous pour l'importer." | 368 | how_to: "Choisissez le fichier de votre export Readability et cliquez sur le bouton ci-dessous pour l'importer." |
369 | worker: | 369 | worker: |
370 | enabled: "Les imports sont asynchrones. Une fois l'import commencé un worker externe traitera les messages un par un. Le service activé est :" | 370 | enabled: "Les imports sont asynchrones. Une fois l'import commencé un worker externe traitera les messages un par un. Le service activé est :" |
371 | download_images_warning: "Vous avez configuré le téléchagement des images pour vos articles. Combiné à l'import classique, cette opération peut être très très longue (voire échouer). Nous vous conseillons <strong>vivement</strong> d'activer les imports asynchrones." | ||
371 | firefox: | 372 | firefox: |
372 | page_title: 'Import > Firefox' | 373 | page_title: 'Import > Firefox' |
373 | description: "Cet outil va vous permettre d'importer tous vos marques-pages de Firefox. Ouvrez le panneau des marques-pages (Ctrl+Maj+O), puis dans « Importation et sauvegarde », choisissez « Sauvegarde... ». Vous allez récupérer un fichier .json. </p>" | 374 | description: "Cet outil va vous permettre d'importer tous vos marques-pages de Firefox. Ouvrez le panneau des marques-pages (Ctrl+Maj+O), puis dans « Importation et sauvegarde », choisissez « Sauvegarde... ». Vous allez récupérer un fichier .json. </p>" |
@@ -505,3 +506,8 @@ flashes: | |||
505 | notice: | 506 | notice: |
506 | client_created: 'Nouveau client %name% créé' | 507 | client_created: 'Nouveau client %name% créé' |
507 | client_deleted: 'Client %name% supprimé' | 508 | client_deleted: 'Client %name% supprimé' |
509 | user: | ||
510 | notice: | ||
511 | added: 'Utilisateur "%username%" ajouté' | ||
512 | updated: 'Utilisateur "%username%" mis à jour' | ||
513 | deleted: 'Utilisateur "%username%" supprimé' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 454429f6..a448b602 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml | |||
@@ -368,6 +368,7 @@ import: | |||
368 | # how_to: 'Please select your Readability export and click on the below button to upload and import it.' | 368 | # how_to: 'Please select your Readability export and click on the below button to upload and import it.' |
369 | worker: | 369 | worker: |
370 | # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" | 370 | # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" |
371 | # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We <strong>strongly recommend</strong> to enable asynchronous import to avoid errors." | ||
371 | firefox: | 372 | firefox: |
372 | page_title: 'Importa da > Firefox' | 373 | page_title: 'Importa da > Firefox' |
373 | # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." | 374 | # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." |
@@ -505,3 +506,8 @@ flashes: | |||
505 | notice: | 506 | notice: |
506 | client_created: 'Nuovo client creato.' | 507 | client_created: 'Nuovo client creato.' |
507 | client_deleted: 'Client eliminato' | 508 | client_deleted: 'Client eliminato' |
509 | user: | ||
510 | notice: | ||
511 | # added: 'User "%username%" added' | ||
512 | # updated: 'User "%username%" updated' | ||
513 | # deleted: 'User "%username%" deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index dadb6b03..a61f7cdd 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml | |||
@@ -368,6 +368,7 @@ import: | |||
368 | how_to: "Mercés de seleccionar vòstre Readability fichièr e de clicar sul boton dejós per lo telecargar e l'importar." | 368 | how_to: "Mercés de seleccionar vòstre Readability fichièr e de clicar sul boton dejós per lo telecargar e l'importar." |
369 | worker: | 369 | worker: |
370 | enabled: "L'importacion se fa de manièra asincròna. Un còp l'importacion lançada, una aisina externa s'ocuparà dels messatges un per un. Lo servici actual es : " | 370 | enabled: "L'importacion se fa de manièra asincròna. Un còp l'importacion lançada, una aisina externa s'ocuparà dels messatges un per un. Lo servici actual es : " |
371 | # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We <strong>strongly recommend</strong> to enable asynchronous import to avoid errors." | ||
371 | firefox: | 372 | firefox: |
372 | page_title: 'Importar > Firefox' | 373 | page_title: 'Importar > Firefox' |
373 | description: "Aquesta aisina importarà totas vòstres favorits de Firefox. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." | 374 | description: "Aquesta aisina importarà totas vòstres favorits de Firefox. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." |
@@ -505,3 +506,8 @@ flashes: | |||
505 | notice: | 506 | notice: |
506 | client_created: 'Novèl client creat' | 507 | client_created: 'Novèl client creat' |
507 | client_deleted: 'Client suprimit' | 508 | client_deleted: 'Client suprimit' |
509 | user: | ||
510 | notice: | ||
511 | # added: 'User "%username%" added' | ||
512 | # updated: 'User "%username%" updated' | ||
513 | # deleted: 'User "%username%" deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 200907c9..a7387b79 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml | |||
@@ -368,6 +368,7 @@ import: | |||
368 | how_to: 'Wybierz swój plik eksportu z Readability i kliknij poniższy przycisk, aby go załadować.' | 368 | how_to: 'Wybierz swój plik eksportu z Readability i kliknij poniższy przycisk, aby go załadować.' |
369 | worker: | 369 | worker: |
370 | enabled: "Import jest wykonywany asynchronicznie. Od momentu rozpoczęcia importu, zewnętrzna usługa może zajmować się na raz tylko jednym zadaniem. Bieżącą usługą jest:" | 370 | enabled: "Import jest wykonywany asynchronicznie. Od momentu rozpoczęcia importu, zewnętrzna usługa może zajmować się na raz tylko jednym zadaniem. Bieżącą usługą jest:" |
371 | # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We <strong>strongly recommend</strong> to enable asynchronous import to avoid errors." | ||
371 | firefox: | 372 | firefox: |
372 | page_title: 'Import > Firefox' | 373 | page_title: 'Import > Firefox' |
373 | description: "Ten importer zaimportuje wszystkie twoje zakładki z Firefoksa. Idź do twoich zakładek (Ctrl+Shift+O), następnie w \"Import i kopie zapasowe\", wybierz \"Utwórz kopię zapasową...\". Uzyskasz plik .json." | 374 | description: "Ten importer zaimportuje wszystkie twoje zakładki z Firefoksa. Idź do twoich zakładek (Ctrl+Shift+O), następnie w \"Import i kopie zapasowe\", wybierz \"Utwórz kopię zapasową...\". Uzyskasz plik .json." |
@@ -505,3 +506,8 @@ flashes: | |||
505 | notice: | 506 | notice: |
506 | client_created: 'Nowy klient utworzony.' | 507 | client_created: 'Nowy klient utworzony.' |
507 | client_deleted: 'Klient usunięty' | 508 | client_deleted: 'Klient usunięty' |
509 | user: | ||
510 | notice: | ||
511 | # added: 'User "%username%" added' | ||
512 | # updated: 'User "%username%" updated' | ||
513 | # deleted: 'User "%username%" deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 255ee839..070abe27 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml | |||
@@ -368,6 +368,7 @@ import: | |||
368 | # how_to: 'Please select your Readability export and click on the below button to upload and import it.' | 368 | # how_to: 'Please select your Readability export and click on the below button to upload and import it.' |
369 | worker: | 369 | worker: |
370 | # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" | 370 | # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" |
371 | # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We <strong>strongly recommend</strong> to enable asynchronous import to avoid errors." | ||
371 | # firefox: | 372 | # firefox: |
372 | # page_title: 'Import > Firefox' | 373 | # page_title: 'Import > Firefox' |
373 | # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." | 374 | # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." |
@@ -505,3 +506,8 @@ flashes: | |||
505 | notice: | 506 | notice: |
506 | # client_created: 'New client created.' | 507 | # client_created: 'New client created.' |
507 | # client_deleted: 'Client deleted' | 508 | # client_deleted: 'Client deleted' |
509 | user: | ||
510 | notice: | ||
511 | # added: 'User "%username%" added' | ||
512 | # updated: 'User "%username%" updated' | ||
513 | # deleted: 'User "%username%" deleted' | ||
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index f3696a55..7679b32a 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml | |||
@@ -109,6 +109,7 @@ config: | |||
109 | # if_label: 'if' | 109 | # if_label: 'if' |
110 | # then_tag_as_label: 'then tag as' | 110 | # then_tag_as_label: 'then tag as' |
111 | # delete_rule_label: 'delete' | 111 | # delete_rule_label: 'delete' |
112 | # edit_rule_label: 'edit' | ||
112 | rule_label: 'Kural' | 113 | rule_label: 'Kural' |
113 | tags_label: 'Etiketler' | 114 | tags_label: 'Etiketler' |
114 | faq: | 115 | faq: |
@@ -367,6 +368,7 @@ import: | |||
367 | # how_to: 'Please select your Readability export and click on the below button to upload and import it.' | 368 | # how_to: 'Please select your Readability export and click on the below button to upload and import it.' |
368 | worker: | 369 | worker: |
369 | # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" | 370 | # enabled: "Import is made asynchronously. Once the import task is started, an external worker will handle jobs one at a time. The current service is:" |
371 | # download_images_warning: "You enabled downloading images for your articles. Combined with classic import it can take ages to proceed (or maybe failed). We <strong>strongly recommend</strong> to enable asynchronous import to avoid errors." | ||
370 | firefox: | 372 | firefox: |
371 | page_title: 'İçe Aktar > Firefox' | 373 | page_title: 'İçe Aktar > Firefox' |
372 | # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." | 374 | # description: "This importer will import all your Firefox bookmarks. Just go to your bookmarks (Ctrl+Maj+O), then into \"Import and backup\", choose \"Backup...\". You will obtain a .json file." |
@@ -504,3 +506,8 @@ flashes: | |||
504 | notice: | 506 | notice: |
505 | # client_created: 'New client created.' | 507 | # client_created: 'New client created.' |
506 | # client_deleted: 'Client deleted' | 508 | # client_deleted: 'Client deleted' |
509 | user: | ||
510 | notice: | ||
511 | # added: 'User "%username%" added' | ||
512 | # updated: 'User "%username%" updated' | ||
513 | # deleted: 'User "%username%" deleted' | ||