checkup: delete images containing cloudcrap scripts

<script src="/_Incapsula_Resource?...>
This commit is contained in:
Tanguy Pruvot 2018-06-09 08:20:17 +02:00
parent eee06c920b
commit 035d304150

View file

@ -186,8 +186,15 @@ class CheckupCommand extends CConsoleCommand
$nbUpdated = 0; $nbDropped = 0;
foreach ($coins->findAll() as $coin) {
if (!empty($coin->image)) {
if (file_exists($this->basePath.$coin->image))
if (file_exists($this->basePath.$coin->image)) {
$data = file_get_contents($this->basePath.$coin->image);
if (strstr($data, "<script ")) {
unlink($this->basePath.$coin->image);
$coin->image = NULL;
$nbDropped += $coin->save();
}
continue;
}
if (file_exists($this->basePath."/images/coin-$coin->symbol.png")) {
$coin->image = "/images/coin-$coin->symbol.png";
$nbUpdated += $coin->save();