-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApplication.cfc
More file actions
67 lines (59 loc) · 2.15 KB
/
Copy pathApplication.cfc
File metadata and controls
67 lines (59 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
component{
this.name = "cfug_raffle";
this.sessionmanagement = true;
this.sessiontimeout = createTimeSpan(1,0,0,0);
this.datasource = "cfug_raffle";
// websockets
this.wschannels=[{name="raffle"}];
// mappings
this.mappings = {
"/orm" : ExpandPath("./orm")
};
this.ormEnabled = true;
this.ormSettings = {
automanageSession : false,
cfclocation : "/orm/",
dbcreate : "dropcreate",
flushatrequestend : false,
logSQL : false,
useDBForMapping : false,
dialect : 'Derby'
};
public boolean function onApplicationStart(){
application.registrationopen = true;
application.winnerselected = false;
application.winner = {};
return true;
}
function onError(exception,eventName){
// requires setup
if (arguments.exception.message.find("Datasource #this.datasource# could not be found")){
var admin = createObject("component","cfide.adminapi.administrator").login('commandbox');
var db = createObject("component","cfide.adminapi.datasource");
if (!db.verifyDSN("cfug_raffle")){
try{
db.setDerbyEmbedded(
name : "cfug_raffle",
database : expandPath("./db"),
isnewdb : true
);
location("./",false);
}
catch(any e){
writeDump(e);
}
}
}
writeDump(arguments.exception);
}
public boolean function onRequestStart(targetPage){
// reload orm
if (structKeyExists(url,"reload")){
application.ormtimestamp = getHttpTimeString();
lock scope="application" type="exclusive" timeout="30"{ ormReload(); }
applicationStop();
location('./',false);
}
return true;
}
}