mirror of
https://github.com/tim-krehan/shopping-list.git
synced 2024-11-27 15:40:00 +01:00
Merge branch 'hourly-routine-installation-failing' into 'develop'
Resolve "Hourly Routine Installation failing" See merge request bluekay/shopping-list!2
This commit is contained in:
commit
264e9fcf3e
2 changed files with 4 additions and 20 deletions
|
@ -107,24 +107,12 @@ CREATE TABLE `RezeptZutat` (
|
||||||
`Zutat` int(11) NOT NULL
|
`Zutat` int(11) NOT NULL
|
||||||
);");
|
);");
|
||||||
|
|
||||||
array_push($SQLStatements, "
|
|
||||||
CREATE TABLE `ViewEinkauf` (
|
|
||||||
`ID` int(11),
|
|
||||||
`Anzahl` double,
|
|
||||||
`Einheit` varchar(255),
|
|
||||||
`Name` varchar(255),
|
|
||||||
`Erledigt` tinyint(1)
|
|
||||||
);");
|
|
||||||
|
|
||||||
array_push($SQLStatements, "
|
array_push($SQLStatements, "
|
||||||
CREATE TABLE `Zutat` (
|
CREATE TABLE `Zutat` (
|
||||||
`ID` int(11) NOT NULL,
|
`ID` int(11) NOT NULL,
|
||||||
`Name` varchar(255) NOT NULL
|
`Name` varchar(255) NOT NULL
|
||||||
);");
|
);");
|
||||||
|
|
||||||
array_push($SQLStatements, "
|
|
||||||
DROP TABLE IF EXISTS `ViewEinkauf`;");
|
|
||||||
|
|
||||||
array_push($SQLStatements, "
|
array_push($SQLStatements, "
|
||||||
CREATE VIEW `ViewEinkauf` AS select `Einkauf`.`ID` AS `ID`,`Einkauf`.`Anzahl` AS `Anzahl`,`Einheit`.`Name` AS `Einheit`,`Einkauf`.`Name` AS `Name`,`Einkauf`.`Erledigt` AS `Erledigt` from (`Einkauf` join `Einheit` on((`Einkauf`.`Einheit` = `Einheit`.`ID`))) ;");
|
CREATE VIEW `ViewEinkauf` AS select `Einkauf`.`ID` AS `ID`,`Einkauf`.`Anzahl` AS `Anzahl`,`Einheit`.`Name` AS `Einheit`,`Einkauf`.`Name` AS `Name`,`Einkauf`.`Erledigt` AS `Erledigt` from (`Einkauf` join `Einheit` on((`Einkauf`.`Einheit` = `Einheit`.`ID`))) ;");
|
||||||
|
|
||||||
|
@ -217,13 +205,6 @@ INSERT INTO `Einheit` (`ID`, `Name`, `Standard`) VALUES
|
||||||
(11, 'Glas', 0);");
|
(11, 'Glas', 0);");
|
||||||
|
|
||||||
|
|
||||||
array_push($SQLStatements, "
|
|
||||||
CREATE EVENT hourly_session_cleanup
|
|
||||||
ON SCHEDULE EVERY 1 HOUR
|
|
||||||
DO
|
|
||||||
DELETE FROM `sessions` WHERE `expires` < NOW();");
|
|
||||||
|
|
||||||
|
|
||||||
foreach($SQLStatements as $statement){
|
foreach($SQLStatements as $statement){
|
||||||
$result = $connection->query($statement);
|
$result = $connection->query($statement);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
include $_SESSION["docroot"].'/php/connect.php';
|
include $_SESSION["docroot"].'/php/connect.php';
|
||||||
if(!(preg_match("/error.+/", $_SERVER["REQUEST_URI"])))
|
if(!(preg_match("/error.+/", $_SERVER["REQUEST_URI"])))
|
||||||
{
|
{
|
||||||
|
# clear expired sessions from the database
|
||||||
|
$mysqli->query('DELETE FROM `sessions` WHERE `expires` < NOW();');
|
||||||
|
|
||||||
$result = $mysqli->query('SELECT * FROM `sessions` WHERE `session_id` = \''.$_COOKIE["token"].'\';');
|
$result = $mysqli->query('SELECT * FROM `sessions` WHERE `session_id` = \''.$_COOKIE["token"].'\';');
|
||||||
|
|
||||||
if($result->num_rows == 0 && (!(in_array("site", array_keys($_GET))) || $_GET["site"]!="login"))
|
if($result->num_rows == 0 && (!(in_array("site", array_keys($_GET))) || $_GET["site"]!="login"))
|
||||||
|
|
Loading…
Reference in a new issue