function make_students($courseid, $count)
{
    print "<h3>Making {$count} students</h3><pre>";
    $time = time();
    forum_utils::start_transaction();
    for ($i = 0; $i < $count; $i++) {
        make_student($courseid, $time . '_' . $i);
        print '.';
        if (($i + 1) % 20 == 0) {
            print " (" . ($i + 1) . ")\n";
        }
        flush();
    }
    forum_utils::finish_transaction();
    print "</pre>";
}
Example #2
0
function make_students($courseid, $count)
{
    print "<h3>Making {$count} students</h3><pre>";
    $time = time();
    $transaction = $DB->start_delegated_transaction();
    for ($i = 0; $i < $count; $i++) {
        make_student($courseid, $time . '_' . $i);
        print '.';
        if (($i + 1) % 20 == 0) {
            print " (" . ($i + 1) . ")\n";
        }
        flush();
    }
    $transaction->allow_commit();
    print "</pre>";
}