X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Fcommandline.inc;h=d7ee1588017bbf9c35a2ace7ca2cc4f9483d6a77;hb=adb3c9f6b62f7cb95d041fd2338a71ce63908c0b;hp=6d94a318d65a550d717b6d4030b479dbe6341244;hpb=ab24007f4c2f0e1290e8546893e7fa4394e367d5;p=quix0rs-gnu-social.git diff --git a/scripts/commandline.inc b/scripts/commandline.inc index 6d94a318d6..d7ee158801 100644 --- a/scripts/commandline.inc +++ b/scripts/commandline.inc @@ -26,8 +26,8 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { exit(); } -define('STATUSNET', true); -define('LACONICA', true); // compatibility +define('GNUSOCIAL', true); +define('STATUSNET', true); //compatibility // Set various flags so we don't time out on long-running processes @@ -188,13 +188,13 @@ function getUser() if (have_option('i', 'id')) { $id = get_option_value('i', 'id'); - $user = User::staticGet('id', $id); + $user = User::getKV('id', $id); if (empty($user)) { throw new Exception("Can't find user with id '$id'."); } } else if (have_option('n', 'nickname')) { $nickname = get_option_value('n', 'nickname'); - $user = User::staticGet('nickname', $nickname); + $user = User::getKV('nickname', $nickname); if (empty($user)) { throw new Exception("Can't find user with nickname '$nickname'"); } @@ -204,3 +204,43 @@ function getUser() return $user; } + +/** "Printf not quiet" */ + +function printfnq() +{ + if (have_option('q', 'quiet')) { + return null; + } + + $cargs = func_num_args(); + + if ($cargs == 0) { + return 0; + } + + $args = func_get_args(); + $format = array_shift($args); + + return vprintf($format, $args); +} + +/** "Print when verbose" */ + +function printfv() +{ + if (!have_option('v', 'verbose')) { + return null; + } + + $cargs = func_num_args(); + + if ($cargs == 0) { + return 0; + } + + $args = func_get_args(); + $format = array_shift($args); + + return vprintf($format, $args); +}