core/parcer/cleartableimg.php

27 lines
765 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
$_SERVER['SERVER_NAME']='tk-ligat.ru';
require_once('/home/cloud/core/set/tk-ligat.ru.php');
require_once('/home/cloud/core/api/php/db.php');
require_once('/home/cloud/core/api/php/json.php');
$imgs=DB::getAll("SELECT * FROM `tovar_img` WHERE `md5` IS NULL");
for ($i=0; $i<count($imgs); $i++){
if (file_exists('/home/cloud/core/img/tk-ligat.ru/tovar/' . $imgs[$i]['filename'] . '.jpg')){
unset($md5);
$md5=md5_file('/home/cloud/core/img/tk-ligat.ru/tovar/' . $imgs[$i]['filename'] . '.jpg');
DB::set("UPDATE `tovar_img` SET `md5`=? WHERE `id`=?", array( $md5, $imgs[$i]['id'] ) );
echo "Существует";
}else{
// echo "Не Существует";
DB::set("DELETE FROM `tovar_img` WHERE `id`=?", $imgs[$i]['id']);
}
}
?>