fat                                      Thu, 11 Nov 2010 23:27:15 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=305284

Log:
- Fixed #52692 (Added '-t/--test' to php-fpm to check and validate FPM conf 
file)

Bug: http://bugs.php.net/52692 (Analyzed) allow to test and validate FPM conf 
file from command line
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.h
    U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c
    U   php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
    U   php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.8.in
    U   php/php-src/trunk/sapi/fpm/fpm/fpm.h
    U   php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c
    U   php/php-src/trunk/sapi/fpm/fpm/fpm_main.c
    U   php/php-src/trunk/sapi/fpm/php-fpm.8.in

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-11-11 23:22:14 UTC (rev 305283)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-11-11 23:27:15 UTC (rev 305284)
@@ -14,6 +14,7 @@
   (Andrey)
 - Improved support for is_link and related functions on Windows. (Pierre)

+- Added '-t/--test' to php-fpm to check and validate FPM conf file. (fat)
 - Added statistics about listening socket queue length for FPM.
   (andrei dot nigmatulin at gmail dot com, fat)
 - Implemented FR #52348, Ability to detect zend multibyte at runtime. (Kalle)

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.h
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.h     2010-11-11 23:22:14 UTC 
(rev 305283)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm.h     2010-11-11 23:27:15 UTC 
(rev 305284)
@@ -23,6 +23,7 @@
        int listening_socket; /* for this child */
        int max_requests; /* for this child */
        int is_child;
+       int test_conf;
 };

 extern struct fpm_globals_s fpm_globals;

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c        2010-11-11 
23:22:14 UTC (rev 305283)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_conf.c        2010-11-11 
23:27:15 UTC (rev 305284)
@@ -1028,13 +1028,20 @@
                return -1;
        }

-       if (free) efree(filename);
-
        if (0 > fpm_conf_post_process()) {
                zlog(ZLOG_ERROR, "failed to post process the configuration");
+               if (free) efree(filename);
                return -1;
        }

+       if (fpm_globals.test_conf) {
+               zlog(ZLOG_NOTICE, "configuration file %s test is successful\n", 
filename);
+               if (free) efree(filename);
+               return -1;
+       }
+
+       if (free) efree(filename);
+
        if (0 > fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_conf_cleanup, 0)) {
                return -1;
        }

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c        2010-11-11 
23:22:14 UTC (rev 305283)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/fpm/fpm_main.c        2010-11-11 
23:27:15 UTC (rev 305284)
@@ -152,6 +152,7 @@
        {'?', 0, "usage"},/* help alias (both '?' and 'usage') */
        {'v', 0, "version"},
        {'y', 1, "fpm-config"},
+       {'t', 0, "test"},
        {'-', 0, NULL} /* end of args */
 };

@@ -959,7 +960,7 @@
                prog = "php";
        }

-       php_printf(     "Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-c <file>] 
[-d foo[=bar]] [-y <file>]\n"
+       php_printf(     "Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-c 
<file>] [-d foo[=bar]] [-y <file>]\n"
                                "  -c <path>|<file> Look for php.ini file in 
this directory\n"
                                "  -n               No php.ini file will be 
used\n"
                                "  -d foo[=bar]     Define INI entry foo with 
value 'bar'\n"
@@ -969,7 +970,8 @@
                                "  -m               Show compiled in modules\n"
                                "  -v               Version number\n"
                                "  -y, --fpm-config <file>\n"
-                               "                   Specify alternative path to 
FastCGI process manager config file.\n",
+                               "                   Specify alternative path to 
FastCGI process manager config file.\n"
+                               "  -t, --test       Test FPM configuration and 
exit\n",
                                prog);
 }
 /* }}} */
@@ -1626,6 +1628,10 @@
                                CG(compiler_options) |= 
ZEND_COMPILE_EXTENDED_INFO;
                                break;

+                       case 't':
+                               fpm_globals.test_conf = 1;
+                               break;
+
                        case 'm': /* list compiled in modules */
                                cgi_sapi_module.startup(&cgi_sapi_module);
                                php_output_startup();

Modified: php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.8.in
===================================================================
--- php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.8.in  2010-11-11 23:22:14 UTC 
(rev 305283)
+++ php/php-src/branches/PHP_5_3/sapi/fpm/php-fpm.8.in  2010-11-11 23:27:15 UTC 
(rev 305284)
@@ -86,6 +86,13 @@
 Specify alternative path to FastCGI process manager configuration file (the 
default is @php_fpm_sysconfdir@/php-fpm.conf)
 .TP
 .PD 0
