Severity: 8192
Message: Function create_function() is deprecated
Filename: geshi/geshi.php
Line Number: 4698
Backtrace:
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4646
Function: _optimize_regexp_list_tokens_to_string
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once
diff --git a/.todo b/.todo index 78cca06..0a46199 100644 --- a/.todo +++ b/.todo @@ -419,9 +419,12 @@ Implemented </comment> </note> - <note priority="veryhigh" time="1314084490"> + <note priority="veryhigh" time="1314084490" done="1314200784"> backup for config file and database - <note priority="high" time="1314084565"> + <comment> + Implemented + </comment> + <note priority="high" time="1314084565" done="0"> configuration item for backup directory </note> </note> diff --git a/debian/control b/debian/control index 1d63d1b..0422bdf 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.9.1 Package: eta Architecture: all -Depends: ${misc:Depends}, bc +Depends: ${misc:Depends}, bc, tar, bzip2 Description: Embelin Time Assistant, a nifty working hour management utility ETA is a small but clever script for maintaining your working hours. It can count over midnight and produce basic reports. diff --git a/eta b/eta index c72cc24..f6a8b6a 100755 --- a/eta +++ b/eta @@ -21,7 +21,7 @@ shortusage() { echo "usage: `basename $0` [ <no params> | -a \"<yyyy-mm-dd [hh:mm - [yyyy-mm.dd] hh:mm] desc>\" ]" - echo " `basename $0` [ -c | -d \"<desc>\" | -e | -f <flt> | -F <flt> | -h | -m | -o | -p <r> | -r <min> | -R | -s | -y ]" + echo " `basename $0` [ -b | -c | -d \"<desc>\" | -e | -f <flt> | -F <flt> | -h | -m | -o | -p <r> | -r <min> | -R | -s | -y ]" echo " `basename $0` [ --version ]" echo " `basename $0` [ --help ]" } @@ -34,6 +34,7 @@ usage() echo " -a \"<yyyy-mm-dd [hh:mm - [yyyy-mm-dd] hh:mm] desc>\" Add a time row (e.g. \"2011-07-04 11:30 - 12:00 Script tuning\")." echo " Note that if you have worked over midnight, you can add different" echo " end date to the event." + echo " -b Backup event database and user configuration file." echo " -c Continue/start new time tracking event from the time previous ends," echo " use previous description." echo " -d \"<description>\" Change latest description. If used with \"-s\" or \"-c\"," @@ -1125,6 +1126,10 @@ readconfig() WMLEN[$WMYEAR]="$WMMONTHS" ;; + "backuppath") + BUPATH="$PARAM" + ;; + *) echo -e "\nUnknown configuration command [$CMD] in $1\n" ;; @@ -1161,7 +1166,7 @@ REMOVELASTEVENT="" FILTERINCLUDE="" FILTEREXCLUDE="" ASSUMEYES="" - +BACKUP="" # # Check the global configuration file @@ -1178,6 +1183,8 @@ then fi +# +# If default behaviour is configured, handle it here. if [[ "$1" == "" ]] && [[ "$DEFBEHAVIOUR" == "" ]]; then version @@ -1251,10 +1258,11 @@ fi # Parse single command line parameters -while getopts 'a:cd:ef:F:hmop:r:Rsyv' opt; +while getopts 'a:bcd:ef:F:hmop:r:Rsyv' opt; do case $opt in a) ADDTIMEROW="$OPTARG";; + b) BACKUP="y";; c) STARTEVENT="y"; STARTFROMPREVTIME="y";; d) NEWDESCRIPTION="$OPTARG";; e) STOPEVENT="y";; @@ -1515,6 +1523,52 @@ then fi fi +if [[ "$BACKUP" == "y" ]]; +then + if [[ "$BUPATH" != "" ]]; + then + BUDIROK="" + + # Files to backup: $TIMEDB, $MYRC + BUFILE="`date +%Y-%m-%d_%H%M%S`.tar.bz2" + + # Trick to replace ~ with $HOME + ESCHOME=`echo $HOME | sed 's/\//#/g'` + BUPATH=`echo $BUPATH | sed "s/\~/$ESCHOME/" | sed 's/#/\//g'` + + # Check the backup path existance and try to create it if needed. + if [ ! -d "$BUPATH" ]; + then + echo "no $BUPATH, creating..." + mkdir -p "$BUPATH" + + if [[ "$?" == "0" ]]; + then + BUDIROK="y" + else + BUDIROK="" + fi + else + BUDIROK="y" + fi + + # If backup path is ok, try to create the backup. + if [[ "$BUDIROK" == "y" ]]; + then + tar -jcC $HOME -f $BUPATH$BUFILE `basename $TIMEDB` `basename $MYRC` + + if [[ "$?" == "0" ]]; + then + echo "backup file $BUFILE created." + else + echo "backup failed, check $BUPATH!" + fi + fi + else + echo "backup directory setting missing, backup was not created." + fi +fi + # If only -r parameter is given, display current time rounded up and down. # But if rounding comes from config file, don't display anything diff --git a/eta.1 b/eta.1 index 09fbf64..d556118 100644 --- a/eta.1 +++ b/eta.1 @@ -22,7 +22,7 @@ [ <no parameters> | \fB\-a\fR "<yyyy-mm-dd [hh:mm \- [yyyy-mm-dd] hh:mm] desc>" ] .br .B eta -[ \fB\-c\fR | \fB\-d\fR "<desc>" | \fB\-e\fR | \fB\-f\fR <flt> | \fB\-F\fR <flt> | \fB\-h\fR | \fB\-m\fR | \fB\-o\fR | \fB\-p\fR <r> | \fB\-r\fR <min> | \fB\-R\fR | \fB\-s\fR | \fB\-y\fR ] +[ \fB\-b\fR | \fB\-c\fR | \fB\-d\fR "<desc>" | \fB\-e\fR | \fB\-f\fR <flt> | \fB\-F\fR <flt> | \fB\-h\fR | \fB\-m\fR | \fB\-o\fR | \fB\-p\fR <r> | \fB\-r\fR <min> | \fB\-R\fR | \fB\-s\fR | \fB\-y\fR ] .br .B eta [ \fB\-\-version\fR ] @@ -53,6 +53,9 @@ end date to the event. Also note: There is a special purpose syntax "yyyy-mm-dd desc" which you can use for "patching" a workday up to configured working day length with a given description. This is handy for example when reporting sickdays and holidays. .TP +\fB\-b\fR +Backup event database and user configuration file. Backup location can be set in configuration file. +.TP \fB\-c\fR Continue/start new time tracking event from the time previous ends, use previous description. @@ -227,6 +230,9 @@ Set the default working week lenght in workdays, usually 5 in Finland. .TP \fBworkingmonthlength\fR <yyyy> <Jan> <Feb> <Mar> <Apr> <May> <Jun> <Jul> <Aug> <Sep> <Oct> <Nov> <Dec> Set the amount of expected working days for each month and year. This configuration option can be set for several years at the same time, see /etc/etarc for syntax and example. +.TP +\fBbackuppath\fR </path/to/backup/directory/> +Set a path to directory where backup files are copied. Note that final "/" needs to be included. .SH COPYRIGHT Copyright \(co 2011 Mika Tapojärvi <mika.tapojarvi@sse.fi> .PP diff --git a/etarc b/etarc index fa5d9ef..64bc364 100644 --- a/etarc +++ b/etarc @@ -50,3 +50,8 @@ workingweeklength 5 # yyyy Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec workingmonthlength 2010 20 20 23 19 22 20 21 23 22 21 22 20 workingmonthlength 2011 19 20 23 20 20 21 22 22 22 21 22 21 + +# Backup path +backuppath ~/.eta_backup/ +