|
@@ 3-51 (lines=49) @@
|
| 1 |
|
<?php |
| 2 |
|
|
| 3 |
|
function createBlogs($N) { |
| 4 |
|
if ($N < 1){ |
| 5 |
|
echo "usage: .../gen-content/blogs/N where N > 0 ... your N wasn't > 0 was it"; |
| 6 |
|
return 1; |
| 7 |
|
} |
| 8 |
|
$dbprefix = elgg_get_config('dbprefix'); |
| 9 |
|
// create N filler blogs quickly |
| 10 |
|
|
| 11 |
|
// entities |
| 12 |
|
$vals = array(); |
| 13 |
|
$subtype = get_subtype_id('object', 'blog'); |
| 14 |
|
$owner = get_data("select guid from {$dbprefix}users_entity limit 1"); // these will all belong to the first user we see |
| 15 |
|
$ownerid = $owner[0]->guid; |
| 16 |
|
$t_base = 150000000; |
| 17 |
|
|
| 18 |
|
$start_guid = get_data("select max(guid)+1 as start from {$dbprefix}entities")[0]->start; // get the max id to start from |
| 19 |
|
for ($i=$start_guid; $i < $start_guid + $N; $i++) { |
| 20 |
|
$timestamp = $t_base + $i; |
| 21 |
|
$vals[] = "('{$i}','object',$subtype,$ownerid,1,$ownerid,2,$timestamp,$timestamp,$timestamp,'yes',NULL)"; |
| 22 |
|
} |
| 23 |
|
$entityvals = implode(',', $vals); |
| 24 |
|
$entities = "INSERT INTO {$dbprefix}entities values {$entityvals}"; |
| 25 |
|
//echo $entities . "<br />\n<hr />"; |
| 26 |
|
echo insert_data($entities). "<br />\n<hr />"; |
| 27 |
|
|
| 28 |
|
// objects |
| 29 |
|
$vals = array(); |
| 30 |
|
for ($i=$start_guid; $i < $start_guid + $N; $i++) { |
| 31 |
|
$vals[] = "('{$i}','Super Blog ($i)','HI! TEST BLOG {$i} HERE! There are Literally {$N} of us!!!1!')"; |
| 32 |
|
} |
| 33 |
|
$objectvals = implode(',', $vals); |
| 34 |
|
$objects = "INSERT INTO {$dbprefix}objects_entity values {$objectvals}"; |
| 35 |
|
//echo $objects . "<br />\n<hr />"; |
| 36 |
|
echo insert_data($objects). "<br />\n<hr />"; |
| 37 |
|
|
| 38 |
|
// river |
| 39 |
|
$vals = array(); |
| 40 |
|
$start_id = get_data("select max(id) as start from {$dbprefix}river")[0]->start + 1; // get the max id to start from |
| 41 |
|
for ($i=$start_id; $i < $start_id + $N; $i++) { |
| 42 |
|
$guid = $i - $start_id + $start_guid; |
| 43 |
|
$timestamp = $t_base + $guid; // try to keep it the same as the timestamps in the entities table |
| 44 |
|
$vals[] = "('{$i}','object','blog','create',2,'river/object/blog/create','{$ownerid}','{$guid}',0,0,{$timestamp},'yes')"; |
| 45 |
|
} |
| 46 |
|
$rivervals = implode(',', $vals); |
| 47 |
|
$river = "INSERT INTO {$dbprefix}river values {$rivervals}"; |
| 48 |
|
//echo $river . "<br />\n<hr />"; |
| 49 |
|
echo insert_data($river). "<br />\n<hr />"; |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
function createWire($N) { |
| 53 |
|
if ($N < 1){ |
| 54 |
|
echo "usage: .../gen-content/wire/N where N > 0 ... your N wasn't > 0 was it"; |
|
@@ 52-99 (lines=48) @@
|
| 49 |
|
echo insert_data($river). "<br />\n<hr />"; |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
function createWire($N) { |
| 53 |
|
if ($N < 1){ |
| 54 |
|
echo "usage: .../gen-content/wire/N where N > 0 ... your N wasn't > 0 was it"; |
| 55 |
|
return 1; |
| 56 |
|
} |
| 57 |
|
$dbprefix = elgg_get_config('dbprefix'); |
| 58 |
|
// create N filler wire quickly |
| 59 |
|
|
| 60 |
|
// entities |
| 61 |
|
$vals = array(); |
| 62 |
|
$subtype = get_subtype_id('object', 'thewire'); |
| 63 |
|
$owner = get_data("select guid from {$dbprefix}users_entity limit 1"); // these will all belong to the first user we see |
| 64 |
|
$ownerid = $owner[0]->guid; |
| 65 |
|
$t_base = 150000000; |
| 66 |
|
|
| 67 |
|
$start_guid = get_data("select max(guid)+1 as start from {$dbprefix}entities")[0]->start; // get the max id to start from |
| 68 |
|
for ($i=$start_guid; $i < $start_guid + $N; $i++) { |
| 69 |
|
$timestamp = $t_base + $i; |
| 70 |
|
$vals[] = "('{$i}','object',$subtype,$ownerid,1,$ownerid,2,$timestamp,$timestamp,$timestamp,'yes',NULL)"; |
| 71 |
|
} |
| 72 |
|
$entityvals = implode(',', $vals); |
| 73 |
|
$entities = "INSERT INTO {$dbprefix}entities values {$entityvals}"; |
| 74 |
|
//echo $entities . "<br />\n<hr />"; |
| 75 |
|
echo insert_data($entities). "<br />\n<hr />"; |
| 76 |
|
|
| 77 |
|
// objects |
| 78 |
|
$vals = array(); |
| 79 |
|
for ($i=$start_guid; $i < $start_guid + $N; $i++) { |
| 80 |
|
$vals[] = "('{$i}','Super Wire post ($i)','HI! TEST WIRE POST {$i} HERE! There are Literally {$N} of us!!!1!')"; |
| 81 |
|
} |
| 82 |
|
$objectvals = implode(',', $vals); |
| 83 |
|
$objects = "INSERT INTO {$dbprefix}objects_entity values {$objectvals}"; |
| 84 |
|
//echo $objects . "<br />\n<hr />"; |
| 85 |
|
echo insert_data($objects). "<br />\n<hr />"; |
| 86 |
|
|
| 87 |
|
// river |
| 88 |
|
$vals = array(); |
| 89 |
|
$start_id = get_data("select max(id) as start from {$dbprefix}river")[0]->start + 1; // get the max id to start from |
| 90 |
|
for ($i=$start_id; $i < $start_id + $N; $i++) { |
| 91 |
|
$guid = $i - $start_id + $start_guid; |
| 92 |
|
$timestamp = $t_base + $guid; // try to keep it the same as the timestamps in the entities table |
| 93 |
|
$vals[] = "('{$i}','object','thewire','create',2,'river/object/thewire/create','{$ownerid}','{$guid}',0,0,{$timestamp},'yes')"; |
| 94 |
|
} |
| 95 |
|
$rivervals = implode(',', $vals); |
| 96 |
|
$river = "INSERT INTO {$dbprefix}river values {$rivervals}"; |
| 97 |
|
//echo $river . "<br />\n<hr />"; |
| 98 |
|
echo insert_data($river). "<br />\n<hr />"; |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
|
| 102 |
|
function createGroups($N) { |