Bugzilla – Attachment 75597 Details for
Bug 20692
koha-plack doesn't check for Include *-plack.conf line in /etc/apache2/sites-available/$INSTANCE.conf
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20692: Extreme toggle checking for plack
Bug-20692-Extreme-toggle-checking-for-plack.patch (text/plain), 7.37 KB, created by
Mark Tompsett
on 2018-05-28 17:51:24 UTC
(
hide
)
Description:
Bug 20692: Extreme toggle checking for plack
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2018-05-28 17:51:24 UTC
Size:
7.37 KB
patch
obsolete
>From c67fe11e8571ab5e87bf1c11abda0f60d3bcf07d Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Mon, 28 May 2018 16:45:29 +0000 >Subject: [PATCH] Bug 20692: Extreme toggle checking for plack > >TEST PLAN >--------- >sudo koha-plack --disable >sudo koha-plack --disable >sudo koha-plack --enable > >sudo koha-plack --disable >echo $? >sudo koha-plack --disable >echo $? >sudo koha-list --noplack >echo $? >sudo koha-plack --enable >echo $? >sudo koha-plack --enable >echo $? >sudo koha-list --plack >echo $? > >git bz apply 20692 >sudo perl ~/misc4dev/cp_debian_files.pl >then repeat the test. > >It should also be noted, because the enable >and disable are now split, if for some reason >they become out of sync, an enable or disable >should correct them. > >Because these are bash scripts, the test tool >(/home/vagrant/qa-test-tools/koha-qa.pl) >does not apply. >--- > debian/scripts/koha-functions.sh | 54 ++++++++++++++++++++++++-- > debian/scripts/koha-plack | 84 ++++++++++++++++++++++++++++++++++++---- > 2 files changed, 126 insertions(+), 12 deletions(-) > >diff --git a/debian/scripts/koha-functions.sh b/debian/scripts/koha-functions.sh >index 6e189b6c94..99b8ded6ec 100755 >--- a/debian/scripts/koha-functions.sh >+++ b/debian/scripts/koha-functions.sh >@@ -185,6 +185,40 @@ is_indexer_running() > fi > } > >+is_plack_enabled_opac() >+{ >+ local instancefile=$1 >+ >+ if [ "$instancefile" = "" ]; then >+ return 1 >+ fi >+ >+ # remember 0 means success/true in bash. >+ if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-opac-plack.conf' \ >+ "$instancefile" ; then >+ return 0 >+ else >+ return 1 >+ fi >+} >+ >+is_plack_enabled_intranet() >+{ >+ local instancefile=$1 >+ >+ if [ "$instancefile" = "" ]; then >+ return 1 >+ fi >+ >+ # remember 0 means success/true in bash. >+ if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-intranet-plack.conf' \ >+ "$instancefile" ; then >+ return 0 >+ else >+ return 1 >+ fi >+} >+ > is_plack_enabled() > { > local site=$1 >@@ -194,10 +228,22 @@ is_plack_enabled() > return 1 > fi > >- if grep -q '^[[:space:]]*Include /etc/koha/apache-shared-opac-plack.conf' \ >- "$instancefile" && \ >- grep -q '^[[:space:]]*Include /etc/koha/apache-shared-intranet-plack.conf' \ >- "$instancefile" ; then >+ if is_plack_enabled_opac $instancefile ; then >+ enabledopac=1 >+ else >+ enabledopac=0 >+ fi >+ if is_plack_enabled_intranet $instancefile ; then >+ enabledintra=1 >+ else >+ enabledintra=0 >+ fi >+ >+ # remember 0 means success/true in bash. >+ if [ "$enabledopac" != "$enabledintra" ] ; then >+ echo "$site has a plack configuration error. Enable or disable plack to correct this." >+ return 0 >+ elif [ "$enabledopac" = "1" ] ; then > return 0 > else > return 1 >diff --git a/debian/scripts/koha-plack b/debian/scripts/koha-plack >index 1677ee0ec1..c568549611 100755 >--- a/debian/scripts/koha-plack >+++ b/debian/scripts/koha-plack >@@ -176,14 +176,48 @@ enable_plack() > local instancename=$1 > local instancefile=$(get_apache_config_for "$instancename") > >- if ! is_plack_enabled $instancename; then >- #Â Uncomment the plack related lines for OPAC and intranet >+ alreadyopac=0 >+ alreadyintra=0 >+ failopac=0 >+ failintra=0 >+ if ! is_plack_enabled_opac $instancefile; then >+ #Â Uncomment the plack related lines for OPAC > sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$:\1:' "$instancefile" >+ if ! is_plack_enabled_opac $instancefile; then >+ [ "${quiet}" != "yes" ] && warn "Plack not enabled for ${instancename} OPAC" >+ failopac=1 >+ else >+ [ "${quiet}" != "yes" ] && warn "Plack enabled for ${instancename} OPAC" >+ fi >+ else >+ [ "${quiet}" != "yes" ] && warn "Plack already enabled for ${instancename} OPAC" >+ alreadyopac=1 >+ fi >+ if ! is_plack_enabled_intranet $instancefile; then >+ #Â Uncomment the plack related lines for intranet > sed -i 's:^\s*#\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$:\1:' "$instancefile" >- [ "${quiet}" != "yes" ] && warn "Plack enabled for ${instancename}" >+ if ! is_plack_enabled_intranet $instancefile; then >+ [ "${quiet}" != "yes" ] && warn "Plack not enabled for ${instancename} Intranet" >+ failintra=1 >+ else >+ [ "${quiet}" != "yes" ] && warn "Plack enabled for ${instancename} Intranet" >+ fi >+ else >+ [ "${quiet}" != "yes" ] && warn "Plack already enabled for ${instancename} Intranet" >+ alreadyintra=1 >+ fi >+ >+ # Fail if it was already plack enabled. >+ if [ $alreadyopac -eq 1 ] && [ $alreadyintra -eq 1 ] ; then >+ return 1 >+ elif [ "$alreadyopac" != "$alreadyintra" ]; then >+ [ "${quiet}" != "yes" ] && warn "$instancename had a plack configuration error. Please confirm it is corrected." >+ fi >+ >+ # Succeed if both or any plack were turned on. >+ if [ $failopac -eq 0 ] || [ $failintra -eq 0 ] ; then > return 0 > else >- [ "${quiet}" != "yes" ] && warn "Plack already enabled for ${instancename}" > return 1 > fi > } >@@ -193,14 +227,48 @@ disable_plack() > local instancename=$1 > local instancefile=$(get_apache_config_for "$instancename") > >- if is_plack_enabled $instancename; then >- #Â Comment out the plack related lines for OPAC and intranet >+ alreadyopac=0 >+ alreadyintra=0 >+ failopac=0 >+ failintra=0 >+ if is_plack_enabled_opac $instancefile ; then >+ #Â Comment the plack related lines for OPAC > sed -i 's:^\(\s*Include /etc/koha/apache-shared-opac-plack.conf\)$:#\1:' "$instancefile" >+ if is_plack_enabled_opac $instancefile ; then >+ [ "${quiet}" != "yes" ] && warn "Plack not disabled for ${instancename} OPAC" >+ failopac=1 >+ else >+ [ "${quiet}" != "yes" ] && warn "Plack disabled for ${instancename} OPAC" >+ fi >+ else >+ [ "${quiet}" != "yes" ] && warn "Plack already disabled for ${instancename} OPAC" >+ alreadyopac=1 >+ fi >+ if is_plack_enabled_intranet $instancefile; then >+ #Â Comment the plack related lines for intranet > sed -i 's:^\(\s*Include /etc/koha/apache-shared-intranet-plack.conf\)$:#\1:' "$instancefile" >- [ "${quiet}" != "yes" ] && warn "Plack disabled for ${instancename}" >+ if is_plack_enabled_intranet $instancefile; then >+ [ "${quiet}" != "yes" ] && warn "Plack not disabled for ${instancename} Intranet" >+ failintra=1 >+ else >+ [ "${quiet}" != "yes" ] && warn "Plack disabled for ${instancename} Intranet" >+ fi >+ else >+ [ "${quiet}" != "yes" ] && warn "Plack already disabled for ${instancename} Intranet" >+ alreadyintra=1 >+ fi >+ >+ # Fail if it was already plack disabled. >+ if [ $alreadyopac -eq 1 ] && [ $alreadyintra -eq 1 ] ; then >+ return 1 >+ elif [ "$alreadyopac" != "$alreadyintra" ]; then >+ [ "${quiet}" != "yes" ] && warn "$instancename had a plack configuration error. Please confirm it is corrected." >+ fi >+ >+ # Succeed if both or any plack were turned off. >+ if [ $failopac -eq 0 ] || [ $failintra -eq 0 ] ; then > return 0 > else >- [ "${quiet}" != "yes" ] && warn "Plack already disabled for ${instancename}" > return 1 > fi > } >-- >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 20692
:
75038
|
75040
|
75510
|
75511
|
75594
|
75597
|
88085
|
88698