This commit is contained in:
jeroenpraat 2015-12-12 17:02:01 +01:00
commit f0a588547d
3 changed files with 28 additions and 2 deletions

View File

@ -112,8 +112,11 @@ require_once('include/api_auth.php');
break; break;
case "json": case "json":
header ("Content-Type: application/json"); header ("Content-Type: application/json");
foreach($r as $rr) foreach($r as $rr) {
if(! $rr)
$rr = array();
$json = json_encode($rr); $json = json_encode($rr);
}
if ($_GET['callback']) if ($_GET['callback'])
$json = $_GET['callback']."(".$json.")"; $json = $_GET['callback']."(".$json.")";
return $json; return $json;
@ -870,6 +873,7 @@ require_once('include/api_auth.php');
// this should output the last post (the one we just posted). // this should output the last post (the one we just posted).
return api_status_show($a,$type); return api_status_show($a,$type);
} }
api_register_func('api/statuses/update_with_media','api_statuses_update', true);
api_register_func('api/statuses/update','api_statuses_update', true); api_register_func('api/statuses/update','api_statuses_update', true);
@ -1078,6 +1082,8 @@ require_once('include/api_auth.php');
'contributors' => '' 'contributors' => ''
); );
$status_info['user'] = $user_info; $status_info['user'] = $user_info;
if(array_key_exists('status',$status_info['user']))
unset($status_info['user']['status']);
} }
return api_apply_template("status", $type, array('$status' => $status_info)); return api_apply_template("status", $type, array('$status' => $status_info));
@ -1319,6 +1325,8 @@ require_once('include/api_auth.php');
// params // params
$id = intval(argv(3)); $id = intval(argv(3));
if(! $id)
$id = $_REQUEST['id'];
logger('API: api_statuses_show: '.$id); logger('API: api_statuses_show: '.$id);
@ -1335,10 +1343,12 @@ require_once('include/api_auth.php');
$r = q("select * from item where true $item_normal $sql_extra", $r = q("select * from item where true $item_normal $sql_extra",
intval($id) intval($id)
); );
xchan_query($r,true); xchan_query($r,true);
$ret = api_format_items($r,$user_info); $ret = api_format_items($r,$user_info);
if ($conversation) { if ($conversation) {
$data = array('$statuses' => $ret); $data = array('$statuses' => $ret);
return api_apply_template("timeline", $type, $data); return api_apply_template("timeline", $type, $data);

View File

@ -28,7 +28,7 @@ function api_login(&$a){
killme(); killme();
} }
catch(Exception $e) { catch(Exception $e) {
logger(__file__.__line__.__function__."\n".$e); logger($e->getMessage());
} }
// workarounds for HTTP-auth in CGI mode // workarounds for HTTP-auth in CGI mode

View File

@ -382,3 +382,19 @@ stuff on your server that might access MySQL, and Hubzilla's poller which
needs MySQL access, too. A good setting for a medium-sized hub might be to needs MySQL access, too. A good setting for a medium-sized hub might be to
keep MySQL's max_connections at 100 and set mpm_prefork's keep MySQL's max_connections at 100 and set mpm_prefork's
MaxRequestWorkers to 70. MaxRequestWorkers to 70.
------------------------------------------------------------------------
For Calculate Automatic according to your server resources and configure
mod_prefork you can Install and Execute ApacheTune
Home Page: https://github.com/royalterra/apache2tune
git clone https://github.com/royalterra/apache2tune.git
cd apache2tune
chmod +x Apache2tune.sh
Please Read the Documentation of Apache2tune
./Apache2tune.sh