Differences from version 1 to 3



@@ -6,7 +6,7 @@

 
 Blog Posts by contrast only expire if the expiration date is greater than the publish date. Therefore individual blog posts can be set to never expire, where as Articles requires the Topic to enforce that.
 
-This script does not currently do anything to change the expiration dates, which means if you are porting old Articles straight to Blog Posts with out adjusting the dates you may find many of your Blog Posts expired. One goal for this script then is to take Article dates, run comparisons, and adjust as best as possible to work with how BlogsPackage handles dates.
+As a crude way to deal with this we set all expiration dates to be the publish_date -1 -- this will keep all articles from expiring. You may want to change this to make the expiration more sophisticated if you have deliberately expired Articles..
 
 {code title=draft script to port Articles to Blog Posts}
 <?php

@@ -18,7 +18,6 @@

 require_once( 'bit_setup_inc.php' );
 require_once( ARTICLES_PKG_PATH.'BitArticle.php' );
 require_once( BLOGS_PKG_PATH.'BitBlogPost.php' );
-require_once( LIBERTY_PKG_PATH.'LibertyComment.php' );
 if( $gBitSystem->isPackageActive( 'tags' )) {
  require_once( TAGS_PKG_PATH.'LibertyTag.php' );
 }

@@ -38,7 +37,10 @@

 
  $post['content_id'] = $article['content_id'];
  $post['publish_date'] = $article['publish_date'];
- $post['expire_date'] = $article['expire_date'];
+
+ if ( $article['expire_date'] > $article['publish_date'] ){
+ $article['expire_date'] = $article['publish_date'] - 1;
+ }
 
  $table = BIT_DB_PREFIX."blog_posts";
  $bp->mDb->StartTrans();

@@ -71,5 +73,4 @@

  vd( $feedback );
  }
 }
-?>
-{/code}
+?>{/code}
Page History
Date/CommentUserIPVersion
23 Aug 2007 (18:33 UTC)
no need for comments class
Will89.247.33.2033
Current • Source
Will89.247.7.292
View • Compare • Difference • Source
Will89.247.7.291
View • Compare • Difference • Source