Skip to content

Commit

Permalink
Upd
Browse files Browse the repository at this point in the history
  • Loading branch information
marat2509 authored Mar 12, 2024
1 parent 276aeec commit c759c94
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 250 deletions.
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
environment:
UPDATE_INTERVAL: 3600 # update interval in seconds
volumes:
- ./nod32ms-dev.conf:/app/nod32ms.conf
- ./nod32ms-dev:/app/nod32ms.conf
- ./docker-data/www:/app/www
- ./docker-data/log:/app/log

Expand Down
213 changes: 0 additions & 213 deletions nod32ms-dev.conf

This file was deleted.

6 changes: 3 additions & 3 deletions worker/core/inc/classes/Config.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ static public function init()

static::$CONF = parse_ini_file(CONF_FILE, true);

// Parse mirrors
if (empty(static::$CONF['ESET']['mirror'])) static::$CONF['ESET']['mirror'] = 'update.eset.com';

static::$CONF['ESET']['mirror'] = array_map("trim", (explode(",", static::$CONF['ESET']['mirror'])));
if (!in_array("update.eset.com", static::$CONF['ESET']['mirror'])) {
static::$CONF['ESET']['mirror'][] = "update.eset.com";
}

if (preg_match("/^win/i", PHP_OS) == false) {
if (substr(static::$CONF['SCRIPT']['web_dir'], 0, 1) != DS) {
Expand Down
9 changes: 0 additions & 9 deletions worker/core/inc/classes/Mirror.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ static public function test_key()

$test_mirrors = [];
foreach (static::$ESET['mirror'] as $mirror) {

Log::write_log(Language::t("Testing mirror %s", $mirror), 4, static::$version);

Tools::download_file(
[
CURLOPT_USERPWD => static::$key[0] . ":" . static::$key[1],
Expand All @@ -108,7 +105,6 @@ static public function test_key()

if ($headers['http_code'] == 200) {
$test_mirrors[$mirror] = round($headers['total_time'] * 1000);
Log::write_log(Language::t("%s mirror is good", $mirror), 4, static::$version);
}
}

Expand Down Expand Up @@ -234,11 +230,6 @@ static public function download_update_ver($mirror, $downloadRandomFile = false)
static public function download_signature()
{
Log::write_log(Language::t("Running %s", __METHOD__), 5, static::$version);

if(empty(static::$mirrors)) {
throw new Exception("Error Processing Request", 1);
}

static::download_update_ver(current(static::$mirrors)['host']);
$web_dir = Config::get('SCRIPT')['web_dir'];
$cur_update_ver = static::$local_update_file;
Expand Down
46 changes: 22 additions & 24 deletions worker/core/inc/classes/Nod32ms.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -574,35 +574,33 @@ private function run_script()
$old_version = Mirror::get_DB_version(Mirror::$local_update_file);

if (!empty(Mirror::$mirrors)) {
if (count(Mirror::$mirrors) > 1) {
$mirror = array_shift(Mirror::$mirrors);
} else {
$mirror = Mirror::$mirrors[0];
}

if (!empty(Mirror::$mirrors)) {
$mirror = current(Mirror::$mirrors);

if ($old_version && $this->compare_versions($old_version, $mirror['db_version'])) {
Log::informer(Language::t("Your version of database is relevant %s", $old_version), Mirror::$version, 2);
continue;
}
if ($old_version && $this->compare_versions($old_version, $mirror['db_version'])) {
Log::informer(Language::t("Your version of database is relevant %s", $old_version), Mirror::$version, 2);
continue;
}

list($size, $downloads, $speed) = Mirror::download_signature();
$this->set_database_size($size);
list($size, $downloads, $speed) = Mirror::download_signature();
$this->set_database_size($size);

// Deleting first element of array
array_shift(Mirror::$mirrors);
if (!Mirror::$updated && $old_version != 0 && !$this->compare_versions($old_version, $mirror['db_version'])) {
Log::informer(Language::t("Your database has not been updated!"), Mirror::$version, 1);
} else {
$total_size[Mirror::$version] = $size;
$total_downloads[Mirror::$version] = $downloads;
if (!empty($speed)) {
$average_speed[Mirror::$version] = $speed;
}

if (!Mirror::$updated && $old_version != 0 && !$this->compare_versions($old_version, $mirror['db_version'])) {
Log::informer(Language::t("Your database has not been updated!"), Mirror::$version, 1);
if ($old_version && !$this->compare_versions($old_version, $mirror['db_version'])) {
Log::informer(Language::t("Your database was successfully updated from %s to %s", $old_version, $mirror['db_version']), Mirror::$version, 2);
} else {
$total_size[Mirror::$version] = $size;
$total_downloads[Mirror::$version] = $downloads;
if (!empty($speed)) {
$average_speed[Mirror::$version] = $speed;
}

if ($old_version && !$this->compare_versions($old_version, $mirror['db_version'])) {
Log::informer(Language::t("Your database was successfully updated from %s to %s", $old_version, $mirror['db_version']), Mirror::$version, 2);
} else {
Log::informer(Language::t("Your database was successfully updated to %s", $mirror['db_version']), Mirror::$version, 2);
}
Log::informer(Language::t("Your database was successfully updated to %s", $mirror['db_version']), Mirror::$version, 2);
}
}
} else {
Expand Down

0 comments on commit c759c94

Please sign in to comment.