php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #64120
Patch php-gearman-1.1.2.patch revision 2014-08-07 03:48 UTC by chjgcn at gmail dot com
Patch gearman-1.1.2.patch revision 2014-08-04 14:50 UTC by chjgcn at gmail dot com

Patch php-gearman-1.1.2.patch for gearman Bug #64120

Patch version 2014-08-07 03:48 UTC

Return to Bug #64120 | Download this patch
Patch Revisions:

Developer: chjgcn@gmail.com

--- php_gearman.c	2013-08-29 13:03:54.000000000 +0800
+++ php_gearman.c	2014-08-07 01:43:18.268836170 +0800
@@ -378,6 +378,21 @@
 	ZEND_ARG_INFO(0, timeout)
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_client_set_ssl, 0, 0, 2)
+	ZEND_ARG_INFO(0, client_object)
+	ZEND_ARG_INFO(0, ssl)
+	ZEND_ARG_INFO(0, ca_file)
+	ZEND_ARG_INFO(0, certificate)
+	ZEND_ARG_INFO(0, key_file)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_set_ssl, 0, 0, 1)
+	ZEND_ARG_INFO(0, ssl)
+	ZEND_ARG_INFO(0, ca_file)
+	ZEND_ARG_INFO(0, certificate)
+	ZEND_ARG_INFO(0, key_file)
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_client_add_server, 0, 0, 3)
 	ZEND_ARG_INFO(0, client_object)
 	ZEND_ARG_INFO(0, host)
@@ -510,6 +525,51 @@
 	ZEND_ARG_INFO(0, unique)
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_client_do_epoch, 0, 0, 4)
+	ZEND_ARG_INFO(0, client_object)
+	ZEND_ARG_INFO(0, function_name)
+	ZEND_ARG_INFO(0, workload)
+	ZEND_ARG_INFO(0, when)
+	ZEND_ARG_INFO(0, unique)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_do_epoch, 0, 0, 3)
+	ZEND_ARG_INFO(0, function_name)
+	ZEND_ARG_INFO(0, workload)
+	ZEND_ARG_INFO(0, when)
+	ZEND_ARG_INFO(0, unique)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_client_do_high_epoch, 0, 0, 4)
+	ZEND_ARG_INFO(0, client_object)
+	ZEND_ARG_INFO(0, function_name)
+	ZEND_ARG_INFO(0, workload)
+	ZEND_ARG_INFO(0, when)
+	ZEND_ARG_INFO(0, unique)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_do_high_epoch, 0, 0, 3)
+	ZEND_ARG_INFO(0, function_name)
+	ZEND_ARG_INFO(0, workload)
+	ZEND_ARG_INFO(0, when)
+	ZEND_ARG_INFO(0, unique)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_client_do_low_epoch, 0, 0, 4)
+	ZEND_ARG_INFO(0, client_object)
+	ZEND_ARG_INFO(0, function_name)
+	ZEND_ARG_INFO(0, workload)
+	ZEND_ARG_INFO(0, when)
+	ZEND_ARG_INFO(0, unique)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_do_low_epoch, 0, 0, 3)
+	ZEND_ARG_INFO(0, function_name)
+	ZEND_ARG_INFO(0, workload)
+	ZEND_ARG_INFO(0, when)
+	ZEND_ARG_INFO(0, unique)
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_client_job_status, 0, 0, 2)
 	ZEND_ARG_INFO(0, client_object)
 	ZEND_ARG_INFO(0, job_handle)
