23 $count_blogs =
function () {
27 'metadata_names' =>
'__faker',
32 while ($count_blogs() < $this->limit) {
36 'comments_on' => $this->faker->boolean() ?
'On' :
'Off',
37 'excerpt' => $this->faker->sentence(),
50 if ($blog->status ==
'unsaved_draft' || $blog->status ==
'draft') {
51 $blog->future_access = $blog->access_id;
55 if ($blog->status ==
'published') {
57 'view' =>
'river/object/blog/create',
58 'action_type' =>
'create',
59 'subject_guid' => $blog->owner_guid,
60 'object_guid' => $blog->guid,
61 'target_guid' => $blog->container_guid,
67 if ($this->faker->boolean()) {
68 $blog->annotate(
'blog_auto_save', $this->faker->text(500),
ACCESS_PRIVATE, $blog->owner_guid);
71 if ($this->faker->boolean() && $blog->status !=
'unsaved_draft') {
72 $blog->annotate(
'blog_revision', $blog->description,
ACCESS_PRIVATE, $blog->owner_guid);
73 $blog->description = $this->faker->text(500);
88 'metadata_names' =>
'__faker',
95 $blogs->setIncrementOffset(
false);
97 foreach ($blogs as $blog) {
98 if ($blog->delete()) {
99 $this->
log(
"Deleted blog $blog->guid");
101 $this->
log(
"Failed to delete blog $blog->guid");
111 $key = array_rand($this->status, 1);
113 return $this->status[
$key];
log($msg, $level= 'NOTICE')
Log a message.
elgg_create_river_item(array $options=array())
Adds an item to the river.
elgg_trigger_event($event, $object_type, $object=null)
createObject(array $attributes=[], array $metadata=[])
Create a new faker object.
getRandomStatus()
Returns random blog status.