|
From: <rd...@us...> - 2009-01-06 12:58:23
|
Revision: 1958
http://digir.svn.sourceforge.net/digir/?rev=1958&view=rev
Author: rdg
Date: 2009-01-06 12:58:21 +0000 (Tue, 06 Jan 2009)
Log Message:
-----------
Included basic checks when processing ping request (service configuration, database connection and runtime errors).
Modified Paths:
--------------
tapirlink/trunk/ChangeLog.txt
tapirlink/trunk/classes/TpDataSourceForm.php
tapirlink/trunk/classes/TpPingResponse.php
Modified: tapirlink/trunk/ChangeLog.txt
===================================================================
--- tapirlink/trunk/ChangeLog.txt 2009-01-06 12:29:26 UTC (rev 1957)
+++ tapirlink/trunk/ChangeLog.txt 2009-01-06 12:58:21 UTC (rev 1958)
@@ -10,7 +10,9 @@
didn't follow the expected (real) database encoding.
* Added support for mixed content elements, allowing TapirLink to be exchange
simple TCS (Taxonomic Concept Schema) data.
- * Fixed bug in SQL count caching mechanism when it was disabled.
+ * Fixed bug in SQL count caching mechanism when it was disabled.
+ * Included basic checks when processing ping request (service configuration,
+ database connection and runtime errors).
Release 0.6.1 (2008-08-01)
--------------------------
@@ -24,7 +26,6 @@
* Included caching mechanism for count SQL in inventories and searches. Can
be controlled with TP_SQL_COUNT_CACHE_LIFE_SECS.
-
Release 0.6.0 (2008-04-30)
--------------------------
(revision 660)
Modified: tapirlink/trunk/classes/TpDataSourceForm.php
===================================================================
--- tapirlink/trunk/classes/TpDataSourceForm.php 2009-01-06 12:29:26 UTC (rev 1957)
+++ tapirlink/trunk/classes/TpDataSourceForm.php 2009-01-06 12:58:21 UTC (rev 1958)
@@ -95,7 +95,7 @@
$r_data_source =& $this->mResource->GetDataSource();
// Validate connection
- if ( ! $r_data_source->validate() )
+ if ( ! $r_data_source->Validate() )
{
return;
}
Modified: tapirlink/trunk/classes/TpPingResponse.php
===================================================================
--- tapirlink/trunk/classes/TpPingResponse.php 2009-01-06 12:29:26 UTC (rev 1957)
+++ tapirlink/trunk/classes/TpPingResponse.php 2009-01-06 12:58:21 UTC (rev 1958)
@@ -21,6 +21,7 @@
*/
require_once('TpResponse.php');
+require_once('TpDiagnostics.php');
class TpPingResponse extends TpResponse
{
@@ -34,6 +35,32 @@
function Body()
{
+ $r_resource =& $this->mRequest->GetResource();
+
+ $r_resource->LoadConfig();
+
+ if ( ! $r_resource->IsValid() )
+ {
+ echo "\n<error>Service configuration error</error>";
+
+ return;
+ }
+
+ $r_data_source =& $r_resource->GetDatasource();
+
+ if ( ! $r_data_source->Validate() )
+ {
+ echo "\n<error>Database connection error</error>";
+
+ return;
+ }
+
+ if ( TpDiagnostics::Count( array( DIAG_ERROR, DIAG_FATAL ) ) )
+ {
+ echo "\n<error>Service runtime error</error>";
+ return;
+ }
+
echo "\n<pong/>";
} // end of member function Body
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|