Provide Zotlabs\Project and System class for querying details about the project/version info. Move these out of /boot.php
This commit is contained in:
@@ -2106,10 +2106,10 @@ require_once('include/api_auth.php');
|
||||
'private' => $private, 'textlimit' => $textlimit, 'sslserver' => $sslserver, 'ssl' => $ssl,
|
||||
'shorturllength' => '30',
|
||||
'hubzilla' => array(
|
||||
'PLATFORM_NAME' => get_platform_name(),
|
||||
'RED_VERSION' => get_project_version(),
|
||||
'PLATFORM_NAME' => Zotlabs\Project\System::get_platform_name(),
|
||||
'RED_VERSION' => Zotlabs\Project\System::get_project_version(),
|
||||
'ZOT_REVISION' => ZOT_REVISION,
|
||||
'DB_UPDATE_VERSION' => get_update_version()
|
||||
'DB_UPDATE_VERSION' => Zotlabs\Project\System::get_update_version()
|
||||
)
|
||||
));
|
||||
|
||||
@@ -2142,12 +2142,12 @@ require_once('include/api_auth.php');
|
||||
|
||||
if($type === 'xml') {
|
||||
header("Content-type: application/xml");
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n" . '<version>' . get_project_version() . '</version>' . "\r\n";
|
||||
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n" . '<version>' . Zotlabs\Project\System::get_project_version() . '</version>' . "\r\n";
|
||||
killme();
|
||||
}
|
||||
elseif($type === 'json') {
|
||||
header("Content-type: application/json");
|
||||
echo '"' . get_project_version() . '"';
|
||||
echo '"' . Zotlabs\Project\System::get_project_version() . '"';
|
||||
killme();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,7 +529,7 @@ function notification($params) {
|
||||
$tpl = get_markup_template('email_notify_html.tpl');
|
||||
$email_html_body = replace_macros($tpl,array(
|
||||
'$banner' => $datarray['banner'],
|
||||
'$notify_icon' => get_notify_icon(),
|
||||
'$notify_icon' => Zotlabs\Project\System::get_notify_icon(),
|
||||
'$product' => $datarray['product'],
|
||||
'$preamble' => $datarray['preamble'],
|
||||
'$sitename' => $datarray['sitename'],
|
||||
|
||||
@@ -67,7 +67,7 @@ function ical_wrapper($ev) {
|
||||
$o .= "BEGIN:VCALENDAR";
|
||||
$o .= "\r\nVERSION:2.0";
|
||||
$o .= "\r\nMETHOD:PUBLISH";
|
||||
$o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . get_platform_name() . "//" . strtoupper(get_app()->language). "\r\n";
|
||||
$o .= "\r\nPRODID:-//" . get_config('system','sitename') . "//" . Zotlabs\Project\System::get_platform_name() . "//" . strtoupper(get_app()->language). "\r\n";
|
||||
if(array_key_exists('start', $ev))
|
||||
$o .= format_event_ical($ev);
|
||||
else {
|
||||
|
||||
@@ -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
|
||||
// with a non-standard platform and version.
|
||||
$ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION, 'server_role' => get_server_role());
|
||||
$ret['compatibility'] = array('project' => PLATFORM_NAME, 'version' => RED_VERSION, 'database' => DB_UPDATE_VERSION, 'server_role' => Zotlabs\Project\System::get_server_role());
|
||||
|
||||
$r = q("select * from channel where channel_id = %d limit 1",
|
||||
intval($channel_id)
|
||||
|
||||
@@ -610,8 +610,8 @@ function get_feed_for($channel, $observer_hash, $params) {
|
||||
$atom = '';
|
||||
|
||||
$atom .= replace_macros($feed_template, array(
|
||||
'$version' => xmlify(get_project_version()),
|
||||
'$red' => xmlify(get_platform_name()),
|
||||
'$version' => xmlify(Zotlabs\Project\System::get_project_version()),
|
||||
'$red' => xmlify(Zotlabs\Project\System::get_platform_name()),
|
||||
'$feed_id' => xmlify($channel['xchan_url']),
|
||||
'$feed_title' => xmlify($channel['channel_name']),
|
||||
'$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now' , ATOM_TIME)) ,
|
||||
|
||||
@@ -189,7 +189,7 @@ function t($s, $ctx = '') {
|
||||
|
||||
function translate_projectname($s) {
|
||||
|
||||
return str_replace(array('$projectname','$Projectname'),array(get_platform_name(),ucfirst(get_platform_name())),$s);
|
||||
return str_replace(array('$projectname','$Projectname'),array(Zotlabs\Project\System::get_platform_name(),ucfirst(Zotlabs\Project\System::get_platform_name())),$s);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1620,7 +1620,7 @@ function format_and_send_email($sender,$xchan,$item) {
|
||||
$tpl = get_markup_template('email_notify_html.tpl');
|
||||
$email_html_body = replace_macros($tpl,array(
|
||||
'$banner' => $banner,
|
||||
'$notify_icon' => get_notify_icon(),
|
||||
'$notify_icon' => Zotlabs\Project\System::get_notify_icon(),
|
||||
'$product' => $product,
|
||||
'$preamble' => '',
|
||||
'$sitename' => $sitename,
|
||||
@@ -1768,8 +1768,8 @@ function get_site_info() {
|
||||
$site_info = get_config('system','info');
|
||||
$site_name = get_config('system','sitename');
|
||||
if(! get_config('system','hidden_version_siteinfo')) {
|
||||
$version = get_project_version();
|
||||
$tag = get_std_version();
|
||||
$version = Zotlabs\Project\System::get_project_version();
|
||||
$tag = Zotlabs\Project\System::get_std_version();
|
||||
|
||||
if(@is_dir('.git') && function_exists('shell_exec')) {
|
||||
$commit = trim( @shell_exec('git log -1 --format="%h"'));
|
||||
@@ -1805,7 +1805,7 @@ function get_site_info() {
|
||||
$data = Array(
|
||||
'version' => $version,
|
||||
'version_tag' => $tag,
|
||||
'server_role' => get_server_role(),
|
||||
'server_role' => Zotlabs\Project\System::get_server_role(),
|
||||
'commit' => $commit,
|
||||
'url' => z_root(),
|
||||
'plugins' => $visible_plugins,
|
||||
@@ -1819,7 +1819,7 @@ function get_site_info() {
|
||||
'locked_features' => $locked_features,
|
||||
'admin' => $admin,
|
||||
'site_name' => (($site_name) ? $site_name : ''),
|
||||
'platform' => get_platform_name(),
|
||||
'platform' => Zotlabs\Project\System::get_platform_name(),
|
||||
'dbdriver' => $db->getdriver(),
|
||||
'lastpoll' => get_config('system','lastpoll'),
|
||||
'info' => (($site_info) ? $site_info : ''),
|
||||
|
||||
@@ -653,17 +653,6 @@ function get_markup_template($s, $root = '') {
|
||||
return $template;
|
||||
}
|
||||
|
||||
// return the standardised version. Since we can't easily compare
|
||||
// before the STD_VERSION definition was applied, we have to treat
|
||||
// all prior release versions the same. You can dig through them
|
||||
// with other means (such as RED_VERSION) if necessary.
|
||||
|
||||
function get_std_version() {
|
||||
if(defined('STD_VERSION'))
|
||||
return STD_VERSION;
|
||||
return '0.0.0';
|
||||
}
|
||||
|
||||
|
||||
function folder_exists($folder)
|
||||
{
|
||||
|
||||
@@ -3835,7 +3835,7 @@ function zotinfo($arr) {
|
||||
$ret['site']['channels'] = channel_total();
|
||||
|
||||
|
||||
$ret['site']['version'] = get_platform_name() . ' ' . RED_VERSION . '[' . DB_UPDATE_VERSION . ']';
|
||||
$ret['site']['version'] = Zotlabs\Project\System::get_platform_name() . ' ' . RED_VERSION . '[' . DB_UPDATE_VERSION . ']';
|
||||
|
||||
$ret['site']['admin'] = get_config('system','admin_email');
|
||||
|
||||
@@ -3855,7 +3855,7 @@ function zotinfo($arr) {
|
||||
$ret['site']['sellpage'] = get_config('system','sellpage');
|
||||
$ret['site']['location'] = get_config('system','site_location');
|
||||
$ret['site']['realm'] = get_directory_realm();
|
||||
$ret['site']['project'] = get_platform_name();
|
||||
$ret['site']['project'] = Zotlabs\Project\System::get_platform_name();
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user