mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-17 17:08:37 +00:00
commit
9313ea9d44
39 changed files with 717 additions and 63 deletions
|
@ -82,7 +82,7 @@ class Annotation
|
|||
* @Exclude
|
||||
*
|
||||
* @ORM\ManyToOne(targetEntity="Wallabag\CoreBundle\Entity\Entry", inversedBy="annotations")
|
||||
* @ORM\JoinColumn(name="entry_id", referencedColumnName="id")
|
||||
* @ORM\JoinColumn(name="entry_id", referencedColumnName="id", onDelete="cascade")
|
||||
*/
|
||||
private $entry;
|
||||
|
||||
|
|
|
@ -108,4 +108,18 @@ class AnnotationRepository extends EntityRepository
|
|||
->getQuery()
|
||||
->getSingleResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all annotations for a user id.
|
||||
* Used when a user want to reset all informations.
|
||||
*
|
||||
* @param int $userId
|
||||
*/
|
||||
public function removeAllByUserId($userId)
|
||||
{
|
||||
$this->getEntityManager()
|
||||
->createQuery('DELETE FROM Wallabag\AnnotationBundle\Entity\Annotation a WHERE a.user = :userId')
|
||||
->setParameter('userId', $userId)
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
{
|
||||
$this
|
||||
->setName('wallabag:install')
|
||||
->setDescription('Wallabag installer.')
|
||||
->setDescription('wallabag installer.')
|
||||
->addOption(
|
||||
'reset',
|
||||
null,
|
||||
|
@ -55,7 +55,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
$this->defaultInput = $input;
|
||||
$this->defaultOutput = $output;
|
||||
|
||||
$output->writeln('<info>Installing Wallabag...</info>');
|
||||
$output->writeln('<info>Installing wallabag...</info>');
|
||||
$output->writeln('');
|
||||
|
||||
$this
|
||||
|
@ -65,7 +65,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
->setupConfig()
|
||||
;
|
||||
|
||||
$output->writeln('<info>Wallabag has been successfully installed.</info>');
|
||||
$output->writeln('<info>wallabag has been successfully installed.</info>');
|
||||
$output->writeln('<comment>Just execute `php bin/console server:run --env=prod` for using wallabag: http://localhost:8000</comment>');
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,8 @@ class InstallCommand extends ContainerAwareCommand
|
|||
$help = '';
|
||||
|
||||
try {
|
||||
$this->getContainer()->get('doctrine')->getManager()->getConnection()->connect();
|
||||
$conn = $this->getContainer()->get('doctrine')->getManager()->getConnection();
|
||||
$conn->connect();
|
||||
} catch (\Exception $e) {
|
||||
if (false === strpos($e->getMessage(), 'Unknown database')
|
||||
&& false === strpos($e->getMessage(), 'database "'.$this->getContainer()->getParameter('database_name').'" does not exist')) {
|
||||
|
@ -107,6 +108,21 @@ class InstallCommand extends ContainerAwareCommand
|
|||
|
||||
$rows[] = [$label, $status, $help];
|
||||
|
||||
// now check if MySQL isn't too old to handle utf8mb4
|
||||
if ($conn->isConnected() && $conn->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) {
|
||||
$version = $conn->query('select version()')->fetchColumn();
|
||||
$minimalVersion = '5.5.4';
|
||||
|
||||
if (false === version_compare($version, $minimalVersion, '>')) {
|
||||
$fulfilled = false;
|
||||
$rows[] = [
|
||||
'<comment>Database version</comment>',
|
||||
'<error>ERROR!</error>',
|
||||
'Your MySQL version ('.$version.') is too old, consider upgrading ('.$minimalVersion.'+).',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->functionExists as $functionRequired) {
|
||||
$label = '<comment>'.$functionRequired.'</comment>';
|
||||
$status = '<info>OK!</info>';
|
||||
|
@ -131,7 +147,7 @@ class InstallCommand extends ContainerAwareCommand
|
|||
throw new \RuntimeException('Some system requirements are not fulfilled. Please check output messages and fix them.');
|
||||
}
|
||||
|
||||
$this->defaultOutput->writeln('<info>Success! Your system can run Wallabag properly.</info>');
|
||||
$this->defaultOutput->writeln('<info>Success! Your system can run wallabag properly.</info>');
|
||||
|
||||
$this->defaultOutput->writeln('');
|
||||
|
||||
|
|
|
@ -224,6 +224,80 @@ class ConfigController extends Controller
|
|||
return $this->redirect($this->generateUrl('config').'?tagging-rule='.$rule->getId().'#set5');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all annotations OR tags OR entries for the current user.
|
||||
*
|
||||
* @Route("/reset/{type}", requirements={"id" = "annotations|tags|entries"}, name="config_reset")
|
||||
*
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function resetAction($type)
|
||||
{
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
switch ($type) {
|
||||
case 'annotations':
|
||||
$this->getDoctrine()
|
||||
->getRepository('WallabagAnnotationBundle:Annotation')
|
||||
->removeAllByUserId($this->getUser()->getId());
|
||||
break;
|
||||
|
||||
case 'tags':
|
||||
$this->removeAllTagsByUserId($this->getUser()->getId());
|
||||
break;
|
||||
|
||||
case 'entries':
|
||||
// SQLite doesn't care about cascading remove, so we need to manually remove associated stuf
|
||||
// otherwise they won't be removed ...
|
||||
if ($this->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) {
|
||||
$this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId());
|
||||
}
|
||||
|
||||
// manually remove tags to avoid orphan tag
|
||||
$this->removeAllTagsByUserId($this->getUser()->getId());
|
||||
|
||||
$this->getDoctrine()
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->removeAllByUserId($this->getUser()->getId());
|
||||
}
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
'notice',
|
||||
'flashes.config.notice.'.$type.'_reset'
|
||||
);
|
||||
|
||||
return $this->redirect($this->generateUrl('config').'#set3');
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all tags for a given user and cleanup orphan tags.
|
||||
*
|
||||
* @param int $userId
|
||||
*/
|
||||
private function removeAllTagsByUserId($userId)
|
||||
{
|
||||
$tags = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findAllTags($userId);
|
||||
|
||||
if (empty($tags)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->getDoctrine()
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->removeTags($userId, $tags);
|
||||
|
||||
// cleanup orphan tags
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
if (count($tag->getEntries()) === 0) {
|
||||
$em->remove($tag);
|
||||
}
|
||||
}
|
||||
|
||||
$em->flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that a rule can be edited/deleted by the current user.
|
||||
*
|
||||
|
|
|
@ -90,15 +90,15 @@ class TagController extends Controller
|
|||
|
||||
$flatTags = [];
|
||||
|
||||
foreach ($tags as $key => $tag) {
|
||||
foreach ($tags as $tag) {
|
||||
$nbEntries = $this->getDoctrine()
|
||||
->getRepository('WallabagCoreBundle:Entry')
|
||||
->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag['id']);
|
||||
->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag->getId());
|
||||
|
||||
$flatTags[] = [
|
||||
'id' => $tag['id'],
|
||||
'label' => $tag['label'],
|
||||
'slug' => $tag['slug'],
|
||||
'id' => $tag->getId(),
|
||||
'label' => $tag->getLabel(),
|
||||
'slug' => $tag->getSlug(),
|
||||
'nbEntries' => $nbEntries,
|
||||
];
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use Wallabag\AnnotationBundle\Entity\Annotation;
|
|||
*
|
||||
* @XmlRoot("entry")
|
||||
* @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntryRepository")
|
||||
* @ORM\Table(name="`entry`")
|
||||
* @ORM\Table(name="`entry`", options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"})
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
* @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())")
|
||||
*/
|
||||
|
@ -190,10 +190,10 @@ class Entry
|
|||
* @ORM\JoinTable(
|
||||
* name="entry_tag",
|
||||
* joinColumns={
|
||||
* @ORM\JoinColumn(name="entry_id", referencedColumnName="id")
|
||||
* @ORM\JoinColumn(name="entry_id", referencedColumnName="id", onDelete="cascade")
|
||||
* },
|
||||
* inverseJoinColumns={
|
||||
* @ORM\JoinColumn(name="tag_id", referencedColumnName="id")
|
||||
* @ORM\JoinColumn(name="tag_id", referencedColumnName="id", onDelete="cascade")
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
|
|
|
@ -329,4 +329,18 @@ class EntryRepository extends EntityRepository
|
|||
|
||||
return $qb->getQuery()->getSingleScalarResult();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all entries for a user id.
|
||||
* Used when a user want to reset all informations.
|
||||
*
|
||||
* @param int $userId
|
||||
*/
|
||||
public function removeAllByUserId($userId)
|
||||
{
|
||||
$this->getEntityManager()
|
||||
->createQuery('DELETE FROM Wallabag\CoreBundle\Entity\Entry e WHERE e.user = :userId')
|
||||
->setParameter('userId', $userId)
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,9 @@ class TagRepository extends EntityRepository
|
|||
|
||||
/**
|
||||
* Find all tags per user.
|
||||
* Instead of just left joined on the Entry table, we select only id and group by id to avoid tag multiplication in results.
|
||||
* Once we have all tags id, we can safely request them one by one.
|
||||
* This'll still be fastest than the previous query.
|
||||
*
|
||||
* @param int $userId
|
||||
*
|
||||
|
@ -41,15 +44,20 @@ class TagRepository extends EntityRepository
|
|||
*/
|
||||
public function findAllTags($userId)
|
||||
{
|
||||
return $this->createQueryBuilder('t')
|
||||
->select('t.slug', 't.label', 't.id')
|
||||
$ids = $this->createQueryBuilder('t')
|
||||
->select('t.id')
|
||||
->leftJoin('t.entries', 'e')
|
||||
->where('e.user = :userId')->setParameter('userId', $userId)
|
||||
->groupBy('t.slug')
|
||||
->addGroupBy('t.label')
|
||||
->addGroupBy('t.id')
|
||||
->groupBy('t.id')
|
||||
->getQuery()
|
||||
->getArrayResult();
|
||||
|
||||
$tags = [];
|
||||
foreach ($ids as $id) {
|
||||
$tags[] = $this->find($id);
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -129,3 +129,10 @@ services:
|
|||
arguments:
|
||||
- '@twig'
|
||||
- '%kernel.debug%'
|
||||
|
||||
wallabag_core.subscriber.sqlite_cascade_delete:
|
||||
class: Wallabag\CoreBundle\Subscriber\SQLiteCascadeDeleteSubscriber
|
||||
arguments:
|
||||
- "@doctrine"
|
||||
tags:
|
||||
- { name: doctrine.event_subscriber }
|
||||
|
|
|
@ -89,10 +89,17 @@ config:
|
|||
email_label: 'Emailadresse'
|
||||
# twoFactorAuthentication_label: 'Two factor authentication'
|
||||
delete:
|
||||
# title: Delete my account (danger zone !)
|
||||
# title: Delete my account (a.k.a danger zone)
|
||||
# description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out.
|
||||
# confirm: Are you really sure? (it can't be UNDONE)
|
||||
# confirm: Are you really sure? (THIS CAN'T BE UNDONE)
|
||||
# button: Delete my account
|
||||
reset:
|
||||
# title: Reset area (a.k.a danger zone)
|
||||
# description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE.
|
||||
# annotations: Remove ALL annotations
|
||||
# tags: Remove ALL tags
|
||||
# entries: Remove ALL entries
|
||||
# confirm: Are you really really sure? (THIS CAN'T BE UNDONE)
|
||||
form_password:
|
||||
old_password_label: 'Gammel adgangskode'
|
||||
new_password_label: 'Ny adgangskode'
|
||||
|
@ -462,6 +469,9 @@ flashes:
|
|||
# tagging_rules_deleted: 'Tagging rule deleted'
|
||||
# user_added: 'User "%username%" added'
|
||||
# rss_token_updated: 'RSS token updated'
|
||||
# annotations_reset: Annotations reset
|
||||
# tags_reset: Tags reset
|
||||
# entries_reset: Entries reset
|
||||
entry:
|
||||
notice:
|
||||
# entry_already_saved: 'Entry already saved on %date%'
|
||||
|
|
|
@ -89,10 +89,17 @@ config:
|
|||
email_label: 'E-Mail-Adresse'
|
||||
twoFactorAuthentication_label: 'Zwei-Faktor-Authentifizierung'
|
||||
delete:
|
||||
# title: Delete my account (danger zone !)
|
||||
# title: Delete my account (a.k.a danger zone)
|
||||
# description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out.
|
||||
# confirm: Are you really sure? (it can't be UNDONE)
|
||||
# confirm: Are you really sure? (THIS CAN'T BE UNDONE)
|
||||
# button: Delete my account
|
||||
reset:
|
||||
# title: Reset area (a.k.a danger zone)
|
||||
# description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE.
|
||||
# annotations: Remove ALL annotations
|
||||
# tags: Remove ALL tags
|
||||
# entries: Remove ALL entries
|
||||
# confirm: Are you really really sure? (THIS CAN'T BE UNDONE)
|
||||
form_password:
|
||||
old_password_label: 'Altes Kennwort'
|
||||
new_password_label: 'Neues Kennwort'
|
||||
|
@ -462,6 +469,9 @@ flashes:
|
|||
tagging_rules_deleted: 'Tagging-Regel gelöscht'
|
||||
user_added: 'Benutzer "%username%" erstellt'
|
||||
rss_token_updated: 'RSS-Token aktualisiert'
|
||||
# annotations_reset: Annotations reset
|
||||
# tags_reset: Tags reset
|
||||
# entries_reset: Entries reset
|
||||
entry:
|
||||
notice:
|
||||
entry_already_saved: 'Eintrag bereits am %date% gespeichert'
|
||||
|
|
|
@ -89,10 +89,17 @@ config:
|
|||
email_label: 'Email'
|
||||
twoFactorAuthentication_label: 'Two factor authentication'
|
||||
delete:
|
||||
title: Delete my account (danger zone !)
|
||||
title: Delete my account (a.k.a danger zone)
|
||||
description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out.
|
||||
confirm: Are you really sure? (it can't be UNDONE)
|
||||
confirm: Are you really sure? (THIS CAN'T BE UNDONE)
|
||||
button: Delete my account
|
||||
reset:
|
||||
title: Reset area (a.k.a danger zone)
|
||||
description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE.
|
||||
annotations: Remove ALL annotations
|
||||
tags: Remove ALL tags
|
||||
entries: Remove ALL entries
|
||||
confirm: Are you really really sure? (THIS CAN'T BE UNDONE)
|
||||
form_password:
|
||||
old_password_label: 'Current password'
|
||||
new_password_label: 'New password'
|
||||
|
@ -461,6 +468,9 @@ flashes:
|
|||
tagging_rules_updated: 'Tagging rules updated'
|
||||
tagging_rules_deleted: 'Tagging rule deleted'
|
||||
rss_token_updated: 'RSS token updated'
|
||||
annotations_reset: Annotations reset
|
||||
tags_reset: Tags reset
|
||||
entries_reset: Entries reset
|
||||
entry:
|
||||
notice:
|
||||
entry_already_saved: 'Entry already saved on %date%'
|
||||
|
|
|
@ -89,10 +89,17 @@ config:
|
|||
email_label: 'Direccion e-mail'
|
||||
twoFactorAuthentication_label: 'Autentificación de dos factores'
|
||||
delete:
|
||||
# title: Delete my account (danger zone !)
|
||||
# title: Delete my account (a.k.a danger zone)
|
||||
# description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out.
|
||||
# confirm: Are you really sure? (it can't be UNDONE)
|
||||
# confirm: Are you really sure? (THIS CAN'T BE UNDONE)
|
||||
# button: Delete my account
|
||||
reset:
|
||||
# title: Reset area (a.k.a danger zone)
|
||||
# description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE.
|
||||
# annotations: Remove ALL annotations
|
||||
# tags: Remove ALL tags
|
||||
# entries: Remove ALL entries
|
||||
# confirm: Are you really really sure? (THIS CAN'T BE UNDONE)
|
||||
form_password:
|
||||
old_password_label: 'Contraseña actual'
|
||||
new_password_label: 'Nueva contraseña'
|
||||
|
@ -462,6 +469,9 @@ flashes:
|
|||
tagging_rules_deleted: 'Regla de etiquetado actualizada'
|
||||
user_added: 'Usuario "%username%" añadido'
|
||||
rss_token_updated: 'RSS token actualizado'
|
||||
# annotations_reset: Annotations reset
|
||||
# tags_reset: Tags reset
|
||||
# entries_reset: Entries reset
|
||||
entry:
|
||||
notice:
|
||||
entry_already_saved: 'Entrada ya guardada por %fecha%'
|
||||
|
|
|
@ -89,10 +89,17 @@ config:
|
|||
email_label: 'نشانی ایمیل'
|
||||
twoFactorAuthentication_label: 'تأیید ۲مرحلهای'
|
||||
delete:
|
||||
# title: Delete my account (danger zone !)
|
||||
# title: Delete my account (a.k.a danger zone)
|
||||
# description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out.
|
||||
# confirm: Are you really sure? (it can't be UNDONE)
|
||||
# confirm: Are you really sure? (THIS CAN'T BE UNDONE)
|
||||
# button: Delete my account
|
||||
reset:
|
||||
# title: Reset area (a.k.a danger zone)
|
||||
# description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE.
|
||||
# annotations: Remove ALL annotations
|
||||
# tags: Remove ALL tags
|
||||
# entries: Remove ALL entries
|
||||
# confirm: Are you really really sure? (THIS CAN'T BE UNDONE)
|
||||
form_password:
|
||||
old_password_label: 'رمز قدیمی'
|
||||
new_password_label: 'رمز تازه'
|
||||
|
@ -461,6 +468,9 @@ flashes:
|
|||
tagging_rules_deleted: 'قانون برچسبگذاری پاک شد'
|
||||
user_added: 'کابر "%username%" افزوده شد'
|
||||
rss_token_updated: 'کد آر-اس-اس بهروز شد'
|
||||
# annotations_reset: Annotations reset
|
||||
# tags_reset: Tags reset
|
||||
# entries_reset: Entries reset
|
||||
entry:
|
||||
notice:
|
||||
entry_already_saved: 'این مقاله در تاریخ %date% ذخیره شده بود'
|
||||
|
|
|
@ -91,8 +91,15 @@ config:
|
|||
delete:
|
||||
title: Supprimer mon compte (attention danger !)
|
||||
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é.
|
||||
confirm: Vous êtes vraiment sûr ? (c'est IRRÉVERSIBLE !)
|
||||
confirm: Vous êtes vraiment sûr ? (C'EST IRRÉVERSIBLE)
|
||||
button: 'Supprimer mon compte'
|
||||
reset:
|
||||
title: Réinitialisation (attention danger !)
|
||||
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 !
|
||||
annotations: Supprimer TOUTES les annotations
|
||||
tags: Supprimer TOUS les tags
|
||||
entries: Supprimer TOUS les articles
|
||||
confirm: Êtes-vous vraiment vraiment sûr ? (C'EST IRRÉVERSIBLE)
|
||||
form_password:
|
||||
old_password_label: 'Mot de passe actuel'
|
||||
new_password_label: 'Nouveau mot de passe'
|
||||
|
@ -391,7 +398,7 @@ developer:
|
|||
field_grant_types: 'Type de privilège accordé'
|
||||
no_client: 'Aucun client pour le moment'
|
||||
remove:
|
||||
warn_message_1: 'Vous avez la possibilité de supprimer le client %name%. Cette action est IRREVERSIBLE !'
|
||||
warn_message_1: 'Vous avez la possibilité de supprimer le client %name%. Cette action est IRRÉVERSIBLE !'
|
||||
warn_message_2: "Si vous supprimez le client %name%, toutes les applications qui l'utilisaient ne fonctionneront plus avec votre compte wallabag."
|
||||
action: 'Supprimer le client %name%'
|
||||
client:
|
||||
|
@ -462,9 +469,12 @@ flashes:
|
|||
tagging_rules_deleted: 'Règle supprimée'
|
||||
user_added: 'Utilisateur "%username%" ajouté'
|
||||
rss_token_updated: 'Jeton RSS mis à jour'
|
||||
annotations_reset: Annotations supprimées
|
||||
tags_reset: Tags supprimés
|
||||
entries_reset: Articles supprimés
|
||||
entry:
|
||||
notice:
|
||||
entry_already_saved: 'Article déjà sauvergardé le %date%'
|
||||
entry_already_saved: 'Article déjà sauvegardé le %date%'
|
||||
entry_saved: 'Article enregistré'
|
||||
entry_saved_failed: 'Article enregistré mais impossible de récupérer le contenu'
|
||||
entry_updated: 'Article mis à jour'
|
||||
|
|
|
@ -89,10 +89,17 @@ config:
|
|||
email_label: 'E-mail'
|
||||
twoFactorAuthentication_label: 'Two factor authentication'
|
||||
delete:
|
||||
# title: Delete my account (danger zone !)
|
||||
# title: Delete my account (a.k.a danger zone)
|
||||
# description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out.
|
||||
# confirm: Are you really sure? (it can't be UNDONE)
|
||||
# confirm: Are you really sure? (THIS CAN'T BE UNDONE)
|
||||
# button: Delete my account
|
||||
reset:
|
||||
# title: Reset area (a.k.a danger zone)
|
||||
# description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE.
|
||||
# annotations: Remove ALL annotations
|
||||
# tags: Remove ALL tags
|
||||
# entries: Remove ALL entries
|
||||
# confirm: Are you really really sure? (THIS CAN'T BE UNDONE)
|
||||
form_password:
|
||||
old_password_label: 'Password corrente'
|
||||
new_password_label: 'Nuova password'
|
||||
|
@ -462,6 +469,9 @@ flashes:
|
|||
tagging_rules_deleted: 'Regola di tagging aggiornate'
|
||||
user_added: 'Utente "%username%" aggiunto'
|
||||
rss_token_updated: 'RSS token aggiornato'
|
||||
# annotations_reset: Annotations reset
|
||||
# tags_reset: Tags reset
|
||||
# entries_reset: Entries reset
|
||||
entry:
|
||||
notice:
|
||||
entry_already_saved: 'Contenuto già salvato in data %date%'
|
||||
|
|
|
@ -89,10 +89,17 @@ config:
|
|||
email_label: 'Adreça de corrièl'
|
||||
twoFactorAuthentication_label: 'Dobla autentificacion'
|
||||
delete:
|
||||
# title: Delete my account (danger zone !)
|
||||
# title: Delete my account (a.k.a danger zone)
|
||||
# description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out.
|
||||
# confirm: Are you really sure? (it can't be UNDONE)
|
||||
# confirm: Are you really sure? (THIS CAN'T BE UNDONE)
|
||||
# button: Delete my account
|
||||
reset:
|
||||
# title: Reset area (a.k.a danger zone)
|
||||
# description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE.
|
||||
# annotations: Remove ALL annotations
|
||||
# tags: Remove ALL tags
|
||||
# entries: Remove ALL entries
|
||||
# confirm: Are you really really sure? (THIS CAN'T BE UNDONE)
|
||||
form_password:
|
||||
old_password_label: 'Senhal actual'
|
||||
new_password_label: 'Senhal novèl'
|
||||
|
@ -462,6 +469,9 @@ flashes:
|
|||
tagging_rules_deleted: 'Règla suprimida'
|
||||
user_added: 'Utilizaire "%username%" ajustat'
|
||||
rss_token_updated: 'Geton RSS mes a jorn'
|
||||
# annotations_reset: Annotations reset
|
||||
# tags_reset: Tags reset
|
||||
# entries_reset: Entries reset
|
||||
entry:
|
||||
notice:
|
||||
entry_already_saved: 'Article ja salvargardat lo %date%'
|
||||
|
|
|
@ -93,6 +93,13 @@ config:
|
|||
description: Jeżeli usuniesz swoje konto, wszystkie twoje artykuły, tagi, adnotacje, oraz konto zostaną trwale usunięte (operacja jest NIEODWRACALNA). Następnie zostaniesz wylogowany.
|
||||
confirm: Jesteś pewien? (tej operacji NIE MOŻNA cofnąć)
|
||||
button: Usuń moje konto
|
||||
reset:
|
||||
# title: Reset area (a.k.a danger zone)
|
||||
# description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE.
|
||||
# annotations: Remove ALL annotations
|
||||
# tags: Remove ALL tags
|
||||
# entries: Remove ALL entries
|
||||
# confirm: Are you really really sure? (THIS CAN'T BE UNDONE)
|
||||
form_password:
|
||||
old_password_label: 'Stare hasło'
|
||||
new_password_label: 'Nowe hasło'
|
||||
|
@ -462,6 +469,9 @@ flashes:
|
|||
tagging_rules_deleted: 'Reguła tagowania usunięta'
|
||||
user_added: 'Użytkownik "%username%" dodany'
|
||||
rss_token_updated: 'Token kanału RSS zaktualizowany'
|
||||
# annotations_reset: Annotations reset
|
||||
# tags_reset: Tags reset
|
||||
# entries_reset: Entries reset
|
||||
entry:
|
||||
notice:
|
||||
entry_already_saved: 'Wpis już został dodany %date%'
|
||||
|
|
|
@ -89,10 +89,17 @@ config:
|
|||
email_label: 'E-mail'
|
||||
# twoFactorAuthentication_label: 'Two factor authentication'
|
||||
delete:
|
||||
# title: Delete my account (danger zone !)
|
||||
# title: Delete my account (a.k.a danger zone)
|
||||
# description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out.
|
||||
# confirm: Are you really sure? (it can't be UNDONE)
|
||||
# confirm: Are you really sure? (THIS CAN'T BE UNDONE)
|
||||
# button: Delete my account
|
||||
reset:
|
||||
# title: Reset area (a.k.a danger zone)
|
||||
# description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE.
|
||||
# annotations: Remove ALL annotations
|
||||
# tags: Remove ALL tags
|
||||
# entries: Remove ALL entries
|
||||
# confirm: Are you really really sure? (THIS CAN'T BE UNDONE)
|
||||
form_password:
|
||||
old_password_label: 'Parola veche'
|
||||
new_password_label: 'Parola nouă'
|
||||
|
@ -462,6 +469,9 @@ flashes:
|
|||
# tagging_rules_deleted: 'Tagging rule deleted'
|
||||
# user_added: 'User "%username%" added'
|
||||
# rss_token_updated: 'RSS token updated'
|
||||
# annotations_reset: Annotations reset
|
||||
# tags_reset: Tags reset
|
||||
# entries_reset: Entries reset
|
||||
entry:
|
||||
notice:
|
||||
# entry_already_saved: 'Entry already saved on %date%'
|
||||
|
|
|
@ -89,10 +89,17 @@ config:
|
|||
email_label: 'E-posta'
|
||||
twoFactorAuthentication_label: 'İki adımlı doğrulama'
|
||||
delete:
|
||||
# title: Delete my account (danger zone !)
|
||||
# title: Delete my account (a.k.a danger zone)
|
||||
# description: If you remove your account, ALL your articles, ALL your tags, ALL your annotations and your account will be PERMANENTLY removed (it can't be UNDONE). You'll then be logged out.
|
||||
# confirm: Are you really sure? (it can't be UNDONE)
|
||||
# confirm: Are you really sure? (THIS CAN'T BE UNDONE)
|
||||
# button: Delete my account
|
||||
reset:
|
||||
# title: Reset area (a.k.a danger zone)
|
||||
# description: By hiting buttons below you'll have ability to remove some informations from your account. Be aware that these actions are IRREVERSIBLE.
|
||||
# annotations: Remove ALL annotations
|
||||
# tags: Remove ALL tags
|
||||
# entries: Remove ALL entries
|
||||
# confirm: Are you really really sure? (THIS CAN'T BE UNDONE)
|
||||
form_password:
|
||||
old_password_label: 'Eski şifre'
|
||||
new_password_label: 'Yeni şifre'
|
||||
|
@ -461,6 +468,9 @@ flashes:
|
|||
tagging_rules_deleted: 'Tagging rule deleted'
|
||||
user_added: 'User "%username%" added'
|
||||
rss_token_updated: 'RSS token updated'
|
||||
# annotations_reset: Annotations reset
|
||||
# tags_reset: Tags reset
|
||||
# entries_reset: Entries reset
|
||||
entry:
|
||||
notice:
|
||||
entry_already_saved: 'Entry already saved on %date%'
|
||||
|
|
|
@ -146,6 +146,28 @@
|
|||
</fieldset>
|
||||
{% endif %}
|
||||
|
||||
<h2>{{ 'config.reset.title'|trans }}</h2>
|
||||
<fieldset class="w500p inline">
|
||||
<p>{{ 'config.reset.description'|trans }}</p>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="{{ path('config_reset', { type: 'annotations'}) }}" onclick="return confirm('{{ 'config.reset.confirm'|trans|escape('js') }}')" class="waves-effect waves-light btn red">
|
||||
{{ 'config.reset.annotations'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('config_reset', { type: 'tags'}) }}" onclick="return confirm('{{ 'config.reset.confirm'|trans|escape('js') }}')" class="waves-effect waves-light btn red">
|
||||
{{ 'config.reset.tags'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="{{ path('config_reset', { type: 'entries'}) }}" onclick="return confirm('{{ 'config.reset.confirm'|trans|escape('js') }}')" class="waves-effect waves-light btn red">
|
||||
{{ 'config.reset.entries'|trans }}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
{{ form_widget(form.user._token) }}
|
||||
{{ form_widget(form.user.save) }}
|
||||
</form>
|
||||
|
|
|
@ -168,6 +168,22 @@
|
|||
{{ form_widget(form.user._token) }}
|
||||
</form>
|
||||
|
||||
<br /><hr /><br />
|
||||
|
||||
<div class="row">
|
||||
<h5>{{ 'config.reset.title'|trans }}</h5>
|
||||
<p>{{ 'config.reset.description'|trans }}</p>
|
||||
<a href="{{ path('config_reset', { type: 'annotations'}) }}" onclick="return confirm('{{ 'config.reset.confirm'|trans|escape('js') }}')" class="waves-effect waves-light btn red">
|
||||
{{ 'config.reset.annotations'|trans }}
|
||||
</a>
|
||||
<a href="{{ path('config_reset', { type: 'tags'}) }}" onclick="return confirm('{{ 'config.reset.confirm'|trans|escape('js') }}')" class="waves-effect waves-light btn red">
|
||||
{{ 'config.reset.tags'|trans }}
|
||||
</a>
|
||||
<a href="{{ path('config_reset', { type: 'entries'}) }}" onclick="return confirm('{{ 'config.reset.confirm'|trans|escape('js') }}')" class="waves-effect waves-light btn red">
|
||||
{{ 'config.reset.entries'|trans }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% if enabled_users > 1 %}
|
||||
<br /><hr /><br />
|
||||
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Subscriber;
|
||||
|
||||
use Doctrine\Common\EventSubscriber;
|
||||
use Doctrine\ORM\Event\LifecycleEventArgs;
|
||||
use Wallabag\CoreBundle\Entity\Entry;
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
|
||||
/**
|
||||
* SQLite doesn't care about cascading remove, so we need to manually remove associated stuf for an Entry.
|
||||
* Foreign Key Support can be enabled by running `PRAGMA foreign_keys = ON;` at runtime (AT RUNTIME !).
|
||||
* But it needs a compilation flag that not all SQLite instance has ...
|
||||
*
|
||||
* @see https://www.sqlite.org/foreignkeys.html#fk_enable
|
||||
*/
|
||||
class SQLiteCascadeDeleteSubscriber implements EventSubscriber
|
||||
{
|
||||
private $doctrine;
|
||||
|
||||
/**
|
||||
* @param \Doctrine\Bundle\DoctrineBundle\Registry $doctrine
|
||||
*/
|
||||
public function __construct(Registry $doctrine)
|
||||
{
|
||||
$this->doctrine = $doctrine;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSubscribedEvents()
|
||||
{
|
||||
return [
|
||||
'preRemove',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* We removed everything related to the upcoming removed entry because SQLite can't handle it on it own.
|
||||
* We do it in the preRemove, because we can't retrieve tags in the postRemove (because the entry id is gone).
|
||||
*
|
||||
* @param LifecycleEventArgs $args
|
||||
*/
|
||||
public function preRemove(LifecycleEventArgs $args)
|
||||
{
|
||||
$entity = $args->getEntity();
|
||||
|
||||
if (!$this->doctrine->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver ||
|
||||
!$entity instanceof Entry) {
|
||||
return;
|
||||
}
|
||||
|
||||
$em = $this->doctrine->getManager();
|
||||
|
||||
if (null !== $entity->getTags()) {
|
||||
foreach ($entity->getTags() as $tag) {
|
||||
$entity->removeTag($tag);
|
||||
}
|
||||
}
|
||||
|
||||
if (null !== $entity->getAnnotations()) {
|
||||
foreach ($entity->getAnnotations() as $annotation) {
|
||||
$em->remove($annotation);
|
||||
}
|
||||
}
|
||||
|
||||
$em->flush();
|
||||
}
|
||||
}
|
|
@ -21,7 +21,7 @@ services:
|
|||
arguments:
|
||||
- WallabagUserBundle:User
|
||||
|
||||
wallabag_user.create_config:
|
||||
wallabag_user.listener.create_config:
|
||||
class: Wallabag\UserBundle\EventListener\CreateConfigListener
|
||||
arguments:
|
||||
- "@doctrine.orm.entity_manager"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue