diff options
author | zotlabs <mike@macgirvin.com> | 2016-12-15 15:56:52 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-15 15:56:52 +1100 |
commit | b630a0113171874c867a3c76e5704c625d31ca66 (patch) | |
tree | 3b864082cbbb3f96c805801c10446ff573ee8dd0 | |
parent | 00fc66d8e8553e3c2633f04401d733547b975b82 (diff) | |
parent | f25189fc749f3ec9d00a3a0095215d4e47ccb63e (diff) | |
download | volse-hubzilla-b630a0113171874c867a3c76e5704c625d31ca66.tar.gz volse-hubzilla-b630a0113171874c867a3c76e5704c625d31ca66.tar.bz2 volse-hubzilla-b630a0113171874c867a3c76e5704c625d31ca66.zip |
Merge pull request #600 from toppoint/dev
Configuring email notifications per channel
-rw-r--r-- | util/nconfig.php | 53 |
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); + |