aboutsummaryrefslogtreecommitdiffstats
path: root/util/nconfig.php
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2017-03-08 09:39:46 +0100
committerMario Vavti <mario@mariovavti.com>2017-03-08 09:39:46 +0100
commitbc2b948f1f6e62b1c277a4042200bb6678956f3f (patch)
tree8586c30e495607eee23f16c0aad40974f0711275 /util/nconfig.php
parent23e3e2c50499fab52769929a448e73012fd915af (diff)
parentff9442474d07cce24c8f66db39ec34471c3874a2 (diff)
downloadvolse-hubzilla-bc2b948f1f6e62b1c277a4042200bb6678956f3f.tar.gz
volse-hubzilla-bc2b948f1f6e62b1c277a4042200bb6678956f3f.tar.bz2
volse-hubzilla-bc2b948f1f6e62b1c277a4042200bb6678956f3f.zip
Merge branch 2.2RC2.2
Diffstat (limited to 'util/nconfig.php')
-rw-r--r--util/nconfig.php53
1 files changed, 53 insertions, 0 deletions
diff --git a/util/nconfig.php b/util/nconfig.php
new file mode 100644
index 000000000..a7cf350d0
--- /dev/null
+++ b/util/nconfig.php
@@ -0,0 +1,53 @@
+#!/usr/bin/env php
+<?php
+
+/**
+* switch off channel email notifications utility
+* This is a preliminary solution using the existing functions from include/channel.php.
+* More options would be nice.
+**/
+
+if(! file_exists('include/cli_startup.php')) {
+ echo 'Run from the top level $Projectname web directory, as util/nconfig <args>' . PHP_EOL;
+ exit(1);
+}
+
+require_once('include/cli_startup.php');
+require_once('include/channel.php');
+
+cli_startup();
+
+
+ if($argc != 2) {
+ echo 'Usage: util/nconfig channel_id|channel_address off' . PHP_EOL;
+ exit(1);
+ }
+
+ if(ctype_digit($argv[1])) {
+ $c = channelx_by_n($argv[1]);
+ }
+ else {
+ $c = channelx_by_nick($argv[1]);
+ }
+
+ if(! $c) {
+ echo t('Source channel not found.');
+ exit(1);
+ }
+
+ switch ($argv[2]) {
+ case 'off':
+ $result = notifications_off($c['channel_id']);
+ break;
+ default:
+ echo 'Only on or off in lower cases are allowed' . PHP_EOL;
+ exit(1);
+ }
+
+ if($result['success'] == false) {
+ echo $result['message'];
+ exit(1);
+ }
+
+ exit(0);
+