Example #1
0
function upgrade_RPC_functions($returnurl)
{
    global $CFG;
    $basedir = $CFG->dirroot . '/mod';
    if (file_exists($basedir) && filetype($basedir) == 'dir') {
        $dirhandle = opendir($basedir);
        while (false !== ($dir = readdir($dirhandle))) {
            $firstchar = substr($dir, 0, 1);
            if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
                continue;
            }
            if (filetype($basedir . '/' . $dir) != 'dir') {
                continue;
            }
            mnet_get_functions('mod', $dir);
        }
    }
    $basedir = $CFG->dirroot . '/auth';
    if (file_exists($basedir) && filetype($basedir) == 'dir') {
        $dirhandle = opendir($basedir);
        while (false !== ($dir = readdir($dirhandle))) {
            $firstchar = substr($dir, 0, 1);
            if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
                continue;
            }
            if (filetype($basedir . '/' . $dir) != 'dir') {
                continue;
            }
            mnet_get_functions('auth', $dir);
        }
    }
    $basedir = $CFG->dirroot . '/enrol';
    if (file_exists($basedir) && filetype($basedir) == 'dir') {
        $dirhandle = opendir($basedir);
        while (false !== ($dir = readdir($dirhandle))) {
            $firstchar = substr($dir, 0, 1);
            if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
                continue;
            }
            if (filetype($basedir . '/' . $dir) != 'dir') {
                continue;
            }
            mnet_get_functions('enrol', $dir);
        }
    }
    $basedir = $CFG->dirroot . '/local';
    if (file_exists($basedir) && filetype($basedir) == 'dir') {
        $dirhandle = opendir($basedir);
        while (false !== ($dir = readdir($dirhandle))) {
            $firstchar = substr($dir, 0, 1);
            if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
                continue;
            }
            if (filetype($basedir . '/' . $dir) != 'dir') {
                continue;
            }
            mnet_get_functions('local', $dir);
        }
    }
}
Example #2
0
function upgrade_RPC_functions()
{
    global $CFG;
    // TODO: rewrite this thing so that it:
    //         1/ does not include half the world
    //         2/ returns status if something upgraded - needed for proper conitnue button
    //         3/ upgrade functions in general should not use normal function calls to moodle core and modules
    $basedir = $CFG->dirroot . '/mod';
    if (file_exists($basedir) && filetype($basedir) == 'dir') {
        $dirhandle = opendir($basedir);
        while (false !== ($dir = readdir($dirhandle))) {
            $firstchar = substr($dir, 0, 1);
            if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
                continue;
            }
            if (filetype($basedir . '/' . $dir) != 'dir') {
                continue;
            }
            mnet_get_functions('mod', $dir);
        }
    }
    $basedir = $CFG->dirroot . '/auth';
    if (file_exists($basedir) && filetype($basedir) == 'dir') {
        $dirhandle = opendir($basedir);
        while (false !== ($dir = readdir($dirhandle))) {
            $firstchar = substr($dir, 0, 1);
            if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
                continue;
            }
            if (filetype($basedir . '/' . $dir) != 'dir') {
                continue;
            }
            mnet_get_functions('auth', $dir);
        }
    }
    $basedir = $CFG->dirroot . '/enrol';
    if (file_exists($basedir) && filetype($basedir) == 'dir') {
        $dirhandle = opendir($basedir);
        while (false !== ($dir = readdir($dirhandle))) {
            $firstchar = substr($dir, 0, 1);
            if ($firstchar == '.' or $dir == 'CVS' or $dir == '_vti_cnf') {
                continue;
            }
            if (filetype($basedir . '/' . $dir) != 'dir') {
                continue;
            }
            mnet_get_functions('enrol', $dir);
        }
    }
    if ($plugins = get_list_of_plugins('portfolio/type')) {
        foreach ($plugins as $p) {
            mnet_get_functions('portfolio', $p);
        }
    }
    if ($plugins = get_list_of_plugins('repository')) {
        foreach ($plugins as $p) {
            mnet_get_functions('repository', $p);
        }
    }
}