From 5b9062a51837399ec9e132d8d706d9d91e1cb7de Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 11 Apr 2011 12:38:12 -0400 Subject: [PATCH] pre-fill users and groups in createsim.php --- scripts/createsim.php | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/scripts/createsim.php b/scripts/createsim.php index f25890676e..bd32ac6324 100644 --- a/scripts/createsim.php +++ b/scripts/createsim.php @@ -81,9 +81,8 @@ function newNotice($i, $tagmax) $content = 'Test notice content'; if ($is_reply == 0) { - common_set_user($user); - $stream = new InboxNoticeStream($user); - $notices = $stream->getNotices(0, 20, null, null); + $stream = new InboxNoticeStream($user, $user->getProfile()); + $notices = $stream->getNotices(0, 20); if ($notices->N > 0) { $nval = rand(0, $notices->N - 1); $notices->fetch(); // go to 0th @@ -212,16 +211,34 @@ function main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $tagmax) global $config; $config['site']['dupelimit'] = -1; - $n = 1; - $g = 1; + $n = 0; + $g = 0; - newUser(0); - newGroup(0, $n); + // 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); -- 2.39.5