summaryrefslogtreecommitdiff
path: root/update.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2021-02-08 08:49:21 +0300
committerAndrew Dolgov <[email protected]>2021-02-08 08:49:21 +0300
commit942afb43a1357b8189f21937fe3abd413a14a21d (patch)
tree9f5301795bdbc62b2f8e71da1b200368bac94783 /update.php
parent5d0f65358fc233dd3fde24d60cbfc74c846af7a6 (diff)
sanity checks: use better CLI detection, shorten most of the textwip-php8
Diffstat (limited to 'update.php')
-rwxr-xr-xupdate.php33
1 files changed, 5 insertions, 28 deletions
diff --git a/update.php b/update.php
index 2963c00f2..e708aad71 100755
--- a/update.php
+++ b/update.php
@@ -72,9 +72,6 @@
return $tags_deleted;
}
- if (!defined('PHP_EXECUTABLE'))
- define('PHP_EXECUTABLE', '/usr/bin/php');
-
$pdo = Db::pdo();
init_plugins();
@@ -106,34 +103,14 @@
array_push($longopts, $command . $data["suffix"]);
}
- $options = getopt("", $longopts);
-
- if (!is_array($options)) {
- die("error: getopt() failed. ".
- "Most probably you are using PHP CGI to run this script ".
- "instead of required PHP CLI. Check tt-rss wiki page on updating feeds for ".
- "additional information.\n");
- }
-
- if (count($options) == 0 && !defined('STDIN')) {
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Tiny Tiny RSS data update script.</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- </head>
-
- <body>
- <h1><?php echo __("Tiny Tiny RSS data update script.") ?></h1>
-
- <?php print_error("Please run this script from the command line. Use option \"--help\" to display command help if this error is displayed erroneously."); ?>
-
- </body></html>
- <?php
+ if (php_sapi_name() != "cli") {
+ header("Content-type: text/plain");
+ print "Please run this script from the command line.\n";
exit;
}
+ $options = getopt("", $longopts);
+
if (count($options) == 0 || isset($options["help"]) ) {
print "Tiny Tiny RSS data update script.\n\n";
print "Options:\n";