1
0
Fork 0

Update does work now

This commit is contained in:
Michael 2018-07-06 05:16:40 +00:00
parent 5203f41d42
commit f33bd5fc8e

View file

@ -86,7 +86,7 @@ class Item extends BaseObject
* @param string $activity activity string * @param string $activity activity string
* @return integer Activity index * @return integer Activity index
*/ */
public static function activityToIndex($activity) private static function activityToIndex($activity)
{ {
$index = array_search($activity, self::ACTIVITIES); $index = array_search($activity, self::ACTIVITIES);
@ -103,7 +103,7 @@ class Item extends BaseObject
* @param integer $index activity index * @param integer $index activity index
* @return string Activity string * @return string Activity string
*/ */
public static function indexToActivity($index) private static function indexToActivity($index)
{ {
if (!isset(self::ACTIVITIES[$index])) { if (!isset(self::ACTIVITIES[$index])) {
return ''; return '';
@ -754,8 +754,10 @@ class Item extends BaseObject
if (empty($item['iaid'])) { if (empty($item['iaid'])) {
$item_activity = dba::selectFirst('item-activity', ['id'], ['uri' => $item['uri']]); $item_activity = dba::selectFirst('item-activity', ['id'], ['uri' => $item['uri']]);
if (DBM::is_result($item_activity)) { if (DBM::is_result($item_activity)) {
$item_fields = ['iaid' => $item_activity['id'], 'icid' => 0, $item_fields = ['iaid' => $item_activity['id'], 'icid' => null];
'verb' => '', 'object' => '', 'body' => 'activity']; foreach (self::MIXED_CONTENT_FIELDLIST as $field) {
$item_fields[$field] = '';
}
dba::update('item', $item_fields, ['id' => $item['id']]); dba::update('item', $item_fields, ['id' => $item['id']]);
if (!empty($item['icid']) && !dba::exists('item', ['icid' => $item['icid']])) { if (!empty($item['icid']) && !dba::exists('item', ['icid' => $item['icid']])) {
@ -1795,14 +1797,14 @@ class Item extends BaseObject
if (empty($item['verb'])) { if (empty($item['verb'])) {
return false; return false;
} }
$activity_index = self::activityToIndex($item['verb']); $activity_index = self::activityToIndex($item['verb']);
if (!$activity_index) { if ($activity_index < 0) {
return false; return false;
} }
$fields = ['activity' => $activity_index]; $fields = ['activity' => $activity_index,
'uri-hash' => hash('sha1', $condition['uri']) . hash('ripemd160', $condition['uri'])];
logger('Update activity for URI ' . $condition['uri']); logger('Update activity for URI ' . $condition['uri']);