Bugzilla – Attachment 67372 Details for
Bug 18709
koha-foreach should use koha-shell, internally
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18709: Make koha-foreach use koha-shell internally
Bug-18709-Make-koha-foreach-use-koha-shell-interna.patch (text/plain), 2.06 KB, created by
Jonathan Druart
on 2017-09-26 17:46:33 UTC
(
hide
)
Description:
Bug 18709: Make koha-foreach use koha-shell internally
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-09-26 17:46:33 UTC
Size:
2.06 KB
patch
obsolete
>From 7e74c7a31b5ac2db650ee8f4291a951b386c0c43 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 27 Jun 2017 11:55:45 -0300 >Subject: [PATCH] Bug 18709: Make koha-foreach use koha-shell internally > >This patch simplifies the koha-foreach script, making it use koha-shell >to gain instance privileges and have all environment variables set. > >To test: >- Apply the patch >- Have one or more instances created (kohadev already exists in kohadevbox, add > another onewith $ sudo koha-create --create-db test) >- Run: > $ sudo kohaclone/debian/scripts/koha-foreach echo "This is instance __instancename__" >=> SUCCESS: The script runs gracefuly, and outputs something like: >This is instance kohadev >This is instance test > Note: this means the command was executed for each instance and the current behaviour > of replacing the placeholder __instancename__ for the actual instance name still > works as expected. >- You can try the different filter switches, but the logic has not been touched. only the > command call. >- Sign off :-D > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > debian/scripts/koha-foreach | 18 +++++------------- > 1 file changed, 5 insertions(+), 13 deletions(-) > >diff --git a/debian/scripts/koha-foreach b/debian/scripts/koha-foreach >index 5262cc5218..50f96c71df 100755 >--- a/debian/scripts/koha-foreach >+++ b/debian/scripts/koha-foreach >@@ -46,21 +46,13 @@ do > esac > shift > done >- >+ > for name in $(koha-list $listopts) > do >- # Optionally use alternative paths for a dev install >- adjust_paths_dev_install $name >- >+ # Replace the __instancename__ placeholder for the instance name (Bug 8566) > cmd=`echo "$@" | sed -e s/__instancename__/${name}/g` >- ( >- exec 3>&1 >- sudo -u "$name-koha" \ >- env PERL5LIB=$PERL5LIB \ >- KOHA_CONF="/etc/koha/sites/$name/koha-conf.xml" \ >- ${cmd} 2>&1 >&3 | sed -e "s/^/$name: /" >&2 3>&- >- exec 3>&- >- ) | sed -e "s/^/$name: /" > >+ if [ "${cmd}" != "" ]; then >+ koha-shell ${name} -c "${cmd}" >+ fi > done >- >-- >2.11.0
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 18709
:
64680
|
67372
|
67920