@@ -636,6 +696,57 @@
 	ZEND_ARG_INFO(0, unique)
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_client_add_task_epoch, 0, 0, 4)
+	ZEND_ARG_INFO(0, client_object)
+	ZEND_ARG_INFO(0, function_name)
+	ZEND_ARG_INFO(0, workload)
+	ZEND_ARG_INFO(0, when)
+	ZEND_ARG_INFO(0, context)
+	ZEND_ARG_INFO(0, unique)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_add_task_epoch, 0, 0, 3)
+	ZEND_ARG_INFO(0, function_name)
+	ZEND_ARG_INFO(0, workload)
+	ZEND_ARG_INFO(0, when)
+	ZEND_ARG_INFO(0, context)
+	ZEND_ARG_INFO(0, unique)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_client_add_task_high_epoch, 0, 0, 4)
+	ZEND_ARG_INFO(0, client_object)
+	ZEND_ARG_INFO(0, function_name)
+	ZEND_ARG_INFO(0, workload)
+	ZEND_ARG_INFO(0, when)
+	ZEND_ARG_INFO(0, context)
+	ZEND_ARG_INFO(0, unique)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_add_task_high_epoch, 0, 0, 3)
+	ZEND_ARG_INFO(0, function_name)
+	ZEND_ARG_INFO(0, workload)
+	ZEND_ARG_INFO(0, when)
+	ZEND_ARG_INFO(0, context)
+	ZEND_ARG_INFO(0, unique)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_client_add_task_low_epoch, 0, 0, 4)
+	ZEND_ARG_INFO(0, client_object)
+	ZEND_ARG_INFO(0, function_name)
+	ZEND_ARG_INFO(0, workload)
+	ZEND_ARG_INFO(0, when)
+	ZEND_ARG_INFO(0, context)
+	ZEND_ARG_INFO(0, unique)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_client_add_task_low_epoch, 0, 0, 3)
+	ZEND_ARG_INFO(0, function_name)
+	ZEND_ARG_INFO(0, workload)
+	ZEND_ARG_INFO(0, when)
+	ZEND_ARG_INFO(0, context)
+	ZEND_ARG_INFO(0, unique)
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_client_add_task_status, 0, 0, 2)
 	ZEND_ARG_INFO(0, client_object)
 	ZEND_ARG_INFO(0, job_handle)
@@ -751,7 +862,7 @@
 ZEND_END_ARG_INFO()
 
 /*
- * Gearman Worker arginvo
+ * Gearman Worker arginfo
  */
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_worker_return_code, 0, 0, 1)
@@ -835,6 +946,21 @@
 	ZEND_ARG_INFO(0, timeout)
 ZEND_END_ARG_INFO()
 
+ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_worker_set_ssl, 0, 0, 2)
+	ZEND_ARG_INFO(0, worker_object)
+	ZEND_ARG_INFO(0, ssl)
+	ZEND_ARG_INFO(0, ca_file)
+	ZEND_ARG_INFO(0, certificate)
+	ZEND_ARG_INFO(0, key_file)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(arginfo_oo_gearman_worker_set_ssl, 0, 0, 1)
+	ZEND_ARG_INFO(0, ssl)
+	ZEND_ARG_INFO(0, ca_file)
+	ZEND_ARG_INFO(0, certificate)
+	ZEND_ARG_INFO(0, key_file)
+ZEND_END_ARG_INFO()
+
 ZEND_BEGIN_ARG_INFO_EX(arginfo_gearman_worker_set_id, 0, 0, 2)
 	ZEND_ARG_INFO(0, worker_object)
 	ZEND_ARG_INFO(0, id)
@@ -1889,6 +2015,41 @@
 }
 /* }}} */
 
+/* {{{ proto void gearman_client_set_ssl(object client, constant timeout, constant ca_file,
+										 constant certificate, constant key_file)
+   Set SSL for a client structure. */
+PHP_FUNCTION(gearman_client_set_ssl) {
+	zval *zobj;
+	gearman_client_obj *obj;
+	bool ssl = false;
+	char *ca_file = NULL;
+	char *certificate = NULL;
+	char *key_file = NULL;
+	int ca_file_len = 0;
+	int certificate_len = 0;
+	int key_file_len = 0;
+
+	GEARMAN_ZPMP(RETURN_NULL(), "b|sss", &zobj, gearman_client_ce,
+				&ssl,
+				&ca_file, &ca_file_len,
+				&certificate, &certificate_len,
+				&key_file, &key_file_len)
+
+	if (ca_file == NULL) {
+		cfg_get_string("gearman.ssl_ca_file", &ca_file);
+	}
+	if (certificate == NULL) {
+		cfg_get_string("gearman.ssl_certificate", &certificate);
+	}
+	if (key_file == NULL) {
+		cfg_get_string("gearman.ssl_key_file", &key_file);
+	}
+
+	gearman_client_set_ssl(&(obj->client), ssl, ca_file, certificate, key_file);
+	RETURN_TRUE;
+}
+/* }}} */
+
 /* {{{ proto bool gearman_client_add_server(object client [, string host [, int port]])
    Add a job server to a client. This goes into a list of servers than can be used to run tasks. No socket I/O happens here, it is just added to a list. */
 PHP_FUNCTION(gearman_client_add_server) {
@@ -1908,10 +2069,6 @@
 		RETURN_FALSE;
 	}
 
