0
1
Fork 0

Image sync script fixes

This commit is contained in:
Juan Ferrer 2020-08-29 13:54:38 +02:00
parent 079e9266f1
commit 989730a905
3 changed files with 7 additions and 3 deletions

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (1.407.28) stable; urgency=low
hedera-web (1.407.29) stable; urgency=low
* Initial Release.

View File

@ -1,6 +1,6 @@
{
"name": "hedera-web",
"version": "1.407.28",
"version": "1.407.29",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {

View File

@ -59,8 +59,11 @@ class Sync extends Vn\Lib\Method {
['collection' => $collection]
);
if ($res->num_rows == 0) continue;
echo "Deleting {$res->num_rows} from collection '$collection'.\n";
while ($image = $res->fetch_object())
if (!empty($image) && !in_array($image->name, ['.', '..'])) {
if (!empty($image->name) && !in_array($image->name, ['.', '..'])) {
$deleteCount++;
$this->recycle("$collection/full/{$image->name}.png");
@ -78,6 +81,7 @@ class Sync extends Vn\Lib\Method {
$db->query('COMMIT');
} catch(Exception $e) {
$db->query('ROLLBACK');
throw $e;
}
}