viewgit/inc/functions.php:22 Function utf8_encode() is deprecated [8192]
Filename | |
---|---|
src/configs/Config.php | |
src/controllers/Controller.php | |
src/controllers/SearchController.php | |
src/executables/QueueServer.php | |
src/models/MachineModel.php | |
src/models/ProfileModel.php |
diff --git a/src/configs/Config.php b/src/configs/Config.php index 802aef16d..0f0bbfd49 100755 --- a/src/configs/Config.php +++ b/src/configs/Config.php @@ -868,7 +868,7 @@ nsconddefine('QUEUE_SLEEP_TIME', 5); nsconddefine('MIRROR_SYNC_FREQUENCY', ONE_HOUR); /** How often mirror script tries to notify machine it is mirroring that it is still alive*/ -nsconddefine('MIRROR_NOTIFY_FREQUENCY', ONE_MINUTE); +nsconddefine('MIRROR_NOTIFY_FREQUENCY', 5 * ONE_MINUTE); /** Max time before dirty index (queue_server) and filters (fetcher) will be force saved in seconds*/ nsconddefine('FORCE_SAVE_TIME', ONE_HOUR); diff --git a/src/controllers/Controller.php b/src/controllers/Controller.php index 3b2bb52d2..bef3a1def 100755 --- a/src/controllers/Controller.php +++ b/src/controllers/Controller.php @@ -764,10 +764,10 @@ abstract class Controller case "file_name": if (isset($value)) { $value = str_replace("&", "&", $value); - $value = str_replace("/", "-", $value); - $value = str_replace("\\", "-", $value); + $value = str_replace("\\", "/", $value); $value = str_replace("*", "-", $value); $clean_value = str_replace(":", "-", $value); + $clean_value = str_replace("..", "-", $value); } else { $clean_value = $default; } diff --git a/src/controllers/SearchController.php b/src/controllers/SearchController.php index 7aad041dc..28e07c43e 100755 --- a/src/controllers/SearchController.php +++ b/src/controllers/SearchController.php @@ -107,7 +107,9 @@ class SearchController extends Controller implements CrawlConstants $this->initializeAdFields($data); list($subsearches, $no_query) = $this->initializeSubsearches(); $format_info = $this->initializeResponseFormat(); - if (!$format_info) { return;} + if (!$format_info) { + return; + } list($view, $web_flag, $raw, $results_per_page, $limit) = $format_info; list($query, $activity, $arg) = $this->initializeUserAndDefaultActivity($data); @@ -678,7 +680,7 @@ class SearchController extends Controller implements CrawlConstants */ public function mirrorHandle() { - $mirror_table_name = C\CRAWL_DIR."/".self::mirror_table_name; + $mirror_table_name = C\CRAWL_DIR . "/" . self::mirror_table_name; $handled = false; if (file_exists($mirror_table_name)) { $mirror_table = unserialize($this->web_site->fileGetContents( @@ -690,7 +692,7 @@ class SearchController extends Controller implements CrawlConstants if ($entry[0] == "::1") { $entry[0] = "[::1]"; } - $request = "http://".$entry[0].$entry[1]; + $request = "http://" . $entry[0] . $entry[1]; $mirrors[] = $request; } } @@ -700,7 +702,8 @@ class SearchController extends Controller implements CrawlConstants $rand = mt_rand(0, $count); // if ==$count, we'll let the current machine handle it if ($rand < $count) { - $request = $mirrors[$rand]."?".$_SERVER["QUERY_STRING"]; + $request = $mirrors[$rand] . "?" . + $_SERVER["QUERY_STRING"]; echo FetchUrl::getPage($request); $handled = true; } diff --git a/src/executables/QueueServer.php b/src/executables/QueueServer.php index 13e00d5e9..f5f8e20e4 100755 --- a/src/executables/QueueServer.php +++ b/src/executables/QueueServer.php @@ -1550,7 +1550,7 @@ class QueueServer implements CrawlConstants, Join $living_stamps[] = $timestamp; } } - $files = glob(C\CRAWL_DIR.'/schedules/*'); + $files = glob(C\CRAWL_DIR . '/schedules/*'); $file_cnt = 0; $crawl_prefixes = [self::schedule_data_base_name, self::double_index_base_name, @@ -1643,10 +1643,12 @@ class QueueServer implements CrawlConstants, Join */ public function updateMostRecentFetcher() { - $robot_table_name = C\CRAWL_DIR."/".self::robot_table_name; + $robot_table_name = C\CRAWL_DIR . "/" . self::robot_table_name; if (file_exists($robot_table_name)) { $robot_table = unserialize(file_get_contents($robot_table_name)); - if (!is_array($robot_table)) { return; } + if (!is_array($robot_table)) { + return; + } $recent = 0 ; foreach ($robot_table as $robot_name => $robot_data) { if ($robot_data[2] > $recent) { diff --git a/src/models/MachineModel.php b/src/models/MachineModel.php index 2ae9b0551..59088adcd 100644 --- a/src/models/MachineModel.php +++ b/src/models/MachineModel.php @@ -94,11 +94,11 @@ class MachineModel extends Model } } if ($channel >= 0) { - $sql = "SELECT URL FROM MACHINE WHERE CHANNEL = ? ". + $sql = "SELECT URL, PARENT FROM MACHINE WHERE CHANNEL = ? ". "ORDER BY NAME DESC"; $result = $db->execute($sql, [$channel]); } else { - $sql = "SELECT URL FROM MACHINE ORDER BY NAME DESC"; + $sql = "SELECT URL, PARENT FROM MACHINE ORDER BY NAME DESC"; $result = $db->execute($sql); } $i = 0; @@ -107,7 +107,8 @@ class MachineModel extends Model if (!empty($row["URL"]) && $row["URL"] == "BASE_URL") { $row["URL"] = C\BASE_URL; } - if (empty($pre_machines) || in_array($row["URL"], $pre_machines)) { + if (empty($row["PARENT"]) && + (empty($pre_machines) || in_array($row["URL"], $pre_machines))) { $machines[$crawl_time][$i] = $row["URL"]; $i++; } diff --git a/src/models/ProfileModel.php b/src/models/ProfileModel.php index 1c47b03a1..2db0b085e 100755 --- a/src/models/ProfileModel.php +++ b/src/models/ProfileModel.php @@ -582,12 +582,7 @@ EOT; $profile['PRIVATE_DB_NAME'] = "private_default"; } if ($field == "WEB_URI") { - if (isset($_SERVER['REQUEST_URI'])) { - $profile[$field] = - UrlParser::getPath($_SERVER['REQUEST_URI']); - } else { - $profile[$field] = UrlParser::getPath(C\NAME_SERVER); - } + $profile[$field] = UrlParser::getPath(C\BASE_URL); } if (in_array($field, $file_fields)) { continue;