Version 5.0.0 beta 7
This commit is contained in:
1 parent
fa2a720105
commit
54d5dcd0a0
156 files changed
+4337
-2995
No files matched your search
@@ -303,57 +303,61 @@ class MoveComments extends QueueAbstract
|
||||
}
|
||||
foreach( new ActiveRecordIterator( Db::i()->select( '*', 'forums_posts', array( "pid>? AND new_topic=? AND " . Db::i()->in( 'topic_id', $subquery ), $data['lastId'], 0 ), "pid ASC", $this->rebuild ), 'IPS\forums\Topic\Post' ) AS $row )
|
||||
{
|
||||
/* @var Records $recordClass */
|
||||
$record = $recordClass::load( $row->topic_id, 'record_topicid' );
|
||||
|
||||
$approved = $row->queued;
|
||||
if ( $row->queued == 1 )
|
||||
try
|
||||
{
|
||||
$approved = 0;
|
||||
}
|
||||
else if ( $row->queued == 0 )
|
||||
{
|
||||
$approved = 1;
|
||||
}
|
||||
|
||||
$comment = new $commentClass;
|
||||
$comment->user = $row->author_id;
|
||||
$comment->database_id = $database->_id;
|
||||
$comment->record_id = $record->primary_id_field;
|
||||
$comment->date = $row->post_date;
|
||||
$comment->ip_address = $row->ip_address;
|
||||
$comment->post = $row->post;
|
||||
$comment->approved = $approved;
|
||||
$comment->author = $row->author_name;
|
||||
$comment->edit_date = $row->edit_time ?: 0;
|
||||
$comment->edit_reason = $row->edit_reason;
|
||||
$comment->edit_member_name = $row->edit_name;
|
||||
$comment->save();
|
||||
/* @var Records $recordClass */
|
||||
$record = $recordClass::load( $row->topic_id, 'record_topicid' );
|
||||
|
||||
/* Update post before register */
|
||||
Db::i()->update( 'core_post_before_registering', array( 'class' => $commentClass, 'id' => $comment->id ), array( 'class=? and id=?', "\IPS\forums\Topic\Post", $row->id ) );
|
||||
$approved = $row->queued;
|
||||
if ( $row->queued == 1 )
|
||||
{
|
||||
$approved = 0;
|
||||
}
|
||||
else if ( $row->queued == 0 )
|
||||
{
|
||||
$approved = 1;
|
||||
}
|
||||
|
||||
Index::i()->index( $comment );
|
||||
|
||||
$row->delete();
|
||||
|
||||
$data['lastId'] = $row->pid;
|
||||
$data['done']++;
|
||||
$done++;
|
||||
|
||||
/* If we're no longer keeping the topic, then delete it, but only if we're really done with it (ex, only the first post still exists). Otherwise, we still want the topic linked, we're just not using it for comments anymore. */
|
||||
if ( $data['deleteTopics'] AND (int) Db::i()->select( 'COUNT(*)', 'forums_posts', array( "topic_id=?", $row->topic_id ) )->first() === 1 )
|
||||
{
|
||||
Topic::load( $row->topic_id )->delete();
|
||||
$record->record_topicid = 0;
|
||||
$comment = new $commentClass;
|
||||
$comment->user = $row->author_id;
|
||||
$comment->database_id = $database->_id;
|
||||
$comment->record_id = $record->primary_id_field;
|
||||
$comment->date = $row->post_date;
|
||||
$comment->ip_address = $row->ip_address;
|
||||
$comment->post = $row->post;
|
||||
$comment->approved = $approved;
|
||||
$comment->author = $row->author_name;
|
||||
$comment->edit_date = $row->edit_time ?: 0;
|
||||
$comment->edit_reason = $row->edit_reason;
|
||||
$comment->edit_member_name = $row->edit_name;
|
||||
$comment->save();
|
||||
|
||||
/* Update post before register */
|
||||
Db::i()->update( 'core_post_before_registering', array( 'class' => $commentClass, 'id' => $comment->id ), array( 'class=? and id=?', "\IPS\forums\Topic\Post", $row->id ) );
|
||||
|
||||
Index::i()->index( $comment );
|
||||
|
||||
$row->delete();
|
||||
|
||||
$data['lastId'] = $row->pid;
|
||||
$data['done']++;
|
||||
$done++;
|
||||
|
||||
/* If we're no longer keeping the topic, then delete it, but only if we're really done with it (ex, only the first post still exists). Otherwise, we still want the topic linked, we're just not using it for comments anymore. */
|
||||
if ( $data['deleteTopics'] and (int)Db::i()->select( 'COUNT(*)', 'forums_posts', array( "topic_id=?", $row->topic_id ) )->first() === 1 )
|
||||
{
|
||||
Topic::load( $row->topic_id )->delete();
|
||||
$record->record_topicid = 0;
|
||||
}
|
||||
|
||||
$record->resyncCommentCounts();
|
||||
$record->save();
|
||||
|
||||
$category = $record->container();
|
||||
$category->resetCommentCounts();
|
||||
$category->save();
|
||||
}
|
||||
|
||||
$record->resyncCommentCounts();
|
||||
$record->save();
|
||||
|
||||
$category = $record->container();
|
||||
$category->resetCommentCounts();
|
||||
$category->save();
|
||||
catch ( OutOfRangeException ) {} // this may have already been handled
|
||||
}
|
||||
|
||||
return $done;
|
||||
|
||||
Reference in new issue
Block a user