mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Event socket bug fix and more docs (#6823)
* Add documentation to methods. Use is_resource for added type detection * Allow connect to specify timeout in microseconds with default 30,000 * Update calling mechanism for event sockets * Update project for new singleton event sockets * remove unused variable * catch errors on closing the socket
This commit is contained in:
@@ -29,29 +29,39 @@
|
||||
//includes files
|
||||
require_once __DIR__ . "/require.php";
|
||||
|
||||
/**
|
||||
* Returns an fp connector from an event socket.
|
||||
* This has been replaced with event_socket::create() method and using the
|
||||
* socket directly is preferred.
|
||||
* @param string $host
|
||||
* @param string $port
|
||||
* @param string $password
|
||||
* @return true Returns true if successful connection and false if there is a failure
|
||||
* @deprecated since version 5.1.11
|
||||
*/
|
||||
function event_socket_create($host = null, $port = null, $password = null) {
|
||||
$esl = new event_socket;
|
||||
if ($esl->connect($host, $port, $password)) {
|
||||
return $esl->reset_fp();
|
||||
}
|
||||
return false;
|
||||
$esl = event_socket::create($host = null, $port = null, $password = null);
|
||||
return ($esl !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a request on the event socket
|
||||
* @param null $fp No longer used
|
||||
* @param string $cmd Command to use
|
||||
* @return string|false Response of the server or false if failed
|
||||
*/
|
||||
function event_socket_request($fp, $cmd) {
|
||||
$esl = new event_socket($fp);
|
||||
$result = $esl->request($cmd);
|
||||
$esl->reset_fp();
|
||||
return $result;
|
||||
return event_socket::command($cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes a request on the event socket
|
||||
* @param type $fp
|
||||
* @param type $cmd
|
||||
* @return type
|
||||
*/
|
||||
function event_socket_request_cmd($cmd) {
|
||||
$esl = new event_socket;
|
||||
if (!$esl->connect()) {
|
||||
return false;
|
||||
}
|
||||
$response = $esl->request($cmd);
|
||||
$esl->close();
|
||||
return $response;
|
||||
return event_socket::command($cmd);
|
||||
}
|
||||
|
||||
function remove_config_from_cache($name) {
|
||||
|
||||
Reference in New Issue
Block a user