mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-15 18:57:05 +00:00
Merge pull request #3271 from wallabag/store-resolved-url
Add `given_url` in Entry table to check if a redirected url has already added
This commit is contained in:
commit
16e1c07553
5 changed files with 164 additions and 11 deletions
|
@ -27,7 +27,8 @@ use Wallabag\UserBundle\Entity\User;
|
|||
* indexes={
|
||||
* @ORM\Index(name="created_at", columns={"created_at"}),
|
||||
* @ORM\Index(name="uid", columns={"uid"}),
|
||||
* @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}})
|
||||
* @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}}),
|
||||
* @ORM\Index(name="hashed_given_url_user_id", columns={"user_id", "hashed_given_url"}, options={"lengths"={null, 40}})
|
||||
* }
|
||||
* )
|
||||
* @ORM\HasLifecycleCallbacks()
|
||||
|
@ -68,6 +69,8 @@ class Entry
|
|||
private $title;
|
||||
|
||||
/**
|
||||
* Define the url fetched by wallabag (the final url after potential redirections).
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @Assert\NotBlank()
|
||||
|
@ -84,6 +87,35 @@ class Entry
|
|||
*/
|
||||
private $hashedUrl;
|
||||
|
||||
/**
|
||||
* From where user retrieved/found the url (an other article, a twitter, or the given_url if non are provided).
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="origin_url", type="text", nullable=true)
|
||||
*
|
||||
* @Groups({"entries_for_user", "export_all"})
|
||||
*/
|
||||
private $originUrl;
|
||||
|
||||
/**
|
||||
* Define the url entered by the user (without redirections).
|
||||
*
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="given_url", type="text", nullable=true)
|
||||
*
|
||||
* @Groups({"entries_for_user", "export_all"})
|
||||
*/
|
||||
private $givenUrl;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="hashed_given_url", type="string", length=40, nullable=true)
|
||||
*/
|
||||
private $hashedGivenUrl;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*
|
||||
|
@ -263,15 +295,6 @@ class Entry
|
|||
*/
|
||||
private $tags;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="origin_url", type="text", nullable=true)
|
||||
*
|
||||
* @Groups({"entries_for_user", "export_all"})
|
||||
*/
|
||||
private $originUrl;
|
||||
|
||||
/*
|
||||
* @param User $user
|
||||
*/
|
||||
|
@ -922,6 +945,31 @@ class Entry
|
|||
return $this->originUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set given url.
|
||||
*
|
||||
* @param string $givenUrl
|
||||
*
|
||||
* @return Entry
|
||||
*/
|
||||
public function setGivenUrl($givenUrl)
|
||||
{
|
||||
$this->givenUrl = $givenUrl;
|
||||
$this->hashedGivenUrl = UrlHasher::hashUrl($givenUrl);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get given url.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGivenUrl()
|
||||
{
|
||||
return $this->givenUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue