Skip to content
Permalink
Browse files

Merge pull request #422 from following5/log_uuids

added 'log_uuids' field to logs/submit result; closes #403
  • Loading branch information...
following5 committed Apr 24, 2016
2 parents 0b41dc2 + 676a4ea commit ee55400d600a6edc07504e7440fa1b8c35682f09
Showing with 35 additions and 17 deletions.
  1. +14 −10 okapi/services/logs/submit.php
  2. +21 −7 okapi/services/logs/submit.xml
@@ -558,18 +558,20 @@ private static function _call(OkapiRequest $request)
# Finally! Insert the rows into the log entries table. Update
# cache stats and user stats.
$log_uuid = self::insert_log_row(
$request->consumer->key, $cache['internal_id'], $user['internal_id'],
$logtype, $when, $formatted_comment, $value_for_text_html_field,
$needs_maintenance2
$log_uuids = array(
self::insert_log_row(
$request->consumer->key, $cache['internal_id'], $user['internal_id'],
$logtype, $when, $formatted_comment, $value_for_text_html_field,
$needs_maintenance2
)
);
self::increment_cache_stats($cache['internal_id'], $when, $logtype);
self::increment_user_stats($user['internal_id'], $logtype);
if ($second_logtype != null)
{
# Reminder: This will only be called for OCPL branch.
self::insert_log_row(
$log_uuids[] = self::insert_log_row(
$request->consumer->key, $cache['internal_id'], $user['internal_id'],
$second_logtype, $when + 1, $second_formatted_comment,
$value_for_text_html_field, 'null'
@@ -667,9 +669,9 @@ private static function _call(OkapiRequest $request)
unlink($filepath);
}
# Success. Return the uuid.
# Success. Return the uuids.
return $log_uuid;
return $log_uuids;
}
private static $success_message = null;
@@ -688,11 +690,12 @@ public static function call(OkapiRequest $request)
{
# If appropriate, $success_message might be changed inside the _call.
self::$success_message = _("Your cache log entry was posted successfully.");
$log_uuid = self::_call($request);
$log_uuids = self::_call($request);
$result = array(
'success' => true,
'message' => self::$success_message,
'log_uuid' => $log_uuid
'log_uuid' => $log_uuids[0],
'log_uuids' => $log_uuids
);
Okapi::gettext_domain_restore();
}
@@ -702,7 +705,8 @@ public static function call(OkapiRequest $request)
$result = array(
'success' => false,
'message' => $e->getMessage(),
'log_uuid' => null
'log_uuid' => null,
'log_uuids' => array()
);
}
@@ -115,8 +115,7 @@

<p>Note: Depending on OC installation and user's log entry type, OKAPI may
actually publish two separate log entries when you set this option to
<b>true</b> (one of them with empty comment). Even then, you will still receive
only one UUID reference (pointing to only one of those entries).</p>
<b>true</b> (one of them with empty comment).</p>
</li>
<li>
<p><b>false</b> - use this to indicate that your user thinks that the cache's
@@ -134,11 +133,26 @@
<returns>
<p>A dictionary of the following structure:</p>
<ul>
<li><b>success</b> - true, if the log entry was submitted successfully,</li>
<li><b>message</b> - plain-text string, a message for the user, which acknowledges success
or describes an error (usually you want to display this only when success is false),</li>
<li><b>log_uuid</b> - ID of the newly created log entry, <b>or null</b>
in case of an error.</li>
<li>
<p><b>success</b> - true, if the log entry was submitted
successfully,</p>
</li>
<li>
<p><b>message</b> - plain-text string, a message for the user,
which acknowledges success or describes an error (usually you
want to display this only when success is false),</p>
</li>
<li>
<p><b>log_uuid</b> - ID of the newly created log entry, <b>or
null</b> in case of an error. If multiple log entries have been
published because <b>needs_maintenance</b> or
<b>needs_maintenance2</b> was set to <b>true</b>: The ID of
one of those log entries.</p>
</li>
<li>
<p><b>log_uuids</b> - a list of the IDs of the newly created
log entries; an empty list in case of an error.</p>
</li>
</ul>
</returns>
</xml>

0 comments on commit ee55400

Please sign in to comment.
You can’t perform that action at this time.