summaryrefslogtreecommitdiffstats
path: root/src/main/webapp/controllers/Tasks.cfc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/webapp/controllers/Tasks.cfc')
-rw-r--r--src/main/webapp/controllers/Tasks.cfc36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/webapp/controllers/Tasks.cfc b/src/main/webapp/controllers/Tasks.cfc
new file mode 100644
index 0000000..c7a470f
--- /dev/null
+++ b/src/main/webapp/controllers/Tasks.cfc
@@ -0,0 +1,36 @@
+<cfcomponent extends="Controller">
+
+ <cffunction name="cleanup">
+ <cfscript>
+
+ var stale_schemas = model("Schema_Def").findAll(where="last_used < '#DateAdd('n', -30, Now())#' AND current_host_id IS NOT NULL", returnAs="objects", order="last_used");
+ var i = 0;
+ for (i = 1; i<= ArrayLen(stale_schemas); i++)
+ {
+ lock name="#stale_schemas[i].db_type_id#_#stale_schemas[i].short_code#" type="exclusive" timeout="60"
+ {
+ stale_schemas[i].purgeDatabase(1);
+ }
+ }
+
+
+ </cfscript>
+
+ <cfobjectcache
+ action = "clear" />
+
+ <cfset renderNothing()>
+
+
+ </cffunction>
+
+ <cffunction name="buildMetaData">
+ <cfscript>
+
+ schemas = model("Schema_Def").findAll(where="structure_json IS NULL");
+
+ </cfscript>
+ </cffunction>
+
+
+</cfcomponent>