From 6eb45fdad26dbc27531115b9a07757a32821a20f Mon Sep 17 00:00:00 2001 From: ghost Date: Sat, 29 Jul 2023 19:38:09 +0300 Subject: [PATCH] fix snap crc32name index --- crontab/cleaner.php | 12 ++++++------ crontab/crawler.php | 9 ++------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/crontab/cleaner.php b/crontab/cleaner.php index ae2b0d0..816aae6 100644 --- a/crontab/cleaner.php +++ b/crontab/cleaner.php @@ -96,10 +96,10 @@ try { // Delete snap files foreach (json_decode(SNAP_STORAGE) as $name => $storages) { - foreach ($storages as $storage) { + foreach ($storages as $i => $storage) { // Generate storage id - $crc32name = crc32(sprintf('%s.%s', $name, $snapStorageIndex)); + $crc32name = crc32(sprintf('%s.%s', $name, $i)); switch ($name) { @@ -162,10 +162,10 @@ try { // Delete snap files foreach (json_decode(SNAP_STORAGE) as $name => $storages) { - foreach ($storages as $storage) { + foreach ($storages as $i => $storage) { // Generate storage id - $crc32name = crc32(sprintf('%s.%s', $name, $snapStorageIndex)); + $crc32name = crc32(sprintf('%s.%s', $name, $i)); switch ($name) { @@ -284,10 +284,10 @@ try { // Delete snap files foreach (json_decode(SNAP_STORAGE) as $name => $storages) { - foreach ($storages as $storage) { + foreach ($storages as $i => $storage) { // Generate storage id - $crc32name = crc32(sprintf('%s.%s', $name, $snapStorageIndex)); + $crc32name = crc32(sprintf('%s.%s', $name, $i)); switch ($name) { diff --git a/crontab/crawler.php b/crontab/crawler.php index b2810aa..498c5c1 100644 --- a/crontab/crawler.php +++ b/crontab/crawler.php @@ -708,17 +708,12 @@ foreach ($db->getHostPageCrawlQueue(CRAWL_PAGE_LIMIT, time() - CRAWL_PAGE_SECOND } // Copy files to each storage - - $snapStorageIndex = 0; - foreach (json_decode(SNAP_STORAGE) as $name => $storages) { - foreach ($storages as $storage) { - - $snapStorageIndex++; + foreach ($storages as $i => $storage) { // Generate storage id - $crc32name = crc32(sprintf('%s.%s', $name, $snapStorageIndex)); + $crc32name = crc32(sprintf('%s.%s', $name, $i)); switch ($name) {