mirror of
https://github.com/OPSnet/Gazelle.git
synced 2026-09-25 01:12:59 -04:00
30 lines
906 B
PHP
30 lines
906 B
PHP
<?php
|
|
|
|
namespace Gazelle\Task;
|
|
|
|
class Freeleech extends \Gazelle\Task {
|
|
public function run(): void {
|
|
//We use this to control 6 hour freeleeches.
|
|
// They're actually 7 hours, but don't tell anyone.
|
|
$qId = self::$db->prepared_query("
|
|
SELECT DISTINCT GroupID
|
|
FROM torrents
|
|
WHERE FreeTorrent = '1'
|
|
AND FreeLeechType = '3'
|
|
AND created < now() - INTERVAL 7 HOUR");
|
|
|
|
self::$db->prepared_query("
|
|
UPDATE torrents
|
|
SET FreeTorrent = '0',
|
|
FreeLeechType = '0'
|
|
WHERE FreeTorrent = '1'
|
|
AND FreeLeechType = '3'
|
|
AND created < now() - INTERVAL 7 HOUR");
|
|
|
|
self::$db->set_query_id($qId);
|
|
while ([$groupID] = self::$db->next_record()) {
|
|
self::$cache->delete_value("torrent_group_$groupID");
|
|
}
|
|
}
|
|
}
|