Fix a warning if links sticky status isn't set

- initiate its status to false when the link is created
  - if not defined, initiate its status to false (can happen if the updater hasn't run)
This commit is contained in:
ArthurHoaro 2019-02-09 14:04:16 +01:00
parent 905f8675a7
commit b790f900c9
2 changed files with 7 additions and 1 deletions

View file

@ -271,7 +271,8 @@ private function check()
), ),
'private' => 0, 'private' => 0,
'created' => new DateTime(), 'created' => new DateTime(),
'tags' => 'opensource software' 'tags' => 'opensource software',
'sticky' => false,
); );
$link['shorturl'] = link_small_hash($link['created'], $link['id']); $link['shorturl'] = link_small_hash($link['created'], $link['id']);
$this->links[1] = $link; $this->links[1] = $link;
@ -284,6 +285,7 @@ private function check()
'private' => 1, 'private' => 1,
'created' => new DateTime('1 minute ago'), 'created' => new DateTime('1 minute ago'),
'tags' => 'secretstuff', 'tags' => 'secretstuff',
'sticky' => false,
); );
$link['shorturl'] = link_small_hash($link['created'], $link['id']); $link['shorturl'] = link_small_hash($link['created'], $link['id']);
$this->links[0] = $link; $this->links[0] = $link;
@ -335,6 +337,8 @@ private function read()
$link['real_url'] = $link['url']; $link['real_url'] = $link['url'];
} }
$link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false;
// To be able to load links before running the update, and prepare the update // To be able to load links before running the update, and prepare the update
if (!isset($link['created'])) { if (!isset($link['created'])) {
$link['id'] = $link['linkdate']; $link['id'] = $link['linkdate'];

View file

@ -1181,6 +1181,8 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
$link['thumbnail'] = $thumbnailer->get($url); $link['thumbnail'] = $thumbnailer->get($url);
} }
$link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false;
$pluginManager->executeHooks('save_link', $link); $pluginManager->executeHooks('save_link', $link);
$LINKSDB[$id] = $link; $LINKSDB[$id] = $link;