summaryrefslogtreecommitdiffstatshomepage
path: root/src/SemanticScuttle/Service/Factory.php
diff options
context:
space:
mode:
authorGravatar cweiske2009-10-03 21:52:30 +0000
committerGravatar cweiske2009-10-03 21:52:30 +0000
commitd5f09b7e4d802cdc2d5f3f876c48ea918c961488 (patch)
treeaa1eb37219c17bef03b1515e5074b4743f89a9a3 /src/SemanticScuttle/Service/Factory.php
parentb7345f833dea849e94f2ce23fdbe6ab58ba98be3 (diff)
downloadscuttle-d5f09b7e4d802cdc2d5f3f876c48ea918c961488.tar.gz
scuttle-d5f09b7e4d802cdc2d5f3f876c48ea918c961488.zip
make the application work again
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@388 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'src/SemanticScuttle/Service/Factory.php')
-rw-r--r--src/SemanticScuttle/Service/Factory.php20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/SemanticScuttle/Service/Factory.php b/src/SemanticScuttle/Service/Factory.php
index b5215e3..b4ba28e 100644
--- a/src/SemanticScuttle/Service/Factory.php
+++ b/src/SemanticScuttle/Service/Factory.php
@@ -1,16 +1,19 @@
<?php
/* Connect to the database and build services */
-class ServiceFactory {
- function ServiceFactory(&$db, $serviceoverrules = array()) {
+class SemanticScuttle_Service_Factory
+{
+ public function __construct($db, $serviceoverrules = array())
+ {
}
- function &getServiceInstance($name, $servicedir = NULL) {
+ public function getServiceInstance($name, $servicedir = null)
+ {
global $dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist, $dbtype;
static $instances = array();
static $db;
if (!isset($db)) {
- require_once(dirname(__FILE__) .'/../includes/db/'. $dbtype .'.php');
+ require_once 'SemanticScuttle/db/'. $dbtype .'.php';
$db = new sql_db();
$db->sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport, $dbpersist);
if(!$db->db_connect_id) {
@@ -25,12 +28,15 @@ class ServiceFactory {
}
if (!class_exists($name)) {
if (!isset($servicedir)) {
- $servicedir = dirname(__FILE__) .'/';
+ $servicedir = 'SemanticScuttle/Service/';
}
- require_once($servicedir . strtolower($name) . '.php');
+ require_once $servicedir . $name . '.php';
}
- $instances[$name] = call_user_func(array($name, 'getInstance'), $db);
+ $instances[$name] = call_user_func(
+ array('SemanticScuttle_Service_' . $name, 'getInstance'),
+ $db
+ );
}
return $instances[$name];
}