Uh oh!
There was an error while loading. Please reload this page.
This repository was archived by the owner on Nov 5, 2023. It is now read-only.
forked from ushahidi/Swiftriver-2011
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSetup.php
More file actions
Latest commit
204 lines (175 loc) · 7.17 KB
/
Copy pathSetup.php
File metadata and controls
204 lines (175 loc) · 7.17 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<?php
namespaceSwiftriver\Core;
/**
* @author mg[at]swiftly[dot]org
*/
class Setup
{
/**
* Static variable for the core configuration handler
*
* @var Configuration\ConfigurationHandlers\CoreConfigurationHandler
*/
privatestatic$configuration;
/**
* Static variable for the DAL Config handler
*
* @var Configuration\ConfigurationHandlers\DALConfigurationHandler
*/
privatestatic$dalConfiguration;
/**
* Static variable for the Pre Processing Config handler
*
* @var Configuration\ConfigurationHandlers\PreProcessingStepsConfigurationHandler
*/
privatestatic$preProcessingStepsConfiguration;
/**
* Static variable for the Event Distribution Config handler
*
* @var Configuration\ConfigurationHandlers\EventDistributionConfigurationHandler
*/
privatestatic$eventDistributionConfiguration;
/**
* Static variable for the Dynamic module Config handler
*
* @var Configuration\ConfigurationHandlers\DynamicModuleConfigurationHandler
*/
privatestatic$dynamicModuleConfiguration;
/**
* Get the shared instance for the logger
* @return \Log
*/
publicstaticfunctionGetLogger()
{
$log = new \Log("this message is ignored, however not supplying one throws an error :o/");
$logger = $log->singleton('file', Setup::Configuration()->CachingDirectory."/log.log" , '');
if(!self::Configuration()->EnableDebugLogging)
{
$mask = \Log::UPTO(\PEAR_LOG_INFO);
$logger->setMask($mask);
}
return$logger;
}
/**
* Static access to the Core Config handler
*
* @return Configuration\ConfigurationHandlers\CoreConfigurationHandler
*/
publicstaticfunctionConfiguration()
{
if(isset(self::$configuration))
returnself::$configuration;
self::$configuration = newConfiguration\ConfigurationHandlers\CoreConfigurationHandler(dirname(__FILE__)."/Configuration/ConfigurationFiles/CoreConfiguration.xml");
returnself::$configuration;
}
/**
* Static access to the DAL Config handler
*
* @return Configuration\ConfigurationHandlers\DALConfigurationHandler
*/
publicstaticfunctionDALConfiguration()
{
if(isset(self::$dalConfiguration))
returnself::$dalConfiguration;
self::$dalConfiguration = newConfiguration\ConfigurationHandlers\DALConfigurationHandler(dirname(__FILE__)."/Configuration/ConfigurationFiles/DALConfiguration.xml");
returnself::$dalConfiguration;
}
/**
* Static access to the Pre Processing Steps config handler
*
* @return Configuration\ConfigurationHandlers\PreProcessingStepsConfigurationHandler
*/
publicstaticfunctionPreProcessingStepsConfiguration()
{
if(isset(self::$preProcessingStepsConfiguration))
returnself::$preProcessingStepsConfiguration;
self::$preProcessingStepsConfiguration = newConfiguration\ConfigurationHandlers\PreProcessingStepsConfigurationHandler(dirname(__FILE__)."/Configuration/ConfigurationFiles/PreProcessingStepsConfiguration.xml");
returnself::$preProcessingStepsConfiguration;
}
/**
* Static access to the Event distribution config handler
*
* @return Configuration\ConfigurationHandlers\EventDistributionConfigurationHandler
*/
publicstaticfunctionEventDistributionConfiguration()
{
if(isset(self::$eventDistributionConfiguration))
returnself::$eventDistributionConfiguration;
self::$eventDistributionConfiguration = newConfiguration\ConfigurationHandlers\EventDistributionConfigurationHandler(dirname(__FILE__)."/Configuration/ConfigurationFiles/EventDistributionConfiguration.xml");
returnself::$eventDistributionConfiguration;
}
/**
* Static access to the dynamic module config handler
*
* @return Configuration\ConfigurationHandlers\DynamicModuleConfigurationHandler
*/
publicstaticfunctionDynamicModuleConfiguration()
{
if(isset(self::$dynamicModuleConfiguration))
returnself::$dynamicModuleConfiguration;
self::$dynamicModuleConfiguration = newConfiguration\ConfigurationHandlers\DynamicModuleConfigurationHandler(dirname(__FILE__)."/Configuration/ConfigurationFiles/DynamicModuleConfiguration.xml");
returnself::$dynamicModuleConfiguration;
}
}
//include the Loging Framework
include_once("Log.php");
//Include the config framework
include_once(dirname(__FILE__)."/Configuration/ConfigurationHandlers/BaseConfigurationHandler.php");
$dirItterator = new \RecursiveDirectoryIterator(dirname(__FILE__)."/Configuration/ConfigurationHandlers/");
$iterator = new \RecursiveIteratorIterator($dirItterator, \RecursiveIteratorIterator::SELF_FIRST);
foreach($iteratoras$file) {
if($file->isFile()) {
$filePath = $file->getPathname();
if(strpos($filePath, ".php")) {
include_once($filePath);
}
}
}
//Include some specific files
include_once(dirname(__FILE__)."/Workflows/WorkflowBase.php");
include_once(dirname(__FILE__)."/Workflows/ContentServices/ContentServicesBase.php");
include_once(dirname(__FILE__)."/Workflows/EventHandlers/EventHandlersBase.php");
include_once(dirname(__FILE__)."/Workflows/ChannelServices/ChannelServicesBase.php");
include_once(dirname(__FILE__)."/Workflows/SourceServices/SourceServicesBase.php");
include_once(dirname(__FILE__)."/Workflows/PreProcessingSteps/PreProcessingStepsBase.php");
include_once(dirname(__FILE__)."/Workflows/Analytics/AnalyticsWorkflowBase.php");
include_once(dirname(__FILE__)."/Workflows/TwitterStreamingServices/TwitterStreamingServicesBase.php");
include_once(Setup::Configuration()->ModulesDirectory."/SiSPS/Parsers/IParser.php");
include_once(Setup::Configuration()->ModulesDirectory."/SiSPS/PushParsers/IPushParser.php");
//include everything else
$directories = array(
dirname(__FILE__)."/Analytics/",
dirname(__FILE__)."/ObjectModel/",
dirname(__FILE__)."/DAL/",
dirname(__FILE__)."/StateTransition/",
dirname(__FILE__)."/PreProcessing/",
dirname(__FILE__)."/Workflows/",
dirname(__FILE__)."/EventDistribution/",
Setup::Configuration()->ModulesDirectory."/SiSW/",
Setup::Configuration()->ModulesDirectory."/SiSPS/",
);
foreach($directoriesas$dir) {
$dirItterator = new \RecursiveDirectoryIterator($dir);
$iterator = new \RecursiveIteratorIterator($dirItterator, \RecursiveIteratorIterator::SELF_FIRST);
foreach($iteratoras$file) {
if($file->isFile()) {
$filePath = $file->getPathname();
if(strpos($filePath, ".php")) {
include_once($filePath);
}
}
}
}
//Include the DAL Data Context Setup file
$relativeDir = Setup::DALConfiguration()->DataContextDirectory;
if(isset($relativeDir) && $relativeDir != "") {
$directory = Setup::Configuration()->ModulesDirectory.$relativeDir;
if(file_exists($directory)) {
//include the setup file - if there is one
$setupfile = $directory."/Setup.php";
if(file_exists($setupfile)) {
include_once($setupfile);
}
}
}
?>