From 30630c6c605410fbe89606b0ac95fdd0e3bb60c0 Mon Sep 17 00:00:00 2001 From: Brian Huisman Date: Mon, 26 Jun 2023 15:00:42 -0400 Subject: [PATCH] Start enforcing PHP and SQL version limitations. --- orcinus/config.php | 18 +++++++++--------- orcinus/crawler.php | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/orcinus/config.php b/orcinus/config.php index e197d53..9ba0186 100644 --- a/orcinus/config.php +++ b/orcinus/config.php @@ -8,8 +8,8 @@ require __DIR__.'/config.ini.php'; // Check PHP version compatibility -if (PHP_VERSION_ID < 70200) - throw new Exception('Orcinus Site Search requires PHP version ">= 7.2.0". You are running '.PHP_VERSION.'.'); +if (PHP_VERSION_ID < 80000) + throw new Exception('Orcinus Site Search requires PHP version ">= 8.0.x". You are running '.PHP_VERSION.'.'); // ***** Connect to the database @@ -35,13 +35,13 @@ $_DDATA['version'] = $version[0]['sql_version']; // Check Database version compatibility if (preg_match('/^(\d+)\.(\d+)\.(\d+)-?(.*)$/', $_DDATA['version'], $ver)) { - // if (strpos($ver[4], 'MariaDB') === 0) { - // if ((int)$ver[1] < 10 || (int)$ver[3] < 5) - // throw new Exception('Orcinus Site Search requires MariaDB version ">= 10.0.5". You are running '.$_DDATA['version'].'.'); - // } else { - // if ((int)$ver[1] < 8 || (int)$ver[3] < 17) - // throw new Exception('Orcinus Site Search requires MySQL version ">= 8.0.17". You are running '.$_DDATA['version'].'.'); - // } + if (strpos($ver[4], 'MariaDB') === 0) { + if ((int)$ver[1] < 10 || (!(int)$ver[2] && (int)$ver[3] < 5)) + throw new Exception('Orcinus Site Search requires MariaDB version ">= 10.0.5". You are running '.$_DDATA['version'].'.'); + } else { + if ((int)$ver[1] < 8 || (!(int)$ver[2] && (int)$ver[3] < 17)) + throw new Exception('Orcinus Site Search requires MySQL version ">= 8.0.17". You are running '.$_DDATA['version'].'.'); + } } diff --git a/orcinus/crawler.php b/orcinus/crawler.php index 45366ba..aa64e74 100644 --- a/orcinus/crawler.php +++ b/orcinus/crawler.php @@ -1399,7 +1399,7 @@ while ($_cURL && count($_RDATA['sp_queue'])) { $data['content'] = str_replace(array("\\\n\r", "\\\n"), '', $data['content']); $data['info']['charset'] = mb_detect_encoding($data['content']); - if (!$data['info']['charset']) $data['info']['charset'] = 'ISO-8859-1'; + if (!$data['info']['charset']) $data['info']['charset'] = 'CP1252'; OS_cleanTextUTF8($data['content'], $data['info']['charset']); if ($data['content']) {