Bugzilla – Attachment 29320 Details for
Bug 10532
koha-run-backups option --output doesn't work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch with working fix
0001-Bug-10532-koha-run-backups-option-output-doesn-t-wor.patch (text/plain), 3.64 KB, created by
Reed Wade
on 2014-06-27 06:35:18 UTC
(
hide
)
Description:
patch with working fix
Filename:
MIME Type:
Creator:
Reed Wade
Created:
2014-06-27 06:35:18 UTC
Size:
3.64 KB
patch
obsolete
>From fa431a1bcd5f2791393410eda2811e9b809f4ada Mon Sep 17 00:00:00 2001 >From: Reed Wade <reed@typist.geek.nz> >Date: Fri, 27 Jun 2014 02:28:08 -0400 >Subject: [PATCH] Bug 10532: koha-run-backups option --output doesn't work > >koha-dump has been modified to accept an optional --output option which is where >it will create backup files. > >koha-run-dumps has been modified to always use that option when calling koha-dump >--- > debian/docs/koha-dump.xml | 4 +++- > debian/scripts/koha-dump | 38 +++++++++++++++++++++++++++++++++++--- > debian/scripts/koha-run-backups | 2 +- > 3 files changed, 39 insertions(+), 5 deletions(-) > >diff --git a/debian/docs/koha-dump.xml b/debian/docs/koha-dump.xml >index a749fb2..70f0982 100644 >--- a/debian/docs/koha-dump.xml >+++ b/debian/docs/koha-dump.xml >@@ -23,7 +23,9 @@ > > <refsynopsisdiv> > <cmdsynopsis> >- <command>koha-dump</command> <arg choice="req" rep="norepeat"><replaceable>instancename</replaceable></arg> >+ <command>koha-dump</command> >+ <arg><option>--output</option> directory</arg> >+ <arg choice="req" rep="norepeat"><replaceable>instancename</replaceable></arg> > </cmdsynopsis> > </refsynopsisdiv> > >diff --git a/debian/scripts/koha-dump b/debian/scripts/koha-dump >index bf4bd5f..d463462 100755 >--- a/debian/scripts/koha-dump >+++ b/debian/scripts/koha-dump >@@ -27,24 +27,56 @@ else > exit 1 > fi > >+show_help() { >+ cat <<EOH >+$0 - performs backup of a koha installations on the system >+ >+Options: >+ --output: the directory that the backup files will be placed into. >+ (default: consults /etc/koha/sites/<instance>/koha-conf.xml) >+EOH >+ >+} >+ > # Make sure the files we create are not accessible by anyone else. > umask 0077 > > # Parse command line. >-[ "$#" = 1 ] || die "Usage: $0 instancename" >+ >+backupdir="" >+ >+CMD_LINE=`getopt -o h --long output:,help -n 'koha-dump' -- "$@"` >+ >+if [ $? != 0 ] ; then show_help ; exit 1 ; fi >+ >+eval set -- "$CMD_LINE" >+while true ; do >+ case "$1" in >+ -h|--help) >+ show_help; exit;; >+ --output) >+ backupdir=$2; shift 2 ;; >+ --) shift ; break ;; >+ *) echo "Unknown error parsing the command line!" ; exit 1 ;; >+ esac >+done >+ >+[ "$#" = 1 ] || die "Usage: $0 [ --output directory ] instancename" >+ > name="$1" >+ >+ > kohaconfig="/etc/koha/sites/$name/koha-conf.xml" > date="$(date +%Y-%m-%d)" > > echo "Dumping Koha site $name:" > >- > # Dump database. > mysqlhost="$( xmlstarlet sel -t -v 'yazgfs/config/hostname' $kohaconfig )" > mysqldb="$( xmlstarlet sel -t -v 'yazgfs/config/database' $kohaconfig )" > mysqluser="$( xmlstarlet sel -t -v 'yazgfs/config/user' $kohaconfig )" > mysqlpass="$( xmlstarlet sel -t -v 'yazgfs/config/pass' $kohaconfig )" >-backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' $kohaconfig || true )" >+[ -z "$backupdir" ] && backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' $kohaconfig || true )" > [ -z "$backupdir" ] && backupdir="/var/spool/koha/$name" > dbdump="$backupdir/$name-$date.sql.gz" > echo "* DB to $dbdump" >diff --git a/debian/scripts/koha-run-backups b/debian/scripts/koha-run-backups >index 74f879b..164e485 100755 >--- a/debian/scripts/koha-run-backups >+++ b/debian/scripts/koha-run-backups >@@ -57,12 +57,12 @@ done > > for name in $(koha-list --enabled | grep -Fxv demo) > do >- koha-dump "$name" > /dev/null > if [ -z "$dirname" ]; then > backupdir="$( xmlstarlet sel -t -v 'yazgfs/config/backupdir' /etc/koha/sites/$name/koha-conf.xml )"; > else > backupdir="$dirname/$name"; > fi >+ koha-dump --output "$backupdir" "$name" > /dev/null > > # Remove old dump files. > # FIXME: This could probably be replaced by one line of perl. >-- >1.9.1 >
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 10532
: 29320