"Fossies" - the Fresh Open Source Software Archive

Member "sphinx-2.2.11-release/mysqlse/gen_data.php" (19 Jul 2016, 722 Bytes) of package /linux/www/sphinx-2.2.11-release.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "gen_data.php" see the Fossies "Dox" file reference documentation.

    1 <?php
    2 
    3 $file_name= $argv[1];
    4 
    5 //echo $file_name;
    6 
    7 $cont= file_get_contents($file_name);
    8 
    9 $words= explode(" ", $cont);
   10 
   11 //echo "words: ".(count($words))."\n";
   12 
   13 $cw = count($words);
   14 
   15 echo "REPLACE INTO test.documents ( id, group_id, date_added, title, content ) VALUES\n";
   16 
   17 
   18 for ($i=1; $i<=100000; $i++)
   19 {
   20   $count_words= mt_rand(10,30);
   21   $pred = "";
   22   for ($j=0; $j<$count_words; $j++)
   23   {
   24     $pred .= chop($words[mt_rand(1, $cw-1)])." ";
   25   }
   26   $count_words= mt_rand(3,5);
   27   $tit = "";
   28   for ($j=0; $j<$count_words; $j++)
   29   {
   30     $tit .= chop($words[mt_rand(1, $cw-1)])." ";
   31   }
   32   echo "($i,".mt_rand(1,20).",NOW(),'".addslashes($tit)."','".addslashes($pred)."'),\n";
   33 }       
   34   echo "(0,1,now(),'end','eND');\n";
   35   
   36 
   37 ?>