+ $userNick = sprintf('%s%d', $userprefix, $userNumber);
+
+ $user = User::getKV('nickname', $userNick);
+
+ if (empty($user)) {
+ throw new Exception("Can't find user '$userNick'.");
+ }
+
+ // NB: it's OK to like your own stuff!
+
+ $otherNumber = rand(0, $u - 1);
+
+ $otherNick = sprintf('%s%d', $userprefix, $otherNumber);
+
+ $other = User::getKV('nickname', $otherNick);
+
+ if (empty($other)) {
+ throw new Exception("Can't find user '$otherNick'.");
+ }
+
+ $notices = $other->getNotices()->fetchAll();
+
+ if (count($notices) == 0) {
+ return;
+ }
+
+ $idx = rand(0, count($notices) - 1);
+
+ $notice = $notices[$idx];
+
+ if ($user->hasFave($notice)) {
+ return;
+ }
+
+ Fave::addNew($user->getProfile(), $notice);
+}*/
+
+function testNoticeContent()
+{
+ global $words;
+
+ if (is_null($words)) {
+ return "test notice content";
+ }
+
+ $cnt = rand(3, 8);
+
+ $ids = array_rand($words, $cnt);
+
+ foreach ($ids as $id) {
+ $parts[] = $words[$id];
+ }
+
+ $text = implode(' ', $parts);
+
+ if (mb_strlen($text) > 80) {
+ $text = substr($text, 0, 77) . "...";
+ }
+
+ return $text;
+}
+
+//function main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $favesavg, $messageavg, $tagmax)
+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++;
+ }