Ejemplo n.º 1
0
function send_content_intent($username)
{
    global $REMOTEWWWROOT;
    require_once get_config('docroot') . 'import/lib.php';
    list($user, $authinstance) = find_remote_user($username, $REMOTEWWWROOT);
    if (!$user) {
        throw new ImportException(null, "Could not find user {$username} for {$REMOTEWWWROOT}");
    }
    if (!is_executable(get_config('pathtounzip'))) {
        throw new ImportException(null, "Cannot find unzip executable");
    }
    if (!$authinstance->weimportcontent) {
        $e = new ImportException(null, 'Importing content is disabled');
        $e->set_log_off();
        // we don't want these ones.
        throw $e;
    }
    $queue = PluginImport::create_new_queue($user->id, null, $REMOTEWWWROOT, 0);
    return array('sendtype' => $queue->queue ? 'queue' : 'immediate', 'token' => $queue->token);
}