Skip to content

Instantly share code, notes, and snippets.

@rileyrg
Created October 15, 2014 11:51
Show Gist options
  • Save rileyrg/288980c813fbcdb5465a to your computer and use it in GitHub Desktop.
Save rileyrg/288980c813fbcdb5465a to your computer and use it in GitHub Desktop.
added list:fdeletewhenexpired setting defaulted to 1 - if 0 then an event doesnt get deleted upon expiry
diff --git a/lib/php/eventstorage.php b/lib/php/eventstorage.php
index 982fcc9..e8da6b9 100755
--- a/lib/php/eventstorage.php
+++ b/lib/php/eventstorage.php
@@ -49,6 +49,7 @@ function populateEventObject(&$row,$category=null){
$row["eventlink"]=getSetting("ev:eventlink",$category,null);
$row["fbcomments"]=getSetting("ev:fbcomments",$category);
$row["fenabled"]=getSetting("ev:fenabled",$category,"1");
+ $row["fdeletewhenexpired"]=getSetting("list:fdeletewhenexpired",$category,"1");
$row["fenableshare"]=getSetting("ev:fenableshare",$category,false); /* to do */
$row["fjsonenabled"]=getSetting("ev:fjsonenabled",$category);
$row["groupby"]=getSetting("ev:groupby",$category,"default");
diff --git a/lib/php/utils.php b/lib/php/utils.php
index 434cbb4..8fb396f 100755
--- a/lib/php/utils.php
+++ b/lib/php/utils.php
@@ -62,7 +62,7 @@ function disableExpiredEvents()
function deleteExpiredEvents()
{
- $purgeSQL='delete from events where fenabled=1 and startdate<>"" and (now() > startdate + INTERVAL duration MINUTE)';
+ $purgeSQL='delete from events where fenabled=1 and fdeletewhenexpired=1 and startdate<>"" and (now() > startdate + INTERVAL duration MINUTE)';
global $mysqli;
$result=$mysqli->query($purgeSQL);
}
diff --git a/lib/web-db-update.sql b/lib/web-db-update.sql
index e6db7e4..495a161 100644
--- a/lib/web-db-update.sql
+++ b/lib/web-db-update.sql
@@ -552,4 +552,5 @@
-- update events set fpopup=1 where popupposition is not null or cookietimeout <> 0;
-- alter table events drop column carouselwidth;
-- delete from events where token="fb:loginperms";
-update events set attachto="barwebs-fblogincontainer" where attachto="fblogincontainer";
+-- update events set attachto="barwebs-fblogincontainer" where attachto="fblogincontainer";
+alter table events add column fdeletewhenexpired tinyint(1) default 1 after fenabled ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment