mirror of
https://github.com/itflow-org/itflow
synced 2026-08-05 07:07:14 +00:00
Cron runs all jobs from a single dispatcher cron.php which should now be run every minute and all other cron jobs eliminated from cron
This commit is contained in:
@@ -1,9 +1,35 @@
|
||||
<?php
|
||||
|
||||
// Request/client detection (IP, UA, browser, OS) and response helpers
|
||||
// Request/client detection (IP, UA, browser, OS), response helpers, and outbound HTTP
|
||||
// Split from the former monolithic functions.php
|
||||
|
||||
|
||||
/*
|
||||
* Form-encoded POST, used for the OAuth token endpoints. Lived in both cron/mail_queue.php
|
||||
* and cron/ticket_email_parser.php as identical copies until cron/cron.php began running
|
||||
* them in one process, where the second declaration is a fatal error.
|
||||
*/
|
||||
function httpFormPost(string $url, array $fields): array {
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($fields, '', '&'));
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
|
||||
|
||||
$raw = curl_exec($ch);
|
||||
$err = curl_error($ch);
|
||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
return [
|
||||
'ok' => ($raw !== false && $code >= 200 && $code < 300),
|
||||
'body' => $raw,
|
||||
'code' => $code,
|
||||
'err' => $err,
|
||||
];
|
||||
}
|
||||
|
||||
function getUserAgent() {
|
||||
return $_SERVER['HTTP_USER_AGENT'];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user