-	if (!gearman_client_set_server_option(&(obj->client), "exceptions", (sizeof("exceptions") - 1))) {
-	    GEARMAN_EXCEPTION("Failed to set exception option", 0);
-	}
-
 	RETURN_TRUE;
 }
 /* }}} */
@@ -1934,10 +2091,6 @@
 		RETURN_FALSE;
 	}
 
-	if (!gearman_client_set_server_option(&(obj->client), "exceptions", (sizeof("exceptions") - 1))) {
-	    GEARMAN_EXCEPTION("Failed to set exception option", 0);
-	}
-
 	RETURN_TRUE;
 }
 /* }}} */
@@ -2234,6 +2387,150 @@
 }
 /* }}} */
 
+/* {{{ proto string gearman_client_do_epoch(object client, string function, string workload, int when [, string unique ])
+   Run a task in the background. */
+PHP_FUNCTION(gearman_client_do_epoch) {
+	zval *zobj;
+	gearman_client_obj *obj;
+	char *function_name;
+	int function_name_len;
+	char *workload;
+	int workload_len;
+	char *unique= NULL;
+	int unique_len= 0;
+	char *job_handle;
+	int64_t when;
+	int64_t now;
+
+	GEARMAN_ZPMP(RETURN_NULL(), "ssl|s", &zobj, gearman_client_ce, 
+				 &function_name, &function_name_len, 
+				 &workload, &workload_len, &when, &unique, &unique_len)
+
+	job_handle= emalloc(GEARMAN_JOB_HANDLE_SIZE);
+
+	/* if 'when' since the Epoch is less than 1 year, we consider it as senconds by now. */
+	when = llabs(when);
+	while (when < 3600 * 366) {
+		if ((now = time(NULL)) != -1) {
+			when += now;
+		}
+	}
+
+	obj->ret= gearman_client_do_epoch(&(obj->client), (char *)function_name,
+									  (char *)unique, (void *)workload,
+									  (size_t)workload_len, when, job_handle);
+	if (! PHP_GEARMAN_CLIENT_RET_OK(obj->ret)) {
+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",
+						 gearman_client_error(&(obj->client)));
+		efree(job_handle);
+		RETURN_EMPTY_STRING();
+	}
+
+	if (! job_handle) {
+		efree(job_handle);
+		RETURN_EMPTY_STRING();
+	}
+
+	RETURN_STRING(job_handle, 0);
+}
+/* }}} */
+
+/* {{{ proto string gearman_client_do_high_epoch(object client, string function, string workload, int when [, string unique ])
+   Run a task in the background. */
+PHP_FUNCTION(gearman_client_do_high_epoch) {
+	zval *zobj;
+	gearman_client_obj *obj;
+	char *function_name;
+	int function_name_len;
+	char *workload;
+	int workload_len;
+	char *unique= NULL;
+	int unique_len= 0;
+	char *job_handle;
+	int64_t when;
+	int64_t now;
+
+	GEARMAN_ZPMP(RETURN_NULL(), "ssl|s", &zobj, gearman_client_ce, 
+				 &function_name, &function_name_len, 
+				 &workload, &workload_len, &when, &unique, &unique_len)
+
+	job_handle= emalloc(GEARMAN_JOB_HANDLE_SIZE);
+
+	/* if 'when' since the Epoch is less than 1 year, we consider it as senconds by now. */
+	when = llabs(when);
+	while (when < 3600 * 366) {
+		if ((now = time(NULL)) != -1) {
+			when += now;
+		}
+	}
+
+	obj->ret= gearman_client_do_high_epoch(&(obj->client), (char *)function_name,
+										   (char *)unique, (void *)workload,
+										   (size_t)workload_len, when, job_handle);
+	if (! PHP_GEARMAN_CLIENT_RET_OK(obj->ret)) {
+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",
+						 gearman_client_error(&(obj->client)));
+		efree(job_handle);
+		RETURN_EMPTY_STRING();
+	}
+
+	if (! job_handle) {
+		efree(job_handle);
+		RETURN_EMPTY_STRING();
+	}
+
+	RETURN_STRING(job_handle, 0);
+}
+/* }}} */
+
+/* {{{ proto string gearman_client_do_low_epoch(object client, string function, string workload, int when [, string unique ])
+   Run a task in the background. */
+PHP_FUNCTION(gearman_client_do_low_epoch) {
+	zval *zobj;
+	gearman_client_obj *obj;
+	char *function_name;
+	int function_name_len;
+	char *workload;
+	int workload_len;
+	char *unique= NULL;
+	int unique_len= 0;
+	char *job_handle;
+	int64_t when;
+	int64_t now;
+
+	GEARMAN_ZPMP(RETURN_NULL(), "ssl|s", &zobj, gearman_client_ce, 
+				 &function_name, &function_name_len, 
+				 &workload, &workload_len, &when, &unique, &unique_len)
+
+	job_handle= emalloc(GEARMAN_JOB_HANDLE_SIZE);
+
+	/* if 'when' since the Epoch is less than 1 year, we consider it as senconds by now. */
+	when = llabs(when);
+	while (when < 3600 * 366) {
+		if ((now = time(NULL)) != -1) {
+			when += now;
+		}
+	}
+
+	obj->ret= gearman_client_do_low_epoch(&(obj->client), (char *)function_name,
+										  (char *)unique, (void *)workload,
+										  (size_t)workload_len, when, job_handle);
+	if (! PHP_GEARMAN_CLIENT_RET_OK(obj->ret)) {
+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",
+						 gearman_client_error(&(obj->client)));
+		efree(job_handle);
+		RETURN_EMPTY_STRING();
+	}
+
+	if (! job_handle) {
+		efree(job_handle);
+		RETURN_EMPTY_STRING();
+	}
+
+	RETURN_STRING(job_handle, 0);
+}
+/* }}} */
+
 /* {{{ proto array gearman_client_job_status(object client, string job_handle)
    Get the status for a backgound job. */
 PHP_FUNCTION(gearman_client_job_status) {
@@ -2647,6 +2944,198 @@
 }
 /* }}} */
 
