diff --git a/PatchBase.php b/PatchBase.php index cda32d9..f79ae25 100644 --- a/PatchBase.php +++ b/PatchBase.php @@ -21,19 +21,21 @@ abstract class PatchBase { return $this->patch; } abstract function check() : bool; - protected function fetch(string $url, bool $text = true) : bool { - // HTTP GET - if ($text) - $str = $this->curl($url); - // HTTP HEAD - else - $str = $this->curl($url, array(array(CURLOPT_HEADER, true), array(CURLOPT_NOBODY, true))); + protected function fetch(string $url) : bool { + $str = $this->curl($url); if ($str) { $this->data = $str; return true; } return false; } + protected function fetch_header(string $url) : bool { + $str = $this->curl($url, array(array(CURLOPT_HEADER, true), array(CURLOPT_NOBODY, true))); + if ($str) { + $this->data = $str; + return true; + } + } protected function fetch_json(string $url) : bool { $str = $this->curl($url); if ($str) { diff --git a/modules/EMClient.php b/modules/EMClient.php index d444df2..655866b 100644 --- a/modules/EMClient.php +++ b/modules/EMClient.php @@ -5,7 +5,7 @@ class EMClient extends PatchBase { parent::__construct('eM Client Inc.', 'eM Client', 'https://www.emclient.com/download?lang=en'); } function check() : bool { - if ($this->fetch('https://www.emclient.com/dist/latest/setup.msi', false)) + if ($this->fetch_header('https://www.emclient.com/dist/latest/setup.msi')) return $this->parse('/filename=emclient-v([\d\.]+)\.msi/'); return false; } diff --git a/modules/PostgreSQL.php b/modules/PostgreSQL.php index 3815d52..1dfdf77 100644 --- a/modules/PostgreSQL.php +++ b/modules/PostgreSQL.php @@ -5,7 +5,7 @@ class PostgreSQL extends PatchBase { parent::__construct('PostgreSQL Global Development Group', 'PostgreSQL', 'https://www.postgresql.org/download/'); } function check() : bool { - if ($this->fetch('https://www.postgresql.org/ftp/latest/', false)) + if ($this->fetch_header('https://www.postgresql.org/ftp/latest/')) return $this->parse('/\/ftp\/source\/v([\d\.]+)/'); return false; } diff --git a/modules/Scilab.php b/modules/Scilab.php index 92291fe..37a723d 100644 --- a/modules/Scilab.php +++ b/modules/Scilab.php @@ -5,7 +5,7 @@ class Scilab extends PatchBase { parent::__construct('ESI Group', 'Scilab', 'https://www.scilab.org/download'); } function check() : bool { - if ($this->fetch('https://www.scilab.org/latest', false)) + if ($this->fetch_header('https://www.scilab.org/latest')) return $this->parse('/\/download\/scilab-([\d\.]+)/'); return false; } diff --git a/modules/Zoom.php b/modules/Zoom.php index 0fdfd6b..88039ae 100644 --- a/modules/Zoom.php +++ b/modules/Zoom.php @@ -5,7 +5,7 @@ class Zoom extends PatchBase { parent::__construct('Zoom Video Communications', 'Zoom', 'https://zoom.us/download'); } function check() : bool { - if ($this->fetch('https://zoom.us/client/latest/ZoomInstaller.exe', false)) + if ($this->fetch_header('https://zoom.us/client/latest/ZoomInstaller.exe')) return $this->parse('/\/prod\/([\d\.]+)\/ZoomInstaller\.exe/'); return false; }