13 private const MAX_LINKS_PER_QUERY = 500;
26 return self::class .
"::runAgent();";
35 private function run(): void
37 $expiredLinks = $this->getExpiredLinks();
38 if (!empty($expiredLinks))
40 $this->cleanExpiredLinks($expiredLinks);
50 private function getExpiredLinks(): array
53 SharingLinkTable::query()
55 ->whereNotNull(
'DATE_EXPIRE')
56 ->where(
'DATE_EXPIRE',
'<',
new DateTime())
57 ->where(
'ACTIVE',
'=',
'Y')
58 ->setLimit(self::MAX_LINKS_PER_QUERY)
62 return array_map(
static function($expiredLink){
63 return (
int)$expiredLink[
'ID'];
73 private function cleanExpiredLinks(array $expiredLinks): void
75 SharingLinkTable::updateMulti(