summaryrefslogtreecommitdiff
path: root/classes/Status_network.php
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@controlyourself.ca>2009-04-08 22:55:34 +0000
committerSarven Capadisli <csarven@controlyourself.ca>2009-04-08 22:55:34 +0000
commit03a4a4bebf2197097e672e094535ee067fe25441 (patch)
tree2b73b7cf06cd7a65a327df726cc6d1106bfecaff /classes/Status_network.php
parente5657ca4bbd8a43bf2dd44c2554e807a45224bd7 (diff)
parent4e3e4fcfff53ea3a5ef5c90672f3848596d3acbf (diff)
Merge branch '0.8.x' of git@gitorious.org:laconica/dev into 0.8.x
Diffstat (limited to 'classes/Status_network.php')
-rwxr-xr-xclasses/Status_network.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/classes/Status_network.php b/classes/Status_network.php
new file mode 100755
index 000000000..f7747f71d
--- /dev/null
+++ b/classes/Status_network.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ * Table Definition for status_network
+ */
+
+class Status_network extends DB_DataObject
+{
+ ###START_AUTOCODE
+ /* the code below is auto generated do not remove the above tag */
+
+ public $__table = 'status_network'; // table name
+ public $nickname; // varchar(64) primary_key not_null
+ public $hostname; // varchar(255) unique_key
+ public $pathname; // varchar(255) unique_key
+ public $sitename; // varchar(255)
+ public $dbhost; // varchar(255)
+ public $dbuser; // varchar(255)
+ public $dbpass; // varchar(255)
+ public $dbname; // varchar(255)
+ public $created; // datetime() not_null
+ public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
+
+ /* Static get */
+ function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('Status_network',$k,$v); }
+
+ /* the code above is auto generated do not remove the tag below */
+ ###END_AUTOCODE
+
+ static function setupDB($dbhost, $dbuser, $dbpass, $dbname)
+ {
+ global $config;
+
+ $config['db']['database_'.$dbname] = "mysqli://$dbuser:$dbpass@$dbhost/$dbname";
+ $config['db']['ini_'.$dbname] = INSTALLDIR.'/classes/statusnet.ini';
+ $config['db']['table_status_network'] = $dbname;
+
+ return true;
+ }
+
+ static function setupSite($servername, $pathname)
+ {
+ global $config;
+
+ $parts = explode('.', $servername);
+
+ $sn = Status_network::staticGet('nickname', $parts[0]);
+
+ if (!empty($sn)) {
+ $dbhost = (empty($sn->dbhost)) ? 'localhost' : $sn->dbhost;
+ $dbuser = (empty($sn->dbuser)) ? $sn->nickname : $sn->dbuser;
+ $dbpass = $sn->dbpass;
+ $dbname = (empty($sn->dbname)) ? $sn->nickname : $sn->dbname;
+
+ $config['db']['database'] = "mysqli://$dbuser:$dbpass@$dbhost/$dbname";
+ $config['site']['name'] = $sn->sitename;
+ return true;
+ } else {
+ return false;
+ }
+ }
+}