+/* {{{ proto object gearman_client_add_task_epoch(object client, string function, zval workload, time_t when [, zval context, string unique ])
+   Add a background task to be run in parallel. */
+PHP_FUNCTION(gearman_client_add_task_epoch) {
+	zval *zobj;
+	zval *zworkload;
+	zval *zdata= NULL;
+	gearman_client_obj *obj;
+	gearman_task_obj *task;
+
+	char *unique= NULL;
+	char *function_name;
+	int unique_len= 0;
+	int function_name_len= 0;
+	int64_t when;
+	int64_t now;
+
+	GEARMAN_ZPMP(RETURN_NULL(), "szl|zs", &zobj, gearman_client_ce, 
+				 &function_name, &function_name_len, &zworkload,
+				 &when, &zdata, &unique, &unique_len)
+
+	/* get a task object, and prepare it for return */
+	Z_TYPE_P(return_value)= IS_OBJECT;
+	object_init_ex(return_value, gearman_task_ce);
+	task= zend_object_store_get_object(return_value TSRMLS_CC);
+
+	if (zdata) {
+		/* add zdata tothe task object and pass the task object via context
+		 * task->client= zobj; */
+		task->zdata= zdata;
+		Z_ADDREF_P(zdata);
+	}
+
+	/* store our workload and add ref so it wont go away on us */
+	task->zworkload= zworkload;
+	Z_ADDREF_P(zworkload);
+	/* need to store a ref to the client for later access to cb's */
+	task->zclient= zobj;
+	Z_ADDREF_P(zobj);
+	task->client= &obj->client;
+
+	/* if 'when' since the Epoch is less than 1 year, we consider it as senconds by now. */
+	when = llabs(when);
+	while (when < 3600 * 366) {
+		if ((now = time(NULL)) != -1) {
+			when += now;
+		}
+	}
+
+	/* add the task */
+	task->task= gearman_client_add_task_epoch(&(obj->client), task->task, 
+												(void *)task, function_name, 
+												unique, Z_STRVAL_P(zworkload),
+												(size_t)Z_STRLEN_P(zworkload),
+												when,
+												&obj->ret);
+	if (obj->ret != GEARMAN_SUCCESS) {
+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",
+						 gearman_client_error(&(obj->client)));
+		RETURN_FALSE;
+	}
+	task->flags |= GEARMAN_TASK_OBJ_CREATED;
+}
+/* }}} */
+
+/* {{{ proto object gearman_client_add_task_high_epoch(object client, string function, zval workload, time_t when [, zval context, string unique ])
+   Add a background task to be run in parallel. */
+PHP_FUNCTION(gearman_client_add_task_high_epoch) {
+	zval *zobj;
+	zval *zworkload;
+	zval *zdata= NULL;
+	gearman_client_obj *obj;
+	gearman_task_obj *task;
+
+	char *unique= NULL;
+	char *function_name;
+	int unique_len= 0;
+	int function_name_len= 0;
+	int64_t when;
+	int64_t now;
+
+	GEARMAN_ZPMP(RETURN_NULL(), "szl|zs", &zobj, gearman_client_ce, 
+				 &function_name, &function_name_len, &zworkload,
+				 &when, &zdata, &unique, &unique_len)
+
+	/* get a task object, and prepare it for return */
+	Z_TYPE_P(return_value)= IS_OBJECT;
+	object_init_ex(return_value, gearman_task_ce);
+	task= zend_object_store_get_object(return_value TSRMLS_CC);
+
+	if (zdata) {
+		/* add zdata tothe task object and pass the task object via context
+		 * task->client= zobj; */
+		task->zdata= zdata;
+		Z_ADDREF_P(zdata);
+	}
+
+	/* store our workload and add ref so it wont go away on us */
+	task->zworkload= zworkload;
+	Z_ADDREF_P(zworkload);
+	/* need to store a ref to the client for later access to cb's */
+	task->zclient= zobj;
+	Z_ADDREF_P(zobj);
+	task->client= &obj->client;
+
+	/* if 'when' since the Epoch is less than 1 year, we consider it as senconds by now. */
+	when = llabs(when);
+	while (when < 3600 * 366) {
+		if ((now = time(NULL)) != -1) {
+			when += now;
+		}
+	}
+
+	/* add the task */
+	task->task= gearman_client_add_task_high_epoch(&(obj->client), task->task, 
+												(void *)task, function_name, 
+												unique, Z_STRVAL_P(zworkload),
+												(size_t)Z_STRLEN_P(zworkload),
+												when,
+												&obj->ret);
+	if (obj->ret != GEARMAN_SUCCESS) {
+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",
+						 gearman_client_error(&(obj->client)));
+		RETURN_FALSE;
+	}
+	task->flags |= GEARMAN_TASK_OBJ_CREATED;
+}
+/* }}} */
+
+/* {{{ proto object gearman_client_add_task_low_epoch(object client, string function, zval workload, time_t when [, zval context, string unique ])
+   Add a background task to be run in parallel. */
+PHP_FUNCTION(gearman_client_add_task_low_epoch) {
+	zval *zobj;
+	zval *zworkload;
+	zval *zdata= NULL;
+	gearman_client_obj *obj;
+	gearman_task_obj *task;
+
+	char *unique= NULL;
+	char *function_name;
+	int unique_len= 0;
+	int function_name_len= 0;
+	int64_t when;
+	int64_t now;
+
+	GEARMAN_ZPMP(RETURN_NULL(), "szl|zs", &zobj, gearman_client_ce, 
+				 &function_name, &function_name_len, &zworkload,
+				 &when, &zdata, &unique, &unique_len)
+
+	/* get a task object, and prepare it for return */
+	Z_TYPE_P(return_value)= IS_OBJECT;
+	object_init_ex(return_value, gearman_task_ce);
+	task= zend_object_store_get_object(return_value TSRMLS_CC);
+
+	if (zdata) {
+		/* add zdata tothe task object and pass the task object via context
+		 * task->client= zobj; */
+		task->zdata= zdata;
+		Z_ADDREF_P(zdata);
+	}
+
+	/* store our workload and add ref so it wont go away on us */
+	task->zworkload= zworkload;
+	Z_ADDREF_P(zworkload);
+	/* need to store a ref to the client for later access to cb's */
+	task->zclient= zobj;
+	Z_ADDREF_P(zobj);
+	task->client= &obj->client;
+
+	/* if 'when' since the Epoch is less than 1 year, we consider it as senconds by now. */
+	when = llabs(when);
+	while (when < 3600 * 366) {
+		if ((now = time(NULL)) != -1) {
+			when += now;
+		}
+	}
+
+	/* add the task */
+	task->task= gearman_client_add_task_low_epoch(&(obj->client), task->task, 
+												(void *)task, function_name, 
+												unique, Z_STRVAL_P(zworkload),
+												(size_t)Z_STRLEN_P(zworkload),
+												when,
+												&obj->ret);
+	if (obj->ret != GEARMAN_SUCCESS) {
+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s",
+						 gearman_client_error(&(obj->client)));
+		RETURN_FALSE;
+	}
+	task->flags |= GEARMAN_TASK_OBJ_CREATED;
+}
+/* }}} */
+
 /* this function is used to request status information from the gearmand
  * server. it will then call you pre_defined status callback, passing
  * zdata/context to it */
