Completed
Push — loadtest ( c81fa4 )
by Ilia
14:48
created

start.php ➔ generate_content_page_handler()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

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