]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - scripts/createsim.php
Merge remote branch 'statusnet/1.0.x' into irc-plugin
[quix0rs-gnu-social.git] / scripts / createsim.php
index 71827ba5b73b9996c07701cb39df92cb8a299345..e0b5fc906be8c0e9fc79bb50d20496f8aa786cd7 100644 (file)
@@ -1,8 +1,8 @@
 #!/usr/bin/env php
 <?php
 /*
- * Laconica - a distributed open-source microblogging tool
- * Copyright (C) 2008, 2009, Control Yourself, Inc.
+ * StatusNet - the distributed open-source microblogging tool
+ * Copyright (C) 2008, 2009, StatusNet, Inc.
  *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU Affero General Public License as published by
@@ -41,9 +41,12 @@ require_once INSTALLDIR.'/scripts/commandline.inc';
 function newUser($i)
 {
     global $userprefix;
-    User::register(array('nickname' => 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);