@@ -3055,6 +3544,12 @@
 	obj->zexception_fn= zexception_fn;
 	Z_ADDREF_P(zexception_fn);
 
+	if (!gearman_client_has_option(&(obj->client), GEARMAN_CLIENT_EXCEPTION)) {
+		if (!gearman_client_set_server_option(&(obj->client), "exceptions", (sizeof("exceptions") - 1))) {
+			GEARMAN_EXCEPTION("Failed to set exception option", 0);
+		}
+	}
+
 	/* set the callback for php */
 	gearman_client_set_exception_fn(&(obj->client), _php_task_exception_fn);
 
@@ -3348,6 +3843,41 @@
 }
 /* }}} */
 
+/* {{{ proto void gearman_worker_set_ssl(object worker, constant timeout, constant ca_file,
+										 constant certificate, constant key_file)
+   Set SSL for a worker structure. */
+PHP_FUNCTION(gearman_worker_set_ssl) {
+	zval *zobj;
+	gearman_worker_obj *obj;
+	bool ssl = false;
+	char *ca_file = NULL;
+	char *certificate = NULL;
+	char *key_file = NULL;
+	int ca_file_len = 0;
+	int certificate_len = 0;
+	int key_file_len = 0;
+
+	GEARMAN_ZPMP(RETURN_NULL(), "b|sss", &zobj, gearman_worker_ce,
+				 &ssl,
+				 &ca_file, &ca_file_len,
+				 &certificate, &certificate_len,
+				 &key_file, &key_file_len)
+
+	if (ca_file == NULL) {
+		cfg_get_string("gearman.ssl_ca_file", &ca_file);
+	}
+	if (certificate == NULL) {
+		cfg_get_string("gearman.ssl_certificate", &certificate);
+	}
+	if (key_file == NULL) {
+		cfg_get_string("gearman.ssl_key_file", &key_file);
+	}
+
+	gearman_worker_set_ssl(&(obj->worker), ssl, ca_file, certificate, key_file);
+	RETURN_TRUE;
+}
+/* }}} */
+
 /* {{{ proto void gearman_worker_set_id(object worker, string id)
    Set id for a worker structure. */
 PHP_FUNCTION(gearman_worker_set_id) {
@@ -3385,10 +3915,6 @@
 		RETURN_FALSE;
 	}
 
