1
1
Fork 0

We now don't store in the "item" table anymore

This commit is contained in:
Michael 2021-02-14 20:27:31 +00:00
parent 36357e790e
commit e1c79a41d9
7 changed files with 275 additions and 497 deletions

View file

@ -1042,38 +1042,13 @@ class Item
Post\ThreadUser::insert($item['uri-id'], $item['uid'], $item);
}
// Remove all fields that aren't part of the item table
$table_fields = DBStructure::getFieldsForTable('item', $item);
// We remove all legacy fields that now are stored in other tables
foreach (self::LEGACY_FIELDLIST as $field) {
unset($table_fields[$field]);
}
$result = DBA::insert('item', $table_fields);
// When the item was successfully stored we fetch the ID of the item.
$current_post = DBA::lastInsertId();
if (empty($current_post) || !DBA::isResult($result)) {
// On failure store the data into a spool file so that the "SpoolPost" worker can try again later.
Logger::warning('Could not store item. it will be spooled', ['result' => $result, 'id' => $current_post]);
self::spool($orig_item);
return 0;
}
Logger::notice('created item', ['id' => $current_post, 'uid' => $item['uid'], 'network' => $item['network'], 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
if (!$parent_id || ($item['gravity'] === GRAVITY_PARENT)) {
$parent_id = $current_post;
}
// Set parent id
DBA::update('item', ['parent' => $parent_id], ['id' => $current_post]);
Logger::notice('created item', ['post-id' => $post_user_id, 'uid' => $item['uid'], 'network' => $item['network'], 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
$posted_item = Post::selectFirst(self::ITEM_FIELDLIST, ['post-user-id' => $post_user_id]);
if (!DBA::isResult($posted_item)) {
Logger::warning('new item not found in DB', ['id' => $post_user_id]);
// On failure store the data into a spool file so that the "SpoolPost" worker can try again later.
Logger::warning('Could not store item. it will be spooled', ['id' => $post_user_id]);
self::spool($orig_item);
return 0;
}
@ -1164,15 +1139,15 @@ class Item
return;
}
$author = Contact::selectFirst(['url', 'contact-type'], ['id' => $item['author-id']]);
$author = Contact::selectFirst(['url', 'contact-type', 'network'], ['id' => $item['author-id']]);
if (!DBA::isResult($author)) {
Logger::error('Author not found', ['id' => $item['author-id']]);
return;
}
$cid = Contact::getIdForURL($author['url'], $item['uid']);
if (empty($cid) || !Contact::isSharing($cid, $item['uid'])) {
Logger::info('The resharer is not a following contact: quit', ['resharer' => $author['url'], 'uid' => $item['uid']]);
if (empty($cid) || (!Contact::isSharing($cid, $item['uid'] && in_array($author['network'], Protocol::FEDERATED)))) {
Logger::info('The resharer is not a following contact: quit', ['resharer' => $author['url'], 'uid' => $item['uid'], 'cid' => $cid]);
return;
}
@ -1815,7 +1790,6 @@ class Item
if (($community_page || $prvgroup) &&
!$item['wall'] && !$item['origin'] && ($item['gravity'] == GRAVITY_PARENT)) {
Logger::info('Delete private group/communiy top-level item without mention', ['id' => $item['id'], 'guid'=> $item['guid']]);
DBA::delete('item', ['uri-id' => $item['uri-id'], 'uid' => $item['uid']]);
Post\User::delete(['uri-id' => $item['uri-id'], 'uid' => $item['uid']]);
return true;
}

View file

@ -23,7 +23,6 @@ namespace Friendica\Model;
use BadMethodCallException;
use Friendica\Core\Logger;
use Friendica\Core\System;
use Friendica\Database\Database;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
@ -516,23 +515,6 @@ class Post
$affected = max($affected, DBA::affectedRows());
}
$update_fields = [];
foreach (Item::USED_FIELDLIST as $field) {
if (array_key_exists($field, $fields)) {
$update_fields[$field] = $fields[$field];
}
}
if (!empty($update_fields)) {
$rows = DBA::selectToArray('post-view', ['item-id'], $condition, []);
$ids = array_column($rows, 'item-id');
if (!DBA::update('item', $update_fields, ['id' => $ids])) {
DBA::rollback();
Logger::notice('Updating item failed', ['fields' => $update_fields, 'condition' => $condition]);
return false;
}
$affected = max($affected, DBA::affectedRows());
}
DBA::commit();
Logger::info('Updated posts', ['rows' => $affected]);

View file

@ -25,6 +25,7 @@ use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use Friendica\DI;
use Friendica\Model\Item;
use Friendica\Model\Post;
@ -47,7 +48,9 @@ class Expire
$rows = Post::select(['item-id', 'guid', 'uri-id', 'uid'], $condition);
while ($row = Post::fetch($rows)) {
Logger::info('Delete expired item', ['id' => $row['item-id'], 'guid' => $row['guid']]);
DBA::delete('item', ['id' => $row['item-id']]);
if (DBStructure::existsTable('item')) {
DBA::delete('item', ['id' => $row['item-id']]);
}
Post\User::delete(['uri-id' => $row['uri-id'], 'uid' => $row['uid']]);
Post\ThreadUser::delete(['uri-id' => $row['uri-id'], 'uid' => $row['uid']]);
}

View file

@ -22,6 +22,7 @@
namespace Friendica\Worker;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use Friendica\Model\Photo;
use Friendica\Model\User;
@ -64,7 +65,9 @@ class ExpireAndRemoveUsers
// It seems that sometimes the system wants to delete the records in the wrong order.
// So when the permissionset is deleted and these tables are still filled then an error is thrown.
// So we now delete them before all other user related entries are deleted.
DBA::delete('item', ['uid' => $user['uid']]);
if (DBStructure::existsTable('item')) {
DBA::delete('item', ['uid' => $user['uid']]);
}
DBA::delete('post-user', ['uid' => $user['uid']]);
DBA::delete('profile_field', ['uid' => $user['uid']]);

View file

@ -23,6 +23,7 @@ namespace Friendica\Worker;
use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\Database\DBStructure;
use Friendica\Model\Photo;
use Friendica\Model\Post;
@ -50,7 +51,9 @@ class RemoveContact {
$items = Post::select(['item-id', 'post-user-id', 'uri-id', 'guid'], $condition, ['limit' => 100]);
while ($item = Post::fetch($items)) {
Logger::info('Delete removed contact item', ['id' => $item['item-id'], 'uri-id' => $item['uri-id'], 'guid' => $item['guid']]);
DBA::delete('item', ['id' => $item['item-id']]);
if (DBStructure::existsTable('item')) {
DBA::delete('item', ['id' => $item['item-id']]);
}
Post::delete(['uri-id' => $item['uri-id']]);
Post\ThreadUser::delete(['post-user-id' => $item['post-user-id']]);
Post\Thread::delete(['uri-id' => $item['uri-id']]);

View file

@ -215,165 +215,6 @@ return [
'plink' => 'http://localhost/display/6',
],
],
'post-thread' => [
[
'uri-id' => 1,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'network' => Protocol::DFRN,
],
[
'uri-id' => 3,
'author-id' => 43,
'owner-id' => 43,
'causer-id' => 43,
'network' => Protocol::DFRN,
],
[
'uri-id' => 6,
'author-id' => 44,
'owner-id' => 44,
'causer-id' => 44,
'network' => Protocol::DFRN,
],
],
'post-user' => [
[
'id' => 1,
'uri-id' => 1,
'uid' => 42,
'contact-id' => 42,
'unseen' => 1,
'origin' => 1,
],
[
'id' => 2,
'uri-id' => 2,
'uid' => 42,
'contact-id' => 42,
'unseen' => 0,
'origin' => 1,
],
[
'id' => 3,
'uri-id' => 3,
'uid' => 42,
'contact-id' => 43,
'unseen' => 0,
'origin' => 1,
],
[
'id' => 4,
'uri-id' => 4,
'uid' => 42,
'contact-id' => 44,
'unseen' => 0,
'origin' => 1,
],
[
'id' => 5,
'uri-id' => 5,
'uid' => 42,
'contact-id' => 42,
'unseen' => 0,
'origin' => 1,
],
[
'id' => 6,
'uri-id' => 6,
'uid' => 42,
'contact-id' => 44,
'unseen' => 0,
'origin' => 1,
],
[
'id' => 7,
'uri-id' => 1,
'uid' => 0,
'contact-id' => 42,
'unseen' => 1,
'origin' => 0,
],
[
'id' => 8,
'uri-id' => 2,
'uid' => 0,
'contact-id' => 42,
'unseen' => 0,
'origin' => 0,
],
[
'id' => 9,
'uri-id' => 3,
'uid' => 0,
'contact-id' => 43,
'unseen' => 0,
'origin' => 0,
],
[
'id' => 10,
'uri-id' => 4,
'uid' => 0,
'contact-id' => 44,
'unseen' => 0,
'origin' => 0,
],
[
'id' => 11,
'uri-id' => 5,
'uid' => 0,
'contact-id' => 42,
'unseen' => 0,
'origin' => 0,
],
[
'id' => 12,
'uri-id' => 6,
'uid' => 0,
'contact-id' => 44,
'unseen' => 0,
'origin' => 0,
],
],
'post-thread-user' => [
[
'uri-id' => 1,
'uid' => 42,
'wall' => 1,
'post-user-id' => 1,
],
[
'uri-id' => 3,
'uid' => 42,
'wall' => 1,
'post-user-id' => 3,
],
[
'uri-id' => 6,
'uid' => 42,
'wall' => 1,
'post-user-id' => 6,
],
[
'uri-id' => 1,
'uid' => 0,
'wall' => 0,
'post-user-id' => 7,
],
[
'uri-id' => 3,
'uid' => 0,
'wall' => 0,
'post-user-id' => 9,
],
[
'uri-id' => 6,
'uid' => 0,
'wall' => 0,
'post-user-id' => 12,
],
],
'post' => [
[
'uri-id' => 1,
@ -454,326 +295,307 @@ return [
'visible' => 1,
],
],
'item' => [
'post-user' => [
[
'id' => 1,
'uri-id' => 1,
'uri' => '1',
'visible' => 1,
'contact-id' => 42,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'uid' => 42,
'verb' => 'http://activitystrea.ms/schema/1.0/post',
'unseen' => 1,
'parent' => 1,
'id' => 1,
'uri-id' => 1,
'uid' => 42,
'contact-id' => 42,
'unseen' => 1,
'origin' => 1,
'parent-uri-id' => 1,
'parent-uri' => '1',
'thr-parent-id' => 1,
'thr-parent' => '1',
'private' => Item::PUBLIC,
'gravity' => GRAVITY_PARENT,
'author-link' => 'http://localhost/profile/selfcontact',
'wall' => 1,
'starred' => 1,
'origin' => 1,
'allow_cid' => '',
'allow_gid' => '',
'deny_cid' => '',
'deny_gid' => '',
'guid' => '1',
'gravity' => GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'vid' => Verb::getID('http://activitystrea.ms/schema/1.0/post'),
'private' => Item::PUBLIC,
'visible' => 1,
],
[
'id' => 2,
'uri-id' => 2,
'uri' => '2',
'visible' => 1,
'contact-id' => 42,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'uid' => 42,
'verb' => 'http://activitystrea.ms/schema/1.0/post',
'unseen' => 0,
'parent' => 1,
'id' => 2,
'uri-id' => 2,
'uid' => 42,
'contact-id' => 42,
'unseen' => 0,
'origin' => 1,
'parent-uri-id' => 1,
'parent-uri' => '1',
'thr-parent-id' => 1,
'thr-parent' => '1',
'private' => Item::PUBLIC,
'gravity' => GRAVITY_COMMENT,
'author-link' => 'http://localhost/profile/selfcontact',
'wall' => 1,
'starred' => 0,
'origin' => 1,
'guid' => '2',
'gravity' => GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'vid' => Verb::getID('http://activitystrea.ms/schema/1.0/post'),
'private' => Item::PUBLIC,
'visible' => 1,
],
[
'id' => 3,
'uri-id' => 3,
'uri' => '3',
'visible' => 1,
'contact-id' => 43,
'author-id' => 43,
'owner-id' => 42,
'causer-id' => 43,
'uid' => 42,
'verb' => 'http://activitystrea.ms/schema/1.0/post',
'unseen' => 0,
'parent' => 3,
'id' => 3,
'uri-id' => 3,
'uid' => 42,
'contact-id' => 43,
'unseen' => 0,
'origin' => 1,
'parent-uri-id' => 3,
'parent-uri' => '3',
'thr-parent-id' => 3,
'thr-parent' => '3',
'private' => Item::PUBLIC,
'gravity' => GRAVITY_PARENT,
'author-link' => 'http://localhost/profile/othercontact',
'wall' => 1,
'starred' => 0,
'origin' => 1,
'guid' => '3',
'gravity' => GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 43,
'causer-id' => 43,
'vid' => Verb::getID('http://activitystrea.ms/schema/1.0/post'),
'private' => Item::PUBLIC,
'visible' => 1,
],
[
'id' => 4,
'uri-id' => 4,
'uri' => '4',
'visible' => 1,
'contact-id' => 44,
'author-id' => 44,
'owner-id' => 42,
'causer-id' => 44,
'uid' => 42,
'verb' => 'http://activitystrea.ms/schema/1.0/post',
'unseen' => 0,
'body' => 'Friend user reply',
'parent' => 1,
'id' => 4,
'uri-id' => 4,
'uid' => 42,
'contact-id' => 44,
'unseen' => 0,
'origin' => 1,
'parent-uri-id' => 1,
'parent-uri' => '1',
'thr-parent-id' => 1,
'thr-parent' => '1',
'private' => Item::PUBLIC,
'gravity' => GRAVITY_COMMENT,
'author-link' => 'http://localhost/profile/othercontact',
'wall' => 1,
'starred' => 0,
'origin' => 1,
'guid' => '4',
'gravity' => GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 44,
'causer-id' => 44,
'vid' => Verb::getID('http://activitystrea.ms/schema/1.0/post'),
'private' => Item::PUBLIC,
'visible' => 1,
],
[
'id' => 5,
'uri-id' => 5,
'uri' => '5',
'visible' => 1,
'contact-id' => 42,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'uid' => 42,
'verb' => 'http://activitystrea.ms/schema/1.0/post',
'unseen' => 0,
'parent' => 1,
'id' => 5,
'uri-id' => 5,
'uid' => 42,
'contact-id' => 42,
'unseen' => 0,
'origin' => 1,
'parent-uri-id' => 1,
'parent-uri' => '1',
'thr-parent-id' => 1,
'thr-parent' => '1',
'private' => Item::PUBLIC,
'gravity' => GRAVITY_COMMENT,
'author-link' => 'http://localhost/profile/othercontact',
'wall' => 1,
'starred' => 0,
'origin' => 1,
'allow_cid' => '',
'allow_gid' => '',
'deny_cid' => '',
'deny_gid' => '',
'guid' => '5',
'gravity' => GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'vid' => Verb::getID('http://activitystrea.ms/schema/1.0/post'),
'private' => Item::PUBLIC,
'visible' => 1,
],
[
'id' => 6,
'uri-id' => 6,
'uri' => '6',
'visible' => 1,
'contact-id' => 44,
'author-id' => 44,
'owner-id' => 42,
'causer-id' => 44,
'uid' => 42,
'verb' => 'http://activitystrea.ms/schema/1.0/post',
'unseen' => 0,
'parent' => 6,
'id' => 6,
'uri-id' => 6,
'uid' => 42,
'contact-id' => 44,
'unseen' => 0,
'origin' => 1,
'parent-uri-id' => 6,
'parent-uri' => '6',
'thr-parent-id' => 6,
'thr-parent' => '6',
'private' => Item::PUBLIC,
'gravity' => GRAVITY_PARENT,
'author-link' => 'http://localhost/profile/othercontact',
'wall' => 1,
'starred' => 0,
'origin' => 1,
'guid' => '6',
'gravity' => GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 44,
'causer-id' => 44,
'vid' => Verb::getID('http://activitystrea.ms/schema/1.0/post'),
'private' => Item::PUBLIC,
'visible' => 1,
],
[
'id' => 7,
'uri-id' => 1,
'uri' => '1',
'visible' => 1,
'contact-id' => 42,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'uid' => 0,
'verb' => 'http://activitystrea.ms/schema/1.0/post',
'unseen' => 1,
'parent' => 7,
'id' => 7,
'uri-id' => 1,
'uid' => 0,
'contact-id' => 42,
'unseen' => 1,
'origin' => 0,
'parent-uri-id' => 1,
'parent-uri' => '1',
'thr-parent-id' => 1,
'thr-parent' => '1',
'private' => Item::PUBLIC,
'gravity' => GRAVITY_PARENT,
'author-link' => 'http://localhost/profile/selfcontact',
'wall' => 0,
'starred' => 1,
'origin' => 0,
'allow_cid' => '',
'allow_gid' => '',
'deny_cid' => '',
'deny_gid' => '',
'guid' => '1',
'gravity' => GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'vid' => Verb::getID('http://activitystrea.ms/schema/1.0/post'),
'private' => Item::PUBLIC,
'visible' => 1,
],
[
'id' => 8,
'uri-id' => 2,
'uri' => '2',
'visible' => 1,
'contact-id' => 42,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'uid' => 0,
'verb' => 'http://activitystrea.ms/schema/1.0/post',
'unseen' => 0,
'parent' => 7,
'id' => 8,
'uri-id' => 2,
'uid' => 0,
'contact-id' => 42,
'unseen' => 0,
'origin' => 0,
'parent-uri-id' => 1,
'parent-uri' => '1',
'thr-parent-id' => 1,
'thr-parent' => '1',
'private' => Item::PUBLIC,
'gravity' => GRAVITY_COMMENT,
'author-link' => 'http://localhost/profile/selfcontact',
'wall' => 0,
'starred' => 0,
'origin' => 0,
'guid' => '2',
'gravity' => GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'vid' => Verb::getID('http://activitystrea.ms/schema/1.0/post'),
'private' => Item::PUBLIC,
'visible' => 1,
],
[
'id' => 9,
'uri-id' => 3,
'uri' => '3',
'visible' => 1,
'contact-id' => 43,
'author-id' => 43,
'owner-id' => 42,
'causer-id' => 43,
'uid' => 0,
'verb' => 'http://activitystrea.ms/schema/1.0/post',
'unseen' => 0,
'parent' => 9,
'id' => 9,
'uri-id' => 3,
'uid' => 0,
'contact-id' => 43,
'unseen' => 0,
'origin' => 0,
'parent-uri-id' => 3,
'parent-uri' => '3',
'thr-parent-id' => 3,
'thr-parent' => '3',
'private' => Item::PUBLIC,
'gravity' => GRAVITY_PARENT,
'author-link' => 'http://localhost/profile/othercontact',
'wall' => 0,
'starred' => 0,
'origin' => 0,
'guid' => '3',
'gravity' => GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 43,
'causer-id' => 43,
'vid' => Verb::getID('http://activitystrea.ms/schema/1.0/post'),
'private' => Item::PUBLIC,
'visible' => 1,
],
[
'id' => 10,
'uri-id' => 4,
'uri' => '4',
'visible' => 1,
'contact-id' => 44,
'author-id' => 44,
'owner-id' => 42,
'causer-id' => 44,
'uid' => 0,
'verb' => 'http://activitystrea.ms/schema/1.0/post',
'unseen' => 0,
'body' => 'Friend user reply',
'parent' => 7,
'id' => 10,
'uri-id' => 4,
'uid' => 0,
'contact-id' => 44,
'unseen' => 0,
'origin' => 0,
'parent-uri-id' => 1,
'parent-uri' => '1',
'thr-parent-id' => 1,
'thr-parent' => '1',
'private' => Item::PUBLIC,
'gravity' => GRAVITY_COMMENT,
'author-link' => 'http://localhost/profile/othercontact',
'wall' => 0,
'starred' => 0,
'origin' => 0,
'guid' => '4',
'gravity' => GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 44,
'causer-id' => 44,
'vid' => Verb::getID('http://activitystrea.ms/schema/1.0/post'),
'private' => Item::PUBLIC,
'visible' => 1,
],
[
'id' => 11,
'uri-id' => 5,
'uri' => '5',
'visible' => 1,
'contact-id' => 42,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'uid' => 0,
'verb' => 'http://activitystrea.ms/schema/1.0/post',
'unseen' => 0,
'parent' => 7,
'id' => 11,
'uri-id' => 5,
'uid' => 0,
'contact-id' => 42,
'unseen' => 0,
'origin' => 0,
'parent-uri-id' => 1,
'parent-uri' => '1',
'thr-parent-id' => 1,
'thr-parent' => '1',
'private' => Item::PUBLIC,
'gravity' => GRAVITY_COMMENT,
'author-link' => 'http://localhost/profile/othercontact',
'wall' => 0,
'starred' => 0,
'origin' => 1,
'allow_cid' => '',
'allow_gid' => '',
'deny_cid' => '',
'deny_gid' => '',
'guid' => '5',
'gravity' => GRAVITY_COMMENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 42,
'causer-id' => 42,
'vid' => Verb::getID('http://activitystrea.ms/schema/1.0/post'),
'private' => Item::PUBLIC,
'visible' => 1,
],
[
'id' => 12,
'uri-id' => 6,
'uri' => '6',
'visible' => 1,
'contact-id' => 44,
'author-id' => 44,
'owner-id' => 42,
'causer-id' => 44,
'uid' => 0,
'verb' => 'http://activitystrea.ms/schema/1.0/post',
'unseen' => 0,
'parent' => 12,
'id' => 12,
'uri-id' => 6,
'uid' => 0,
'contact-id' => 44,
'unseen' => 0,
'origin' => 0,
'parent-uri-id' => 6,
'parent-uri' => '6',
'thr-parent-id' => 6,
'thr-parent' => '6',
'private' => Item::PUBLIC,
'gravity' => GRAVITY_PARENT,
'author-link' => 'http://localhost/profile/othercontact',
'wall' => 0,
'starred' => 0,
'origin' => 0,
'guid' => '6',
'gravity' => GRAVITY_PARENT,
'network' => Protocol::DFRN,
'owner-id' => 42,
'author-id' => 44,
'causer-id' => 44,
'vid' => Verb::getID('http://activitystrea.ms/schema/1.0/post'),
'private' => Item::PUBLIC,
'visible' => 1,
],
],
'post-thread' => [
[
'uri-id' => 1,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'network' => Protocol::DFRN,
],
[
'uri-id' => 3,
'author-id' => 43,
'owner-id' => 43,
'causer-id' => 43,
'network' => Protocol::DFRN,
],
[
'uri-id' => 6,
'author-id' => 44,
'owner-id' => 44,
'causer-id' => 44,
'network' => Protocol::DFRN,
],
],
'post-thread-user' => [
[
'uri-id' => 1,
'uid' => 42,
'wall' => 1,
'post-user-id' => 1,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'network' => Protocol::DFRN,
],
[
'uri-id' => 3,
'uid' => 42,
'wall' => 1,
'post-user-id' => 3,
'author-id' => 43,
'owner-id' => 43,
'causer-id' => 43,
'network' => Protocol::DFRN,
],
[
'uri-id' => 6,
'uid' => 42,
'wall' => 1,
'post-user-id' => 6,
'author-id' => 44,
'owner-id' => 44,
'causer-id' => 44,
'network' => Protocol::DFRN,
],
[
'uri-id' => 1,
'uid' => 0,
'wall' => 0,
'post-user-id' => 7,
'author-id' => 42,
'owner-id' => 42,
'causer-id' => 42,
'network' => Protocol::DFRN,
],
[
'uri-id' => 3,
'uid' => 0,
'wall' => 0,
'post-user-id' => 9,
'author-id' => 43,
'owner-id' => 43,
'causer-id' => 43,
'network' => Protocol::DFRN,
],
[
'uri-id' => 6,
'uid' => 0,
'wall' => 0,
'post-user-id' => 12,
'author-id' => 44,
'owner-id' => 44,
'causer-id' => 44,
'network' => Protocol::DFRN,
],
],
'notify' => [

View file

@ -773,19 +773,13 @@ function update_1399()
function update_1400()
{
/*
if (!DBA::e("INSERT IGNORE INTO `post` (`uri-id`, `parent-uri-id`, `thr-parent-id`, `owner-id`, `author-id`, `network`,
`created`, `received`, `edited`, `gravity`, `causer-id`, `post-type`, `vid`, `private`, `visible`, `deleted`)
`created`, `received`, `edited`, `gravity`, `causer-id`, `post-type`, `vid`, `private`, `visible`, `deleted`, `global`)
SELECT `uri-id`, `parent-uri-id`, `thr-parent-id`, `owner-id`, `author-id`, `network`, `created`, `received`, `edited`,
`gravity`, `causer-id`, `post-type`, `vid`, `private`, `visible`, `deleted` FROM `item`")) {
`gravity`, `causer-id`, `post-type`, `vid`, `private`, `visible`, `deleted`, `global` FROM `item`")) {
return Update::FAILED;
}
if (!DBA::e("UPDATE `post` INNER JOIN `item` ON `item`.`uri-id` = `post`.`uri-id` AND `item`.`uid` = 0
SET `post`.`global` = true")) {
return Update::FAILED;
// --------------------------------------
if (!DBA::e("UPDATE `post-user` INNER JOIN `item` ON `item`.`uri-id` = `post-user`.`uri-id` AND `item`.`uid` = `post-user`.`uid`
INNER JOIN `event` ON `item`.`event-id` = `event`.`id` AND `event`.`id` != 0
SET `post-user`.`event-id` = `item`.`event-id`")) {
@ -805,8 +799,6 @@ function update_1400()
return Update::FAILED;
}
*/
if (!DBA::e("UPDATE `post-thread-user` INNER JOIN `post-thread` ON `post-thread-user`.`uri-id` = `post-thread`.`uri-id`
SET `post-thread-user`.`owner-id` = `post-thread`.`owner-id`, `post-thread-user`.`author-id` = `post-thread`.`author-id`,
`post-thread-user`.`causer-id` = `post-thread`.`causer-id`, `post-thread-user`.`network` = `post-thread`.`network`,
@ -815,6 +807,5 @@ function update_1400()
return Update::FAILED;
}
return Update::SUCCESS;
}