| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                                                    
                                                                                                        
            
            
                | 3 |  | View Code Duplication | 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 |  | View Code Duplication | 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) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |     if ($N < 1){ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         echo "usage: .../gen-content/groups/N  where N > 0  ... your N wasn't > 0 was it"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |         return 1; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |     $dbprefix = elgg_get_config('dbprefix'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |     // create N filler groups quickly | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |     // entities | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |     $vals = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |     $owner = get_data("select guid from {$dbprefix}users_entity limit 1");      // these will all belong to the first user we see | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |     $ownerid = $owner[0]->guid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |     $t_base = 150000000; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |     $start_guid = get_data("select max(guid)+1 as start from {$dbprefix}entities")[0]->start;  // get the max id to start from | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |     for ($i=$start_guid; $i < $start_guid + $N; $i++) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |         $timestamp = $t_base + $i; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |         $vals[] = "('{$i}','group',0,$ownerid,1,$ownerid,2,$timestamp,$timestamp,$timestamp,'yes',NULL)"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |     $entityvals = implode(',', $vals); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |     $entities = "INSERT INTO {$dbprefix}entities values {$entityvals}"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |     //echo $entities . "<br />\n<hr />"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     echo insert_data($entities). "<br />\n<hr />"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |     // group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |     $vals = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |     for ($i=$start_guid; $i < $start_guid + $N; $i++) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |         $vals[] = "('{$i}','Super group ($i)','HI! TEST group {$i} HERE! There are Literally {$N} of us!!!1!')"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |     $objectvals = implode(',', $vals); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |     $objects = "INSERT INTO {$dbprefix}groups_entity values {$objectvals}"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |     //echo $objects . "<br />\n<hr />"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |     echo insert_data($objects). "<br />\n<hr />"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |     // river | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |     $vals = array(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |     $start_id = get_data("select max(id) as start from {$dbprefix}river")[0]->start + 1;  // get the max id to start from | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |     for ($i=$start_id; $i < $start_id + $N; $i++) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |         $guid = $i - $start_id + $start_guid; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |         $timestamp = $t_base + $guid;  // try to keep it the same as the timestamps in the entities table | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |         $vals[] = "('{$i}','group','','create',2,'river/group/create','{$ownerid}','{$guid}',0,0,{$timestamp},'yes')"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |     $rivervals = implode(',', $vals); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |     $river = "INSERT INTO {$dbprefix}river values {$rivervals}"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |     //echo $river . "<br />\n<hr />"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |     echo insert_data($river). "<br />\n<hr />"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 150 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 151 |  |  | function createUsers($N) { | 
            
                                                        
            
                                    
            
            
                | 152 |  |  |     if ($N < 1){ | 
            
                                                        
            
                                    
            
            
                | 153 |  |  |         echo "usage: .../gen-content/users/N  where N > 0  ... your N wasn't > 0 was it"; | 
            
                                                        
            
                                    
            
            
                | 154 |  |  |         return 1; | 
            
                                                        
            
                                    
            
            
                | 155 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 156 |  |  |     $dbprefix = elgg_get_config('dbprefix'); | 
            
                                                        
            
                                    
            
            
                | 157 |  |  |     // create N filler users quickly | 
            
                                                        
            
                                    
            
            
                | 158 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 159 |  |  |     // entities | 
            
                                                        
            
                                    
            
            
                | 160 |  |  |     $vals = array(); | 
            
                                                        
            
                                    
            
            
                | 161 |  |  |     $t_base = 150000000; | 
            
                                                        
            
                                    
            
            
                | 162 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 163 |  |  |     $start_guid = get_data("select max(guid)+1 as start from {$dbprefix}entities")[0]->start;  // get the max id to start from | 
            
                                                        
            
                                    
            
            
                | 164 |  |  |     for ($i=$start_guid; $i < $start_guid + $N; $i++) { | 
            
                                                        
            
                                    
            
            
                | 165 |  |  |         $timestamp = $t_base + $i; | 
            
                                                        
            
                                    
            
            
                | 166 |  |  |         $vals[] = "('{$i}','user',0,0,1,0,2,$timestamp,$timestamp,$timestamp,'yes',NULL)"; | 
            
                                                        
            
                                    
            
            
                | 167 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 168 |  |  |     $entityvals = implode(',', $vals); | 
            
                                                        
            
                                    
            
            
                | 169 |  |  |     $entities = "INSERT INTO {$dbprefix}entities values {$entityvals}"; | 
            
                                                        
            
                                    
            
            
                | 170 |  |  |     //echo $entities . "<br />\n<hr />"; | 
            
                                                        
            
                                    
            
            
                | 171 |  |  |     echo insert_data($entities). "<br />\n<hr />"; | 
            
                                                        
            
                                    
            
            
                | 172 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 173 |  |  |     // user | 
            
                                                        
            
                                    
            
            
                | 174 |  |  |     $vals = array(); | 
            
                                                        
            
                                    
            
            
                | 175 |  |  |     for ($i=$start_guid; $i < $start_guid + $N; $i++) { | 
            
                                                        
            
                                    
            
            
                | 176 |  |  |         $timestamp = $t_base + $i; | 
            
                                                        
            
                                    
            
            
                | 177 |  |  |         $vals[] = "('{$i}','Super user ($i)','Superuser($i)','','','','Superuser($i)@test.gccollab.ca','en','no','no',$timestamp,$timestamp,$timestamp,$timestamp)"; | 
            
                                                        
            
                                    
            
            
                | 178 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 179 |  |  |     $objectvals = implode(',', $vals); | 
            
                                                        
            
                                    
            
            
                | 180 |  |  |     $objects = "INSERT INTO {$dbprefix}users_entity values {$objectvals}"; | 
            
                                                        
            
                                    
            
            
                | 181 |  |  |     //echo $objects . "<br />\n<hr />"; | 
            
                                                        
            
                                    
            
            
                | 182 |  |  |     echo insert_data($objects). "<br />\n<hr />"; | 
            
                                                        
            
                                    
            
            
                | 183 |  |  |  | 
            
                                                        
            
                                    
            
            
                | 184 |  |  |     // other stuff | 
            
                                                        
            
                                    
            
            
                | 185 |  |  | } |