Completed
Push — loadtest ( 49444c...a21f60 )
by Ilia
15:05
created

start.php ➔ generate_content_page_handler()   B

Complexity

Conditions 7
Paths 7

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 7
nc 7
nop 1
dl 0
loc 21
rs 8.6506
c 0
b 0
f 0
1
<?php
2
require('lib/createObjectsFunctions.php');
3
4
elgg_register_event_handler('init','system','loadtest_init');
5
6
function loadtest_init($event, $object_type, $object = null) {
7
    /* page handlers */
8
    // for generating random test content
9
    elgg_register_page_handler('gen-content', 'generate_content_page_handler');
10
11
    // for simulating page load - related system load
12
}
13
14
function generate_content_page_handler($params) {
15
    // generate content of type requested
16
    switch ($params[0]) {   // first parameter is the content type
17
        case 'blog':
18
        case 'blogs':
19
            createBlogs($params[1]);
20
            break;case 'blog':
21
        case 'wire':
22
            createWire($params[1]);
23
            break;
24
        case 'groups':
25
        case 'group':
26
            createGroups($params[1]);
27
            break;
28
        default:
29
            # nothing
30
            echo "usage:  .../gen-content/[blogs, bookmarks, discussions, groups, members, wire, files, polls, events, missions]/N  to create N random instances of that content type ";
31
            break;
32
    }
33
    return true;
34
}
35
36