3535 */
3636class Populate
3737{
38- private $ blockSize = 150 ;
38+ private $ blockSize = 500 ;
3939 private $ refreshRate = 0 ;
4040 private $ loremIpsum = null ;
4141 private $ ounters = array ();
@@ -50,6 +50,8 @@ public function __construct ($options = array())
5050 $ this ->counters ['categories ' ]['current ' ] = 0 ;
5151 $ this ->counters ['boards ' ]['max ' ] = 100 ;
5252 $ this ->counters ['boards ' ]['current ' ] = 0 ;
53+ $ this ->counters ['membergroups ' ]['max ' ] = 200 ;
54+ $ this ->counters ['membergroups ' ]['current ' ] = 0 ;
5355 $ this ->counters ['members ' ]['max ' ] = 270000 ;
5456 $ this ->counters ['members ' ]['current ' ] = 0 ;
5557 $ this ->counters ['topics ' ]['max ' ] = 370000 ;
@@ -130,19 +132,53 @@ private function makeBoards ()
130132 $ this ->pause ();
131133 }
132134
135+ private function makeMembergroups ()
136+ {
137+ global $ smcFunc ;
138+
139+ while ($ this ->counters ['membergroups ' ]['current ' ] < $ this ->counters ['membergroups ' ]['max ' ] && $ this ->blockSize --)
140+ {
141+ $ smcFunc ['db_insert ' ]('' ,
142+ '{db_prefix}membergroups ' ,
143+ array (
144+ 'description ' => 'string ' , 'group_name ' => 'string-80 ' , 'min_posts ' => 'int ' ,
145+ 'icons ' => 'string ' , 'online_color ' => 'string ' , 'group_type ' => 'int ' ,
146+ ),
147+ array (
148+ '' ,
149+ 'Membergroup ' . ++$ this ->counters ['membergroups ' ]['current ' ],
150+ '-1 ' ,
151+ '1#icon.png ' ,
152+ '' ,
153+ 0 ,
154+ ),
155+ array ('id_group ' )
156+ );
157+ }
158+
159+ $ this ->pause ();
160+ }
161+
133162 private function makeMembers ()
134163 {
135- global $ sourcedir ;
164+ global $ sourcedir, $ modSettings ;
136165 require_once ($ sourcedir . '/Subs-Members.php ' );
137166
167+ // Hash password is slow with the default 10 on the hash cost, reducing this helps.
168+ $ modSettings ['bcrypt_hash_cost ' ] = 4 ;
169+
138170 while ($ this ->counters ['members ' ]['current ' ] < $ this ->counters ['members ' ]['max ' ] && $ this ->blockSize --)
139171 {
140172 $ regOptions = array (
141173 'interface ' => 'admin ' ,
142174 'username ' => 'Member ' . ++$ this ->counters ['members ' ]['current ' ],
143175 'email ' => 'member_ ' . $ this ->counters ['members ' ]['current ' ] . '@ ' . $ _SERVER ['SERVER_NAME ' ] . (strpos ($ _SERVER ['SERVER_NAME ' ], '. ' ) === FALSE ? '.com ' : '' ),
144176 'password ' => '' ,
145- 'require ' => 'nothing '
177+ 'require ' => 'nothing ' ,
178+ 'send_welcome_email ' => false ,
179+ 'check_password_strength ' => false ,
180+ 'check_email_ban ' => false ,
181+ 'memberGroup ' => rand (8 , $ this ->counters ['membergroups ' ]['max ' ]),
146182 );
147183
148184 registerMember ($ regOptions );
0 commit comments