27 lines
765 B
PHP
27 lines
765 B
PHP
<?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']);
|
||
}
|
||
|
||
|
||
|
||
}
|
||
|
||
?>
|