provide get_server_role() to abstract different roles and capabilities
This commit is contained in:
parent
ec950de205
commit
d8e6fd5df0
6
boot.php
6
boot.php
@ -2394,3 +2394,9 @@ function get_site_icon() {
|
|||||||
return z_root() . '/images/hz-32.png';
|
return z_root() . '/images/hz-32.png';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function get_server_role() {
|
||||||
|
if(UNO)
|
||||||
|
return 'basic';
|
||||||
|
return 'advanced';
|
||||||
|
}
|
||||||
|
@ -484,7 +484,7 @@ function identity_basic_export($channel_id, $items = false) {
|
|||||||
|
|
||||||
// use constants here as otherwise we will have no idea if we can import from a site
|
// use constants here as otherwise we will have no idea if we can import from a site
|
||||||
// with a non-standard platform and version.
|
// with a non-standard platform and version.
|
||||||
$ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION, 'server_role' => UNO );
|
$ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION, 'server_role' => get_server_role());
|
||||||
|
|
||||||
$r = q("select * from channel where channel_id = %d limit 1",
|
$r = q("select * from channel where channel_id = %d limit 1",
|
||||||
intval($channel_id)
|
intval($channel_id)
|
||||||
|
@ -1805,6 +1805,7 @@ function get_site_info() {
|
|||||||
$data = Array(
|
$data = Array(
|
||||||
'version' => $version,
|
'version' => $version,
|
||||||
'version_tag' => $tag,
|
'version_tag' => $tag,
|
||||||
|
'server_role' => get_server_role(),
|
||||||
'commit' => $commit,
|
'commit' => $commit,
|
||||||
'url' => z_root(),
|
'url' => z_root(),
|
||||||
'plugins' => $visible_plugins,
|
'plugins' => $visible_plugins,
|
||||||
|
@ -120,7 +120,7 @@ function import_account(&$a, $account_id) {
|
|||||||
notice($t);
|
notice($t);
|
||||||
}
|
}
|
||||||
if(array_key_exists('server_role',$data['compatibility'])
|
if(array_key_exists('server_role',$data['compatibility'])
|
||||||
&& $data['compatibility']['server_role'] != UNO) {
|
&& $data['compatibility']['server_role'] != get_server_role()) {
|
||||||
notice( t('Server platform is not compatible. Operation not permitted.') . EOL);
|
notice( t('Server platform is not compatible. Operation not permitted.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user