@ -104,12 +104,12 @@ switch ($argv[1]) {
foreach ($db->getHostPages($host->hostId) as $hostPage) {
foreach ($db->getHostPages($host->hostId) as $hostPage) {
$snapPath = chunk_split($hostPage->hostPageId, 1, '/');
foreach ($db->getHostPageSnaps($hostPage->hostPageId) as $hostPageSnap) {
foreach ($db->getHostPageSnaps($hostPage->hostPageId) as $hostPageSnap) {
// Define variables
// Define variables
$snapFilesExists = false;
$hostPageSnapStorageFilesExists = false;
$snapPath = chunk_split($hostPage->hostPageId, 1, '/');
// Check file exists
// Check file exists
foreach (json_decode(SNAP_STORAGE) as $hostPageSnapStorageName => $storages) {
foreach (json_decode(SNAP_STORAGE) as $hostPageSnapStorageName => $storages) {
@ -128,18 +128,18 @@ switch ($argv[1]) {
if (file_exists($hostPageSnapFilename)) {
if (file_exists($hostPageSnapFilename)) {
$snapFilesExists = true;
$ho stPageS napStorage FilesExists = true;
if (!$db->findHostPageSnapStorageByCRC32Name($hostPageSnap->hostPageSnapId, $crc32name)) {
if (!$db->findHostPageSnapStorageByCRC32Name($hostPageSnap->hostPageSnapId, $crc32name)) {
if ($db->addHostPageSnapStorage($hostPageSnap->hostPageSnapId, $crc32name, $hostPageSnap->timeAdded)) {
if ($db->addHostPageSnapStorage($hostPageSnap->hostPageSnapId, $crc32name, $hostPageSnap->timeAdded)) {
CLI::warning(sprintf(_('register snap #%s file: %s storage: %s index: %s;'), $hostPageSnap->hostPageSnapId, $hostPageSnapFilename, $hostPageSnapStorageName, $i));
CLI::warning(sprintf(_('add index hostPageSnapId #%s file: %s storage: %s index: %s;'), $hostPageSnap->hostPageSnapId, $hostPageSnapFilename, $hostPageSnapStorageName, $i));
}
}
} else {
} else {
CLI::success(sprintf(_('skip related snap #%s file: %s storage: %s index: %s;'), $hostPageSnap->hostPageSnapId, $hostPageSnapFilename, $hostPageSnapStorageName, $i));
CLI::success(sprintf(_('skip related index ho stPageS napId #%s file: %s storage: %s index: %s;'), $hostPageSnap->hostPageSnapId, $hostPageSnapFilename, $hostPageSnapStorageName, $i));
}
}
}
}
@ -155,17 +155,17 @@ switch ($argv[1]) {
if ($ftp->size($hostPageSnapFilename)) {
if ($ftp->size($hostPageSnapFilename)) {
$snapFilesExists = true;
$ho stPageS napStorage FilesExists = true;
if (!$db->findHostPageSnapStorageByCRC32Name($hostPageSnap->hostPageSnapId, $crc32name)) {
if (!$db->findHostPageSnapStorageByCRC32Name($hostPageSnap->hostPageSnapId, $crc32name)) {
if ($db->addHostPageSnapStorage($hostPageSnap->hostPageSnapId, $crc32name, $hostPageSnap->timeAdded)) {
if ($db->addHostPageSnapStorage($hostPageSnap->hostPageSnapId, $crc32name, $hostPageSnap->timeAdded)) {
CLI::warning(sprintf(_('register snap #%s file: %s storage: %s index: %s;'), $hostPageSnap->hostPageSnapId, $hostPageSnapFilename, $hostPageSnapStorageName, $i));
CLI::warning(sprintf(_('add index hostPageSnapId #%s file: %s storage: %s index: %s;'), $hostPageSnap->hostPageSnapId, $hostPageSnapFilename, $hostPageSnapStorageName, $i));
}
}
} else {
} else {
CLI::success(sprintf(_('skip related snap #%s file: %s storage: %s index: %s;'), $hostPageSnap->hostPageSnapId, $hostPageSnapFilename, $hostPageSnapStorageName, $i));
CLI::success(sprintf(_('skip related index ho stPageS napId #%s file: %s storage: %s index: %s;'), $hostPageSnap->hostPageSnapId, $hostPageSnapFilename, $hostPageSnapStorageName, $i));
}
}
}
}
@ -185,7 +185,7 @@ switch ($argv[1]) {
}
}
// Files not exists
// Files not exists
if (!$snapFilesExists) {
if (!$ho stPageS napStorage FilesExists) {
// Delete snap from registry
// Delete snap from registry
try {
try {
@ -200,7 +200,7 @@ switch ($argv[1]) {
$db->deleteHostPageSnapStorages($hostPageSnap->hostPageSnapId);
$db->deleteHostPageSnapStorages($hostPageSnap->hostPageSnapId);
$db->deleteHostPageSnap($hostPageSnap->hostPageSnapId);
$db->deleteHostPageSnap($hostPageSnap->hostPageSnapId);
CLI::warning(sprintf(_('delete snap index: #%s timestamp : %s as not found in file storages;'), $hostPageSnap->hostPageSnapId, $hostPageSnap->timeAdded));
CLI::warning(sprintf(_('delete hostPageSnapId: #%s timeAdded : %s as not found in file storages;'), $hostPageSnap->hostPageSnapId, $hostPageSnap->timeAdded));
$db->commit();
$db->commit();