mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
Atom updates
Обновления лент при удалении тем (одиночном, массовом). При удалении сообщений (одиночном, массовом).
This commit is contained in:
parent
1969c6c57e
commit
469d038784
4 changed files with 43 additions and 12 deletions
|
@ -58,8 +58,8 @@ switch($this->request['type'])
|
|||
}
|
||||
post_delete($post_id);
|
||||
|
||||
// Update user atom feed
|
||||
update_atom((int) $this->request['topic_id']);
|
||||
// Update atom feed
|
||||
update_atom('topic', (int) $this->request['topic_id']);
|
||||
|
||||
$this->response['hide'] = true;
|
||||
$this->response['post_id'] = $post_id;
|
||||
|
@ -162,8 +162,8 @@ switch($this->request['type'])
|
|||
}
|
||||
else $this->ajax_die($lang['EMPTY_MESSAGE']);
|
||||
|
||||
// Update user atom feed
|
||||
update_atom((int) $this->request['topic_id']);
|
||||
// Update atom feed
|
||||
update_atom('topic', (int) $this->request['topic_id']);
|
||||
|
||||
$this->response['html'] = bbcode2html($text);
|
||||
}
|
||||
|
@ -316,8 +316,8 @@ switch($this->request['type'])
|
|||
user_notification('reply', $post, $post['topic_title'], $post['forum_id'], $topic_id, $notify);
|
||||
}
|
||||
|
||||
// Update user atom feed
|
||||
update_atom((int) $this->request['topic_id']);
|
||||
// Update atom feed
|
||||
update_atom('topic', (int) $this->request['topic_id']);
|
||||
|
||||
$this->response['redirect'] = make_url(POST_URL . "$post_id#$post_id");
|
||||
break;
|
||||
|
|
|
@ -2838,11 +2838,19 @@ function is_gold ($type)
|
|||
return $is_gold;
|
||||
}
|
||||
|
||||
function update_atom ($topic_id)
|
||||
function update_atom ($type, $id)
|
||||
{
|
||||
require_once(INC_DIR .'functions_atom.php');
|
||||
|
||||
// Update user atom feed
|
||||
$topic_poster = (int) DB()->fetch_row("SELECT topic_poster FROM ". BB_TOPICS ." WHERE topic_id = $topic_id LIMIT 1", 'topic_poster');
|
||||
update_user_feed($topic_poster, get_username($topic_poster));
|
||||
switch ($type)
|
||||
{
|
||||
case 'user':
|
||||
update_user_feed($id, get_username($id));
|
||||
break;
|
||||
|
||||
case 'topic':
|
||||
$topic_poster = (int) DB()->fetch_row("SELECT topic_poster FROM ". BB_TOPICS ." WHERE topic_id = $id LIMIT 1", 'topic_poster');
|
||||
update_user_feed($topic_poster, get_username($topic_poster));
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -277,6 +277,13 @@ function topic_delete ($mode_or_topic_id, $forum_id = null, $prune_time = 0, $pr
|
|||
GROUP BY p.poster_id
|
||||
");
|
||||
|
||||
// Get array for atom update
|
||||
$atom_csv = array();
|
||||
foreach (DB()->fetch_rowset('SELECT user_id FROM '.$tmp_user_posts) as $at)
|
||||
{
|
||||
$atom_csv[] = $at['user_id'];
|
||||
}
|
||||
|
||||
DB()->query("
|
||||
UPDATE
|
||||
$tmp_user_posts tmp, ". BB_USERS ." u
|
||||
|
@ -384,6 +391,12 @@ function topic_delete ($mode_or_topic_id, $forum_id = null, $prune_time = 0, $pr
|
|||
// Sync
|
||||
sync('forum', array_keys($sync_forums));
|
||||
|
||||
// Update atom feed
|
||||
foreach ($atom_csv as $atom)
|
||||
{
|
||||
update_atom('user', $atom);
|
||||
}
|
||||
|
||||
DB()->query("DROP TEMPORARY TABLE $tmp_delete_topics");
|
||||
|
||||
return $deleted_topics_count;
|
||||
|
@ -663,6 +676,16 @@ function post_delete ($mode_or_post_id, $user_id = null, $exclude_first = true)
|
|||
sync('forum', array_keys($sync_forums));
|
||||
sync('user_posts', $sync_users);
|
||||
|
||||
// Update atom feed
|
||||
foreach ($sync_topics as $atom_topic)
|
||||
{
|
||||
update_atom('topic', $atom_topic);
|
||||
}
|
||||
foreach ($sync_users as $atom_user)
|
||||
{
|
||||
update_atom('user', $atom_user);
|
||||
}
|
||||
|
||||
DB()->query("DROP TEMPORARY TABLE $tmp_delete_posts");
|
||||
|
||||
return $deleted_posts_count;
|
||||
|
|
|
@ -444,8 +444,8 @@ elseif ( ($submit || $confirm) && !$topic_has_new_posts )
|
|||
}
|
||||
}
|
||||
|
||||
// Update user atom feed
|
||||
update_atom($topic_id);
|
||||
// Update atom feed
|
||||
update_atom('topic', $topic_id);
|
||||
|
||||
if ($mode == 'reply' && $post_info['topic_status'] == TOPIC_LOCKED)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue