Version 0.0.6. Added a crontask that adjusts the stage of packaged beer depending on the days passed packaging

Sat, 09 Feb 2019 22:12:31 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Sat, 09 Feb 2019 22:12:31 +0100
changeset 257
62e294ab94f5
parent 256
4767a790d1f6
child 258
943fbe0e9fd6

Version 0.0.6. Added a crontask that adjusts the stage of packaged beer depending on the days passed packaging

config.status file | annotate | diff | comparison | revisions
configure file | annotate | diff | comparison | revisions
configure.ac file | annotate | diff | comparison | revisions
script/Makefile file | annotate | diff | comparison | revisions
script/crontask file | annotate | diff | comparison | revisions
www/Makefile file | annotate | diff | comparison | revisions
www/crontasks.php file | annotate | diff | comparison | revisions
--- a/config.status	Sat Feb 09 20:14:21 2019 +0100
+++ b/config.status	Sat Feb 09 22:12:31 2019 +0100
@@ -621,9 +621,9 @@
 S["CC"]="gcc"
 S["CYEARS"]="2016-2019"
 S["COPYRIGHT"]="Copyright (C) 2016-2019 Michiel Broek, All Rights Reserved"
-S["VERSION"]="0.0.5"
+S["VERSION"]="0.0.6"
 S["PACKAGE"]="bms"
-S["SUBDIRS"]="bmsd doc tools www"
+S["SUBDIRS"]="bmsd doc script tools www"
 S["target_alias"]=""
 S["host_alias"]=""
 S["build_alias"]=""
@@ -709,7 +709,7 @@
 D["PACKAGE_STRING"]=" \"\""
 D["PACKAGE_BUGREPORT"]=" \"\""
 D["PACKAGE_URL"]=" \"\""
-D["VERSION"]=" \"0.0.5\""
+D["VERSION"]=" \"0.0.6\""
 D["COPYRIGHT"]=" \"Copyright (C) 2016-2019 Michiel Broek, All Rights Reserved\""
 D["STDC_HEADERS"]=" 1"
 D["HAVE_SYS_TYPES_H"]=" 1"
--- a/configure	Sat Feb 09 20:14:21 2019 +0100
+++ b/configure	Sat Feb 09 22:12:31 2019 +0100
@@ -2027,11 +2027,11 @@
 
 ac_config_headers="$ac_config_headers config.h"
 
-SUBDIRS="bmsd doc tools www"
+SUBDIRS="bmsd doc script tools www"
 
 
 PACKAGE="bms"
-VERSION="0.0.5"
+VERSION="0.0.6"
 COPYRIGHT="Copyright (C) 2016-2019 Michiel Broek, All Rights Reserved"
 CYEARS="2016-2019"
 
--- a/configure.ac	Sat Feb 09 20:14:21 2019 +0100
+++ b/configure.ac	Sat Feb 09 22:12:31 2019 +0100
@@ -2,13 +2,13 @@
 
 AC_INIT(bmsd/bms.c)
 AM_CONFIG_HEADER(config.h)
-SUBDIRS="bmsd doc tools www"
+SUBDIRS="bmsd doc script tools www"
 AC_SUBST(SUBDIRS)
 
 dnl General settings
 dnl After changeing the version number, run autoconf!
 PACKAGE="bms"
-VERSION="0.0.5"
+VERSION="0.0.6"
 COPYRIGHT="Copyright (C) 2016-2019 Michiel Broek, All Rights Reserved"
 CYEARS="2016-2019"
 AC_SUBST(PACKAGE)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/script/Makefile	Sat Feb 09 22:12:31 2019 +0100
@@ -0,0 +1,25 @@
+# Makefile for the mbsePi-apps/thermferm.
+
+include ../Makefile.global
+
+TARGET		= bmsd
+OTHER		= Makefile crontask
+
+#############################################################################
+
+.c.o:
+		${CC} ${CFLAGS} ${INCLUDES} ${DEFINES} -c $<
+
+all:
+
+
+clean:
+
+install:
+		${INSTALL} -d -g 314 -o 314 ${PREFIX} ${BINDIR}
+		${INSTALL} -c -g 314 -o 314 -m 0755 crontask ${BINDIR}
+
+filelist:	Makefile
+		BASE=`pwd`; \
+		BASE=`basename $${BASE}`; \
+		(for f in ${OTHER} ;do echo ${PACKAGE}-${VERSION}/$${BASE}/$$f; done) >filelist
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/script/crontask	Sat Feb 09 22:12:31 2019 +0100
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+cd $HOME/www
+php crontasks.php
+
--- a/www/Makefile	Sat Feb 09 20:14:21 2019 +0100
+++ b/www/Makefile	Sat Feb 09 22:12:31 2019 +0100
@@ -3,7 +3,8 @@
 
 include ../Makefile.global
 
-SRC		= cmd_fermenter.php config.php.dist favicon.ico gen_about.php getfermentablesources.php \
+SRC		= cmd_fermenter.php config.php.dist crontasks.php favicon.ico gen_about.php \
+		  getfermentablesources.php \
 		  getfermenter.php getfermentlog.php gethopsources.php getmiscsources.php \
 		  getnode.php getwatersources.php getyeastsources.php index.php \
 		  inv_equipments.php inv_fermentables.php inv_hops.php inv_instock.php \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/www/crontasks.php	Sat Feb 09 22:12:31 2019 +0100
@@ -0,0 +1,14 @@
+<?php
+
+require_once('config.php');
+
+$mysqli = new mysqli(DBASE_HOST,DBASE_USER,DBASE_PASS,DBASE_NAME);
+$query = "UPDATE products SET stage=7 WHERE stage = 6 AND DATEDIFF(CURDATE(), package_date) > 0";
+$result = $mysqli->query($query);
+
+$query = "UPDATE products SET stage=8 WHERE stage = 7 AND DATEDIFF(CURDATE(), package_date) > 13";
+$result = $mysqli->query($query);
+
+$query = "UPDATE products SET stage=9 WHERE stage = 8 AND DATEDIFF(CURDATE(), package_date) > 41";
+$result = $mysqli->query($query);
+

mercurial