Jump to content


Photo

Archiver not un-achiving topics


I have unarchived some topics, it has been over 24 hours and it still says:

This topic will be unarchived shortly.

Posted Image

I was unable to get any info on how long it takes.

IP.Board 3.3.1

Status: Fixed
Version: 3.3.2
Fixed In: 3.3.3


15 Comments

Photo
Extreame™
May 09 2012 04:52 AM
This issue is still present on my board.

Upgraded to 3.3.2 over 16 hours ago and I still do not have topics that have been archived, back from the abyss of the archiver Posted Image
Hmm, submit a ticket please :)
Photo
Extreame™
May 09 2012 06:15 AM
Done
Matt the problem is with this code in classes_archive_restore::processBatch() below:
  /* Now fetch the max/min if archiver is on */
  if ( $this->settings['archive_on'] && $options['process'] > 0 && $restoreData['restore_min_tid'] && $restoreData['restore_max_tid'] )
  {
   $date  = IPS_UNIX_TIME_NOW - ( 86400 * intval( $this->settings['archive_restore_days'] ) );
  
   $this->DB->build( array( 'select' => 'archive_id',
		  'from'   => 'forums_archive_posts',
		  'where'  => 'archive_content_date > ' . $date . ' AND archive_topic_id BETWEEN ' . intval( $restoreData['restore_min_tid'] ) . ' AND ' . intval( $restoreData['restore_max_tid'] ),
		  'order'  => 'archive_topic_id ASC, archive_id ASC',
		  'limit'  => array( 0, $options['process'] ) ) );
  
   $o = $this->DB->execute();
  
   while( $post = $this->DB->fetch( $o ) )
   {
    $pids[ $post['archive_id'] ] = $post['archive_id'];
   }
  
   /* All done? */
   if ( ! count( $pids ) )
   {
    $restoreData['restore_min_tid'] = 0;
    $restoreData['restore_max_tid'] = 0;
   
    $this->setRestoreData( $restoreData );
   }
  }

We never check against a remote DB when loading the post IDs to restore and thus the code never restores anything.
Ok.. So.. We spoke a bit about this on IM.. Basically.. If you archive topics to a remote DB.. You can't unarchive them.

The restore function only checks the local database.

This.. Leads to multiple issues.. Obviously, anyone who has a topic archived and is using a remote DB, can't unarchive it.. However.. A second thing that will have to be considered here is that if they flag a topic to be unarchived, the task runs normally, as if it completes successfully, because the forums_archive_posts table is empty.. So.. So far as the task is concerned, it runs through.. Doesn't do what it should, but, it THINKS it does.

This means, that even if the root problem here is fixed.. You're going to have topics that have topic_archive_status flagged at code 4, 'unarchiving', while the core_archive_restore table is cleared for the manual tids.. So.. In addition to the 'fix'.. Something will have to be done to scan for any topics with an archive flag of 4, get the list and add those back in to core_archive_restore's manual tids, otherwise, you'll wind up with 'orphan' topics that show as 'to be restored' that will never restore.
Photo
Extreame™
May 09 2012 10:35 AM
Jason, I do not have my archive topics going to a remote DB, it is on the same server as ipb DB (localhost).

So, is this an issue for me, or are you just stating here what you have discussed on IM?
If it's not using the IPB database to store the archived topics, it's a remote database.
Photo
Extreame™
May 09 2012 08:03 PM
Understood. Thank-you.
Update the files in the zip to admin/sources/classes/archive:

[attachment=39459:archiveupdate.zip]


Then run this script (upload into forum root)

[attachment=39458:333_archive_update_php.php]
Photo
Extreame™
May 10 2012 09:42 AM
Perfect, it now shows in the ACP the topics that are now going to be unarchived:

Posted Image

Awesome work Matt (and everyone else) Posted Image
:)
Is this intended to be a 'quick fix' for those using remote DB archiving?

Because, i'm working on a site right now where someone applied this and is NOT using remote archiving, and they can no longer restore topics..

So.. I'm assuming this patch is only a patch for the remote issue, and people using standard local archiving should NOT apply this?
Jason: the patch Matt uploaded is the fix included in IPB too as far as I know.

I'll let him check your reply though.
Assign the ticket to me and I'll take a look. The fix included here should work for both remote and local DBs.
Suffering same problem.
Applied the fix (uploading the files and running the one on the forum's root).

Got this error on screen (running the archiver cron manually to see from the CP):
mySQL query error: SELECT archive_id FROM invision_forums_archive_posts WHERE archive_topic_id IN(1002644) AND archive_restored=0 ORDER BY archive_topic_id ASC, archive_id ASC LIMIT 0,250

But the topic we was watching, was unarchived.
Don't know what about that error.

We are using external archive, on a separate DB.