protected function selectUrls() { /** @var Urls[] $urls */ $urls = Urls::find(['type = :type: AND action = :action: AND state = :state:', 'limit' => 1, 'bind' => ['type' => Urls::IMAGE, 'action' => Urls::FOR_REPLACE_WATERMARK, 'state' => Urls::OPEN]]); foreach ($urls as $url) { unlink($this->getDI()->get('config')->imagesCacheDir . $url->url); $this->urls[] = ['url' => $url->url, 'urlId' => $url->id]; } $urls->delete(); }
protected function selectUrls() { /** @var Urls[] $urls */ $urls = Urls::find(['type = :type: AND action = :action: AND state = :state:', 'limit' => 1, 'bind' => ['type' => Urls::IMAGE, 'action' => Urls::FOR_PUT_WATERMARK, 'state' => Urls::OPEN]]); foreach ($urls as $url) { $urlsForDelete = Urls::find(['url = :url:', 'bind' => ['url' => $url->url]]); $urlsForDelete->delete(); $this->urls[] = ['url' => $url->url, 'urlId' => $url->id]; } }
protected function deleteContents() { /** @var Urls[] $urls */ $urls = Urls::find(['(type = :type1: OR type = :type2:) AND action = :action:', 'bind' => ['type1' => Urls::CONTENT, 'type2' => Urls::COMMON, 'action' => Urls::FOR_DELETING]]); foreach ($urls as $url) { $contentsForDeleting = Contents::find(['url = :url: AND type = :type:', 'bind' => ['url' => $url->url, 'type' => $url->type]]); $contentsForDeleting->delete(); $this->log->info("Удален контент url= . {$url->url}"); $url->delete(); } }