24 lines
688 B
PHP
24 lines
688 B
PHP
|
<?php
|
|||
|
require_once('/home/cloud/core/api/php/db.php');
|
|||
|
DB::$type='sqlite3';
|
|||
|
DB::$path='/home/cloud/core/bd/tk-ligat.ru.db';
|
|||
|
|
|||
|
$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']);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
?>
|