1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-12 11:40:26 +01:00

[ticket/15925] Add core.update_post_info_modify_sql

Add event to modify the sql to allow for more columns to be updated during sync
Same as sync events but only ran for last posts, slightly different formatting

PHPBB3-15925
This commit is contained in:
Alec 2019-01-12 07:09:27 -05:00 committed by Marc Alexander
parent 516d0f5b27
commit 86bbd05608
No known key found for this signature in database
GPG Key ID: 50E0D2423696F995

View File

@ -365,8 +365,10 @@ function update_post_information($type, $ids, $return_update_sql = false)
extract($phpbb_dispatcher->trigger_event('core.update_post_info_modify_posts_sql', compact($vars)));
$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary));
$rowset = array();
while ($row = $db->sql_fetchrow($result))
{
$rowset[] = $row;
$update_sql[$row["{$type}_id"]][] = $type . '_last_post_id = ' . (int) $row['post_id'];
$update_sql[$row["{$type}_id"]][] = "{$type}_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'";
$update_sql[$row["{$type}_id"]][] = $type . '_last_post_time = ' . (int) $row['post_time'];
@ -375,6 +377,22 @@ function update_post_information($type, $ids, $return_update_sql = false)
$update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "'";
}
$db->sql_freeresult($result);
/**
* Event to modify the update_sql array to add new update data for forum or topic last posts
*
* @event core.update_post_info_modify_sql
* @var string type The table being updated (forum or topic)
* @var array rowset Array with the posts data
* @var array update_sql Array with SQL data to update the forums or topics table with
* @since 3.2.6-RC1
*/
$vars = array(
'type',
'rowset',
'update_sql',
);
extract($phpbb_dispatcher->trigger_event('core.update_post_info_modify_sql', compact($vars)));
}
unset($empty_forums, $ids, $last_post_ids);