17 $count_users =
function () {
20 'metadata_names' =>
'__faker',
25 $count_friends =
function (
$user) {
28 'relationship' =>
'friend',
29 'relationship_guid' =>
$user->guid,
30 'inverse_relationship' =>
false,
31 'metadata_names' =>
'__faker',
40 while ($count_users() < $this->limit) {
53 $exclude[] =
$user->guid;
58 if ($count_friends(
$user)) {
63 if ($collection_id > 0) {
64 $this->
log(
"Created new friend collection for user {$user->getDisplayName()} [collection_id: {$collection_id}]");
67 $friends_limit = $this->
faker()->numberBetween(5, 10);
69 $friends_exclude = [
$user->guid];
70 while ($count_friends(
$user) < $friends_limit) {
79 $friends_exclude[] = $friend->guid;
81 if (
$user->addFriend($friend->guid,
true)) {
82 $this->
log(
"User {$user->getDisplayName()} [guid: {$user->guid}] friended user {$friend->getDisplayName()} [guid: {$friend->guid}]");
83 if ($this->
faker()->
boolean() && $collection_id > 0) {
101 'metadata_names' =>
'__faker',
108 $users->setIncrementOffset(
false);
110 foreach ($users as
$user) {
111 if ($user->delete()) {
112 $this->
log(
"Deleted user $user->guid");
114 $this->
log(
"Failed to delete user $user->guid");
log($msg, $level=LogLevel::NOTICE)
Log a message.
getRandomUser(array $exclude=[])
Returns random fake user.
createIcon(ElggEntity $entity)
Create an icon for an entity.
faker($locale= 'en_US')
Returns an instance of faker.
elgg_get_entities(array $options=[])
Fetches/counts entities or performs a calculation on their properties.
add_user_to_access_collection($user_guid, $collection_id)
Adds a user to an access collection.
create_access_collection($name, $owner_guid=0, $subtype=null)
Creates a new access collection.
createUser(array $attributes=[], array $metadata=[])
Create a new fake user.
advance($step=1)
Advance progressbar.
elgg_get_config($name, $default=null)
Get an Elgg configuration value.