import v1.0.0-RC4 | 2009-05-20
This commit is contained in:
26
utilities/deleteTestUsers.php
Normal file
26
utilities/deleteTestUsers.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
/**
|
||||
* This scripts creates fake user (non-admin) accounts, with the test flag set to 1.
|
||||
*/
|
||||
|
||||
define('APP_DIR', dirname(__FILE__) . '/..');
|
||||
require APP_DIR . '/Setup.php';
|
||||
|
||||
Setup::setIncludePath();
|
||||
Setup::setAutoLoader();
|
||||
Setup::setConfig();
|
||||
Setup::setLogger();
|
||||
Setup::setDatabase();
|
||||
|
||||
$users = new Users();
|
||||
$users->deleteTestEntries();
|
65
utilities/generateRandomHistory.php
Normal file
65
utilities/generateRandomHistory.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
/**
|
||||
* This scripts creates fake entries in the history table
|
||||
*/
|
||||
|
||||
define('APP_DIR', dirname(__FILE__) . '/..');
|
||||
|
||||
/**
|
||||
* Number of entries to create
|
||||
*/
|
||||
define('NUM_ENTRIES', 3000);
|
||||
|
||||
require APP_DIR . '/Setup.php';
|
||||
|
||||
Setup::setIncludePath();
|
||||
Setup::setAutoLoader();
|
||||
Setup::setConfig();
|
||||
Setup::setLogger();
|
||||
Setup::setDatabase();
|
||||
|
||||
class GenerateRandomHistory
|
||||
{
|
||||
private $_names;
|
||||
private $_numNames;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->_words = file(dirname(__FILE__).'/../libs/Monkeys/tests/words.txt');
|
||||
$this->_numWords= count($this->_words);
|
||||
}
|
||||
|
||||
public function generate()
|
||||
{
|
||||
$histories = new Histories();
|
||||
|
||||
$stats = new Stats();
|
||||
$userIds = $stats->getAllTestUsersIds();
|
||||
$numUsers = count($userIds);
|
||||
|
||||
for ($i = 0; $i < NUM_ENTRIES; $i++) {
|
||||
$history = $histories->createRow();
|
||||
|
||||
$history->user_id = $userIds[rand(0, $numUsers - 1)]['id'];
|
||||
$history->date = date('Y-m-d H:i:s', time() - rand(0, 365) * 24 * 60 * 60);
|
||||
$history->site = 'http://' . strtolower(trim($this->_words[rand(0, $this->_numWords)])) . '.com/'
|
||||
. strtolower(trim($this->_words[rand(0, $this->_numWords)]));
|
||||
$history->ip = rand(1, 255) . '.' . rand(1, 255) . '.' . rand(1, 255) . '.' . rand(1, 255);
|
||||
$history->result = History::AUTHORIZED;
|
||||
$history->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$generate = new GenerateRandomHistory();
|
||||
$generate->generate();
|
64
utilities/generateRandomTrustedSites.php
Normal file
64
utilities/generateRandomTrustedSites.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
/**
|
||||
* This scripts creates fake entries in the sites table
|
||||
*/
|
||||
|
||||
define('APP_DIR', dirname(__FILE__) . '/..');
|
||||
|
||||
/**
|
||||
* Number of entries to create
|
||||
*/
|
||||
define('NUM_ENTRIES', 1000);
|
||||
|
||||
require APP_DIR . '/Setup.php';
|
||||
|
||||
Setup::setIncludePath();
|
||||
Setup::setAutoLoader();
|
||||
Setup::setConfig();
|
||||
Setup::setLogger();
|
||||
Setup::setDatabase();
|
||||
|
||||
class GenerateRandomSites
|
||||
{
|
||||
private $_names;
|
||||
private $_numNames;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->_words = file(dirname(__FILE__).'/../libs/Monkeys/tests/words.txt');
|
||||
$this->_numWords= count($this->_words);
|
||||
}
|
||||
|
||||
public function generate()
|
||||
{
|
||||
$sites = new Sites();
|
||||
|
||||
$stats = new Stats();
|
||||
$userIds = $stats->getAllTestUsersIds();
|
||||
$numUsers = count($userIds);
|
||||
|
||||
for ($i = 0; $i < NUM_ENTRIES; $i++) {
|
||||
$site = $sites->createRow();
|
||||
|
||||
$site->user_id = $userIds[rand(0, $numUsers - 1)]['id'];
|
||||
$site->site = 'http://' . strtolower(trim($this->_words[rand(0, $this->_numWords)])) . '.com/'
|
||||
. strtolower(trim($this->_words[rand(0, $this->_numWords)]));
|
||||
$site->creation_date = date('Y-m-d H:i:s', time() - rand(0, 365) * 24 * 60 * 60);
|
||||
$site->trusted = 'a:1:{s:26:"Zend_OpenId_Extension_Sreg";a:0:{}}';
|
||||
$site->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$generate = new GenerateRandomSites();
|
||||
$generate->generate();
|
66
utilities/generateRandomUsers.php
Executable file
66
utilities/generateRandomUsers.php
Executable file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2005-2009 Keyboard Monkeys Ltd. http://www.kb-m.com
|
||||
* @license http://creativecommons.org/licenses/BSD/ BSD License
|
||||
* @author Keyboard Monkey Ltd
|
||||
* @since CommunityID 0.9
|
||||
* @package CommunityID
|
||||
* @packager Keyboard Monkeys
|
||||
*/
|
||||
|
||||
/**
|
||||
* This scripts creates fake user (non-admin) accounts, with the test flag set to 1.
|
||||
*/
|
||||
|
||||
define('APP_DIR', dirname(__FILE__) . '/..');
|
||||
|
||||
/**
|
||||
* Number of users to create
|
||||
*/
|
||||
define('NUM_USERS', 1000);
|
||||
|
||||
require APP_DIR . '/Setup.php';
|
||||
|
||||
Setup::setIncludePath();
|
||||
Setup::setAutoLoader();
|
||||
Setup::setConfig();
|
||||
Setup::setLogger();
|
||||
Setup::setDatabase();
|
||||
|
||||
class GenerateRandomUsers
|
||||
{
|
||||
private $_names;
|
||||
private $_numNames;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->_names = file(dirname(__FILE__).'/../libs/Monkeys/tests/names.txt');
|
||||
$this->_numNames = count($this->_names);
|
||||
}
|
||||
|
||||
public function generate()
|
||||
{
|
||||
$users = new Users();
|
||||
for ($i = 0; $i < NUM_USERS ; $i++) {
|
||||
$firstname = trim($this->_names[rand(0, $this->_numNames)]);
|
||||
$username = strtolower(substr($firstname, 0, 4));
|
||||
$user = $users->createRow();
|
||||
|
||||
$user->test = 1;
|
||||
$user->username = $username;
|
||||
$user->openid = "http://localhost/communityid/identity/$username";
|
||||
$user->accepted_eula = 1;
|
||||
$user->registration_date = date('Y-m-d', time() - rand(0, 365) * 24 * 60 * 60);
|
||||
$user->firstname = $firstname;
|
||||
$user->lastname = trim($this->_names[rand(0, $this->_numNames)]);
|
||||
$user->email = "$username@mailinator.com";
|
||||
$user->role = 'registered';
|
||||
$user->token = '';
|
||||
$user->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$generate = new GenerateRandomUsers();
|
||||
$generate->generate();
|
12
utilities/lighttpd_mod_rewrite.txt
Normal file
12
utilities/lighttpd_mod_rewrite.txt
Normal file
@ -0,0 +1,12 @@
|
||||
If using Lighttpd as your web server, add the following to Lighttpd's main config file:
|
||||
|
||||
url.rewrite-once = (
|
||||
"(.*\.(js|ico|gif|jpg|png|css|html|php))(\?v=.*)?$" => "$1",
|
||||
".*\?(.*)$" => "/index.php?$1",
|
||||
"" => "/index.php"
|
||||
)
|
||||
|
||||
Note: The "php" part in the first rule is to be able to load the javascript language file, which is actually a php file.
|
||||
|
||||
Make sure you have mod_rewrite enabled by putting the following somewhere above the previous block:
|
||||
server.modules += ("mod_rewrite")
|
Reference in New Issue
Block a user