SAAS-157: Automated metrics: gather info about soundcloud usage

- put DB query inside try-catch
This commit is contained in:
denise 2012-05-07 12:12:08 -04:00
parent 3a6a1d8691
commit bdf314b93a
1 changed files with 13 additions and 7 deletions

View File

@ -942,15 +942,21 @@ Logging::log("getting media! - 2");
*/
public static function getSoundCloudUploads()
{
$con = Propel::getConnection();
try {
$con = Propel::getConnection();
$sql = "SELECT soundcloud_id as id, soundcloud_upload_time"
." FROM CC_FILES"
." WHERE (id != -2 and id != -3) and"
." (soundcloud_upload_time >= (now() - (INTERVAL '1 day')))";
$sql = "SELECT soundcloud_id as id, soundcloud_upload_time"
." FROM CC_FILES"
." WHERE (id != -2 and id != -3) and"
." (soundcloud_upload_time >= (now() - (INTERVAL '1 day')))";
$rows = $con->query($sql)->fetchAll();
return count($rows);
$rows = $con->query($sql)->fetchAll();
return count($rows);
} catch (Exception $e) {
header('HTTP/1.0 503 Service Unavailable');
Logging::log("Could not connect to database.");
exit;
}
}