mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-07-21 09:03:38 +02:00
merge r3661 from branch 2.0 to trunk
feature 1071: improve log system on API calls. The log can be activated by a configuration setting. The log file can be changed also with a configuration setting. improvement: pwg.images.add API methods gets a cleaner way to log received parameters. git-svn-id: http://piwigo.org/svn/trunk@3662 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
@@ -654,6 +654,12 @@ $conf['enable_plugins']=true;
|
|||||||
// Web services are allowed (true) or completely forbidden (false)
|
// Web services are allowed (true) or completely forbidden (false)
|
||||||
$conf['allow_web_services'] = true;
|
$conf['allow_web_services'] = true;
|
||||||
|
|
||||||
|
// enable log for web services
|
||||||
|
$conf['ws_enable_log'] = false;
|
||||||
|
|
||||||
|
// web services log file path
|
||||||
|
$conf['ws_log_filepath'] = '/tmp/piwigo_ws.log';
|
||||||
|
|
||||||
// Maximum number of images to be returned foreach call to the web service
|
// Maximum number of images to be returned foreach call to the web service
|
||||||
$conf['ws_max_images_per_page'] = 500;
|
$conf['ws_max_images_per_page'] = 500;
|
||||||
|
|
||||||
|
|||||||
@@ -990,19 +990,15 @@ function ws_images_add($params, &$service)
|
|||||||
return new PwgError(401, 'Access denied');
|
return new PwgError(401, 'Access denied');
|
||||||
}
|
}
|
||||||
|
|
||||||
// name
|
foreach ($params as $param_key => $param_value) {
|
||||||
// category_id
|
ws_logfile(
|
||||||
// file_content
|
sprintf(
|
||||||
// file_sum
|
'[pwg.images.add] input param "%s" : "%s"',
|
||||||
// thumbnail_content
|
$param_key,
|
||||||
// thumbnail_sum
|
is_null($param_value) ? 'NULL' : $param_value
|
||||||
// rank
|
)
|
||||||
|
);
|
||||||
// $fh_log = fopen('/tmp/php.log', 'w');
|
}
|
||||||
// fwrite($fh_log, time()."\n");
|
|
||||||
// fwrite($fh_log, 'input rank :'.$params['rank']."\n");
|
|
||||||
// fwrite($fh_log, 'input: '.$params['file_sum']."\n");
|
|
||||||
// fwrite($fh_log, 'input: '.$params['thumbnail_sum']."\n");
|
|
||||||
|
|
||||||
// does the image already exists ?
|
// does the image already exists ?
|
||||||
$query = '
|
$query = '
|
||||||
@@ -1028,8 +1024,6 @@ SELECT
|
|||||||
$day
|
$day
|
||||||
);
|
);
|
||||||
|
|
||||||
//fwrite($fh_log, $upload_dir."\n");
|
|
||||||
|
|
||||||
// create the upload directory tree if not exists
|
// create the upload directory tree if not exists
|
||||||
if (!is_dir($upload_dir)) {
|
if (!is_dir($upload_dir)) {
|
||||||
umask(0000);
|
umask(0000);
|
||||||
@@ -1223,8 +1217,6 @@ SELECT
|
|||||||
}
|
}
|
||||||
|
|
||||||
invalidate_user_cache();
|
invalidate_user_cache();
|
||||||
|
|
||||||
// fclose($fh_log);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1790,10 +1782,14 @@ function ws_categories_setInfo($params, &$service)
|
|||||||
|
|
||||||
function ws_logfile($string)
|
function ws_logfile($string)
|
||||||
{
|
{
|
||||||
return true;
|
global $conf;
|
||||||
|
|
||||||
|
if (!$conf['ws_enable_log']) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
file_put_contents(
|
file_put_contents(
|
||||||
'/tmp/piwigo_ws.log',
|
$conf['ws_log_filepath'],
|
||||||
'['.date('c').'] '.$string."\n",
|
'['.date('c').'] '.$string."\n",
|
||||||
FILE_APPEND
|
FILE_APPEND
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user