aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--docs/en/developer/docker.rst6
-rw-r--r--docs/en/developer/translate.rst35
-rw-r--r--docs/en/index.rst5
-rw-r--r--docs/en/user/configuration.rst42
-rw-r--r--docs/en/user/create_account.rst11
-rw-r--r--docs/en/user/download_articles.rst5
-rw-r--r--docs/en/user/first_article.rst14
-rw-r--r--docs/en/user/import.rst24
-rw-r--r--docs/en/user/installation.rst145
-rw-r--r--docs/en/user/login.rst7
-rw-r--r--docs/fr/developer/docker.rst50
-rw-r--r--docs/fr/developer/translate.rst62
-rw-r--r--docs/fr/index.rst29
-rw-r--r--docs/fr/user/configuration.rst114
-rw-r--r--docs/fr/user/create_account.rst46
-rw-r--r--docs/fr/user/download_articles.rst17
-rw-r--r--docs/fr/user/filters.rst2
-rw-r--r--docs/fr/user/first_article.rst68
-rw-r--r--docs/fr/user/import.rst83
-rw-r--r--docs/fr/user/installation.rst143
-rw-r--r--docs/fr/user/login.rst23
-rw-r--r--docs/fr/user/tags.rst2
-rw-r--r--src/Wallabag/ApiBundle/Controller/WallabagRestController.php31
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php9
-rw-r--r--src/Wallabag/CoreBundle/Helper/ContentProxy.php40
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/services.yml1
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php11
-rw-r--r--src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php106
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php26
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagV1Import.php28
-rw-r--r--src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php18
31 files changed, 1062 insertions, 141 deletions
diff --git a/docs/en/developer/docker.rst b/docs/en/developer/docker.rst
index aece2984..8816cbcf 100644
--- a/docs/en/developer/docker.rst
+++ b/docs/en/developer/docker.rst
@@ -15,11 +15,11 @@ your system and up to date.
15Switch DBMS 15Switch DBMS
16----------- 16-----------
17 17
18By default, wallabag will start with a sqlite database. 18By default, wallabag will start with a SQLite database.
19Since wallabag provides support for Postgresql and MySQL, docker 19Since wallabag provides support for Postgresql and MySQL, docker
20containers are also available for these ones. 20containers are also available for these ones.
21 21
22In ``docker-compose.yml``, for the chosen DBMS uncomment : 22In ``docker-compose.yml``, for the chosen DBMS uncomment:
23 23
24- the container definition (``postgres`` or ``mariadb`` root level 24- the container definition (``postgres`` or ``mariadb`` root level
25 block) 25 block)
@@ -27,7 +27,7 @@ In ``docker-compose.yml``, for the chosen DBMS uncomment :
27- the container env file in the ``php`` container 27- the container env file in the ``php`` container
28 28
29In order to keep running Symfony commands on your host (such as 29In order to keep running Symfony commands on your host (such as
30``wallabag:install``), you also should : 30``wallabag:install``), you also should:
31 31
32- source the proper env files on your command line, so variables 32- source the proper env files on your command line, so variables
33 like ``SYMFONY__ENV__DATABASE_HOST`` will exist. 33 like ``SYMFONY__ENV__DATABASE_HOST`` will exist.
diff --git a/docs/en/developer/translate.rst b/docs/en/developer/translate.rst
index 85cf2563..33b0ebdb 100644
--- a/docs/en/developer/translate.rst
+++ b/docs/en/developer/translate.rst
@@ -1,31 +1,38 @@
1Translate wallabag 1Translate wallabag
2================== 2==================
3 3
4wallabag web application
5------------------------
6
4Translation files 7Translation files
5----------------- 8~~~~~~~~~~~~~~~~~
6 9
7.. note:: 10.. note::
8 11
9 As wallabag is mainly developed by a French team, please consider that french translation is the most updated one and please copy it to create your own translation. 12 As wallabag is mainly developed by a French team, please consider that french
13 translation is the most updated one and please copy it to create your own translation.
10 14
11You can find translation files here: https://github.com/wallabag/wallabag/tree/v2/src/Wallabag/CoreBundle/Resources/translations. 15You can find translation files here: https://github.com/wallabag/wallabag/tree/v2/src/Wallabag/CoreBundle/Resources/translations.
12 16
13You have to create ``messages.CODE.yml`` and ``validators.CODE.yml``, where CODE is the the ISO 639-1 code of your language (`see wikipedia <https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes>`__). 17You have to create ``messages.CODE.yml`` and ``validators.CODE.yml``, where CODE
18is the ISO 639-1 code of your language (`see wikipedia <https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes>`__).
14 19
15Other files to translate: 20Other files to translate:
16 21
17- https://github.com/wallabag/wallabag/tree/v2/app/Resources/CraueConfigBundle/translations. 22- https://github.com/wallabag/wallabag/tree/v2/app/Resources/CraueConfigBundle/translations.
18- https://github.com/wallabag/wallabag/tree/v2/app/Resources/FOSUserBundle/translations. 23- https://github.com/wallabag/wallabag/tree/v2/app/Resources/FOSUserBundle/translations.
19 24
20You have to create ``CraueConfigBundle.CODE.yml``. 25You have to create ``THE_TRANSLATION_FILE.CODE.yml`` files.
21 26
22Configuration file 27Configuration file
23------------------ 28~~~~~~~~~~~~~~~~~~
24 29
25You have to edit `app/config/config.yml 30You have to edit `app/config/config.yml
26<https://github.com/wallabag/wallabag/blob/v2/app/config/config.yml>`__ to display your language on Configuration page of wallabag (to allow users to switch to this new translation). 31<https://github.com/wallabag/wallabag/blob/v2/app/config/config.yml>`__ to display
32your language on Configuration page of wallabag (to allow users to switch to this new translation).
27 33
28Under the ``wallabag_core.languages`` section, you have to add a new line for with your translation. For example 34Under the ``wallabag_core.languages`` section, you have to add a new line with
35your translation. For example:
29 36
30:: 37::
31 38
@@ -36,6 +43,18 @@ Under the ``wallabag_core.languages`` section, you have to add a new line for wi
36 fr: 'Français' 43 fr: 'Français'
37 44
38 45
39For the first column (``en``, ``fr``, etc.), you have to add the ISO 639-1 code of your language (see above). 46For the first column (``en``, ``fr``, etc.), you have to add the ISO 639-1 code
47of your language (see above).
40 48
41For the second column, it's the name of your language. Just that. 49For the second column, it's the name of your language. Just that.
50
51wallabag documentation
52----------------------
53
54.. note::
55
56 Contrary to the web application, the main language for documentation is english.
57
58Documentation files are stored here: https://github.com/wallabag/wallabag/tree/v2/docs
59
60You need to respect the ``en`` folder structure when you create your own translation.
diff --git a/docs/en/index.rst b/docs/en/index.rst
index acd9b383..17e375d2 100644
--- a/docs/en/index.rst
+++ b/docs/en/index.rst
@@ -8,6 +8,10 @@ wallabag documentation
8**wallabag** is a read-it-later application: it saves a web page by 8**wallabag** is a read-it-later application: it saves a web page by
9keeping content only. Elements like navigation or ads are deleted. 9keeping content only. Elements like navigation or ads are deleted.
10 10
11.. note::
12
13 This documentation is about wallabag v2. If you want to read documentation for wallabag v1, `please have a look here <https://github.com/wallabag/documentation>`__.
14
11The main documentation for this application is organized into a couple sections: 15The main documentation for this application is organized into a couple sections:
12 16
13* :ref:`user-docs` 17* :ref:`user-docs`
@@ -19,6 +23,7 @@ The main documentation for this application is organized into a couple sections:
19 :maxdepth: 2 23 :maxdepth: 2
20 :caption: User documentation 24 :caption: User documentation
21 25
26 user/installation
22 user/create_account 27 user/create_account
23 user/login 28 user/login
24 user/configuration 29 user/configuration
diff --git a/docs/en/user/configuration.rst b/docs/en/user/configuration.rst
index 369c977a..70d960ff 100644
--- a/docs/en/user/configuration.rst
+++ b/docs/en/user/configuration.rst
@@ -3,7 +3,8 @@ Configuration
3 3
4Now you're logged in, it's time to configure your account as you want. 4Now you're logged in, it's time to configure your account as you want.
5 5
6Click on ``Config`` menu. You have five tabs: ``Settings``, ``RSS``, ``User information``, ``Password`` and ``Tagging rules``. 6Click on ``Config`` menu. You have five tabs: ``Settings``, ``RSS``,
7``User information``, ``Password`` and ``Tagging rules``.
7 8
8Settings 9Settings
9-------- 10--------
@@ -11,7 +12,9 @@ Settings
11Theme 12Theme
12~~~~~ 13~~~~~
13 14
14wallabag is customizable. You can choose your prefered theme here. You can also create a new one, a chapter is dedicated for this. The default theme is ``Material``, it's the theme used in the documentation screenshots. 15wallabag is customizable. You can choose your prefered theme here. You can also
16create a new one, a chapter will be dedicated for this. The default theme is
17``Material``, it's the theme used in the documentation screenshots.
15 18
16Items per page 19Items per page
17~~~~~~~~~~~~~~ 20~~~~~~~~~~~~~~
@@ -21,7 +24,8 @@ You can change the number of articles displayed on each page.
21Language 24Language
22~~~~~~~~ 25~~~~~~~~
23 26
24You can change the language of wallabag interface. 27You can change the language of wallabag interface. You need to logout for this change
28to take effect.
25 29
26RSS 30RSS
27--- 31---
@@ -43,41 +47,49 @@ You can change your name, your email address and enable ``Two factor authenticat
43Two factor authentication 47Two factor authentication
44~~~~~~~~~~~~~~~~~~~~~~~~~ 48~~~~~~~~~~~~~~~~~~~~~~~~~
45 49
46 Two-factor authentication (also known as 2FA) is a technology patented in 1984 that provides identification of users by means of the combination of two different components. 50 Two-factor authentication (also known as 2FA) is a technology patented in 1984
51 that provides identification of users by means of the combination of two different components.
47 52
48https://en.wikipedia.org/wiki/Two-factor_authentication 53https://en.wikipedia.org/wiki/Two-factor_authentication
49 54
50If you enable 2FA, each time you want to login to wallabag, you'll receive a code by email. You have to put this code on the following form. 55If you enable 2FA, each time you want to login to wallabag, you'll receive
56a code by email. You have to put this code on the following form.
51 57
52.. image:: ../../img/user/2FA_form.png 58.. image:: ../../img/user/2FA_form.png
53 :alt: Two factor authentication 59 :alt: Two factor authentication
54 :align: center 60 :align: center
55 61
56If you don't want to receive a code each time you want to login, you can check the ``I'm on a trusted computer`` checkbox: wallabag will remember you for 15 days. 62If you don't want to receive a code each time you want to login, you can check
63the ``I'm on a trusted computer`` checkbox: wallabag will remember you for 15 days.
57 64
58Password 65Password
59-------- 66--------
60 67
61You can change your password here. 68You can change your password here (8 characters minimum).
62 69
63Tagging rules 70Tagging rules
64------------- 71-------------
65 72
66If you want to automatically assign a tag to new articles, this part of the configuration is for you. 73If you want to automatically assign a tag to new articles, this part
74of the configuration is for you.
67 75
68What does « tagging rules » mean? 76What does « tagging rules » mean?
69~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 77~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70 78
71They are rules used by wallabag to automatically tag new entries. 79They are rules used by wallabag to automatically tag new entries.
72Each time a new entry is added, all the tagging rules will be used to add the tags you configured, thus saving you the trouble to manually classify your entries. 80Each time a new entry is added, all the tagging rules will be used to add
81the tags you configured, thus saving you the trouble to manually classify your entries.
73 82
74How do I use them? 83How do I use them?
75~~~~~~~~~~~~~~~~~~ 84~~~~~~~~~~~~~~~~~~
76 85
77Let assume you want to tag new entries as *« short reading »* when the reading time is inferior to 3 minutes. 86Let assume you want to tag new entries as *« short reading »* when
78In that case, you should put « readingTime <= 3 » in the **Rule** field and *« short reading »* in the **Tags** field. 87the reading time is inferior to 3 minutes.
88In that case, you should put « readingTime <= 3 » in the **Rule** field
89and *« short reading »* in the **Tags** field.
79Several tags can added simultaneously by separating them by a comma: *« short reading, must read »*. 90Several tags can added simultaneously by separating them by a comma: *« short reading, must read »*.
80Complex rules can be written by using predefined operators: if *« readingTime >= 5 AND domainName = "github.com" »* then tag as *« long reading, github »*. 91Complex rules can be written by using predefined operators:
92if *« readingTime >= 5 AND domainName = "github.com" »* then tag as *« long reading, github »*.
81 93
82Which variables and operators can I use to write rules? 94Which variables and operators can I use to write rules?
83~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 95~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -96,4 +108,4 @@ language The entry's language != Not equal
96mimetype The entry's mime-type OR One rule or another 108mimetype The entry's mime-type OR One rule or another
97readingTime The estimated entry's reading time, in minutes AND One rule and another 109readingTime The estimated entry's reading time, in minutes AND One rule and another
98domainName The domain name of the entry matches Tests that a subject is matches a search (case-insensitive). Example: title matches "football" 110domainName The domain name of the entry matches Tests that a subject is matches a search (case-insensitive). Example: title matches "football"
99=========== ============================================== ======== ========== \ No newline at end of file 111=========== ============================================== ======== ==========
diff --git a/docs/en/user/create_account.rst b/docs/en/user/create_account.rst
index 11fe304c..f0110e55 100644
--- a/docs/en/user/create_account.rst
+++ b/docs/en/user/create_account.rst
@@ -7,13 +7,16 @@ On the login page, click on ``Register`` button.
7 :alt: Registration form 7 :alt: Registration form
8 :align: center 8 :align: center
9 9
10You have to fill the form. Please sure to type a valid email address, we'll send you an activation email. 10You have to fill the form. Please sure to type a valid email address,
11we'll send you an activation email.
11 12
12.. image:: ../../img/user/sent_email.png 13.. image:: ../../img/user/sent_email.png
13 :alt: Email was sent to activate account 14 :alt: Email was sent to activate account
14 :align: center 15 :align: center
15 16
16Check your inbox, you now have a new mail with a link like this ``http://wallabag/register/confirm/Ba19wokGovN-DdBQNfg4YgRkUQWRP4-k2g0Bk-hBTX4``. Click on it to activate your account. 17Check your inbox, you now have a new mail with a link like this
18``http://wallabag/register/confirm/Ba19wokGovN-DdBQNfg4YgRkUQWRP4-k2g0Bk-hBTX4``.
19Click on it to activate your account.
17 20
18Your account is now activated. 21Your account is now activated.
19 22
@@ -33,11 +36,11 @@ Make sure that all fields are well filled:
33* same passwords in two fields 36* same passwords in two fields
34 37
35I don't receive my activation email 38I don't receive my activation email
36~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 39~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 40
38Are you sure your email address was correct? Did you check your spams folder? 41Are you sure your email address was correct? Did you check your spams folder?
39 42
40When I click on the activation link, I've got this message: ``The user with confirmation token "DtrOPfbQeVkWf6N" does not exist``. 43When I click on the activation link, I've got this message: ``The user with confirmation token "DtrOPfbQeVkWf6N" does not exist``.
41~~~~~~~~~~~~~~~ 44~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42 45
43You already enabled your account or the URL of the activation email is wrong. 46You already enabled your account or the URL of the activation email is wrong.
diff --git a/docs/en/user/download_articles.rst b/docs/en/user/download_articles.rst
index 21ab1995..4813776d 100644
--- a/docs/en/user/download_articles.rst
+++ b/docs/en/user/download_articles.rst
@@ -9,8 +9,9 @@ On the article view, click on this icon, in the sidebar:
9 :alt: download article 9 :alt: download article
10 :align: center 10 :align: center
11 11
12You can also download a full category in these formats. For example, on **Unread** view, click on this icon in the top bar: 12You can also download a full category (unread, starred, archive) in these formats.
13For example, on **Unread** view, click on this icon in the top bar:
13 14
14.. image:: ../../img/user/download_articles.png 15.. image:: ../../img/user/download_articles.png
15 :alt: download articles 16 :alt: download articles
16 :align: center \ No newline at end of file 17 :align: center
diff --git a/docs/en/user/first_article.rst b/docs/en/user/first_article.rst
index 6f94bbef..1400e1e8 100644
--- a/docs/en/user/first_article.rst
+++ b/docs/en/user/first_article.rst
@@ -10,20 +10,24 @@ The main purpose of wallabag is to save web articles. You have many ways to do i
10By using a bookmarklet 10By using a bookmarklet
11---------------------- 11----------------------
12 12
13On the ``Howto`` page, you have a ``Bookmarklet`` tab. Drag and drop the ``bag it!`` link to your bookmarks bar of your browser. 13On the ``Howto`` page, you have a ``Bookmarklet`` tab. Drag and drop the ``bag it!``
14link to your bookmarks bar of your browser.
14 15
15Now, each time you're reading an article on the web and you want to save it, click on the ``bag it!`` link in your bookmarks bar. The article is saved. 16Now, each time you're reading an article on the web and you want to save it,
17click on the ``bag it!`` link in your bookmarks bar. The article is saved.
16 18
17By using the classic form 19By using the classic form
18------------------------- 20-------------------------
19 21
20In the top bar of your screen, you have 3 icons. With the first one, a plus sign, you can easily save a new article. 22In the top bar of your screen, you have 3 icons. With the first one, a plus sign,
23you can easily save a new article.
21 24
22.. image:: ../../img/user/topbar.png 25.. image:: ../../img/user/topbar.png
23 :alt: Top bar 26 :alt: Top bar
24 :align: center 27 :align: center
25 28
26Click on it to display a new field, paste the article URL inside and press your ``Return`` key. The article is saved. 29Click on it to display a new field, paste the article URL inside and press your
30``Return`` key. The article is saved.
27 31
28By using a browser add-on 32By using a browser add-on
29------------------------- 33-------------------------
@@ -59,4 +63,4 @@ Windows Phone
59iOS 63iOS
60~~~ 64~~~
61 65
62*This application is not yet available for wallabag v2*. \ No newline at end of file 66*This application is not yet available for wallabag v2*.
diff --git a/docs/en/user/import.rst b/docs/en/user/import.rst
index 37f375b2..d6054d39 100644
--- a/docs/en/user/import.rst
+++ b/docs/en/user/import.rst
@@ -29,7 +29,8 @@ You will have a ``Unread articles.json`` file.
29Import your data into wallabag 2.x 29Import your data into wallabag 2.x
30~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 30~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31 31
32Click on ``Import`` link in the menu, select your export file on your computer and import it. 32Click on ``Import`` link in the menu, choose the right wallabag version,
33select your export file on your computer and import it.
33 34
34.. image:: ../../img/user/import_wllbg.png 35.. image:: ../../img/user/import_wllbg.png
35 :alt: Import from wallabag 1.x 36 :alt: Import from wallabag 1.x
@@ -40,24 +41,31 @@ All your wallabag articles will be imported.
40From Pocket 41From Pocket
41----------- 42-----------
42 43
43Create a new applicaton on Pocket 44Create a new application on Pocket
44~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 45~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45 46
46To import your data from Pocket, we use the Pocket API. You need to create a new application on their developer website to continue. 47To import your data from Pocket, we use the Pocket API. You need to create
48a new application on their developer website to continue.
47 49
48* Create a new application `on the developer website <https://getpocket.com/developer/apps/new>`_ 50* Create a new application `on the developer website <https://getpocket.com/developer/apps/new>`_
49* Fill in the required fields: application name, application description, permissions (only **retrieve**), platform (**web**), accept the terms of service and submit your new application 51* Fill in the required fields: application name, application description,
52 permissions (only **retrieve**), platform (**web**), accept the terms of service
53 and submit your new application
50 54
51Pocket will give you a **Consumer Key** (for example, `49961-985e4b92fe21fe4c78d682c1`). You need to configure the ``pocket_consumer_key`` into the ``app/config/parameters.yml`` file in wallabag. 55Pocket will give you a **Consumer Key** (for example, `49961-985e4b92fe21fe4c78d682c1`).
56You need to configure the ``pocket_consumer_key`` into the ``app/config/parameters.yml`` file in wallabag.
52 57
53Now, all is fine to migrate from Pocket. 58Now, all is fine to migrate from Pocket.
54 59
55Import your data into wallabag 2.x 60Import your data into wallabag 2.x
56~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 61~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57 62
58Click on ``Import`` link in the menu, on ``Import contents`` in Pocket section and then on ``Connect to Pocket and import data``. 63Click on ``Import`` link in the menu, on ``Import contents`` in Pocket section
64and then on ``Connect to Pocket and import data``.
59 65
60You need to authorize wallabag to interact with your Pocket account. Your data will be imported. Data import can be a demanding process for your server (we need to work on this import to improve it). 66You need to authorize wallabag to interact with your Pocket account.
67Your data will be imported. Data import can be a demanding process for your server
68(we need to work on this import to improve it).
61 69
62From Instapaper 70From Instapaper
63--------------- 71---------------
diff --git a/docs/en/user/installation.rst b/docs/en/user/installation.rst
new file mode 100644
index 00000000..760fd4d2
--- /dev/null
+++ b/docs/en/user/installation.rst
@@ -0,0 +1,145 @@
1Install wallabag
2================
3
4Requirements
5------------
6
7wallabag is compatible with php >= 5.5
8
9You'll need the following extensions for wallabag to work. Some of these may already activated in your version of php, so you may not have to install all corresponding packages.
10
11- php-session
12- php-ctype
13- php-dom
14- pĥp-hash
15- php-simplexml
16- php-json
17- php-gd
18- php-mbstring
19- php-xml
20- php-tidy
21- php-iconv
22- php-curl
23- php-gettext
24- php-tokenizer
25
26wallabag uses PDO to connect to database, so you'll need one of:
27
28- php-pdo_mysql
29- php-pdo_sqlite
30- php-pdo_pgsql
31
32and it's corresponding database server.
33
34Installation
35------------
36
37wallabag uses a big number of libraries in order to function. These libraries must be installed with a tool called Composer. You need to install it if you don't already have.
38
39Install Composer:
40
41::
42
43 curl -s http://getcomposer.org/installer | php
44
45You can find specific instructions here : __ https://getcomposer.org/doc/00-intro.md
46
47To install wallabag itself, you must run these two commands:
48
49::
50
51 SYMFONY_ENV=prod composer create-project wallabag/wallabag wallabag "2.0.*@alpha" --no-dev
52 php bin/console wallabag:install --env=prod
53
54To start php's build-in server and test if everything did install correctly, you can do:
55
56::
57
58 php bin/console server:run --env=prod
59
60And access wallabag at http://yourserverip:8000
61
62Installing on Apache
63--------------------
64
65Assuming you install wallabag in the /var/www/wallabag folder and that you want to use php as an Apache module, here's a vhost for wallabag:
66
67::
68
69 <VirtualHost *:80>
70 ServerName domain.tld
71 ServerAlias www.domain.tld
72
73 DocumentRoot /var/www/wallabag/web
74 <Directory /var/www/wallabag/web>
75 AllowOverride None
76 Order Allow,Deny
77 Allow from All
78
79 <IfModule mod_rewrite.c>
80 Options -MultiViews
81 RewriteEngine On
82 RewriteCond %{REQUEST_FILENAME} !-f
83 RewriteRule ^(.*)$ app.php [QSA,L]
84 </IfModule>
85 </Directory>
86
87 # uncomment the following lines if you install assets as symlinks
88 # or run into problems when compiling LESS/Sass/CoffeScript assets
89 # <Directory /var/www/wallabag>
90 # Options FollowSymlinks
91 # </Directory>
92
93 # optionally disable the RewriteEngine for the asset directories
94 # which will allow apache to simply reply with a 404 when files are
95 # not found instead of passing the request into the full symfony stack
96 <Directory /var/www/wallabag/web/bundles>
97 <IfModule mod_rewrite.c>
98 RewriteEngine Off
99 </IfModule>
100 </Directory>
101 ErrorLog /var/log/apache2/wallabag_error.log
102 CustomLog /var/log/apache2/wallabag_access.log combined
103 </VirtualHost>
104
105After reloading or restarting Apache, you should now be able to access wallabag at http://domain.tld.
106
107Installing on Nginx
108-------------------
109
110Assuming you install wallabag in the /var/www/wallabag folder, here's the recipe for wallabag :
111
112::
113
114 server {
115 server_name domain.tld www.domain.tld;
116 root /var/www/wallabag/web;
117
118 location / {
119 # try to serve file directly, fallback to app.php
120 try_files $uri /app.php$is_args$args;
121 }
122 location ~ ^/app\.php(/|$) {
123 fastcgi_pass unix:/var/run/php5-fpm.sock;
124 fastcgi_split_path_info ^(.+\.php)(/.*)$;
125 include fastcgi_params;
126 # When you are using symlinks to link the document root to the
127 # current version of your application, you should pass the real
128 # application path instead of the path to the symlink to PHP
129 # FPM.
130 # Otherwise, PHP's OPcache may not properly detect changes to
131 # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
132 # for more information).
133 fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
134 fastcgi_param DOCUMENT_ROOT $realpath_root;
135 # Prevents URIs that include the front controller. This will 404:
136 # http://domain.tld/app.php/some-path
137 # Remove the internal directive to allow URIs like this
138 internal;
139 }
140
141 error_log /var/log/nginx/wallabag_error.log;
142 access_log /var/log/nginx/wallabag_access.log;
143 }
144
145After reloading or restarting nginx, you should now be able to access wallabag at http://domain.tld.
diff --git a/docs/en/user/login.rst b/docs/en/user/login.rst
index 1b6b8875..1813f3d8 100644
--- a/docs/en/user/login.rst
+++ b/docs/en/user/login.rst
@@ -5,7 +5,8 @@ Your account is now enabled, congratulations!
5 5
6To login to wallabag, fill the form on login page. 6To login to wallabag, fill the form on login page.
7 7
8If you are on your personal computer and you want to stay connected, you can check the ``Keep me logged in`` checkbox: wallabag will remember you for one year. 8If you are on your personal computer and you want to stay connected,
9you can check the ``Keep me logged in`` checkbox: wallabag will remember you for one year.
9 10
10.. image:: ../../img/user/login_form.png 11.. image:: ../../img/user/login_form.png
11 :alt: Login form 12 :alt: Login form
@@ -17,4 +18,6 @@ Frequently asked questions
17I forgot my password 18I forgot my password
18~~~~~~~~~~~~~~~~~~~~ 19~~~~~~~~~~~~~~~~~~~~
19 20
20You can reset your password by clicking on ``Forgot your password?`` link, on the login page. Then, fill the form with your email address 21You can reset your password by clicking on ``Forgot your password?`` link,
22on the login page. Then, fill the form with your email address or your username,
23you'll receive an email to reset your password.
diff --git a/docs/fr/developer/docker.rst b/docs/fr/developer/docker.rst
new file mode 100644
index 00000000..73cb56be
--- /dev/null
+++ b/docs/fr/developer/docker.rst
@@ -0,0 +1,50 @@
1Exécuter wallabag avec docker-compose
2=====================================
3
4Pour faire tourner votre propre instance de développement de wallabag, vous pouvez
5utiliser les fichiers docker pré-configurés.
6
7Pré-requis
8----------
9
10Soyez sur d'avoir `Docker
11<https://docs.docker.com/installation/ubuntulinux/>`__ et `Docker
12Compose <https://docs.docker.com/compose/install/>`__ installés et à jour sur votre
13système.
14
15Changer de SGBD
16---------------
17
18Par défaut, wallabag fonctionne avec une base de données SQLite.
19Depuis que wallabag supporte Postgresql et MySQL, les conteneurs Docker sont
20aussi disponibles pour ces SGBD.
21
22Dans ``docker-compose.yml``, en fonction de votre SGBD, décommentez :
23
24- la définition du conteneur (le block racine ``postgres`` ou ``mariadb``)
25- le conteneur ``links`` dans le conteneur ``php``
26- le conteneur ``env_file`` dans le conteneur ``php``
27
28Pour que les commandes Symfony (par exemple ``wallabag:install``) continuent de
29fonctionner sur votre système, vous devez aussi :
30
31- charger le bon fichier d'environnement dans votre ligne de commandes (``source``),
32pour que les variables comme ``SYMFONY__ENV__DATABASE_HOST`` existent.
33- ajouter une ligne ``127.0.0.1 rdbms`` dans votre fichier ``hosts``
34
35Exécuter wallabag
36-----------------
37
38#. Forker et cloner le projet
39#. Editer ``app/config/parameters.yml`` pour remplacer les propriétés ``database_*``
40 par les lignes commentées (celles avec des valeurs préfixées par ``env.``)
41#. ``composer install`` pour installer les dépendances
42#. ``php app/console wallabag:install`` pour créer le schéma de la BDD
43#. ``docker-compose up`` pour démarrer les conteneurs
44#. Enfin, se rendre sur http://localhost:8080/ pour accéder à une installation
45 tout propre de wallabag.
46
47Il est possible de rencontrer des problèmes de droits UNIX, de mauvais chemins
48dans les fichiers de cache, etc…
49Les opérations comme vider le cache ou restaurer les permissions des fichiers
50peuvent être fréquemment nécessaires, n'ayez crainte !
diff --git a/docs/fr/developer/translate.rst b/docs/fr/developer/translate.rst
new file mode 100644
index 00000000..87e78cb4
--- /dev/null
+++ b/docs/fr/developer/translate.rst
@@ -0,0 +1,62 @@
1Traduire wallabag
2=================
3
4L'application web
5-----------------
6
7Fichiers de traductions
8~~~~~~~~~~~~~~~~~~~~~~~
9
10.. note::
11
12 Comme wallabag est principalement dévelopée par une équipe française, c'est
13 cette traduction qui est considérée comme la plus récente. Merci de vous baser
14 sur celle-ci pour créer votre traduction.
15
16Les principaux fichiers de traduction se trouvent ici : https://github.com/wallabag/wallabag/tree/v2/src/Wallabag/CoreBundle/Resources/translations.
17
18Vous devez créer les fichiers ``messages.CODE.yml`` et ``validators.CODE.yml``,
19où CODE est le code ISO 639-1 de votre langue (`cf wikipedia <https://fr.wikipedia.org/wiki/Liste_des_codes_ISO_639-1>`__).
20
21Autres fichiers à traduire :
22
23- https://github.com/wallabag/wallabag/tree/v2/app/Resources/CraueConfigBundle/translations.
24- https://github.com/wallabag/wallabag/tree/v2/app/Resources/FOSUserBundle/translations.
25
26Vous devez créer les fichiers ``LE_FICHIER_DE_TRADUCTION.CODE.yml``.
27
28Fichier de configuration
29~~~~~~~~~~~~~~~~~~~~~~~~
30
31Vous devez éditer `app/config/config.yml
32<https://github.com/wallabag/wallabag/blob/v2/app/config/config.yml>`__ pour
33afficher votre langue dans la page Configuration de wallabag (pour permettre aux
34utilisateurs de choisir cette nouvelle traduction).
35
36Dans la section ``wallabag_core.languages``, vous devez ajouter une nouvelle ligne
37avec votre traduction. Par exemple :
38
39::
40
41 wallabag_core:
42 ...
43 languages:
44 en: 'English'
45 fr: 'Français'
46
47
48Pour la première colonne (``en``, ``fr``, etc.), vous devez ajouter le code ISO 639-1
49de votre langue (voir ci-dessus).
50
51Pour la seconde colonne, c'est juste le nom de votre langue.
52
53Documentation de wallabag
54-------------------------
55
56.. note::
57
58 Contrairement à l'application, la langue principale de la documentation est l'anglais
59
60Les fichiers de documentation se trouvent ici : https://github.com/wallabag/wallabag/tree/v2/docs
61
62Vous devez respecter la structure du dossier ``en`` quand vous crééz votre traduction.
diff --git a/docs/fr/index.rst b/docs/fr/index.rst
index 31c7bd3a..a47b8a62 100644
--- a/docs/fr/index.rst
+++ b/docs/fr/index.rst
@@ -9,9 +9,36 @@ Documentation de wallabag
9simplement d’archiver une page web en ne conservant que le contenu. Les 9simplement d’archiver une page web en ne conservant que le contenu. Les
10éléments superflus (menu, publicité, etc.) sont supprimés. 10éléments superflus (menu, publicité, etc.) sont supprimés.
11 11
12.. note::
13
14 Vous vous trouvez sur la documentation de wallabag v2. Si vous voulez lire la documentation de wallabag v1, `vous pouvez jeter un œil ici <https://github.com/wallabag/documentation>`__.
15
12La documentation principale de cette application est découpée en plusieurs sections : 16La documentation principale de cette application est découpée en plusieurs sections :
13 17
18* :ref:`user-docs`
19* :ref:`dev-docs`
20
21.. _user-docs:
22
23.. toctree::
24 :maxdepth: 2
25 :caption: Documentation utilisateur
26
27 user/installation
28 user/create_account
29 user/login
30 user/configuration
31 user/first_article
32 user/import
33 user/download_articles
34 user/filters
35 user/tags
36
37.. _dev-docs:
38
14.. toctree:: 39.. toctree::
15 :maxdepth: 2 40 :maxdepth: 2
41 :caption: Documentation développeur
16 42
17 index 43 developer/docker
44 developer/translate
diff --git a/docs/fr/user/configuration.rst b/docs/fr/user/configuration.rst
new file mode 100644
index 00000000..f8bb6d42
--- /dev/null
+++ b/docs/fr/user/configuration.rst
@@ -0,0 +1,114 @@
1Configuration
2=============
3
4Maintenant que vous êtes connecté, il est temps de confirurer votre compte.
5
6Cliquez sur le menu ``Configuration``. Vous avez accès à 5 onglets:
7``Paramètres``, ``RSS``, ``Mon compte``, ``Mot de passe`` and ``Règles de tag automatiques``.
8
9Paramètres
10----------
11
12Thème
13~~~~~
14
15L'affichage de wallabag est personnalisable. C'est ici que vous choisissez le thème
16que vous préférez. Vous pouvez aussi en créer un nouveau, une documentation sera
17disponible pour apprendre comment. Le thème par défaut ``Material``, c'est ce thème
18qui est utilisé dans les captures d'écran de la documentation.
19
20Nombre d'articles par page
21~~~~~~~~~~~~~~~~~~~~~~~~~~
22
23Vous pouvez définir le nombre d'articles affichés sur chaque page.
24
25Langue
26~~~~~~
27
28Vous pouvez définir la langue de l'interface de wallabag. Vous devrez vous déconnecter
29pour que la nouvelle langue soit prise en compte.
30
31RSS
32---
33
34wallabag propose un flux RSS for chaque statut d'article : non lus, favoris and lus.
35
36Tout d'abord, vous devez vous créer un jeton personnel : cliquez sur ``Créez votre jeton``.
37C'est possible de regénérer votre jeton en cliquant sur ``Réinitialisez votre jeton``.
38
39Vous avez maintenant trois liens, un par statut : ajoutez les dans votre agrégateur de flux RSS préféré.
40
41Vous pouvez aussi définir combien d'articles vous souhaitez dans vos flux RSS
42(50 est la valeur par défaut).
43
44Mon compte
45----------
46
47Vous pouvez ici modifier votre nom, votre adresse email et activer la ``Double authentification``.
48
49Double authentification (2FA)
50~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51
52 Two-factor authentication (also known as 2FA) is a technology patented in
53 1984 that provides identification of users by means of the combination of two different components.
54
55https://en.wikipedia.org/wiki/Two-factor_authentication
56
57Si vous activer 2FA, à chaque tentative de connexion à wallabag, vous recevrez
58un code par email. Vous devez renseigner ce code dans le formulaire suivant :
59
60.. image:: ../../img/user/2FA_form.png
61 :alt: Two factor authentication
62 :align: center
63
64Si vous ne souhaitez pas recevoir un code à chaque fois que vous vous connectez,
65vous pouvez cocher la case ``Je suis sur un ordinateur de confiance`` : wallabag
66se souviendra de vous pour 15 jours.
67
68Mot de passe
69------------
70
71Vous pouvez changer de mot de passe ici (8 caractères minimum).
72
73Règles de tag automatiques
74--------------------------
75
76Si vous voulez automatiquement assigner un tag à de nouveaux articles en fonction de
77certains critères, cette partie de la configuration est pour vous.
78
79Que veut dire « règles de tag automatiques » ?
80~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
81
82Ce sont des règles utilisées par wallabag pour automatiquement assigner un tag
83à un nouvel article.
84À chaque fois que vous ajoutez un nouvel article, toutes les règles sont utilisées pour ajouter
85les tags que vous avez configurés, vous épargnant ainsi la peine de classer manuellement vos articles.
86
87Comment les utiliser ?
88~~~~~~~~~~~~~~~~~~~~~~
89
90Admettons que vous voulez ajouter comme tag *« lecture rapide »* quand le temps de lecture
91d'un article est inférieur à 3 minutes.
92Dans ce cas, vous devez ajouter « readingTime <= 3 » dans le champ **Règle** et *« lecture rapide »* dans le champ **Tags**.
93Plusieurs tags peuvent être ajoutés en même temps en les séparant par une virgule : *« lecture rapide, à lire »*.
94Des règles complexes peuvent être écrites en utilisant les opérateurs pré-définis :
95if *« readingTime >= 5 AND domainName = "github.com" »* then tag as *« long reading, github »*.
96
97Quels variables et opérateurs puis-je utiliser pour écrire mes règles ?
98~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
99
100Les variables et opérateurs suivants peuvent être utilisés lors de la création de vos règles :
101
102=========== ============================================== ========== ==========
103Variable Sens Opérateur Sens
104----------- ---------------------------------------------- ---------- ----------
105title Titre de l'article <= Inférieur ou égal à …
106url URL de l'article < Strictement inférieur à …
107isArchived Si l'article est archivé ou non => Supérieur ou égal à …
108isStared Si l'article est en favori ou non > Strictement supérieur à …
109content Le contenu de l'article = Égal à …
110language La langue de l'article != Différent de …
111mimetype The type MIME de l'article OR Telle règle ou telle autre règle
112readingTime Le temps de lecture de l'article, en minutes AND Telle règle et telle règle
113domainName Le nom de domaine de l'article matches Contient telle chaine de caractère (insensible à la casse). Exemple : title matches "football"
114=========== ============================================== ========== ==========
diff --git a/docs/fr/user/create_account.rst b/docs/fr/user/create_account.rst
new file mode 100644
index 00000000..7fea6edf
--- /dev/null
+++ b/docs/fr/user/create_account.rst
@@ -0,0 +1,46 @@
1Se créer un compte
2==================
3
4Sur la page de connexion, cliquez sur le bouton ``Créer un compte``.
5
6.. image:: ../../img/user/registration_form.png
7 :alt: Registration form
8 :align: center
9
10Vous devez renseigner le formulaire. Faites attention de bien renseigner une adresse
11email valide, nous allons vous envoyer un email d'activation.
12
13.. image:: ../../img/user/sent_email.png
14 :alt: Email was sent to activate account
15 :align: center
16
17Vérifiez votre boite de réception, vous avez un nouvel email avec un lien comme celui-ci
18``http://wallabag/register/confirm/Ba19wokGovN-DdBQNfg4YgRkUQWRP4-k2g0Bk-hBTX4``.
19Cliquez dessus pour activer votre compte.
20
21Votre compte est maintenant actif.
22
23.. image:: ../../img/user/activated_account.png
24 :alt: Welcome on board!
25 :align: center
26
27Foire aux questions
28-------------------
29
30Je ne veux pas valider le formulaire de création de compte
31~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32
33Soyez sur d'avoir bien renseigné tous les champs :
34
35* une adresse email valide
36* le même mot de passe dans les deux champs
37
38Je n'ai pas reçu mon email d'activation
39~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
40
41Êtes-vous sur d'avoir renseigné votre bonne adresse ? Avez-vous vérifié le dossier de spams ?
42
43Quand je clique sur le lien d'activation, j'ai ce message : ``The user with confirmation token "DtrOPfbQeVkWf6N" does not exist``.
44~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
45
46Vous avez déjà activé votre compte ou l'URL d'activation n'est pas correcte.
diff --git a/docs/fr/user/download_articles.rst b/docs/fr/user/download_articles.rst
new file mode 100644
index 00000000..dafeba37
--- /dev/null
+++ b/docs/fr/user/download_articles.rst
@@ -0,0 +1,17 @@
1Télécharger des articles
2========================
3
4Vous pouvez télécharger chaque article dans plusieurs formats : ePUB, MOBI, PDF, XML, JSON, CSV.
5
6Lorsque vous lisez un article, cliquez sur cette icône dans la barre latérale :
7
8.. image:: ../../img/user/download_article.png
9 :alt: download article
10 :align: center
11
12Vous pouvez aussi télécharger une catégorie (non lus, favoris, lus) dans ces formats.
13Par exemple, dans la vue **Non lus**, cliquez sur cette icône dans la barre supérieure :
14
15.. image:: ../../img/user/download_articles.png
16 :alt: download articles
17 :align: center
diff --git a/docs/fr/user/filters.rst b/docs/fr/user/filters.rst
new file mode 100644
index 00000000..ecb29948
--- /dev/null
+++ b/docs/fr/user/filters.rst
@@ -0,0 +1,2 @@
1Filtres
2=======
diff --git a/docs/fr/user/first_article.rst b/docs/fr/user/first_article.rst
new file mode 100644
index 00000000..90c45a44
--- /dev/null
+++ b/docs/fr/user/first_article.rst
@@ -0,0 +1,68 @@
1Sauvegardez votre premier article
2=================================
3
4La fonctionnalité principale de wallabag est de sauvegarder des articles.
5Vous avez plusieurs manières de le faire.
6
7.. note::
8
9 Un guide de démarrage s'affichera dans l'application jusqu'à ce que vous
10 enregistriez votre premier article.
11
12En utilisant le bookmarklet
13---------------------------
14
15Sur la page ``Aide``, vous avez un onglet ``Bookmarklet``. Glissez/déposez le lien ``bag it!``
16dans votre barre de favoris de votre navigateur.
17
18Maintennat, à chaque fois que vous lisez un article et que vous souhaitez le sauvegarder,
19cliquez sur le lien ``bag it!`` dans votre barre de favoris. L'article est enregistré.
20
21En utilisant le formulaire classique
22------------------------------------
23
24Dans la barre haut de wallabag, vous avez trois icônes. Avec la première icône,
25un signe plus, vous pouvez facilement ajouter un nouvel article.
26
27.. image:: ../../img/user/topbar.png
28 :alt: Top bar
29 :align: center
30
31Cliquez dessus pour afficher un nouveau champ, collez-y l'URL de l'article et appuyez
32sur la touche ``Entrée``. L'article est enregistré.
33
34En utilisant l'extension de votre navigateur
35--------------------------------------------
36
37Firefox
38~~~~~~~
39
40*Cette extension n'est pas encore disponible pour wallabag v2*.
41
42Chrome
43~~~~~~
44
45*Cette extension n'est pas encore disponible pour wallabag v2*.
46
47En utilisant l'application de votre smartphone
48----------------------------------------------
49
50Android
51~~~~~~~
52
53*Cette application n'est pas encore disponible pour wallabag v2*.
54
55Firefox OS
56~~~~~~~~~~
57
58*Cette application n'est pas encore disponible pour wallabag v2*.
59
60Windows Phone
61~~~~~~~~~~~~~
62
63*Cette application n'est pas encore disponible pour wallabag v2*.
64
65iOS
66~~~
67
68*Cette application n'est pas encore disponible pour wallabag v2*.
diff --git a/docs/fr/user/import.rst b/docs/fr/user/import.rst
new file mode 100644
index 00000000..c95f175d
--- /dev/null
+++ b/docs/fr/user/import.rst
@@ -0,0 +1,83 @@
1Migrer à wallabag
2=================
3
4Depuis wallabag
5---------------
6
7Exportez vos données de wallabag 1.x
8~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9
10Sur la page de configuration, cliquez sur ``Export JSON`` dans la section ``Exportez vos données wallabag``.
11
12.. image:: ../../img/user/export_wllbg_1.png
13 :alt: Export from wallabag 1.x
14 :align: center
15
16Vous obtiendrez un fichier ``wallabag-export-1-1970-01-01.json``.
17
18Exportez vos données de wallabag 2.x
19~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20
21Dans la barre latérale de téléchargement, cliquez sur ``JSON``.
22
23.. image:: ../../img/user/export_wllbg_2.png
24 :alt: Export from wallabag 2.x
25 :align: center
26
27Vous obtiendrez un fichier ``Unread articles.json``.
28
29Importez vos données wallabag 2.x
30~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31
32Cliquez sur le lien ``Importer`` dans le menu, choisissez la version de wallabag correspondante,
33sélectionnez votre fichier d'export sur votre ordinateur et importez-le.
34
35.. image:: ../../img/user/import_wllbg.png
36 :alt: Import from wallabag 1.x
37 :align: center
38
39Tous vos articles wallabag seront importés.
40
41Depuis Pocket
42-------------
43
44Créer une nouvelle application dans Pocket
45~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
46
47Pour importer vos données depuis Pocket, nous utilisons l'API de Pocket.
48Vous devez créer une nouvelle application sur leur site dédié aux développeurs pour continuer.
49
50* Créez une nouvelle application `sur leur site Développeurs <https://getpocket.com/developer/apps/new>`_
51* Remplissez les champs requis : nom de l'application, description de l'application,
52 permissions (seulement **retrieve**), la plateforme (**web**), acceptez les
53 termes d'utilisation du service et soumettez votre application
54
55Pocket vous fournira une **Consumer Key** (par exemple, `49961-985e4b92fe21fe4c78d682c1`).
56Vous devez configurer la ``pocket_consumer_key`` dans le fichier ``app/config/parameters.yml``.
57
58Maintenant, tout est bien configuré pour migrer depuis Pocket.
59
60Importez vos données dans wallabag 2.x
61~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62
63Cliquez sur le lien ``Importer`` dans le menu, sur ``Importer les contenus`` dans
64la section Pocket puis sur ``Se connecter à Pocket et importer les données``.
65
66Vous devez autoriser wallabag à se connecter à votre compte Pocket.
67Vos données vont être importées. L'import de données est une action qui peut être couteuse
68pour votre serveur (nous devons encore travailler pour améliorer cet import).
69
70Depuis Instapaper
71-----------------
72
73*Fonctionnalité pas encore implémentée dans wallabag v2.*
74
75Depuis Readability
76------------------
77
78*Fonctionnalité pas encore implémentée dans wallabag v2.*
79
80Depuis un fichier HTML ou JSON
81------------------------------
82
83*Fonctionnalité pas encore implémentée dans wallabag v2.*
diff --git a/docs/fr/user/installation.rst b/docs/fr/user/installation.rst
new file mode 100644
index 00000000..9c5c3cc8
--- /dev/null
+++ b/docs/fr/user/installation.rst
@@ -0,0 +1,143 @@
1Installer wallabag
2==================
3
4Pré-requis
5------------
6
7wallabag est compatible avec php >= 5.5
8
9Vous aurez besoin des extensions suivantes pour que wallabag fonctionne. Il est possible que certaines de ces extensions soient déjà activées dans votre version de php, donc vous n'avez pas forcément besoin d'installer tous les paquets correspondants.
10
11- php-session
12- php-ctype
13- php-dom
14- pĥp-hash
15- php-simplexml
16- php-json
17- php-gd
18- php-mbstring
19- php-xml
20- php-tidy
21- php-iconv
22- php-curl
23- php-gettext
24- php-tokenizer
25
26wallabag utilise PDO afin de se connecter à une base de données, donc vous aurez besoin d'une extension et d'un système de bases de données parmi :
27
28- php-pdo_mysql
29- php-pdo_sqlite
30- php-pdo_pgsql
31
32Installation
33------------
34
35wallabag utilise un grand nombre de bibliothèques pour fonctionner. Ces bibliothèques doivent être installées à l'aide d'un outil nommé Composer. Vous devez l'installer si ce n'est déjà fait.
36
37Installation de Composer :
38
39::
40
41 curl -s http://getcomposer.org/installer | php
42
43Vous pouvez trouver des instructions spécifiques ici (en anglais) : __ https://getcomposer.org/doc/00-intro.md
44
45Pour installer wallabag, vous devez exécuter ces deux commandes :
46
47::
48
49 SYMFONY_ENV=prod composer create-project wallabag/wallabag wallabag "2.0.*@alpha" --no-dev
50 php bin/console wallabag:install --env=prod
51
52Pour démarrer le serveur interne à php et vérifier que tout s'est installé correctement, vous pouvez exécuter :
53
54::
55
56 php bin/console server:run --env=prod
57
58Et accéder wallabag à l'adresse http://lipdevotreserveur:8000
59
60Installation avec Apache
61------------------------
62
63En imaginant que vous vouliez installer wallabag dans le dossier /var/www/wallabag et que vous utilisiez php comme un module Apache, voici un vhost pour wallabag :
64
65::
66
67 <VirtualHost *:80>
68 ServerName domain.tld
69 ServerAlias www.domain.tld
70
71 DocumentRoot /var/www/wallabag/web
72 <Directory /var/www/wallabag/web>
73 AllowOverride None
74 Order Allow,Deny
75 Allow from All
76
77 <IfModule mod_rewrite.c>
78 Options -MultiViews
79 RewriteEngine On
80 RewriteCond %{REQUEST_FILENAME} !-f
81 RewriteRule ^(.*)$ app.php [QSA,L]
82 </IfModule>
83 </Directory>
84
85 # uncomment the following lines if you install assets as symlinks
86 # or run into problems when compiling LESS/Sass/CoffeScript assets
87 # <Directory /var/www/wallabag>
88 # Options FollowSymlinks
89 # </Directory>
90
91 # optionally disable the RewriteEngine for the asset directories
92 # which will allow apache to simply reply with a 404 when files are
93 # not found instead of passing the request into the full symfony stack
94 <Directory /var/www/wallabag/web/bundles>
95 <IfModule mod_rewrite.c>
96 RewriteEngine Off
97 </IfModule>
98 </Directory>
99 ErrorLog /var/log/apache2/wallabag_error.log
100 CustomLog /var/log/apache2/wallabag_access.log combined
101 </VirtualHost>
102
103Après que vous ayez rechargé/redémarré Apache, vous devriez pouvoir avoir accès à wallabag à l'adresse http://domain.tld.
104
105Installation avec Nginx
106-----------------------
107
108En imaginant que vous vouliez installer wallabag dans le dossier /var/www/wallabag, voici un fichier de configuration Nginx pour wallabag :
109
110::
111
112 server {
113 server_name domain.tld www.domain.tld;
114 root /var/www/wallabag/web;
115
116 location / {
117 # try to serve file directly, fallback to app.php
118 try_files $uri /app.php$is_args$args;
119 }
120 location ~ ^/app\.php(/|$) {
121 fastcgi_pass unix:/var/run/php5-fpm.sock;
122 fastcgi_split_path_info ^(.+\.php)(/.*)$;
123 include fastcgi_params;
124 # When you are using symlinks to link the document root to the
125 # current version of your application, you should pass the real
126 # application path instead of the path to the symlink to PHP
127 # FPM.
128 # Otherwise, PHP's OPcache may not properly detect changes to
129 # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
130 # for more information).
131 fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
132 fastcgi_param DOCUMENT_ROOT $realpath_root;
133 # Prevents URIs that include the front controller. This will 404:
134 # http://domain.tld/app.php/some-path
135 # Remove the internal directive to allow URIs like this
136 internal;
137 }
138
139 error_log /var/log/nginx/wallabag_error.log;
140 access_log /var/log/nginx/wallabag_access.log;
141 }
142
143Après que vous ayez rechargé/redémarré Nginx, vous devriez pouvoir avoir accès à wallabag à l'adresse http://domain.tld.
diff --git a/docs/fr/user/login.rst b/docs/fr/user/login.rst
new file mode 100644
index 00000000..7ef70569
--- /dev/null
+++ b/docs/fr/user/login.rst
@@ -0,0 +1,23 @@
1Se connecter
2============
3
4Votre compte est maintenant actif, félicitations !
5
6Pour vous connecter à wallabag, remplissez le formulaire de connexion.
7
8Si vous êtes sur un ordinateur de confiance et que vous souhaitez rester connecté
9vous pouvez cocher la case ``Restez connecté`` : wallabag se souviendra de vous pour un an.
10
11.. image:: ../../img/user/login_form.png
12 :alt: Login form
13 :align: center
14
15Foire aux questions
16-------------------
17
18J'ai oublié mon mot de passe
19~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20
21Vous pouvez réinitialiser votre mot de passe en cliquant sur ``Mot de passe oublié ?``,
22sur la page de connexion. Ensuite, renseignez votre adresse email ou votre nom d'utilisateur,
23un email vous sera envoyé.
diff --git a/docs/fr/user/tags.rst b/docs/fr/user/tags.rst
new file mode 100644
index 00000000..8ddc0f40
--- /dev/null
+++ b/docs/fr/user/tags.rst
@@ -0,0 +1,2 @@
1Tags
2==== \ No newline at end of file
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
index 84bc14a9..03990088 100644
--- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
@@ -15,31 +15,6 @@ use Wallabag\CoreBundle\Entity\Tag;
15 15
16class WallabagRestController extends FOSRestController 16class WallabagRestController extends FOSRestController
17{ 17{
18 /**
19 * @param Entry $entry
20 * @param string $tags
21 */
22 private function assignTagsToEntry(Entry $entry, $tags)
23 {
24 foreach (explode(',', $tags) as $label) {
25 $label = trim($label);
26 $tagEntity = $this
27 ->getDoctrine()
28 ->getRepository('WallabagCoreBundle:Tag')
29 ->findOneByLabel($label);
30
31 if (is_null($tagEntity)) {
32 $tagEntity = new Tag();
33 $tagEntity->setLabel($label);
34 }
35
36 // only add the tag on the entry if the relation doesn't exist
37 if (!$entry->getTags()->contains($tagEntity)) {
38 $entry->addTag($tagEntity);
39 }
40 }
41 }
42
43 private function validateAuthentication() 18 private function validateAuthentication()
44 { 19 {
45 if (false === $this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) { 20 if (false === $this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) {
@@ -140,7 +115,7 @@ class WallabagRestController extends FOSRestController
140 115
141 $tags = $request->request->get('tags', ''); 116 $tags = $request->request->get('tags', '');
142 if (!empty($tags)) { 117 if (!empty($tags)) {
143 $this->assignTagsToEntry($entry, $tags); 118 $this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags);
144 } 119 }
145 120
146 $em = $this->getDoctrine()->getManager(); 121 $em = $this->getDoctrine()->getManager();
@@ -192,7 +167,7 @@ class WallabagRestController extends FOSRestController
192 167
193 $tags = $request->request->get('tags', ''); 168 $tags = $request->request->get('tags', '');
194 if (!empty($tags)) { 169 if (!empty($tags)) {
195 $this->assignTagsToEntry($entry, $tags); 170 $this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags);
196 } 171 }
197 172
198 $em = $this->getDoctrine()->getManager(); 173 $em = $this->getDoctrine()->getManager();
@@ -270,7 +245,7 @@ class WallabagRestController extends FOSRestController
270 245
271 $tags = $request->request->get('tags', ''); 246 $tags = $request->request->get('tags', '');
272 if (!empty($tags)) { 247 if (!empty($tags)) {
273 $this->assignTagsToEntry($entry, $tags); 248 $this->get('wallabag_core.content_proxy')->assignTagsToEntry($entry, $tags);
274 } 249 }
275 250
276 $em = $this->getDoctrine()->getManager(); 251 $em = $this->getDoctrine()->getManager();
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index ea77d138..0fae3a0f 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -3,6 +3,7 @@
3namespace Wallabag\CoreBundle\Controller; 3namespace Wallabag\CoreBundle\Controller;
4 4
5use Pagerfanta\Adapter\DoctrineORMAdapter; 5use Pagerfanta\Adapter\DoctrineORMAdapter;
6use Pagerfanta\Exception\OutOfRangeCurrentPageException;
6use Pagerfanta\Pagerfanta; 7use Pagerfanta\Pagerfanta;
7use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; 8use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
8use Symfony\Bundle\FrameworkBundle\Controller\Controller; 9use Symfony\Bundle\FrameworkBundle\Controller\Controller;
@@ -252,7 +253,13 @@ class EntryController extends Controller
252 $entries = new Pagerfanta($pagerAdapter); 253 $entries = new Pagerfanta($pagerAdapter);
253 254
254 $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage()); 255 $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage());
255 $entries->setCurrentPage($page); 256 try {
257 $entries->setCurrentPage($page);
258 } catch (OutOfRangeCurrentPageException $e) {
259 if ($page > 1) {
260 return $this->redirect($this->generateUrl($type, array('page' => $entries->getNbPages())), 302);
261 }
262 }
256 263
257 return $this->render( 264 return $this->render(
258 'WallabagCoreBundle:Entry:entries.html.twig', 265 'WallabagCoreBundle:Entry:entries.html.twig',
diff --git a/src/Wallabag/CoreBundle/Helper/ContentProxy.php b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
index bd8b993a..ba90b731 100644
--- a/src/Wallabag/CoreBundle/Helper/ContentProxy.php
+++ b/src/Wallabag/CoreBundle/Helper/ContentProxy.php
@@ -5,7 +5,9 @@ namespace Wallabag\CoreBundle\Helper;
5use Graby\Graby; 5use Graby\Graby;
6use Psr\Log\LoggerInterface as Logger; 6use Psr\Log\LoggerInterface as Logger;
7use Wallabag\CoreBundle\Entity\Entry; 7use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\CoreBundle\Entity\Tag;
8use Wallabag\CoreBundle\Tools\Utils; 9use Wallabag\CoreBundle\Tools\Utils;
10use Wallabag\CoreBundle\Repository\TagRepository;
9 11
10/** 12/**
11 * This kind of proxy class take care of getting the content from an url 13 * This kind of proxy class take care of getting the content from an url
@@ -16,12 +18,14 @@ class ContentProxy
16 protected $graby; 18 protected $graby;
17 protected $tagger; 19 protected $tagger;
18 protected $logger; 20 protected $logger;
21 protected $tagRepository;
19 22
20 public function __construct(Graby $graby, RuleBasedTagger $tagger, Logger $logger) 23 public function __construct(Graby $graby, RuleBasedTagger $tagger, TagRepository $tagRepository, Logger $logger)
21 { 24 {
22 $this->graby = $graby; 25 $this->graby = $graby;
23 $this->tagger = $tagger; 26 $this->tagger = $tagger;
24 $this->logger = $logger; 27 $this->logger = $logger;
28 $this->tagRepository = $tagRepository;
25 } 29 }
26 30
27 /** 31 /**
@@ -75,4 +79,38 @@ class ContentProxy
75 79
76 return $entry; 80 return $entry;
77 } 81 }
82
83 /**
84 * Assign some tags to an entry.
85 *
86 * @param Entry $entry
87 * @param array|string $tags An array of tag or a string coma separated of tag
88 */
89 public function assignTagsToEntry(Entry $entry, $tags)
90 {
91 if (!is_array($tags)) {
92 $tags = explode(',', $tags);
93 }
94
95 foreach ($tags as $label) {
96 $label = trim($label);
97
98 // avoid empty tag
99 if (0 === strlen($label)) {
100 continue;
101 }
102
103 $tagEntity = $this->tagRepository->findOneByLabel($label);
104
105 if (is_null($tagEntity)) {
106 $tagEntity = new Tag();
107 $tagEntity->setLabel($label);
108 }
109
110 // only add the tag on the entry if the relation doesn't exist
111 if (false === $entry->getTags()->contains($tagEntity)) {
112 $entry->addTag($tagEntity);
113 }
114 }
115 }
78} 116}
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml
index a8796fe4..1aa66be1 100644
--- a/src/Wallabag/CoreBundle/Resources/config/services.yml
+++ b/src/Wallabag/CoreBundle/Resources/config/services.yml
@@ -50,6 +50,7 @@ services:
50 arguments: 50 arguments:
51 - "@wallabag_core.graby" 51 - "@wallabag_core.graby"
52 - "@wallabag_core.rule_based_tagger" 52 - "@wallabag_core.rule_based_tagger"
53 - "@wallabag_core.tag_repository"
53 - "@logger" 54 - "@logger"
54 55
55 wallabag_core.rule_based_tagger: 56 wallabag_core.rule_based_tagger:
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
index 32d6a575..5512d6e1 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/EntryControllerTest.php
@@ -216,6 +216,17 @@ class EntryControllerTest extends WallabagCoreTestCase
216 $this->assertEquals(200, $client->getResponse()->getStatusCode()); 216 $this->assertEquals(200, $client->getResponse()->getStatusCode());
217 } 217 }
218 218
219 public function testRangeException()
220 {
221 $this->logInAs('admin');
222 $client = $this->getClient();
223
224 $client->request('GET', '/all/list/900');
225
226 $this->assertEquals(302, $client->getResponse()->getStatusCode());
227 $this->assertEquals('/all/list', $client->getResponse()->getTargetUrl());
228 }
229
219 /** 230 /**
220 * @depends testPostNewOk 231 * @depends testPostNewOk
221 */ 232 */
diff --git a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php
index d29984e9..f58b5828 100644
--- a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php
@@ -3,8 +3,9 @@
3namespace Wallabag\CoreBundle\Tests\Helper; 3namespace Wallabag\CoreBundle\Tests\Helper;
4 4
5use Psr\Log\NullLogger; 5use Psr\Log\NullLogger;
6use Wallabag\CoreBundle\Entity\Entry;
7use Wallabag\CoreBundle\Helper\ContentProxy; 6use Wallabag\CoreBundle\Helper\ContentProxy;
7use Wallabag\CoreBundle\Entity\Entry;
8use Wallabag\CoreBundle\Entity\Tag;
8use Wallabag\UserBundle\Entity\User; 9use Wallabag\UserBundle\Entity\User;
9 10
10class ContentProxyTest extends \PHPUnit_Framework_TestCase 11class ContentProxyTest extends \PHPUnit_Framework_TestCase
@@ -30,7 +31,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
30 'language' => '', 31 'language' => '',
31 )); 32 ));
32 33
33 $proxy = new ContentProxy($graby, $tagger, $this->getLogger()); 34 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger());
34 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 35 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0');
35 36
36 $this->assertEquals('http://0.0.0.0', $entry->getUrl()); 37 $this->assertEquals('http://0.0.0.0', $entry->getUrl());
@@ -68,7 +69,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
68 ), 69 ),
69 )); 70 ));
70 71
71 $proxy = new ContentProxy($graby, $tagger, $this->getLogger()); 72 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger());
72 $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); 73 $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io');
73 74
74 $this->assertEquals('http://domain.io', $entry->getUrl()); 75 $this->assertEquals('http://domain.io', $entry->getUrl());
@@ -107,7 +108,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
107 ), 108 ),
108 )); 109 ));
109 110
110 $proxy = new ContentProxy($graby, $tagger, $this->getLogger()); 111 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger());
111 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 112 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0');
112 113
113 $this->assertEquals('http://1.1.1.1', $entry->getUrl()); 114 $this->assertEquals('http://1.1.1.1', $entry->getUrl());
@@ -120,6 +121,96 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
120 $this->assertEquals('1.1.1.1', $entry->getDomainName()); 121 $this->assertEquals('1.1.1.1', $entry->getDomainName());
121 } 122 }
122 123
124 public function testAssignTagsWithArrayAndExtraSpaces()
125 {
126 $graby = $this->getMockBuilder('Graby\Graby')
127 ->disableOriginalConstructor()
128 ->getMock();
129
130 $tagRepo = $this->getTagRepositoryMock();
131 $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger());
132
133 $entry = new Entry(new User());
134
135 $proxy->assignTagsToEntry($entry, array(' tag1', 'tag2 '));
136
137 $this->assertCount(2, $entry->getTags());
138 $this->assertEquals('tag1', $entry->getTags()[0]->getLabel());
139 $this->assertEquals('tag2', $entry->getTags()[1]->getLabel());
140 }
141
142 public function testAssignTagsWithString()
143 {
144 $graby = $this->getMockBuilder('Graby\Graby')
145 ->disableOriginalConstructor()
146 ->getMock();
147
148 $tagRepo = $this->getTagRepositoryMock();
149 $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger());
150
151 $entry = new Entry(new User());
152
153 $proxy->assignTagsToEntry($entry, 'tag1, tag2');
154
155 $this->assertCount(2, $entry->getTags());
156 $this->assertEquals('tag1', $entry->getTags()[0]->getLabel());
157 $this->assertEquals('tag2', $entry->getTags()[1]->getLabel());
158 }
159
160 public function testAssignTagsWithEmptyArray()
161 {
162 $graby = $this->getMockBuilder('Graby\Graby')
163 ->disableOriginalConstructor()
164 ->getMock();
165
166 $tagRepo = $this->getTagRepositoryMock();
167 $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger());
168
169 $entry = new Entry(new User());
170
171 $proxy->assignTagsToEntry($entry, array());
172
173 $this->assertCount(0, $entry->getTags());
174 }
175
176 public function testAssignTagsWithEmptyString()
177 {
178 $graby = $this->getMockBuilder('Graby\Graby')
179 ->disableOriginalConstructor()
180 ->getMock();
181
182 $tagRepo = $this->getTagRepositoryMock();
183 $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger());
184
185 $entry = new Entry(new User());
186
187 $proxy->assignTagsToEntry($entry, '');
188
189 $this->assertCount(0, $entry->getTags());
190 }
191
192 public function testAssignTagsAlreadyAssigned()
193 {
194 $graby = $this->getMockBuilder('Graby\Graby')
195 ->disableOriginalConstructor()
196 ->getMock();
197
198 $tagRepo = $this->getTagRepositoryMock();
199 $proxy = new ContentProxy($graby, $this->getTaggerMock(), $tagRepo, $this->getLogger());
200
201 $tagEntity = new Tag();
202 $tagEntity->setLabel('tag1');
203
204 $entry = new Entry(new User());
205 $entry->addTag($tagEntity);
206
207 $proxy->assignTagsToEntry($entry, 'tag1, tag2');
208
209 $this->assertCount(2, $entry->getTags());
210 $this->assertEquals('tag1', $entry->getTags()[0]->getLabel());
211 $this->assertEquals('tag2', $entry->getTags()[1]->getLabel());
212 }
213
123 private function getTaggerMock() 214 private function getTaggerMock()
124 { 215 {
125 return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger') 216 return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger')
@@ -128,6 +219,13 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
128 ->getMock(); 219 ->getMock();
129 } 220 }
130 221
222 private function getTagRepositoryMock()
223 {
224 return $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository')
225 ->disableOriginalConstructor()
226 ->getMock();
227 }
228
131 private function getLogger() 229 private function getLogger()
132 { 230 {
133 return new NullLogger(); 231 return new NullLogger();
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index 22932238..5dfd098c 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -9,7 +9,6 @@ use GuzzleHttp\Client;
9use GuzzleHttp\Exception\RequestException; 9use GuzzleHttp\Exception\RequestException;
10use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; 10use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
11use Wallabag\CoreBundle\Entity\Entry; 11use Wallabag\CoreBundle\Entity\Entry;
12use Wallabag\CoreBundle\Entity\Tag;
13use Wallabag\CoreBundle\Helper\ContentProxy; 12use Wallabag\CoreBundle\Helper\ContentProxy;
14use Craue\ConfigBundle\Util\Config; 13use Craue\ConfigBundle\Util\Config;
15 14
@@ -177,26 +176,6 @@ class PocketImport implements ImportInterface
177 $this->client = $client; 176 $this->client = $client;
178 } 177 }
179 178
180 private function assignTagsToEntry(Entry $entry, $tags)
181 {
182 foreach ($tags as $tag) {
183 $label = trim($tag['tag']);
184 $tagEntity = $this->em
185 ->getRepository('WallabagCoreBundle:Tag')
186 ->findOneByLabel($label);
187
188 if (is_object($tagEntity)) {
189 $entry->addTag($tagEntity);
190 } else {
191 $newTag = new Tag();
192 $newTag->setLabel($label);
193
194 $entry->addTag($newTag);
195 }
196 $this->em->flush();
197 }
198 }
199
200 /** 179 /**
201 * @see https://getpocket.com/developer/docs/v3/retrieve 180 * @see https://getpocket.com/developer/docs/v3/retrieve
202 * 181 *
@@ -246,7 +225,10 @@ class PocketImport implements ImportInterface
246 } 225 }
247 226
248 if (isset($pocketEntry['tags']) && !empty($pocketEntry['tags'])) { 227 if (isset($pocketEntry['tags']) && !empty($pocketEntry['tags'])) {
249 $this->assignTagsToEntry($entry, $pocketEntry['tags']); 228 $this->contentProxy->assignTagsToEntry(
229 $entry,
230 array_keys($pocketEntry['tags'])
231 );
250 } 232 }
251 233
252 $this->em->persist($entry); 234 $this->em->persist($entry);
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
index bbac6eaf..05bdb401 100644
--- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
+++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
@@ -6,7 +6,6 @@ use Psr\Log\LoggerInterface;
6use Psr\Log\NullLogger; 6use Psr\Log\NullLogger;
7use Doctrine\ORM\EntityManager; 7use Doctrine\ORM\EntityManager;
8use Wallabag\CoreBundle\Entity\Entry; 8use Wallabag\CoreBundle\Entity\Entry;
9use Wallabag\CoreBundle\Entity\Tag;
10use Wallabag\UserBundle\Entity\User; 9use Wallabag\UserBundle\Entity\User;
11use Wallabag\CoreBundle\Tools\Utils; 10use Wallabag\CoreBundle\Tools\Utils;
12use Wallabag\CoreBundle\Helper\ContentProxy; 11use Wallabag\CoreBundle\Helper\ContentProxy;
@@ -144,6 +143,7 @@ class WallabagV1Import implements ImportInterface
144 // @see ContentProxy->updateEntry 143 // @see ContentProxy->updateEntry
145 $entry = new Entry($this->user); 144 $entry = new Entry($this->user);
146 $entry->setUrl($importedEntry['url']); 145 $entry->setUrl($importedEntry['url']);
146
147 if (in_array($importedEntry['title'], $untitled)) { 147 if (in_array($importedEntry['title'], $untitled)) {
148 $entry = $this->contentProxy->updateEntry($entry, $importedEntry['url']); 148 $entry = $this->contentProxy->updateEntry($entry, $importedEntry['url']);
149 } else { 149 } else {
@@ -152,10 +152,14 @@ class WallabagV1Import implements ImportInterface
152 $entry->setReadingTime(Utils::getReadingTime($importedEntry['content'])); 152 $entry->setReadingTime(Utils::getReadingTime($importedEntry['content']));
153 $entry->setDomainName(parse_url($importedEntry['url'], PHP_URL_HOST)); 153 $entry->setDomainName(parse_url($importedEntry['url'], PHP_URL_HOST));
154 } 154 }
155
155 if (array_key_exists('tags', $importedEntry) && $importedEntry['tags'] != '') { 156 if (array_key_exists('tags', $importedEntry) && $importedEntry['tags'] != '') {
156 $tags = explode(',', $importedEntry['tags']); 157 $this->contentProxy->assignTagsToEntry(
157 $this->assignTagsToEntry($entry, $tags); 158 $entry,
159 $importedEntry['tags']
160 );
158 } 161 }
162
159 $entry->setArchived($importedEntry['is_read']); 163 $entry->setArchived($importedEntry['is_read']);
160 $entry->setStarred($importedEntry['is_fav']); 164 $entry->setStarred($importedEntry['is_fav']);
161 165
@@ -171,22 +175,4 @@ class WallabagV1Import implements ImportInterface
171 175
172 $this->em->flush(); 176 $this->em->flush();
173 } 177 }
174
175 private function assignTagsToEntry(Entry $entry, $tags)
176 {
177 foreach ($tags as $tag) {
178 $label = trim($tag);
179 $tagEntity = $this->em
180 ->getRepository('WallabagCoreBundle:Tag')
181 ->findOneByLabel($label);
182 if (is_object($tagEntity)) {
183 $entry->addTag($tagEntity);
184 } else {
185 $newTag = new Tag();
186 $newTag->setLabel($label);
187 $entry->addTag($newTag);
188 }
189 $this->em->flush();
190 }
191 }
192} 178}
diff --git a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
index 25359d56..f44786b1 100644
--- a/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
+++ b/src/Wallabag/ImportBundle/Tests/Import/PocketImportTest.php
@@ -260,24 +260,10 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
260 ->method('findByUrlAndUserId') 260 ->method('findByUrlAndUserId')
261 ->will($this->onConsecutiveCalls(false, true)); 261 ->will($this->onConsecutiveCalls(false, true));
262 262
263 $tag = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Tag')
264 ->disableOriginalConstructor()
265 ->getMock();
266
267 $tagRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\TagRepository')
268 ->disableOriginalConstructor()
269 ->getMock();
270
271 $tagRepo->expects($this->exactly(2))
272 // the method `findOneByLabel` doesn't exist, EntityRepository will then call `_call` method
273 // to magically call the `findOneBy` with ['label' => 'foo']
274 ->method('__call')
275 ->will($this->onConsecutiveCalls(false, $tag));
276
277 $this->em 263 $this->em
278 ->expects($this->any()) 264 ->expects($this->exactly(2))
279 ->method('getRepository') 265 ->method('getRepository')
280 ->will($this->onConsecutiveCalls($entryRepo, $tagRepo, $tagRepo, $entryRepo)); 266 ->willReturn($entryRepo);
281 267
282 $entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry') 268 $entry = $this->getMockBuilder('Wallabag\CoreBundle\Entity\Entry')
283 ->disableOriginalConstructor() 269 ->disableOriginalConstructor()