X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=scripts%2Fcreatesim.php;h=e0b5fc906be8c0e9fc79bb50d20496f8aa786cd7;hb=3da2b316525a95ef965a07a0fe9acbb4681fc02c;hp=eb97a624dbac10c9e0075050de4973ca8cb13963;hpb=936b0999786a77fb6463a638784520fb623d523e;p=quix0rs-gnu-social.git diff --git a/scripts/createsim.php b/scripts/createsim.php index eb97a624db..e0b5fc906b 100644 --- a/scripts/createsim.php +++ b/scripts/createsim.php @@ -1,8 +1,8 @@ #!/usr/bin/env php sprintf('%s%d', $userprefix, $i), - 'password' => sprintf('password%d', $i), - 'fullname' => sprintf('Test User %d', $i))); + $user = User::register(array('nickname' => sprintf('%s%d', $userprefix, $i), + 'password' => sprintf('password%d', $i), + 'fullname' => sprintf('Test User %d', $i))); + if (!empty($user)) { + $user->free(); + } } function newNotice($i, $tagmax) @@ -73,6 +76,9 @@ function newNotice($i, $tagmax) } $notice = Notice::saveNew($user->id, $content, 'system'); + + $user->free(); + $notice->free(); } function newSub($i) @@ -101,15 +107,21 @@ function newSub($i) $to = User::staticGet('nickname', $tunic); - if (empty($from)) { + if (empty($to)) { throw new Exception("Can't find user '$tunic'."); } subs_subscribe_to($from, $to); + + $from->free(); + $to->free(); } function main($usercount, $noticeavg, $subsavg, $tagmax) { + global $config; + $config['site']['dupelimit'] = -1; + $n = 1; newUser(0); @@ -135,7 +147,7 @@ function main($usercount, $noticeavg, $subsavg, $tagmax) $usercount = (have_option('u', 'users')) ? get_option_value('u', 'users') : 100; $noticeavg = (have_option('n', 'notices')) ? get_option_value('n', 'notices') : 100; -$subsavg = (have_option('b', 'subscriptions')) ? get_option_value('b', 'subscriptions') : min($usercount/20, 10); +$subsavg = (have_option('b', 'subscriptions')) ? get_option_value('b', 'subscriptions') : max($usercount/20, 10); $tagmax = (have_option('t', 'tags')) ? get_option_value('t', 'tags') : 10000; $userprefix = (have_option('x', 'prefix')) ? get_option_value('x', 'prefix') : 'testuser';