-	if (! gearman_worker_set_server_option(&(obj->worker), "exceptions", (sizeof("exceptions") - 1))) {
-		GEARMAN_EXCEPTION("Failed to set exception option", 0);
-	}
-
 	RETURN_TRUE;
 }
 /* }}} */
@@ -3411,10 +3937,6 @@
 		RETURN_FALSE;
 	}
 
-	if (! gearman_worker_set_server_option(&(obj->worker), "exceptions", (sizeof("exceptions") - 1))) {
-		GEARMAN_EXCEPTION("Failed to set exception option", 0);
-	}
-
 	RETURN_TRUE;
 }
 /* }}} */
@@ -4107,6 +4629,7 @@
 	PHP_FE(gearman_client_remove_options, arginfo_gearman_client_remove_options)
 	PHP_FE(gearman_client_timeout, arginfo_gearman_client_timeout)
 	PHP_FE(gearman_client_set_timeout, arginfo_gearman_client_set_timeout)
+	PHP_FE(gearman_client_set_ssl, arginfo_gearman_client_set_ssl)
 	PHP_FE(gearman_client_context, arginfo_gearman_client_context)
 	PHP_FE(gearman_client_set_context, arginfo_gearman_client_set_context)
 #if jluedke_0
@@ -4128,6 +4651,9 @@
 	PHP_FE(gearman_client_do_background, arginfo_gearman_client_do_background)
 	PHP_FE(gearman_client_do_high_background, arginfo_gearman_client_do_high_background)
 	PHP_FE(gearman_client_do_low_background, arginfo_gearman_client_do_low_background)
+	PHP_FE(gearman_client_do_epoch, arginfo_gearman_client_do_epoch)
+	PHP_FE(gearman_client_do_high_epoch, arginfo_gearman_client_do_high_epoch)
+	PHP_FE(gearman_client_do_low_epoch, arginfo_gearman_client_do_low_epoch)
 	PHP_FE(gearman_client_job_status, arginfo_gearman_client_job_status)
 	PHP_FE(gearman_client_job_status_by_unique_key, arginfo_gearman_client_job_status_by_unique_key)
 	PHP_FE(gearman_client_echo, arginfo_gearman_client_echo)
