[packages/phorum] send 500 HTTP status code in case of database error

glen glen at pld-linux.org
Wed Dec 12 19:49:21 CET 2012


commit c1a89a3ab43eeb94b23cecd0fe9a5348465f9379
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Wed Dec 12 20:48:19 2012 +0200

    send 500 HTTP status code in case of database error
    
    this allows you to track from accesslogs failed requests, and in case of
    some frontend server, act accordingly if the status code is not correct
    
    also makes search engines not to index your error pages!

 500.patch   | 10 ++++++++++
 phorum.spec |  2 ++
 2 files changed, 12 insertions(+)
---
diff --git a/phorum.spec b/phorum.spec
index 7090cf9..8647312 100644
--- a/phorum.spec
+++ b/phorum.spec
@@ -24,6 +24,7 @@ Patch6:		no-pear-json.patch
 Patch10:	translate-macros.patch
 Patch11:	wordwrap.patch
 Patch12:	unhide-errors.patch
+Patch13:	500.patch
 URL:		http://www.phorum.org/
 BuildRequires:	iconv
 BuildRequires:	rpm-php-pearprov
@@ -335,6 +336,7 @@ sed -i -e "s,require_once PHORUM_DIR.'/common.php';,require_once 'common.php';,"
 %patch10 -p1
 %patch11 -p1
 %patch12 -p1
+%patch13 -p1
 
 # cleanup backups after patching
 find '(' -name '*~' -o -name '*.orig' ')' -print0 | xargs -0 -r -l512 rm -f
diff --git a/500.patch b/500.patch
new file mode 100644
index 0000000..16a0b1a
--- /dev/null
+++ b/500.patch
@@ -0,0 +1,10 @@
+--- ./common.php	2012-12-12 19:37:10.000000000 +0200
++++ ./common.php	2012-12-12 19:37:33.010371715 +0200
+@@ -144,6 +144,7 @@
+         phorum_redirect_by_url($PHORUM["DBCONFIG"]["down_page"]);
+         exit();
+     } else {
++        header('HTTP/1.1 500 Internal Server Error');
+         echo "The database connection failed. Please check your database configuration in include/db/config.php. If the configuration is okay, check if the database server is running.";
+         exit();
+     }
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/phorum.git/commitdiff/c1a89a3ab43eeb94b23cecd0fe9a5348465f9379



More information about the pld-cvs-commit mailing list