diff options
-rw-r--r-- | app/config/parameters.yml.dist | 2 | ||||
-rw-r--r-- | docs/en/user/parameters.rst | 1 | ||||
-rw-r--r-- | src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php | 3 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/TagController.php | 10 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/EntryRepository.php | 3 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Repository/TagRepository.php | 33 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | 10 |
7 files changed, 28 insertions, 34 deletions
diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index a33ea37b..436eeeda 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist | |||
@@ -20,7 +20,7 @@ parameters: | |||
20 | database_table_prefix: wallabag_ | 20 | database_table_prefix: wallabag_ |
21 | database_socket: null | 21 | database_socket: null |
22 | # with MySQL, use "utf8mb4" if got problem with content with emojis | 22 | # with MySQL, use "utf8mb4" if got problem with content with emojis |
23 | database_charset: utf8 | 23 | database_charset: utf8mb4 |
24 | 24 | ||
25 | mailer_transport: smtp | 25 | mailer_transport: smtp |
26 | mailer_host: 127.0.0.1 | 26 | mailer_host: 127.0.0.1 |
diff --git a/docs/en/user/parameters.rst b/docs/en/user/parameters.rst index 79c50871..c4345b74 100644 --- a/docs/en/user/parameters.rst +++ b/docs/en/user/parameters.rst | |||
@@ -12,6 +12,7 @@ What is the meaning of the parameters? | |||
12 | "database_path", "``""%kernel.root_dir%/../data/db/wallabag.sqlite""``", "only for SQLite, define where to put the database file. Leave it for other database" | 12 | "database_path", "``""%kernel.root_dir%/../data/db/wallabag.sqlite""``", "only for SQLite, define where to put the database file. Leave it for other database" |
13 | "database_table_prefix", "wallabag_", "all wallabag's tables will be prefixed with that string. You can include a ``_`` for clarity" | 13 | "database_table_prefix", "wallabag_", "all wallabag's tables will be prefixed with that string. You can include a ``_`` for clarity" |
14 | "database_socket", "null", "If your database is using a socket instead of tcp, put the path of the socket (other connection parameters will then be ignored" | 14 | "database_socket", "null", "If your database is using a socket instead of tcp, put the path of the socket (other connection parameters will then be ignored" |
15 | "database_charset", "utf8mb4", "For PostgreSQL you should use utf8, for other use utf8mb4 which handle emoji" | ||
15 | 16 | ||
16 | .. csv-table:: Configuration to send emails from wallabag | 17 | .. csv-table:: Configuration to send emails from wallabag |
17 | :header: "name", "default", "description" | 18 | :header: "name", "default", "description" |
diff --git a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php index c81a2614..52989bcf 100644 --- a/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php +++ b/src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php | |||
@@ -116,7 +116,8 @@ class AnnotationRepository extends EntityRepository | |||
116 | public function removeAllByUserId($userId) | 116 | public function removeAllByUserId($userId) |
117 | { | 117 | { |
118 | $this->getEntityManager() | 118 | $this->getEntityManager() |
119 | ->createQuery('DELETE FROM Wallabag\AnnotationBundle\Entity\Annotation a WHERE a.user = '.$userId) | 119 | ->createQuery('DELETE FROM Wallabag\AnnotationBundle\Entity\Annotation a WHERE a.user = :userId') |
120 | ->setParameter('userId', $userId) | ||
120 | ->execute(); | 121 | ->execute(); |
121 | } | 122 | } |
122 | } | 123 | } |
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 5acc6852..4542d484 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php | |||
@@ -90,15 +90,15 @@ class TagController extends Controller | |||
90 | 90 | ||
91 | $flatTags = []; | 91 | $flatTags = []; |
92 | 92 | ||
93 | foreach ($tags as $key => $tag) { | 93 | foreach ($tags as $tag) { |
94 | $nbEntries = $this->getDoctrine() | 94 | $nbEntries = $this->getDoctrine() |
95 | ->getRepository('WallabagCoreBundle:Entry') | 95 | ->getRepository('WallabagCoreBundle:Entry') |
96 | ->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag['id']); | 96 | ->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag->getId()); |
97 | 97 | ||
98 | $flatTags[] = [ | 98 | $flatTags[] = [ |
99 | 'id' => $tag['id'], | 99 | 'id' => $tag->getId(), |
100 | 'label' => $tag['label'], | 100 | 'label' => $tag->getLabel(), |
101 | 'slug' => $tag['slug'], | 101 | 'slug' => $tag->getSlug(), |
102 | 'nbEntries' => $nbEntries, | 102 | 'nbEntries' => $nbEntries, |
103 | ]; | 103 | ]; |
104 | } | 104 | } |
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 5df5eff5..14616d88 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php | |||
@@ -339,7 +339,8 @@ class EntryRepository extends EntityRepository | |||
339 | public function removeAllByUserId($userId) | 339 | public function removeAllByUserId($userId) |
340 | { | 340 | { |
341 | $this->getEntityManager() | 341 | $this->getEntityManager() |
342 | ->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.user = '.$userId) | 342 | ->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.user = :userId') |
343 | ->setParameter('userId', $userId) | ||
343 | ->execute(); | 344 | ->execute(); |
344 | } | 345 | } |
345 | } | 346 | } |
diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php index 69661b12..81445989 100644 --- a/src/Wallabag/CoreBundle/Repository/TagRepository.php +++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php | |||
@@ -34,6 +34,9 @@ class TagRepository extends EntityRepository | |||
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Find all tags per user. | 36 | * Find all tags per user. |
37 | * Instead of just left joined on the Entry table, we select only id and group by id to avoid tag multiplication in results. | ||
38 | * Once we have all tags id, we can safely request them one by one. | ||
39 | * This'll still be fastest than the previous query. | ||
37 | * | 40 | * |
38 | * @param int $userId | 41 | * @param int $userId |
39 | * | 42 | * |
@@ -41,32 +44,20 @@ class TagRepository extends EntityRepository | |||
41 | */ | 44 | */ |
42 | public function findAllTags($userId) | 45 | public function findAllTags($userId) |
43 | { | 46 | { |
44 | return $this->createQueryBuilder('t') | 47 | $ids = $this->createQueryBuilder('t') |
45 | ->select('t.slug', 't.label', 't.id') | 48 | ->select('t.id') |
46 | ->leftJoin('t.entries', 'e') | 49 | ->leftJoin('t.entries', 'e') |
47 | ->where('e.user = :userId')->setParameter('userId', $userId) | 50 | ->where('e.user = :userId')->setParameter('userId', $userId) |
48 | ->groupBy('t.slug') | 51 | ->groupBy('t.id') |
49 | ->addGroupBy('t.label') | ||
50 | ->addGroupBy('t.id') | ||
51 | ->getQuery() | 52 | ->getQuery() |
52 | ->getArrayResult(); | 53 | ->getArrayResult(); |
53 | } | ||
54 | 54 | ||
55 | /** | 55 | $tags = []; |
56 | * Find all tags. | 56 | foreach ($ids as $id) { |
57 | * | 57 | $tags[] = $this->find($id); |
58 | * @param int $userId | 58 | } |
59 | * | 59 | |
60 | * @return array | 60 | return $tags; |
61 | */ | ||
62 | public function findAllTags($userId) | ||
63 | { | ||
64 | return $this->createQueryBuilder('t') | ||
65 | ->select('t') | ||
66 | ->leftJoin('t.entries', 'e') | ||
67 | ->where('e.user = :userId')->setParameter('userId', $userId) | ||
68 | ->getQuery() | ||
69 | ->getResult(); | ||
70 | } | 61 | } |
71 | 62 | ||
72 | /** | 63 | /** |
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 7a98f133..14bdbbc7 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml | |||
@@ -91,15 +91,15 @@ config: | |||
91 | delete: | 91 | delete: |
92 | title: Supprimer mon compte (attention danger !) | 92 | title: Supprimer mon compte (attention danger !) |
93 | description: Si vous confirmez la suppression de votre compte, TOUS les articles, TOUS les tags, TOUTES les annotations et votre compte seront DÉFINITIVEMENT supprimé (c'est IRRÉVERSIBLE). Vous serez ensuite déconnecté. | 93 | description: Si vous confirmez la suppression de votre compte, TOUS les articles, TOUS les tags, TOUTES les annotations et votre compte seront DÉFINITIVEMENT supprimé (c'est IRRÉVERSIBLE). Vous serez ensuite déconnecté. |
94 | confirm: Vous êtes vraiment sûr ? (C'EST IRREVERSIBLE) | 94 | confirm: Vous êtes vraiment sûr ? (C'EST IRRÉVERSIBLE) |
95 | button: 'Supprimer mon compte' | 95 | button: 'Supprimer mon compte' |
96 | reset: | 96 | reset: |
97 | title: Réinitialisation (attention danger !) | 97 | title: Réinitialisation (attention danger !) |
98 | description: En cliquant sur les boutons ci-dessous vous avez la possibilité de supprimer certaines informations de votre compte. Attention, ces actions sont IRREVERSIBLES ! | 98 | description: En cliquant sur les boutons ci-dessous vous avez la possibilité de supprimer certaines informations de votre compte. Attention, ces actions sont IRRÉVERSIBLES ! |
99 | annotations: Supprimer TOUTES les annotations | 99 | annotations: Supprimer TOUTES les annotations |
100 | tags: Supprimer TOUS les tags | 100 | tags: Supprimer TOUS les tags |
101 | entries: Supprimer TOUS les articles | 101 | entries: Supprimer TOUS les articles |
102 | confirm: Êtes-vous vraiment vraiment sûr ? (C'EST IRREVERSIBLE) | 102 | confirm: Êtes-vous vraiment vraiment sûr ? (C'EST IRRÉVERSIBLE) |
103 | form_password: | 103 | form_password: |
104 | old_password_label: 'Mot de passe actuel' | 104 | old_password_label: 'Mot de passe actuel' |
105 | new_password_label: 'Nouveau mot de passe' | 105 | new_password_label: 'Nouveau mot de passe' |
@@ -398,7 +398,7 @@ developer: | |||
398 | field_grant_types: 'Type de privilège accordé' | 398 | field_grant_types: 'Type de privilège accordé' |
399 | no_client: 'Aucun client pour le moment' | 399 | no_client: 'Aucun client pour le moment' |
400 | remove: | 400 | remove: |
401 | warn_message_1: 'Vous avez la possibilité de supprimer le client %name%. Cette action est IRREVERSIBLE !' | 401 | warn_message_1: 'Vous avez la possibilité de supprimer le client %name%. Cette action est IRRÉVERSIBLE !' |
402 | warn_message_2: "Si vous supprimez le client %name%, toutes les applications qui l'utilisaient ne fonctionneront plus avec votre compte wallabag." | 402 | warn_message_2: "Si vous supprimez le client %name%, toutes les applications qui l'utilisaient ne fonctionneront plus avec votre compte wallabag." |
403 | action: 'Supprimer le client %name%' | 403 | action: 'Supprimer le client %name%' |
404 | client: | 404 | client: |
@@ -474,7 +474,7 @@ flashes: | |||
474 | entries_reset: Articles supprimés | 474 | entries_reset: Articles supprimés |
475 | entry: | 475 | entry: |
476 | notice: | 476 | notice: |
477 | entry_already_saved: 'Article déjà sauvergardé le %date%' | 477 | entry_already_saved: 'Article déjà sauvegardé le %date%' |
478 | entry_saved: 'Article enregistré' | 478 | entry_saved: 'Article enregistré' |
479 | entry_saved_failed: 'Article enregistré mais impossible de récupérer le contenu' | 479 | entry_saved_failed: 'Article enregistré mais impossible de récupérer le contenu' |
480 | entry_updated: 'Article mis à jour' | 480 | entry_updated: 'Article mis à jour' |