add app_options field

This commit is contained in:
zotlabs 2018-08-02 22:49:30 -07:00
parent c806279fa9
commit d908f53607
7 changed files with 38 additions and 12 deletions

View File

@ -927,10 +927,11 @@ class Apps {
$darray['app_requires'] = ((x($arr,'requires')) ? escape_tags($arr['requires']) : '');
$darray['app_system'] = ((x($arr,'system')) ? intval($arr['system']) : 0);
$darray['app_deleted'] = ((x($arr,'deleted')) ? intval($arr['deleted']) : 0);
$darray['app_options'] = ((x($arr,'options')) ? intval($arr['options']) : 0);
$created = datetime_convert();
$r = q("insert into app ( app_id, app_sig, app_author, app_name, app_desc, app_url, app_photo, app_version, app_channel, app_addr, app_price, app_page, app_requires, app_created, app_edited, app_system, app_plugin, app_deleted ) values ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', %d )",
$r = q("insert into app ( app_id, app_sig, app_author, app_name, app_desc, app_url, app_photo, app_version, app_channel, app_addr, app_price, app_page, app_requires, app_created, app_edited, app_system, app_plugin, app_deleted, app_options ) values ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s', %d, %d )",
dbesc($darray['app_id']),
dbesc($darray['app_sig']),
dbesc($darray['app_author']),
@ -948,7 +949,8 @@ class Apps {
dbesc($created),
intval($darray['app_system']),
dbesc($darray['app_plugin']),
intval($darray['app_deleted'])
intval($darray['app_deleted']),
intval($darray['app_options'])
);
if($r) {
@ -1009,10 +1011,11 @@ class Apps {
$darray['app_requires'] = ((x($arr,'requires')) ? escape_tags($arr['requires']) : '');
$darray['app_system'] = ((x($arr,'system')) ? intval($arr['system']) : 0);
$darray['app_deleted'] = ((x($arr,'deleted')) ? intval($arr['deleted']) : 0);
$darray['app_options'] = ((x($arr,'options')) ? intval($arr['options']) : 0);
$edited = datetime_convert();
$r = q("update app set app_sig = '%s', app_author = '%s', app_name = '%s', app_desc = '%s', app_url = '%s', app_photo = '%s', app_version = '%s', app_addr = '%s', app_price = '%s', app_page = '%s', app_requires = '%s', app_edited = '%s', app_system = %d, app_plugin = '%s', app_deleted = %d where app_id = '%s' and app_channel = %d",
$r = q("update app set app_sig = '%s', app_author = '%s', app_name = '%s', app_desc = '%s', app_url = '%s', app_photo = '%s', app_version = '%s', app_addr = '%s', app_price = '%s', app_page = '%s', app_requires = '%s', app_edited = '%s', app_system = %d, app_plugin = '%s', app_deleted = %d, app_options = %d where app_id = '%s' and app_channel = %d",
dbesc($darray['app_sig']),
dbesc($darray['app_author']),
dbesc($darray['app_name']),
@ -1028,6 +1031,7 @@ class Apps {
intval($darray['app_system']),
dbesc($darray['app_plugin']),
intval($darray['app_deleted']),
intval($darray['app_options']),
dbesc($darray['app_id']),
intval($darray['app_channel'])
);
@ -1117,6 +1121,9 @@ class Apps {
if($app['app_system'])
$ret['system'] = $app['app_system'];
if($app['app_options'])
$ret['options'] = $app['app_options'];
if($app['app_plugin'])
$ret['plugin'] = trim($app['app_plugin']);

View File

@ -27,12 +27,11 @@ class Probe extends \Zotlabs\Web\Controller {
$o .= '<pre>';
if(! $j['success']) {
$o .= sprintf( t('Fetching URL returns error: %1$s'),$res['error'] . "\r\n\r\n");
$o .= "<strong>https connection failed. Trying again with auto failover to http.</strong>\r\n\r\n";
$j = \Zotlabs\Zot\Finger::run($addr,$channel,true);
if(! $j['success'])
$o .= sprintf( t('Fetching URL returns error: %1$s'),$res['error'] . "\r\n\r\n");
if(! $j['success']) {
return $o;
}
}
if($do_import && $j)
$x = import_xchan($j);

View File

@ -36,10 +36,6 @@ class Zfinger extends \Zotlabs\Web\Controller {
echo $ret;
killme();
json_return_and_die($x);
}

22
Zotlabs/Update/_1217.php Normal file
View File

@ -0,0 +1,22 @@
<?php
namespace Zotlabs\Update;
class _1217 {
function run() {
if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r = q("ALTER TABLE app ADD app_options smallint NOT NULL DEFAULT '0' ");
}
else {
$r = q("ALTER TABLE app ADD app_options int(11) NOT NULL DEFAULT 0 ");
}
if($r) {
return UPDATE_SUCCESS;
}
return UPDATE_FAILED;
}
}

View File

@ -54,7 +54,7 @@ define ( 'STD_VERSION', '3.7.1' );
define ( 'ZOT_REVISION', '6.0a' );
define ( 'DB_UPDATE_VERSION', 1216 );
define ( 'DB_UPDATE_VERSION', 1217 );
define ( 'PROJECT_BASE', __DIR__ );

View File

@ -127,6 +127,7 @@ CREATE TABLE IF NOT EXISTS `app` (
`app_deleted` int(11) NOT NULL DEFAULT 0 ,
`app_system` int(11) NOT NULL DEFAULT 0 ,
`app_plugin` char(191) NOT NULL DEFAULT '',
`app_options` int(11) NOT NULL DEFAULT 0 ,
`app_created` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
`app_edited` datetime NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY (`id`),

View File

@ -125,6 +125,7 @@ CREATE TABLE "app" (
"app_deleted" smallint NOT NULL DEFAULT '0',
"app_system" smallint NOT NULL DEFAULT '0',
"app_plugin" text NOT NULL DEFAULT '',
"app_options" smallint NOT NULL DEFAULT '0',
"app_created" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"app_edited" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
PRIMARY KEY ("id")