forked from GNUsocial/gnu-social
updates to Status_network
This commit is contained in:
parent
528ceec3fe
commit
eb6a60ef88
@ -12,11 +12,13 @@ class Status_network extends DB_DataObject
|
||||
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 $sitename; // varchar(255)
|
||||
public $theme; // varchar(255)
|
||||
public $logo; // varchar(255)
|
||||
public $created; // datetime() not_null
|
||||
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
|
||||
|
||||
@ -37,13 +39,19 @@ class Status_network extends DB_DataObject
|
||||
return true;
|
||||
}
|
||||
|
||||
static function setupSite($servername, $pathname)
|
||||
static function setupSite($servername, $pathname, $wildcard)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$parts = explode('.', $servername);
|
||||
// XXX I18N, probably not crucial for hostnames
|
||||
// XXX This probably needs a tune up
|
||||
|
||||
$sn = Status_network::staticGet('nickname', $parts[0]);
|
||||
if (0 == strncasecmp(strrev($wildcard), strrev($servername), strlen($wildcard))) {
|
||||
$parts = explode('.', $servername);
|
||||
$sn = Status_network::staticGet('nickname', strtolower($parts[0]));
|
||||
} else {
|
||||
$sn = Status_network::staticGet('hostname', strtolower($servername));
|
||||
}
|
||||
|
||||
if (!empty($sn)) {
|
||||
$dbhost = (empty($sn->dbhost)) ? 'localhost' : $sn->dbhost;
|
||||
@ -52,7 +60,16 @@ class Status_network extends DB_DataObject
|
||||
$dbname = (empty($sn->dbname)) ? $sn->nickname : $sn->dbname;
|
||||
|
||||
$config['db']['database'] = "mysqli://$dbuser:$dbpass@$dbhost/$dbname";
|
||||
|
||||
$config['site']['name'] = $sn->sitename;
|
||||
|
||||
if (!empty($sn->theme)) {
|
||||
$config['site']['theme'] = $sn->theme;
|
||||
}
|
||||
if (!empty($sn->logo)) {
|
||||
$config['site']['logo'] = $sn->logo;
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -1,13 +1,14 @@
|
||||
|
||||
[status_network]
|
||||
nickname = 130
|
||||
hostname = 2
|
||||
pathname = 2
|
||||
sitename = 2
|
||||
dbhost = 2
|
||||
dbuser = 2
|
||||
dbpass = 2
|
||||
dbname = 2
|
||||
sitename = 2
|
||||
theme = 2
|
||||
logo = 2
|
||||
created = 142
|
||||
modified = 384
|
||||
|
||||
|
@ -5,12 +5,16 @@ create table status_network (
|
||||
nickname varchar(64) primary key comment 'nickname',
|
||||
hostname varchar(255) unique key comment 'alternate hostname if any',
|
||||
pathname varchar(255) unique key comment 'alternate pathname if any',
|
||||
sitename varchar(255) comment 'display name',
|
||||
|
||||
dbhost varchar(255) comment 'database host',
|
||||
dbuser varchar(255) comment 'database username',
|
||||
dbpass varchar(255) comment 'database password',
|
||||
dbname varchar(255) comment 'database name',
|
||||
|
||||
sitename varchar(255) comment 'display name',
|
||||
theme varchar(255) comment 'theme name',
|
||||
logo varchar(255) comment 'site logo',
|
||||
|
||||
created datetime not null comment 'date this record was created',
|
||||
modified timestamp comment 'date this record was modified'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user