forked from GNUsocial/gnu-social
All groups start with a random admin
This commit is contained in:
parent
6902c0af35
commit
efab3c6558
@ -51,16 +51,20 @@ function newUser($i)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function newGroup($i)
|
function newGroup($i, $j)
|
||||||
{
|
{
|
||||||
global $groupprefix;
|
global $groupprefix;
|
||||||
|
global $userprefix;
|
||||||
|
|
||||||
$user = User_group::register(array('nickname' => sprintf('%s%d', $groupprefix, $i),
|
// Pick a random user to be the admin
|
||||||
'local' => true,
|
|
||||||
'fullname' => sprintf('Test Group %d', $i)));
|
$n = rand(0, max($j - 1, 0));
|
||||||
if (!empty($user)) {
|
$user = User::staticGet('nickname', sprintf('%s%d', $userprefix, $n));
|
||||||
$user->free();
|
|
||||||
}
|
$group = User_group::register(array('nickname' => sprintf('%s%d', $groupprefix, $i),
|
||||||
|
'local' => true,
|
||||||
|
'userid' => $user->id,
|
||||||
|
'fullname' => sprintf('Test Group %d', $i)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function newNotice($i, $tagmax)
|
function newNotice($i, $tagmax)
|
||||||
@ -196,7 +200,7 @@ function main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $tagmax)
|
|||||||
$g = 1;
|
$g = 1;
|
||||||
|
|
||||||
newUser(0);
|
newUser(0);
|
||||||
newGroup(0);
|
newGroup(0, $n);
|
||||||
|
|
||||||
// # registrations + # notices + # subs
|
// # registrations + # notices + # subs
|
||||||
|
|
||||||
@ -214,13 +218,13 @@ function main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $tagmax)
|
|||||||
{
|
{
|
||||||
$e = rand(0, $events);
|
$e = rand(0, $events);
|
||||||
|
|
||||||
if ($e > 0 && $e <= $ut) {
|
if ($e >= 0 && $e <= $ut) {
|
||||||
printfv("$i Creating user $n\n");
|
printfv("$i Creating user $n\n");
|
||||||
newUser($n);
|
newUser($n);
|
||||||
$n++;
|
$n++;
|
||||||
} else if ($e > $ut && $e <= $gt) {
|
} else if ($e > $ut && $e <= $gt) {
|
||||||
printfv("$i Creating group $g\n");
|
printfv("$i Creating group $g\n");
|
||||||
newGroup($g);
|
newGroup($g, $n);
|
||||||
$g++;
|
$g++;
|
||||||
} else if ($e > $gt && $e <= $nt) {
|
} else if ($e > $gt && $e <= $nt) {
|
||||||
printfv("$i Making a new notice\n");
|
printfv("$i Making a new notice\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user