|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* Implement command-line option parsing.
|
|
|
|
*/
|
|
|
|
include_once 'utils/logging.php';
|
|
|
|
|
|
|
|
// Read the -v|--verbose option increasing logging verbosity to debug.
|
|
|
|
$options = getopt("vn", ["verbose", "fast", "no-color", "dry-run", "archive"]);
|
|
|
|
if (isset($options["v"]) or isset($options["verbose"])) {
|
|
|
|
$LOGGING_VERBOSITY = LoggingVerbosity::Debug;
|
|
|
|
}
|
|
|
|
|
|
|
|
$FAST_FETCH_MODE = (isset($options["fast"]));
|
|
|
|
|
|
|
|
$DO_DRY_RUN = (isset($options["n"]) || isset($options["dry-run"]));
|
|
|
|
|
|
|
|
if (isset($options["no-color"])) {
|
|
|
|
LoggingVerbosity::$showColor = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$DO_ARCHIVE_FILES = isset($options["archive"]);
|
|
|
|
|
|
|
|
// set timeout for file_get_contents()
|
|
|
|
ini_set('default_socket_timeout', 6); // in seconds, default is 60
|
|
|
|
|
|
|
|
// curl timeout in milliseconds
|
|
|
|
|
|
|
|
// max time for initiation of the connection
|
|
|
|
$CURL_CONNECT_TIMEOUT_MS = 2000;
|
|
|
|
|
|
|
|
// max time for each connection (incl. transfer)
|
|
|
|
$CURL_TIMEOUT_MS = $FAST_FETCH_MODE ? 3000 : 9000;
|
|
|
|
|
|
|
|
// delay between retries in milliseconds
|
|
|
|
$CURL_RETRY_SLEEP = 2000;
|
|
|
|
?>
|