function main($usercount, $noticeavg, $subsavg, $tagmax) { global $config; $config['site']['dupelimit'] = -1; $n = 1; newUser(0); // # registrations + # notices + # subs $events = $usercount + $usercount * ($noticeavg + $subsavg); for ($i = 0; $i < $events; $i++) { $e = rand(0, 1 + $noticeavg + $subsavg); if ($e == 0) { newUser($n); $n++; } else { if ($e < $noticeavg + 1) { newNotice($n, $tagmax); } else { newSub($n); } } } }
function main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $tagmax) { global $config; $config['site']['dupelimit'] = -1; $n = 0; $g = 0; // Make users first $preuser = min($usercount, 5); for ($j = 0; $j < $preuser; $j++) { printfv("{$i} Creating user {$n}\n"); newUser($n); $n++; } $pregroup = min($groupcount, 3); for ($k = 0; $k < $pregroup; $k++) { printfv("{$i} Creating group {$g}\n"); newGroup($g, $n); $g++; } // # registrations + # notices + # subs $events = $usercount + $groupcount + $usercount * ($noticeavg + $subsavg + $joinsavg); $events -= $preuser; $events -= $pregroup; $ut = $usercount; $gt = $ut + $groupcount; $nt = $gt + $usercount * $noticeavg; $st = $nt + $usercount * $subsavg; $jt = $st + $usercount * $joinsavg; printfv("{$events} events ({$ut}, {$gt}, {$nt}, {$st}, {$jt})\n"); for ($i = 0; $i < $events; $i++) { $e = rand(0, $events); if ($e >= 0 && $e <= $ut) { printfv("{$i} Creating user {$n}\n"); newUser($n); $n++; } else { if ($e > $ut && $e <= $gt) { printfv("{$i} Creating group {$g}\n"); newGroup($g, $n); $g++; } else { if ($e > $gt && $e <= $nt) { printfv("{$i} Making a new notice\n"); newNotice($n, $tagmax); } else { if ($e > $nt && $e <= $st) { printfv("{$i} Making a new subscription\n"); newSub($n); } else { if ($e > $st && $e <= $jt) { printfv("{$i} Making a new group join\n"); newJoin($n, $g); } else { printfv("No event for {$i}!"); } } } } } } }