core/parcer/cleartableimg.php

24 lines
668 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
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`");
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']);
}
}
?>