@@ -4142,6 +4668,9 @@
 	PHP_FE(gearman_client_add_task_background, arginfo_gearman_client_add_task_background)
 	PHP_FE(gearman_client_add_task_high_background, arginfo_gearman_client_add_task_high_background)
 	PHP_FE(gearman_client_add_task_low_background, arginfo_gearman_client_add_task_low_background)
+	PHP_FE(gearman_client_add_task_epoch, arginfo_gearman_client_add_task_epoch)
+	PHP_FE(gearman_client_add_task_high_epoch, arginfo_gearman_client_add_task_high_epoch)
+	PHP_FE(gearman_client_add_task_low_epoch, arginfo_gearman_client_add_task_low_epoch)
 	PHP_FE(gearman_client_add_task_status, arginfo_gearman_client_add_task_status)
 	PHP_FE(gearman_client_set_workload_fn, arginfo_gearman_client_set_workload_fn)
 	PHP_FE(gearman_client_set_created_fn, arginfo_gearman_client_set_created_fn)
@@ -4184,6 +4713,7 @@
 	PHP_FE(gearman_worker_remove_options, arginfo_gearman_worker_remove_options)
 	PHP_FE(gearman_worker_timeout, arginfo_gearman_worker_timeout)
 	PHP_FE(gearman_worker_set_timeout, arginfo_gearman_worker_set_timeout)
+	PHP_FE(gearman_worker_set_ssl, arginfo_gearman_worker_set_ssl)
 	PHP_FE(gearman_worker_set_id, arginfo_gearman_worker_set_id)
 #if jluedke_0
 	PHP_FE(gearman_worker_context, arginfo_gearman_worker_context)
@@ -4274,6 +4804,7 @@
 	__PHP_ME_MAPPING(removeOptions, gearman_client_remove_options, arginfo_oo_gearman_client_remove_options, 0)
 	__PHP_ME_MAPPING(timeout, gearman_client_timeout, arginfo_oo_gearman_client_timeout, 0)
 	__PHP_ME_MAPPING(setTimeout, gearman_client_set_timeout, arginfo_oo_gearman_client_set_timeout, 0)
+	__PHP_ME_MAPPING(setSSL, gearman_client_set_ssl, arginfo_oo_gearman_client_set_ssl, 0)
 	__PHP_ME_MAPPING(context, gearman_client_context, arginfo_oo_gearman_client_context, 0)
 	__PHP_ME_MAPPING(setContext, gearman_client_set_context, arginfo_oo_gearman_client_set_context, 0)
 #if jluedke_0
@@ -4295,6 +4826,9 @@
 	__PHP_ME_MAPPING(doBackground, gearman_client_do_background, arginfo_oo_gearman_client_do_background, 0)
 	__PHP_ME_MAPPING(doHighBackground, gearman_client_do_high_background, arginfo_oo_gearman_client_do_high_background, 0)
 	__PHP_ME_MAPPING(doLowBackground, gearman_client_do_low_background, arginfo_oo_gearman_client_do_low_background, 0)
+	__PHP_ME_MAPPING(doEpoch, gearman_client_do_epoch, arginfo_oo_gearman_client_do_epoch, 0)
+	__PHP_ME_MAPPING(doHighEpoch, gearman_client_do_high_epoch, arginfo_oo_gearman_client_do_high_epoch, 0)
+	__PHP_ME_MAPPING(doLowEpoch, gearman_client_do_low_epoch, arginfo_oo_gearman_client_do_low_epoch, 0)
 	__PHP_ME_MAPPING(jobStatus, gearman_client_job_status, arginfo_oo_gearman_client_job_status, 0)
 	__PHP_ME_MAPPING(jobStatusByUniqueKey, gearman_client_job_status_by_unique_key, arginfo_oo_gearman_client_job_status_by_unique_key, 0)
 	__PHP_ME_MAPPING(echo, gearman_client_echo, arginfo_oo_gearman_client_echo, 0)
@@ -4309,6 +4843,9 @@
 	__PHP_ME_MAPPING(addTaskBackground, gearman_client_add_task_background, arginfo_oo_gearman_client_add_task_background, 0)
 	__PHP_ME_MAPPING(addTaskHighBackground, gearman_client_add_task_high_background, arginfo_oo_gearman_client_add_task_high_background, 0)
 	__PHP_ME_MAPPING(addTaskLowBackground, gearman_client_add_task_low_background, arginfo_oo_gearman_client_add_task_low_background, 0)
