示例#1
0
            // Double-hyphen switch
            $DAEMON->cli_switch(strtolower(substr($switch, 2)), $params);
        } else {
            if (substr($switch, 0, 1) == '-') {
                // Single-hyphen switch(es), may be more than one run together
                $switch = substr($switch, 1);
                // Get rid of the -
                $len = strlen($switch);
                for ($j = 0; $j < $len; ++$j) {
                    $DAEMON->cli_switch(strtolower(substr($switch, $j, 1)), $params);
                }
            }
        }
    }
}
if (!$DAEMON->query_start()) {
    // For some reason we didn't start, so print out some info
    echo 'Starts the Moodle chat socket server on port ' . $CFG->chat_serverport;
    echo "\n\n";
    echo "Usage: chatd.php [parameters]\n\n";
    echo "Parameters:\n";
    echo "  --start         Starts the daemon\n";
    echo "  -v              Verbose mode (prints trivial information messages)\n";
    echo "  -l [logfile]    Log all messages to logfile (if not specified, chatd.log)\n";
    echo "Example:\n";
    echo "  chatd.php --start -l\n\n";
    die;
}
if (!function_exists('socket_set_option')) {
    echo "Error: Function socket_set_option() does not exist.\n";
    echo "Possibly PHP has not been compiled with --enable-sockets.\n\n";
示例#2
0
            // Double-hyphen switch.
            $daemon->cli_switch(strtolower(substr($switch, 2)), $params);
        } else {
            if (substr($switch, 0, 1) == '-') {
                // Single-hyphen switch(es), may be more than one run together.
                $switch = substr($switch, 1);
                // Get rid of the "-".
                $len = strlen($switch);
                for ($j = 0; $j < $len; ++$j) {
                    $daemon->cli_switch(strtolower(substr($switch, $j, 1)), $params);
                }
            }
        }
    }
}
if (!$daemon->query_start()) {
    // For some reason we didn't start, so print out some info.
    echo 'Starts the Moodle chat socket server on port ' . $CFG->chat_serverport;
    echo "\n\n";
    echo "Usage: chatd.php [parameters]\n\n";
    echo "Parameters:\n";
    echo "  --start         Starts the daemon\n";
    echo "  -v              Verbose mode (prints trivial information messages)\n";
    echo "  -l [logfile]    Log all messages to logfile (if not specified, chatd.log)\n";
    echo "Example:\n";
    echo "  chatd.php --start -l\n\n";
    die;
}
if (!function_exists('socket_set_option')) {
    echo "Error: Function socket_set_option() does not exist.\n";
    echo "Possibly PHP has not been compiled with --enable-sockets.\n\n";