aboutsummaryrefslogtreecommitdiffstats
path: root/include/ws_functions.inc.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2009-07-21 21:40:47 +0000
committerplegall <plg@piwigo.org>2009-07-21 21:40:47 +0000
commit7edf366f8b50e6e60cc2627824ab34a24e5311c2 (patch)
tree97c5174a0ff253666f545120abc48685aaf6738a /include/ws_functions.inc.php
parent881aa5ab221c3670e34f60ed8a642762638804e9 (diff)
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/branches/2.0@3661 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/ws_functions.inc.php')
-rw-r--r--include/ws_functions.inc.php34
1 files changed, 15 insertions, 19 deletions
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index 35f0bb8c7..93cbaca86 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -990,19 +990,15 @@ function ws_images_add($params, &$service)
return new PwgError(401, 'Access denied');
}
- // name
- // category_id
- // file_content
- // file_sum
- // thumbnail_content
- // thumbnail_sum
- // 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");
+ foreach ($params as $param_key => $param_value) {
+ ws_logfile(
+ sprintf(
+ '[pwg.images.add] input param "%s" : "%s"',
+ $param_key,
+ is_null($param_value) ? 'NULL' : $param_value
+ )
+ );
+ }
// does the image already exists ?
$query = '
@@ -1028,8 +1024,6 @@ SELECT
$day
);
- //fwrite($fh_log, $upload_dir."\n");
-
// create the upload directory tree if not exists
if (!is_dir($upload_dir)) {
umask(0000);
@@ -1223,8 +1217,6 @@ SELECT
}
invalidate_user_cache();
-
- // fclose($fh_log);
}
/**
@@ -1790,10 +1782,14 @@ function ws_categories_setInfo($params, &$service)
function ws_logfile($string)
{
- return true;
+ global $conf;
+
+ if (!$conf['ws_enable_log']) {
+ return true;
+ }
file_put_contents(
- '/tmp/piwigo_ws.log',
+ $conf['ws_log_filepath'],
'['.date('c').'] '.$string."\n",
FILE_APPEND
);