+	__PHP_ME_MAPPING(addTaskEpoch, gearman_client_add_task_epoch, arginfo_oo_gearman_client_add_task_epoch, 0)
+	__PHP_ME_MAPPING(addTaskHighEpoch, gearman_client_add_task_high_epoch, arginfo_oo_gearman_client_add_task_high_epoch, 0)
+	__PHP_ME_MAPPING(addTaskLowEpoch, gearman_client_add_task_low_epoch, arginfo_oo_gearman_client_add_task_low_epoch, 0)
 	__PHP_ME_MAPPING(addTaskStatus, gearman_client_add_task_status, arginfo_oo_gearman_client_add_task_status, 0)
 	__PHP_ME_MAPPING(setWorkloadCallback, gearman_client_set_workload_fn, arginfo_oo_gearman_client_set_workload_fn, 0)
 	__PHP_ME_MAPPING(setCreatedCallback, gearman_client_set_created_fn, arginfo_oo_gearman_client_set_created_fn, 0)
@@ -4357,6 +4894,7 @@
 	__PHP_ME_MAPPING(removeOptions, gearman_worker_remove_options, arginfo_oo_gearman_worker_remove_options, 0)
 	__PHP_ME_MAPPING(timeout, gearman_worker_timeout, arginfo_oo_gearman_worker_timeout, 0)
 	__PHP_ME_MAPPING(setTimeout, gearman_worker_set_timeout, arginfo_oo_gearman_worker_set_timeout, 0)
+	__PHP_ME_MAPPING(setSSL, gearman_worker_set_ssl, arginfo_oo_gearman_worker_set_ssl, 0)
 	__PHP_ME_MAPPING(setId, gearman_worker_set_id, arginfo_oo_gearman_worker_set_id, 0)
 #if jluedke_0
 	__PHP_ME_MAPPING(context, gearman_worker_context, arginfo_oo_gearman_worker_context, 0)
@@ -4894,6 +5432,15 @@
 	REGISTER_LONG_CONSTANT("GEARMAN_CLIENT_FREE_TASKS",
 		GEARMAN_CLIENT_FREE_TASKS,
 		CONST_CS | CONST_PERSISTENT);
+	REGISTER_LONG_CONSTANT("GEARMAN_CLIENT_GENERATE_UNIQUE",
+		GEARMAN_CLIENT_GENERATE_UNIQUE,
+		CONST_CS | CONST_PERSISTENT);
+	REGISTER_LONG_CONSTANT("GEARMAN_CLIENT_EXCEPTION",
+		GEARMAN_CLIENT_EXCEPTION,
+		CONST_CS | CONST_PERSISTENT);
+	REGISTER_LONG_CONSTANT("GEARMAN_CLIENT_SSL",
+		GEARMAN_CLIENT_SSL,
+		CONST_CS | CONST_PERSISTENT);
 	REGISTER_LONG_CONSTANT("GEARMAN_CLIENT_STATE_IDLE",
 		GEARMAN_CLIENT_STATE_IDLE,
 		CONST_CS | CONST_PERSISTENT);
@@ -4933,6 +5480,15 @@
 	REGISTER_LONG_CONSTANT("GEARMAN_WORKER_TIMEOUT_RETURN",
 		GEARMAN_WORKER_TIMEOUT_RETURN,
 		CONST_CS | CONST_PERSISTENT);
+	REGISTER_LONG_CONSTANT("GEARMAN_WORKER_GRAB_ALL",
+		GEARMAN_WORKER_GRAB_ALL,
+		CONST_CS | CONST_PERSISTENT);
+	REGISTER_LONG_CONSTANT("GEARMAN_WORKER_SSL",
+		GEARMAN_WORKER_SSL,
+		CONST_CS | CONST_PERSISTENT);
+	REGISTER_LONG_CONSTANT("GEARMAN_WORKER_IDENTIFIER",
+		GEARMAN_WORKER_IDENTIFIER,
+		CONST_CS | CONST_PERSISTENT);
 	REGISTER_LONG_CONSTANT("GEARMAN_WORKER_STATE_START",
 		GEARMAN_WORKER_STATE_START,
 		CONST_CS | CONST_PERSISTENT);
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 03:01:29 2024 UTC