diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-12-29 10:54:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-29 10:54:07 +0100 |
commit | 8527238846b0ea307ba68ca8a831eb0884c68d4a (patch) | |
tree | f93d54cd9fcbb85fa43c989ef670612f9a4d47e5 /src/Wallabag | |
parent | 90f6ee4dbe761f97edf0bf87ffeb1f75acec6c25 (diff) | |
parent | 7239082a5e290dada1d393f7a25acebb09ace2de (diff) | |
download | wallabag-8527238846b0ea307ba68ca8a831eb0884c68d4a.tar.gz wallabag-8527238846b0ea307ba68ca8a831eb0884c68d4a.tar.zst wallabag-8527238846b0ea307ba68ca8a831eb0884c68d4a.zip |
Merge pull request #2702 from wallabag/add-index-uuid
Added index on entry.uuid
Diffstat (limited to 'src/Wallabag')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 10 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Entity/Entry.php | 29 |
2 files changed, 21 insertions, 18 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index b03f49ed..f7398e69 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -539,8 +539,8 @@ class EntryController extends Controller | |||
539 | { | 539 | { |
540 | $this->checkUserAction($entry); | 540 | $this->checkUserAction($entry); |
541 | 541 | ||
542 | if (null === $entry->getUuid()) { | 542 | if (null === $entry->getUid()) { |
543 | $entry->generateUuid(); | 543 | $entry->generateUid(); |
544 | 544 | ||
545 | $em = $this->getDoctrine()->getManager(); | 545 | $em = $this->getDoctrine()->getManager(); |
546 | $em->persist($entry); | 546 | $em->persist($entry); |
@@ -548,7 +548,7 @@ class EntryController extends Controller | |||
548 | } | 548 | } |
549 | 549 | ||
550 | return $this->redirect($this->generateUrl('share_entry', [ | 550 | return $this->redirect($this->generateUrl('share_entry', [ |
551 | 'uuid' => $entry->getUuid(), | 551 | 'uid' => $entry->getUid(), |
552 | ])); | 552 | ])); |
553 | } | 553 | } |
554 | 554 | ||
@@ -565,7 +565,7 @@ class EntryController extends Controller | |||
565 | { | 565 | { |
566 | $this->checkUserAction($entry); | 566 | $this->checkUserAction($entry); |
567 | 567 | ||
568 | $entry->cleanUuid(); | 568 | $entry->cleanUid(); |
569 | 569 | ||
570 | $em = $this->getDoctrine()->getManager(); | 570 | $em = $this->getDoctrine()->getManager(); |
571 | $em->persist($entry); | 571 | $em->persist($entry); |
@@ -581,7 +581,7 @@ class EntryController extends Controller | |||
581 | * | 581 | * |
582 | * @param Entry $entry | 582 | * @param Entry $entry |
583 | * | 583 | * |
584 | * @Route("/share/{uuid}", requirements={"uuid" = ".+"}, name="share_entry") | 584 | * @Route("/share/{uid}", requirements={"uid" = ".+"}, name="share_entry") |
585 | * @Cache(maxage="25200", smaxage="25200", public=true) | 585 | * @Cache(maxage="25200", smaxage="25200", public=true) |
586 | * | 586 | * |
587 | * @return \Symfony\Component\HttpFoundation\Response | 587 | * @return \Symfony\Component\HttpFoundation\Response |
diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index 3ae5334f..7276b437 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php | |||
@@ -22,7 +22,10 @@ use Wallabag\AnnotationBundle\Entity\Annotation; | |||
22 | * @ORM\Table( | 22 | * @ORM\Table( |
23 | * name="`entry`", | 23 | * name="`entry`", |
24 | * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"}, | 24 | * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"}, |
25 | * indexes={@ORM\Index(name="created_at", columns={"created_at"})} | 25 | * indexes={ |
26 | * @ORM\Index(name="created_at", columns={"created_at"}), | ||
27 | * @ORM\Index(name="uid", columns={"uid"}) | ||
28 | * } | ||
26 | * ) | 29 | * ) |
27 | * @ORM\HasLifecycleCallbacks() | 30 | * @ORM\HasLifecycleCallbacks() |
28 | * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())") | 31 | * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())") |
@@ -44,11 +47,11 @@ class Entry | |||
44 | /** | 47 | /** |
45 | * @var string | 48 | * @var string |
46 | * | 49 | * |
47 | * @ORM\Column(name="uuid", type="text", nullable=true) | 50 | * @ORM\Column(name="uid", type="string", length=23, nullable=true) |
48 | * | 51 | * |
49 | * @Groups({"entries_for_user", "export_all"}) | 52 | * @Groups({"entries_for_user", "export_all"}) |
50 | */ | 53 | */ |
51 | private $uuid; | 54 | private $uid; |
52 | 55 | ||
53 | /** | 56 | /** |
54 | * @var string | 57 | * @var string |
@@ -649,34 +652,34 @@ class Entry | |||
649 | /** | 652 | /** |
650 | * @return string | 653 | * @return string |
651 | */ | 654 | */ |
652 | public function getUuid() | 655 | public function getUid() |
653 | { | 656 | { |
654 | return $this->uuid; | 657 | return $this->uid; |
655 | } | 658 | } |
656 | 659 | ||
657 | /** | 660 | /** |
658 | * @param string $uuid | 661 | * @param string $uid |
659 | * | 662 | * |
660 | * @return Entry | 663 | * @return Entry |
661 | */ | 664 | */ |
662 | public function setUuid($uuid) | 665 | public function setUid($uid) |
663 | { | 666 | { |
664 | $this->uuid = $uuid; | 667 | $this->uid = $uid; |
665 | 668 | ||
666 | return $this; | 669 | return $this; |
667 | } | 670 | } |
668 | 671 | ||
669 | public function generateUuid() | 672 | public function generateUid() |
670 | { | 673 | { |
671 | if (null === $this->uuid) { | 674 | if (null === $this->uid) { |
672 | // @see http://blog.kevingomez.fr/til/2015/07/26/why-is-uniqid-slow/ for true parameter | 675 | // @see http://blog.kevingomez.fr/til/2015/07/26/why-is-uniqid-slow/ for true parameter |
673 | $this->uuid = uniqid('', true); | 676 | $this->uid = uniqid('', true); |
674 | } | 677 | } |
675 | } | 678 | } |
676 | 679 | ||
677 | public function cleanUuid() | 680 | public function cleanUid() |
678 | { | 681 | { |
679 | $this->uuid = null; | 682 | $this->uid = null; |
680 | } | 683 | } |
681 | 684 | ||
682 | /** | 685 | /** |