X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Fcreatesim.php;h=624043161da9f19fe0e3512e760e0f770e3f2ca4;hb=d4bdfc2aa27a592427632050807a0d583b595d96;hp=e0ad74c49e6128ad3a12143775926cf07d9fcea5;hpb=63306081bc164fcf57abd7f0996767626fd1e501;p=quix0rs-gnu-social.git diff --git a/scripts/createsim.php b/scripts/createsim.php index e0ad74c49e..624043161d 100644 --- a/scripts/createsim.php +++ b/scripts/createsim.php @@ -31,7 +31,7 @@ $longoptions = array( 'words=', 'prefix=', 'groupprefix=', - 'faves=' +// 'faves=', ); $helptext = <<getProfile()); + $stream = new InboxNoticeStream($user->getProfile(), $user->getProfile()); $notices = $stream->getNotices(0, 20); if ($notices->N > 0) { $nval = rand(0, $notices->N - 1); @@ -163,7 +162,7 @@ function newNotice($i, $tagmax) if ($in_group == 0) { $groups = $user->getGroups(); - if ($groups->N > 0) { + if ($groups instanceof User_group) { $gval = rand(0, $groups->N - 1); $groups->fetch(); // go to 0th for ($i = 0; $i < $gval; $i++) { @@ -187,6 +186,7 @@ function newNotice($i, $tagmax) $notice = Notice::saveNew($user->id, $content, 'createsim', $options); } +/* Plugins should be part of the simulation too! function newMessage($i) { global $userprefix; @@ -207,7 +207,7 @@ function newMessage($i) $other = $friends[$j]; $message = Message::saveNew($user->id, $other->id, $content, 'createsim'); -} +}*/ function newSub($i) { @@ -275,6 +275,7 @@ function newJoin($u, $g) } } +/* Plugins should be part of the simulation too! function newFave($u) { global $userprefix; @@ -317,7 +318,7 @@ function newFave($u) } Fave::addNew($user->getProfile(), $notice); -} +}*/ function testNoticeContent() { @@ -344,7 +345,8 @@ function testNoticeContent() return $text; } -function main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $favesavg, $messageavg, $tagmax) +//function main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $favesavg, $messageavg, $tagmax) +function main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $tagmax) { global $config; $config['site']['dupelimit'] = -1; @@ -372,7 +374,8 @@ function main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $favesav // # registrations + # notices + # subs - $events = $usercount + $groupcount + ($usercount * ($noticeavg + $subsavg + $joinsavg + $favesavg + $messageavg)); + //$events = $usercount + $groupcount + ($usercount * ($noticeavg + $subsavg + $joinsavg + $favesavg + $messageavg)); + $events = $usercount + $groupcount + ($usercount * ($noticeavg + $subsavg + $joinsavg)); $events -= $preuser; $events -= $pregroup; @@ -382,10 +385,11 @@ function main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $favesav $nt = $gt + ($usercount * $noticeavg); $st = $nt + ($usercount * $subsavg); $jt = $st + ($usercount * $joinsavg); - $ft = $jt + ($usercount * $favesavg); - $mt = $ft + ($usercount * $messageavg); +// $ft = $jt + ($usercount * $favesavg); +// $mt = $ft + ($usercount * $messageavg); - printfv("$events events ($ut, $gt, $nt, $st, $jt, $ft, $mt)\n"); +// printfv("$events events ($ut, $gt, $nt, $st, $jt, $ft, $mt)\n"); + printfv("$events events ($ut, $gt, $nt, $st, $jt)\n"); for ($i = 0; $i < $events; $i++) { @@ -408,12 +412,12 @@ function main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $favesav } else if ($e > $st && $e <= $jt) { printfv("$i Making a new group join\n"); newJoin($n, $g); - } else if ($e > $jt && $e <= $ft) { +/* } else if ($e > $jt && $e <= $ft) { printfv("$i Making a new fave\n"); - newFave($n); - } else if ($e > $ft && $e <= $mt) { + newFave($n);*/ +/* } else if ($e > $ft && $e <= $mt) { printfv("$i Making a new message\n"); - newMessage($n); + newMessage($n);*/ } else { printfv("No event for $i!"); } @@ -427,8 +431,8 @@ $groupcount = (have_option('g', 'groups')) ? get_option_value('g', 'groups') : $noticeavg = (have_option('n', 'notices')) ? get_option_value('n', 'notices') : 100; $subsavg = (have_option('b', 'subscriptions')) ? get_option_value('b', 'subscriptions') : max($usercount/20, 10); $joinsavg = (have_option('j', 'joins')) ? get_option_value('j', 'joins') : 5; -$favesavg = (have_option('f', 'faves')) ? get_option_value('f', 'faves') : max($noticeavg/10, 5); -$messageavg = (have_option('m', 'messages')) ? get_option_value('m', 'messages') : max($noticeavg/10, 5); +//$favesavg = (have_option('f', 'faves')) ? get_option_value('f', 'faves') : max($noticeavg/10, 5); +//$messageavg = (have_option('m', 'messages')) ? get_option_value('m', 'messages') : max($noticeavg/10, 5); $tagmax = (have_option('t', 'tags')) ? get_option_value('t', 'tags') : 10000; $userprefix = (have_option('x', 'prefix')) ? get_option_value('x', 'prefix') : 'testuser'; $groupprefix = (have_option('z', 'groupprefix')) ? get_option_value('z', 'groupprefix') : 'testgroup'; @@ -445,7 +449,8 @@ if (is_readable($wordsfile)) { } try { - main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $favesavg, $messageavg, $tagmax); + //main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $favesavg, $messageavg, $tagmax); + main($usercount, $groupcount, $noticeavg, $subsavg, $joinsavg, $tagmax); } catch (Exception $e) { printfv("Got an exception: ".$e->getMessage()); }