]> granicus.if.org Git - php/commitdiff
Udm_Get_Doc_Count function from mnoGoSearch 3.1.11 has been added.
authorSergey Kartashoff <gluke@php.net>
Thu, 1 Mar 2001 13:26:26 +0000 (13:26 +0000)
committerSergey Kartashoff <gluke@php.net>
Thu, 1 Mar 2001 13:26:26 +0000 (13:26 +0000)
mnoGoSearch library version printing in phpinfo() has been added.
Example updated.

ext/mnogosearch/php_mnogo.c
ext/mnogosearch/php_mnogo.h
ext/mnogosearch/test.php

index 62724aa2b1fabd8568594df3cec20da4e197a611..5453620bf9ea85c3bb1b75471fe7e1b2f71d22be 100644 (file)
@@ -117,6 +117,10 @@ function_entry mnogosearch_functions[] = {
        
        PHP_FE(udm_free_res,            NULL)
        PHP_FE(udm_free_agent,          NULL)
+
+#if UDM_VERSION_ID > 30110
+       PHP_FE(udm_get_doc_count,       NULL)
+#endif
        
        {NULL, NULL, NULL}
 };
@@ -275,8 +279,13 @@ DLEXPORT PHP_RINIT_FUNCTION(mnogosearch)
 
 DLEXPORT PHP_MINFO_FUNCTION(mnogosearch)
 {
+       char buf[32];
+       
        php_info_print_table_start();
        php_info_print_table_row(2, "mnoGoSearch Support", "enabled" );
+       
+       sprintf(buf,"%d", UDM_VERSION_ID);
+       php_info_print_table_row(2, "mnoGoSearch library version", buf );
        php_info_print_table_end();
 }
 
@@ -1035,6 +1044,33 @@ DLEXPORT PHP_FUNCTION(udm_error)
 /* }}} */
 
 
+#if UDM_VERSION_ID > 30110
+/* {{{ proto int udm_get_doc_count(int agent)
+   Get total number of documents in database */
+DLEXPORT PHP_FUNCTION(udm_get_doc_count)
+{
+       pval ** yyagent;
+       UDM_AGENT * Agent;
+       int id=-1;
+
+       switch(ZEND_NUM_ARGS()){
+               case 1: {
+                               if (zend_get_parameters_ex(1, &yyagent)==FAILURE) {
+                                       RETURN_FALSE;
+                               }
+                       }
+                       break;
+               default:
+                       WRONG_PARAM_COUNT;
+                       break;
+       }
+       ZEND_FETCH_RESOURCE(Agent, UDM_AGENT *, yyagent, id, "mnoGoSearch-Agent", le_link);
+       RETURN_LONG(UdmGetDocCount(Agent));
+}
+/* }}} */
+#endif
+
+
 #endif
 
 
index 8967685783f31d9fe4af4fd6f7f9d1ea44f2ddf6..34a85d39270b603aa55c8648715d2b7e598a24f5 100644 (file)
@@ -27,6 +27,9 @@
 
 #if HAVE_MNOGOSEARCH
 
+#include <udm_config.h>
+#include <udmsearch.h>
+
 extern zend_module_entry mnogosearch_module_entry;
 #define mnogosearch_module_ptr &mnogosearch_module_entry
 
@@ -65,6 +68,10 @@ DLEXPORT PHP_FUNCTION(udm_get_res_param);
 DLEXPORT PHP_FUNCTION(udm_free_res);
 DLEXPORT PHP_FUNCTION(udm_free_agent);
 
+#if UDM_VERSION_ID > 30110
+DLEXPORT PHP_FUNCTION(udm_get_doc_count);
+#endif
+
 #else
 
 #define mnogosearch_module_ptr NULL
index 0fb3b968aaf7b101f39d36bda6131ad06a978cee..b4dce3470a3b3bc2ee0df0003eddf3dc571c112f 100644 (file)
@@ -24,6 +24,8 @@
 
        $udm=Udm_Alloc_Agent("mysql://udm:udm@localhost/udm/",'single');        
        
+       print  "Total number of urls in database: ".Udm_Get_Doc_Count($udm)."<br>\n";
+       
 // Stage 2: set search parameters
 
        $page_size=10;