Bugzilla – Attachment 21219 Details for
Bug 10622
Add --sip and --nosip switches to koha-list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10622: [SIGNED OFF] add --sip and --nosip switches to koha-list
Bug-10622-SIGNED-OFF-add---sip-and---nosip-switche.patch (text/plain), 5.76 KB, created by
Robin Sheat
on 2013-09-19 04:34:17 UTC
(
hide
)
Description:
Bug 10622: [SIGNED OFF] add --sip and --nosip switches to koha-list
Filename:
MIME Type:
Creator:
Robin Sheat
Created:
2013-09-19 04:34:17 UTC
Size:
5.76 KB
patch
obsolete
>From b08d458a0b6c2270c6613c571d1152dff0ffe6f4 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Mon, 22 Jul 2013 11:30:27 -0300 >Subject: [PATCH] Bug 10622: [SIGNED OFF] add --sip and --nosip switches to > koha-list > >Just added those switches. > >Sponsored-by: Universidad Nacional de Cordoba >Signed-off-by: Magnus Enger <magnus@enger.priv.no> >I applied the patch on my local dev install, and then copied the >patched koha-list script to a couple of servers with actual >instances running off the packages, to test the script. >- It seems that the -h switch did not work before this patch, now > both -h and --help works nicely >- --sip and --nosip work as expected, also in combination with > --email and --noemail > >The patch does not add --sip and --nosip to the man page for >koha-list, but I will do a followup for that. > >Signed-off-by: Robin Sheat <robin@catalyst.net.nz> >--- > debian/scripts/koha-list | 99 +++++++++++++++++++++++++++++++++++++++--------- > 1 file changed, 81 insertions(+), 18 deletions(-) > >diff --git a/debian/scripts/koha-list b/debian/scripts/koha-list >index f722cf1..f6b0c0e 100755 >--- a/debian/scripts/koha-list >+++ b/debian/scripts/koha-list >@@ -49,6 +49,17 @@ is_email_enabled() > fi > } > >+is_sip_enabled() >+{ >+ local instancename=$1 >+ >+ if [ -e /etc/koha/sites/$instancename/SIPconfig.xml ]; then >+ return 0 >+ else >+ return 1 >+ fi >+} >+ > get_instances() > { > find /etc/koha/sites -mindepth 1 -maxdepth 1\ >@@ -59,40 +70,76 @@ show_instances() > { > local show=$1 > local show_email=$2 >+ local show_sip=$3 > > for instance in $( get_instances ); do > case $show in > "all") >- show_instance_filter_email $instance $show_email;; >+ if instance_filter_email $instance $show_email && \ >+ instance_filter_sip $instance $show_sip; then >+ echo $instance >+ fi ;; > "enabled") > if is_enabled $instance; then >- show_instance_filter_email $instance $show_email >+ if instance_filter_email $instance $show_email && \ >+ instance_filter_sip $instance $show_sip; then >+ echo $instance >+ fi > fi ;; > "disabled") > if ! is_enabled $instance; then >- show_instance_filter_email $instance $show_email >+ if instance_filter_email $instance $show_email && \ >+ instance_filter_sip $instance $show_sip; then >+ echo $instance >+ fi > fi ;; > esac > done > } > >-show_instance_filter_email() >+ >+instance_filter_sip() >+{ >+ local instancename=$1 >+ local show_sip=$2; >+ >+ case $show_sip in >+ "all") >+ return 0 ;; >+ "enabled") >+ if is_sip_enabled $instancename; then >+ return 0 >+ fi ;; >+ "disabled") >+ if ! is_sip_enabled $instancename; then >+ return 0 >+ fi ;; >+ esac >+ >+ # Didn't match any criteria >+ return 1 >+} >+ >+instance_filter_email() > { > local instancename=$1 > local show_email=$2; > > case $show_email in > "all") >- echo $instancename ;; >+ return 0 ;; > "enabled") > if is_email_enabled $instancename; then >- echo $instancename >+ return 0 > fi ;; > "disabled") > if ! is_email_enabled $instancename; then >- echo $instancename >+ return 0 > fi ;; > esac >+ >+ # Didn't match any criteria >+ return 1 > } > > set_show() >@@ -117,39 +164,55 @@ set_show_email() > fi > } > >+set_show_sip() >+{ >+ local sip_param=$1 >+ >+ if [ "$show_sip" = "all" ]; then >+ show_sip=$sip_param >+ else >+ die "Error: --sip and --nosip are mutually exclusive." >+ fi >+} >+ > usage() > { > local scriptname=$0 > >- echo <<eoh >+ cat <<EOH > Lists Koha instances, optionally only those that are enabled or have > email turned on. > >-Usage: $scriptname [--enabled|--disabled] [--email|--noemail] [-h] >+Usage: $scriptname [--enabled|--disabled] [--email|--noemail] [--sip|--nosip] [-h] > Options: >- --enabled only show instances that are enabled >- --disabled only show instances that are disabled >- --email only show instances that have email enabled >- --noemail only show instances that do not have email enabled >- -h this help >+ --enabled Only show instances that are enabled >+ --disabled Only show instances that are disabled >+ --email Only show instances that have email enabled >+ --noemail Only show instances that do not have email enabled >+ --sip Only show instances that have sip enabled >+ --nosip Only show instances that do not have sip enabled >+ --help | -h Show this help > > The filtering options can be combined, and you probably want to do this > (except --email and --noemail, or --enabled and --disabled, that's just silly.) >-eoh >+EOH > } > > show="all" > show_email="all" >+show_sip="all" > >-args=$(getopt -l enabled,disabled,email,noemail -o h -n $0 -- "$@") >+args=$(getopt -l help,enabled,disabled,email,noemail,sip,nosip -o h -n $0 -- "$@") > set -- $args > > while [ ! -z "$1" ] > do > case "$1" in >- -h) usage; exit;; >+ -h|--help) usage; exit;; > --email) set_show_email "enabled" ;; > --noemail) set_show_email "disabled" ;; >+ --sip) set_show_sip "enabled" ;; >+ --nosip) set_show_sip "disabled" ;; > --enabled) set_show "enabled" ;; > --disabled) set_show "disabled" ;; > *) break;; >@@ -157,6 +220,6 @@ do > shift > done > >-show_instances $show $show_email >+show_instances $show $show_email $show_sip > > exit 0 >-- >1.8.1.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10622
:
19852
|
20213
|
20214
|
20221
| 21219 |
21220