Browse Source

cache magnet public status on user public only

main
ghost 1 year ago
parent
commit
e871662d87
  1. 25
      src/crontab/export/feed.php

25
src/crontab/export/feed.php

@ -217,7 +217,7 @@ try
} }
// Cache public status // Cache public status
$public['user'][$user->userId] = $user->public; $public['user'][$user->userId] = (bool) $user->public;
} }
/// Dump users feed /// Dump users feed
@ -359,7 +359,12 @@ try
} }
// Cache public status // Cache public status
$public['magnet'][$magnet->magnetId] = $magnet->public; if (!empty($public['user'][$magnet->userId]))
{
$public['magnet'][$magnet->magnetId] = (bool) $magnet->public;
} else {
$public['magnet'][$magnet->magnetId] = false;
}
} }
/// Dump magnets feed /// Dump magnets feed
@ -378,8 +383,8 @@ try
foreach ($db->getMagnetDownloads() as $magnetDownload) foreach ($db->getMagnetDownloads() as $magnetDownload)
{ {
// Dump public data only // Dump public data only
if (isset($public['magnet'][$magnetDownload->magnetId]) && $public['magnet'][$magnetDownload->magnetId] === '1' && if (!empty($public['magnet'][$magnetDownload->magnetId]) &&
isset($public['user'][$magnetDownload->userId]) && $public['user'][$magnetDownload->userId] === '1') !empty($public['user'][$magnetDownload->userId]))
{ {
$magnetDownloads[] = (object) $magnetDownloads[] = (object)
[ [
@ -407,8 +412,8 @@ try
foreach ($db->getMagnetComments() as $magnetComment) foreach ($db->getMagnetComments() as $magnetComment)
{ {
// Dump public data only // Dump public data only
if (isset($public['magnet'][$magnetComment->magnetId]) && $public['magnet'][$magnetComment->magnetId] === '1' && if (!empty($public['magnet'][$magnetComment->magnetId]) &&
isset($public['user'][$magnetComment->userId]) && $public['user'][$magnetComment->userId] === '1') !empty($public['user'][$magnetComment->userId]))
{ {
$magnetComments[] = (object) $magnetComments[] = (object)
[ [
@ -439,8 +444,8 @@ try
foreach ($db->getMagnetStars() as $magnetStar) foreach ($db->getMagnetStars() as $magnetStar)
{ {
// Dump public data only // Dump public data only
if (isset($public['magnet'][$magnetStar->magnetId]) && $public['magnet'][$magnetStar->magnetId] === '1' && if (!empty($public['magnet'][$magnetStar->magnetId]) &&
isset($public['user'][$magnetStar->userId]) && $public['user'][$magnetStar->userId] === '1') !empty($public['user'][$magnetStar->userId]))
{ {
$magnetStars[] = (object) $magnetStars[] = (object)
[ [
@ -469,8 +474,8 @@ try
foreach ($db->getMagnetViews() as $magnetView) foreach ($db->getMagnetViews() as $magnetView)
{ {
// Dump public data only // Dump public data only
if (isset($public['magnet'][$magnetView->magnetId]) && $public['magnet'][$magnetView->magnetId] === '1' && if (!empty($public['magnet'][$magnetView->magnetId]) &&
isset($public['user'][$magnetView->userId] ) && $public['user'][$magnetView->userId] === '1') !empty($public['user'][$magnetView->userId]))
{ {
$magnetViews[] = (object) $magnetViews[] = (object)
[ [

Loading…
Cancel
Save