[xiph-commits] r14901 - in branches/dir.xiph.org: cgi-bin cronjobs inc
balbinus at svn.xiph.org
balbinus at svn.xiph.org
Sat May 17 03:01:01 PDT 2008
Author: balbinus
Date: 2008-05-17 03:01:01 -0700 (Sat, 17 May 2008)
New Revision: 14901
Modified:
branches/dir.xiph.org/cgi-bin/yp.php
branches/dir.xiph.org/cronjobs/prune_mountpoints.php
branches/dir.xiph.org/inc/class.db.php
Log:
More checkings, plus a new escape function in the base database connection class (needed now that we have two servers).
Modified: branches/dir.xiph.org/cgi-bin/yp.php
===================================================================
--- branches/dir.xiph.org/cgi-bin/yp.php 2008-05-17 09:56:53 UTC (rev 14900)
+++ branches/dir.xiph.org/cgi-bin/yp.php 2008-05-17 10:01:01 UTC (rev 14901)
@@ -161,7 +161,7 @@
if ($mp instanceOf Mountpoint)
{
$server = new Server(0, false, true);
- $server->setMountpointId($mp_id);
+ $server->setMountpointId($mp->getId());
$server->setSid($sid);
$server->setListenUrl($listen_url);
$server->setLastTouchedFrom($ip);
@@ -355,10 +355,11 @@
$listen_url = $server->getListenUrl();
$res = $server->remove();
APILog::serverRemoved($res, $server_id, $mp_id, $listen_url);
- if ($res)
+ if ($res && $mp_id)
{
$mountpoint = Mountpoint::retrieveByPk($mp_id);
- if (!$mountpoint->hasLinkedServers())
+ if ($mountpoint instanceOf Mountpoint
+ && !$mountpoint->hasLinkedServers())
{
$res = $mountpoint->remove();
$mountpoint->decrementCounter(Mountpoint::COUNTER_TOTAL);
Modified: branches/dir.xiph.org/cronjobs/prune_mountpoints.php
===================================================================
--- branches/dir.xiph.org/cronjobs/prune_mountpoints.php 2008-05-17 09:56:53 UTC (rev 14900)
+++ branches/dir.xiph.org/cronjobs/prune_mountpoints.php 2008-05-17 10:01:01 UTC (rev 14901)
@@ -16,11 +16,13 @@
while (!$toDelete->endOf())
{
+ printf("Processing %s... ", $toDelete->current('id'));
$server = Server::retrieveByPk($toDelete->current('id'));
$mp_id = $server->getMountpointId();
$mountpoint = Mountpoint::retrieveByPk($mp_id);
$server->remove();
- if (!$mountpoint->hasLinkedServers())
+ echo "ok.\n";
+ if ($mountpoint instanceOf Mountpoint && !$mountpoint->hasLinkedServers())
{
$mountpoint->remove();
}
Modified: branches/dir.xiph.org/inc/class.db.php
===================================================================
--- branches/dir.xiph.org/inc/class.db.php 2008-05-17 09:56:53 UTC (rev 14900)
+++ branches/dir.xiph.org/inc/class.db.php 2008-05-17 10:01:01 UTC (rev 14901)
@@ -225,6 +225,17 @@
return $this->affected_rows;
}
+
+ /**
+ * Returns an escaped string.
+ *
+ * @param string $str The string to escape.
+ * @return string
+ */
+ public function escape($str)
+ {
+ return @mysql_real_escape_string($str, $this->db_handle);
+ }
/**
* Returns an instance of the DatabaseConnection.
More information about the commits
mailing list