| @@ 110-123 (lines=14) @@ | ||
| 107 | * @param int|null $workerID |
|
| 108 | * @return bool |
|
| 109 | */ |
|
| 110 | private function markAsActive($base, $workerID = 0) |
|
| 111 | { |
|
| 112 | if ($workerID == 0) { |
|
| 113 | $query = $this->pdo->prepare(<<<SQL |
|
| 114 | UPDATE robotstxt__cache0 |
|
| 115 | SET worker = NULL |
|
| 116 | WHERE base = :base AND worker = 0; |
|
| 117 | SQL |
|
| 118 | ); |
|
| 119 | $query->bindParam(':base', $base, PDO::PARAM_STR); |
|
| 120 | return $query->execute(); |
|
| 121 | } |
|
| 122 | return true; |
|
| 123 | } |
|
| 124 | ||
| 125 | /** |
|
| 126 | * Update an robots.txt in the database |
|
| @@ 259-269 (lines=11) @@ | ||
| 256 | * @param int $delay - in seconds |
|
| 257 | * @return bool |
|
| 258 | */ |
|
| 259 | public function clean($delay = 600) |
|
| 260 | { |
|
| 261 | $delay = self::CACHE_TIME + $delay; |
|
| 262 | $query = $this->pdo->prepare(<<<SQL |
|
| 263 | DELETE FROM robotstxt__cache0 |
|
| 264 | WHERE worker = 0 AND nextUpdate < (UNIX_TIMESTAMP() - :delay); |
|
| 265 | SQL |
|
| 266 | ); |
|
| 267 | $query->bindParam(':delay', $delay, PDO::PARAM_INT); |
|
| 268 | return $query->execute(); |
|
| 269 | } |
|
| 270 | ||
| 271 | /** |
|
| 272 | * Create SQL table |
|
| @@ 105-114 (lines=10) @@ | ||
| 102 | * @param int $delay - in seconds |
|
| 103 | * @return bool |
|
| 104 | */ |
|
| 105 | public function clean($delay = 60) |
|
| 106 | { |
|
| 107 | $query = $this->pdo->prepare(<<<SQL |
|
| 108 | DELETE FROM robotstxt__delay0 |
|
| 109 | WHERE microTime < ((UNIX_TIMESTAMP() - :delay) * 1000000); |
|
| 110 | SQL |
|
| 111 | ); |
|
| 112 | $query->bindParam(':delay', $delay, PDO::PARAM_INT); |
|
| 113 | return $query->execute(); |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * Create SQL table |
|