[pLog-svn] r4370 - plog/branches/lifetype-1.1.3/tools

reto at devel.lifetype.net reto at devel.lifetype.net
Wed Nov 29 22:39:44 GMT 2006


Author: reto
Date: 2006-11-29 22:39:44 +0000 (Wed, 29 Nov 2006)
New Revision: 4370

Modified:
   plog/branches/lifetype-1.1.3/tools/generateData.php
Log:
added random trackback generation... (there is room for improvement, but it's all I needed...)

Modified: plog/branches/lifetype-1.1.3/tools/generateData.php
===================================================================
--- plog/branches/lifetype-1.1.3/tools/generateData.php	2006-11-29 22:37:16 UTC (rev 4369)
+++ plog/branches/lifetype-1.1.3/tools/generateData.php	2006-11-29 22:39:44 UTC (rev 4370)
@@ -15,6 +15,8 @@
 include_once( PLOG_CLASS_PATH."class/dao/article.class.php" );
 include_once( PLOG_CLASS_PATH."class/dao/articlecomments.class.php" );
 include_once( PLOG_CLASS_PATH."class/dao/usercomment.class.php" );
+include_once( PLOG_CLASS_PATH."class/dao/trackbacks.class.php" );
+include_once( PLOG_CLASS_PATH."class/dao/trackback.class.php" );
 
 // check whether we're being run from the command line
 $commandLine = is_array( $argv );
@@ -30,7 +32,8 @@
                   "numCategoriesPerBlog" => 10,
                   "numCategoriesPerPost" => 3,
                   "numUsersPerBlog" => 2,
-                  "numCommentsPerArticle" => 10 );
+                  "numCommentsPerArticle" => 10,
+                  "numTrackbacksPerArticle" => 10);
 
 // to keep track of users
 $userPool = Array();
@@ -200,7 +203,27 @@
                 $userComments->addComment( $userComment );
                 $l++;
             }
-
+            
+            // add the trackbakcs per article
+            $m = 0;
+            $trackbacksPerArticle = rand(1,$params["numTrackbacksPerArticle"] );
+            $tb = new Trackbacks();
+            while( $m < $trackbacksPerArticle ) {
+                $url = 'http://www.'.generateRandomWord(10).'.com/'.generateRandomWord(4).'/'.generateRandomWord(15).'.html';
+                $articleTrackback = new Trackback ( 
+                                                $url, // url
+                                                generateRandomWords(rand(1,3)), // title
+                                                $article->getId(),   // art id
+                                                $blog->getId(), // blog id
+                                                generateRandomParagraph(), //excerpt
+                                                generateRandomWords(rand(1,2)), // blog name
+                                                generateRandomDate(), // date
+                                                '127.0.0.1' // client ip
+                                                ); 
+                $tb->addTrackback( $articleTrackback );
+                $m++;
+            }
+             
             $k++;
         }
 	print("Blog $i added {$nl}");



More information about the pLog-svn mailing list