diff options
author | redmatrix <mike@macgirvin.com> | 2016-09-07 17:36:45 -0700 |
---|---|---|
committer | redmatrix <mike@macgirvin.com> | 2016-09-07 17:36:45 -0700 |
commit | c2f83639d49c4ff49acdaa5c6f3dd0a3c1edbdf9 (patch) | |
tree | c0c066eb952cb2eca78a0d1cc5e9b6b86ddebe6a | |
parent | 77e865fc8ef8b41112885390881cf260b5c726ef (diff) | |
download | volse-hubzilla-c2f83639d49c4ff49acdaa5c6f3dd0a3c1edbdf9.tar.gz volse-hubzilla-c2f83639d49c4ff49acdaa5c6f3dd0a3c1edbdf9.tar.bz2 volse-hubzilla-c2f83639d49c4ff49acdaa5c6f3dd0a3c1edbdf9.zip |
provide version info in /pubsites
-rw-r--r-- | Zotlabs/Module/Dirsearch.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Pubsites.php | 2 | ||||
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/zot.php | 16 | ||||
-rw-r--r-- | install/schema_mysql.sql | 1 | ||||
-rw-r--r-- | install/schema_postgres.sql | 1 | ||||
-rw-r--r-- | install/update.php | 10 |
7 files changed, 26 insertions, 10 deletions
diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php index 8f60910f1..ebd6c3715 100644 --- a/Zotlabs/Module/Dirsearch.php +++ b/Zotlabs/Module/Dirsearch.php @@ -448,9 +448,9 @@ class Dirsearch extends \Zotlabs\Web\Controller { $register = 'closed'; if(strpos($rr['site_url'],'https://') !== false) - $ret['sites'][] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location'], 'project' => $rr['site_project']); + $ret['sites'][] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location'], 'project' => $rr['site_project'], 'version' => $rr['site_version']); else - $insecure[] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location'], 'project' => $rr['site_project']); + $insecure[] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location'], 'project' => $rr['site_project'], 'version' => $rr['site_version']); } if($insecure) { $ret['sites'] = array_merge($ret['sites'],$insecure); diff --git a/Zotlabs/Module/Pubsites.php b/Zotlabs/Module/Pubsites.php index 3dc0501d2..a66fd9c7a 100644 --- a/Zotlabs/Module/Pubsites.php +++ b/Zotlabs/Module/Pubsites.php @@ -49,7 +49,7 @@ class Pubsites extends \Zotlabs\Web\Controller { $location = '<br /> '; } $urltext = str_replace(array('https://'), '', $jj['url']); - $o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . '<a target="stats" href="https://hubchart-tarine.rhcloud.com/hub.jsp?hubFqdn=' . $m['host'] . '"><i class="fa fa-area-chart"></i></a></td><td>' . ucwords($jj['project']) . '</td>'; + $o .= '<tr><td><a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ' . $urltext . '</a>' . $location . '</td><td>' . $jj['access'] . '</td><td>' . $jj['register'] . '</td><td>' . '<a target="stats" href="https://hubchart-tarine.rhcloud.com/hub.jsp?hubFqdn=' . $m['host'] . '"><i class="fa fa-area-chart"></i></a></td><td>' . ucwords($jj['project']) . (($jj['version']) ? ' ' . $jj['version'] : '') . '</td>'; if($rating_enabled) $o .= '<td><a href="ratings/' . $host . '" class="btn-btn-default"><i class="fa fa-eye"></i> ' . t('View') . '</a></td>' . $rate_links ; $o .= '</tr>'; @@ -47,7 +47,7 @@ define ( 'PLATFORM_NAME', 'hubzilla' ); define ( 'STD_VERSION', '1.13.1' ); define ( 'ZOT_REVISION', '1.1' ); -define ( 'DB_UPDATE_VERSION', 1182 ); +define ( 'DB_UPDATE_VERSION', 1183 ); /** diff --git a/include/zot.php b/include/zot.php index 6187e8a61..7093a255b 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2844,6 +2844,7 @@ function import_site($arr, $pubkey) { $site_location = htmlspecialchars($arr['location'],ENT_COMPAT,'UTF-8',false); $site_realm = htmlspecialchars($arr['realm'],ENT_COMPAT,'UTF-8',false); $site_project = htmlspecialchars($arr['project'],ENT_COMPAT,'UTF-8',false); + $site_version = ((array_key_exists('version',$arr)) ? htmlspecialchars($arr['version'],ENT_COMPAT,'UTF-8',false) : ''); // You can have one and only one primary directory per realm. // Downgrade any others claiming to be primary. As they have @@ -2863,14 +2864,16 @@ function import_site($arr, $pubkey) { || ($siterecord['site_location'] != $site_location) || ($siterecord['site_register'] != $register_policy) || ($siterecord['site_project'] != $site_project) - || ($siterecord['site_realm'] != $site_realm)) { + || ($siterecord['site_realm'] != $site_realm) + || ($siterecord['site_version'] != $site_version) ) { + $update = true; // logger('import_site: input: ' . print_r($arr,true)); // logger('import_site: stored: ' . print_r($siterecord,true)); - $r = q("update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s', site_type = %d, site_project = '%s' + $r = q("update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s', site_type = %d, site_project = '%s', site_version = '%s' where site_url = '%s'", dbesc($site_location), intval($site_directory), @@ -2882,6 +2885,7 @@ function import_site($arr, $pubkey) { dbesc($site_realm), intval(SITE_TYPE_ZOT), dbesc($site_project), + dbesc($site_version), dbesc($url) ); if(! $r) { @@ -2899,8 +2903,8 @@ function import_site($arr, $pubkey) { else { $update = true; - $r = q("insert into site ( site_location, site_url, site_access, site_flags, site_update, site_directory, site_register, site_sellpage, site_realm, site_type, site_project ) - values ( '%s', '%s', %d, %d, '%s', '%s', %d, '%s', '%s', %d, '%s' )", + $r = q("insert into site ( site_location, site_url, site_access, site_flags, site_update, site_directory, site_register, site_sellpage, site_realm, site_type, site_project, site_version ) + values ( '%s', '%s', %d, %d, '%s', '%s', %d, '%s', '%s', %d, '%s', '%s' )", dbesc($site_location), dbesc($url), intval($access_policy), @@ -2911,7 +2915,8 @@ function import_site($arr, $pubkey) { dbesc($sellpage), dbesc($site_realm), intval(SITE_TYPE_ZOT), - dbesc($site_project) + dbesc($site_project), + dbesc($site_version) ); if(! $r) { logger('import_site: record create failed. ' . print_r($arr,true)); @@ -3978,6 +3983,7 @@ function zotinfo($arr) { $ret['site']['location'] = get_config('system','site_location'); $ret['site']['realm'] = get_directory_realm(); $ret['site']['project'] = Zotlabs\Lib\System::get_platform_name() . ' ' . Zotlabs\Lib\System::get_server_role(); + $ret['site']['version'] = Zotlabs\Lib\System::get_project_version(); } diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index 5e5b9d5be..9a4f58880 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -1151,6 +1151,7 @@ CREATE TABLE IF NOT EXISTS `site` ( `site_dead` smallint NOT NULL DEFAULT '0', `site_type` smallint NOT NULL DEFAULT '0', `site_project` char(255) NOT NULL DEFAULT '', + `site_version` varchar(32) NOT NULL DEFAULT '', PRIMARY KEY (`site_url`), KEY `site_flags` (`site_flags`), KEY `site_update` (`site_update`), diff --git a/install/schema_postgres.sql b/install/schema_postgres.sql index 44711c190..b190a810a 100644 --- a/install/schema_postgres.sql +++ b/install/schema_postgres.sql @@ -1131,6 +1131,7 @@ CREATE TABLE "site" ( "site_dead" smallint NOT NULL DEFAULT '0', "site_type" smallint NOT NULL DEFAULT '0', "site_project" text NOT NULL DEFAULT '', + "site_version" text NOT NULL DEFAULT '', PRIMARY KEY ("site_url") ); create index "site_flags" on site ("site_flags"); diff --git a/install/update.php b/install/update.php index 2b3a9b338..9fd362fff 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1182 ); +define( 'UPDATE_VERSION' , 1183 ); /** * @@ -2436,3 +2436,11 @@ function update_r1181() { return UPDATE_SUCCESS; } +function update_r1182() { + + $r1 = q("alter table site add site_version varchar(32) not null default '' "); + + if($r1) + return UPDATE_SUCCESS; + return UPDATE_FAILED; +} |