[xiph-commits] r14665 - branches/dir.xiph.org/cgi-bin

balbinus at svn.xiph.org balbinus at svn.xiph.org
Mon Apr 7 12:06:27 PDT 2008


Author: balbinus
Date: 2008-04-07 12:06:27 -0700 (Mon, 07 Apr 2008)
New Revision: 14665

Modified:
   branches/dir.xiph.org/cgi-bin/yp.php
Log:
Added a check for a mountpoint by the same stream name.

Modified: branches/dir.xiph.org/cgi-bin/yp.php
===================================================================
--- branches/dir.xiph.org/cgi-bin/yp.php	2008-04-07 18:48:08 UTC (rev 14664)
+++ branches/dir.xiph.org/cgi-bin/yp.php	2008-04-07 19:06:27 UTC (rev 14665)
@@ -87,7 +87,7 @@
 		// MySQL Connection
 		$db = DirXiphOrgDBC::getInstance();
 		
-		// Look for the mountpoint
+		// Look for the mountpoint (same listen URL)
 		$server_id = $sid = null;
 		$query = 'SELECT `id`, `mountpoint_id` FROM `server` WHERE `listen_url` = "%s";';
 		$query = sprintf($query, mysql_real_escape_string($listen_url));
@@ -103,11 +103,26 @@
 			$server_id = $res->current('id');
 			$server = Server::retrieveByPk($server_id);
 		}
-		catch(SQLNoResultException $e)
+		catch (SQLNoResultException $e)
 		{
 			// The mountpoint doesn't exist yet in our database (it's OK)
 		}
 		
+		// Look for the mountpoint, bis (different listen URL, same stream name)
+		$query = 'SELECT `id` FROM `mountpoint` WHERE `stream_name` = "%s";';
+		$query = sprintf($query, mysql_real_escape_string($stream_name));
+		try
+		{
+			// The mountpoint exists, only a different server.
+			$res = $db->singleQuery($query);
+			$mp_id = $res->current('id');
+			$mp = Mountpoint::retrieveByPk($mp_id);
+		}
+		catch (SQLNoResultException $e)
+		{
+			// The mountpoint doesn't exist yet in our database (it's OK)
+		}
+		
 		// SID
 		$sid = UUIDGen::generate();
 		



More information about the commits mailing list