[pLog-svn] r1768 - plog/branches/plog-1.1-ben
ork at devel.plogworld.net
ork at devel.plogworld.net
Tue Apr 5 23:34:56 GMT 2005
Author: ork
Date: 2005-04-05 23:34:56 +0000 (Tue, 05 Apr 2005)
New Revision: 1768
Added:
plog/branches/plog-1.1-ben/generateRandomData.php
Log:
just a 1st step to fill a pLog db with random data :)
Added: plog/branches/plog-1.1-ben/generateRandomData.php
===================================================================
--- plog/branches/plog-1.1-ben/generateRandomData.php 2005-04-05 23:16:08 UTC (rev 1767)
+++ plog/branches/plog-1.1-ben/generateRandomData.php 2005-04-05 23:34:56 UTC (rev 1768)
@@ -0,0 +1,43 @@
+<?
+
+function generateRandomText($codelenght) {
+ while($newcode_length < $codelenght) {
+ $x=1;
+ $y=4;
+ $part = rand($x,$y);
+ if($part==1){$a=48;$b=57;} // Numbers
+ if($part==2){$a=65;$b=90;} // UpperCase
+ if($part==3){$a=97;$b=122;} // LowerCase
+ if($part==4){if ($space > 4) { $newcode = $newcode." "; $space = 0; continue;} } // Space
+ $code_part=chr(rand($a,$b));
+ $newcode_length = $newcode_length + 1;
+ $newcode = $newcode.$code_part;
+ $space++;
+ }
+ return $newcode;
+}
+
+function generateRandomDate() {
+ // generate random date between 2000-01-01 and now
+ $time = rand(946681200, time());
+ return $time;
+}
+
+define( "PLOG_CLASS_PATH", "./" );
+
+require_once( "class/dao/article.class.php" );
+require_once( "class/dao/articles.class.php" );
+
+$article = new Article(generateRandomText( 20 ),
+ generateRandomText( 1024 ),
+ array( 1 ),
+ 1,
+ 1,
+ POST_STATUS_PUBLISHED,
+ 1);
+$articles = new Articles();
+$articles->addArticle( $article );
+
+
+
+?>
More information about the pLog-svn
mailing list