+.B \-\-test
+.TP
+.PD 1
+.B \-t
+Test FPM configuration file and exit
+.TP
+.PD 0
 .B \-\-zend\-extension \fIfile\fP
 .TP
 .PD 1

Modified: php/php-src/trunk/sapi/fpm/fpm/fpm.h
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm.h        2010-11-11 23:22:14 UTC (rev 
305283)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm.h        2010-11-11 23:27:15 UTC (rev 
305284)
@@ -23,6 +23,7 @@
        int listening_socket; /* for this child */
        int max_requests; /* for this child */
        int is_child;
+       int test_conf;
 };

 extern struct fpm_globals_s fpm_globals;

Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c   2010-11-11 23:22:14 UTC (rev 
305283)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm_conf.c   2010-11-11 23:27:15 UTC (rev 
305284)
@@ -1028,13 +1028,20 @@
                return -1;
        }

-       if (free) efree(filename);
-
        if (0 > fpm_conf_post_process()) {
                zlog(ZLOG_ERROR, "failed to post process the configuration");
+               if (free) efree(filename);
                return -1;
        }

+       if (fpm_globals.test_conf) {
+               zlog(ZLOG_NOTICE, "configuration file %s test is successful\n", 
filename);
+               if (free) efree(filename);
+               return -1;
+       }
+
+       if (free) efree(filename);
+
        if (0 > fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_conf_cleanup, 0)) {
                return -1;
        }

Modified: php/php-src/trunk/sapi/fpm/fpm/fpm_main.c
===================================================================
--- php/php-src/trunk/sapi/fpm/fpm/fpm_main.c   2010-11-11 23:22:14 UTC (rev 
305283)
+++ php/php-src/trunk/sapi/fpm/fpm/fpm_main.c   2010-11-11 23:27:15 UTC (rev 
305284)
@@ -152,6 +152,7 @@
        {'?', 0, "usage"},/* help alias (both '?' and 'usage') */
        {'v', 0, "version"},
        {'y', 1, "fpm-config"},
+       {'t', 0, "test"},
        {'-', 0, NULL} /* end of args */
 };

@@ -957,7 +958,7 @@
                prog = "php";
        }

-       php_printf(     "Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-c <file>] 
[-d foo[=bar]] [-y <file>]\n"
+       php_printf(     "Usage: %s [-n] [-e] [-h] [-i] [-m] [-v] [-t] [-c 
<file>] [-d foo[=bar]] [-y <file>]\n"
                                "  -c <path>|<file> Look for php.ini file in 
this directory\n"
                                "  -n               No php.ini file will be 
used\n"
                                "  -d foo[=bar]     Define INI entry foo with 
value 'bar'\n"
@@ -967,7 +968,8 @@
                                "  -m               Show compiled in modules\n"
                                "  -v               Version number\n"
                                "  -y, --fpm-config <file>\n"
-                               "                   Specify alternative path to 
FastCGI process manager config file.\n",
+                               "                   Specify alternative path to 
FastCGI process manager config file.\n"
+                               "  -t, --test       Test FPM configuration and 
exit\n",
                                prog);
 }
 /* }}} */
@@ -1625,6 +1627,10 @@
                                CG(compiler_options) |= 
ZEND_COMPILE_EXTENDED_INFO;
                                break;

+                       case 't':
+                               fpm_globals.test_conf = 1;
+                               break;
+
                        case 'm': /* list compiled in modules */
                                cgi_sapi_module.startup(&cgi_sapi_module);
                                php_output_activate(TSRMLS_C);

Modified: php/php-src/trunk/sapi/fpm/php-fpm.8.in
===================================================================
--- php/php-src/trunk/sapi/fpm/php-fpm.8.in     2010-11-11 23:22:14 UTC (rev 
305283)
+++ php/php-src/trunk/sapi/fpm/php-fpm.8.in     2010-11-11 23:27:15 UTC (rev 
305284)
@@ -86,6 +86,13 @@
 Specify alternative path to FastCGI process manager configuration file (the 
default is @php_fpm_sysconfdir@/php-fpm.conf)
 .TP
 .PD 0
+.B \-\-test
+.TP
+.PD 1
+.B \-t
+Test FPM configuration file and exit
+.TP
+.PD 0
 .B \-\-zend\-extension \fIfile\fP
 .TP
 .PD 1

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to