Merge branch 'devel' of dev.sourcefabric.org:airtime into devel
This commit is contained in:
commit
0a70b7d6f1
|
@ -120,6 +120,8 @@ class ApiController extends Zend_Controller_Action
|
||||||
if ($media != null) {
|
if ($media != null) {
|
||||||
|
|
||||||
$filepath = $media->getFilePath();
|
$filepath = $media->getFilePath();
|
||||||
|
// Make sure we don't have some wrong result beecause of caching
|
||||||
|
clearstatcache();
|
||||||
if (is_file($filepath)) {
|
if (is_file($filepath)) {
|
||||||
$full_path = $media->getPropelOrm()->getDbFilepath();
|
$full_path = $media->getPropelOrm()->getDbFilepath();
|
||||||
|
|
||||||
|
@ -468,8 +470,8 @@ class ApiController extends Zend_Controller_Action
|
||||||
// Replace this compound result in a hash with proper error handling later on
|
// Replace this compound result in a hash with proper error handling later on
|
||||||
$return_hash = array();
|
$return_hash = array();
|
||||||
Application_Model_Preference::SetImportTimestamp();
|
Application_Model_Preference::SetImportTimestamp();
|
||||||
Logging::info("--->Mode: $mode || file: {$md['MDATA_KEY_FILEPATH']} ");
|
//Logging::info("--->Mode: $mode || file: {$md['MDATA_KEY_FILEPATH']} ");
|
||||||
Logging::info( $md );
|
//Logging::info( $md );
|
||||||
if ($mode == "create") {
|
if ($mode == "create") {
|
||||||
$filepath = $md['MDATA_KEY_FILEPATH'];
|
$filepath = $md['MDATA_KEY_FILEPATH'];
|
||||||
$filepath = Application_Common_OsPath::normpath($filepath);
|
$filepath = Application_Common_OsPath::normpath($filepath);
|
||||||
|
|
|
@ -4,7 +4,8 @@ class Application_Model_Datatables
|
||||||
{
|
{
|
||||||
private static function buildWhereClauseForAdvancedSearch($dbname2searchTerm)
|
private static function buildWhereClauseForAdvancedSearch($dbname2searchTerm)
|
||||||
{
|
{
|
||||||
$where = array();
|
$where['clause'] = array();
|
||||||
|
$where['params'] = array();
|
||||||
foreach ($dbname2searchTerm as $dbname=>$term) {
|
foreach ($dbname2searchTerm as $dbname=>$term) {
|
||||||
$isRange = false;
|
$isRange = false;
|
||||||
if (strstr($term, '~')) {
|
if (strstr($term, '~')) {
|
||||||
|
@ -24,22 +25,27 @@ class Application_Model_Datatables
|
||||||
if ($isRange) {
|
if ($isRange) {
|
||||||
$sub = array();
|
$sub = array();
|
||||||
if ($input1 != null) {
|
if ($input1 != null) {
|
||||||
$sub[] = $dbname." >= '".$input1."'";
|
$sub[] = $dbname." >= :" . $dbname . "1";
|
||||||
}
|
}
|
||||||
if ($input2 != null) {
|
if ($input2 != null) {
|
||||||
$sub[] = $dbname." <= '".$input2."'";
|
$sub[] = $dbname." <= :" . $dbname . "2";
|
||||||
}
|
}
|
||||||
if (!empty($sub)) {
|
if (!empty($sub)) {
|
||||||
$where[] = "(".implode(' AND ', $sub).")";
|
$where['clause'][$dbname] = "(".implode(' AND ', $sub).")";
|
||||||
|
$where['params'][$dbname."1"] = $input1;
|
||||||
|
if ($input2 != null) {
|
||||||
|
$where['params'][$dbname."2"] = $input2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (trim($input1) !== "") {
|
if (trim($input1) !== "") {
|
||||||
$where[] = $dbname." ILIKE "."'%".$input1."%'";
|
$where['clause'][$dbname] = $dbname." ILIKE :" . $dbname."1";
|
||||||
|
$where['params'][$dbname."1"] = "%".$input1."%";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return implode(" AND ", $where);
|
return $where;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* query used to return data for a paginated/searchable datatable.
|
* query used to return data for a paginated/searchable datatable.
|
||||||
|
@ -73,10 +79,15 @@ class Application_Model_Datatables
|
||||||
}
|
}
|
||||||
|
|
||||||
$where = array();
|
$where = array();
|
||||||
|
/* Holds the parameters for binding after the
|
||||||
|
* statement has been prepared
|
||||||
|
*/
|
||||||
|
$params = array();
|
||||||
|
|
||||||
$advancedWhere = self::buildWhereClauseForAdvancedSearch($dbname2searchTerm);
|
$advancedWhere = self::buildWhereClauseForAdvancedSearch($dbname2searchTerm);
|
||||||
if ($advancedWhere != "") {
|
if (!empty($advancedWhere['clause'])) {
|
||||||
$where[] = $advancedWhere;
|
$where[] = join(" AND ", $advancedWhere['clause']);
|
||||||
|
$params = $advancedWhere['params'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($data["sSearch"] !== "") {
|
if ($data["sSearch"] !== "") {
|
||||||
|
@ -99,17 +110,19 @@ class Application_Model_Datatables
|
||||||
}
|
}
|
||||||
|
|
||||||
$outerCond = array();
|
$outerCond = array();
|
||||||
|
$simpleWhere = array();
|
||||||
|
|
||||||
foreach ($searchTerms as $term) {
|
foreach ($searchTerms as $term) {
|
||||||
$innerCond = array();
|
$innerCond = array();
|
||||||
|
|
||||||
foreach ($searchCols as $col) {
|
foreach ($searchCols as $col) {
|
||||||
$escapedTerm = pg_escape_string($term);
|
$simpleWhere['clause']["simple_".$col] = "{$col}::text ILIKE :simple_".$col;
|
||||||
$innerCond[] = "{$col}::text ILIKE '%{$escapedTerm}%'";
|
$simpleWhere['params']["simple_".$col] = "%".$term."%";
|
||||||
}
|
}
|
||||||
$outerCond[] = "(".join(" OR ", $innerCond).")";
|
$outerCond[] = "(".implode(" OR ", $simpleWhere['clause']).")";
|
||||||
}
|
}
|
||||||
$where[] = "(".join(" AND ", $outerCond).")";
|
$where[] = "(" .implode(" AND ", $outerCond). ")";
|
||||||
|
$params = array_merge($params, $simpleWhere['params']);
|
||||||
}
|
}
|
||||||
// End Where clause
|
// End Where clause
|
||||||
|
|
||||||
|
@ -124,8 +137,10 @@ class Application_Model_Datatables
|
||||||
// End Order By clause
|
// End Order By clause
|
||||||
|
|
||||||
$displayLength = intval($data["iDisplayLength"]);
|
$displayLength = intval($data["iDisplayLength"]);
|
||||||
|
$needToBind = false;
|
||||||
if (count($where) > 0) {
|
if (count($where) > 0) {
|
||||||
$where = join(" AND ", $where);
|
$needToBind = true;
|
||||||
|
$where = join(" OR ", $where);
|
||||||
$sql = $selectorCount." FROM ".$fromTable." WHERE ".$where;
|
$sql = $selectorCount." FROM ".$fromTable." WHERE ".$where;
|
||||||
$sqlTotalDisplayRows = $sql;
|
$sqlTotalDisplayRows = $sql;
|
||||||
|
|
||||||
|
@ -149,15 +164,41 @@ class Application_Model_Datatables
|
||||||
$totalRows = $r->fetchColumn(0);
|
$totalRows = $r->fetchColumn(0);
|
||||||
|
|
||||||
if (isset($sqlTotalDisplayRows)) {
|
if (isset($sqlTotalDisplayRows)) {
|
||||||
$r = $con->query($sqlTotalDisplayRows);
|
$stmt = $con->prepare($sqlTotalDisplayRows);
|
||||||
$totalDisplayRows = $r->fetchColumn(0);
|
foreach($params as $param=>&$value) {
|
||||||
|
$stmt->bindParam(":$param", $value);
|
||||||
|
}
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$totalDisplayRows = $stmt->fetchColumn(0);
|
||||||
|
} else {
|
||||||
|
$msg = implode(',', $stmt->errorInfo());
|
||||||
|
throw new Exception("Error: $msg");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$totalDisplayRows = $totalRows;
|
$totalDisplayRows = $totalRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = $con->query($sql);
|
//TODO
|
||||||
$r->setFetchMode(PDO::FETCH_ASSOC);
|
if ($needToBind) {
|
||||||
$results = $r->fetchAll();
|
$stmt = $con->prepare($sql);
|
||||||
|
|
||||||
|
foreach($params as $param=>&$value) {
|
||||||
|
$stmt->bindParam(":$param", $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$stmt->setFetchMode(PDO::FETCH_ASSOC);
|
||||||
|
$results = $stmt->fetchAll();
|
||||||
|
} else {
|
||||||
|
$msg = implode(',', $stmt->errorInfo());
|
||||||
|
throw new Exception("Error: $msg");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$stmt = $con->query($sql);
|
||||||
|
$stmt->setFetchMode(PDO::FETCH_ASSOC);
|
||||||
|
$results = $stmt->fetchAll();
|
||||||
|
}
|
||||||
|
|
||||||
// we need to go over all items and fix length for playlist
|
// we need to go over all items and fix length for playlist
|
||||||
// in case the playlist contains dynamic block
|
// in case the playlist contains dynamic block
|
||||||
foreach ($results as &$r) {
|
foreach ($results as &$r) {
|
||||||
|
|
|
@ -16,9 +16,6 @@ class Application_Model_Preference
|
||||||
$id = $auth->getIdentity()->id;
|
$id = $auth->getIdentity()->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
$key = pg_escape_string($key);
|
|
||||||
$value = pg_escape_string($value);
|
|
||||||
|
|
||||||
//Check if key already exists
|
//Check if key already exists
|
||||||
$sql = "SELECT COUNT(*) FROM cc_pref"
|
$sql = "SELECT COUNT(*) FROM cc_pref"
|
||||||
." WHERE keystr = '$key'";
|
." WHERE keystr = '$key'";
|
||||||
|
|
|
@ -405,12 +405,16 @@ class Application_Model_StoredFile
|
||||||
*/
|
*/
|
||||||
public function getFileExtension()
|
public function getFileExtension()
|
||||||
{
|
{
|
||||||
|
// TODO : what's the point of having this function? Can we not just use
|
||||||
|
// the extension from the file_path column from cc_files?
|
||||||
$mime = $this->_file->getDbMime();
|
$mime = $this->_file->getDbMime();
|
||||||
|
|
||||||
if ($mime == "audio/vorbis" || $mime == "application/ogg") {
|
if ($mime == "audio/vorbis" || $mime == "application/ogg") {
|
||||||
return "ogg";
|
return "ogg";
|
||||||
} elseif ($mime == "audio/mp3" || $mime == "audio/mpeg") {
|
} elseif ($mime == "audio/mp3" || $mime == "audio/mpeg") {
|
||||||
return "mp3";
|
return "mp3";
|
||||||
|
} elseif ($mime == "audio/x/flac") {
|
||||||
|
return "flac";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,50 +3,63 @@ class Application_Model_StreamSetting
|
||||||
{
|
{
|
||||||
public static function setValue($key, $value, $type)
|
public static function setValue($key, $value, $type)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
$key = pg_escape_string($key);
|
|
||||||
$value = pg_escape_string($value);
|
|
||||||
|
|
||||||
// Check if key already exists
|
// Check if key already exists
|
||||||
$sql = "SELECT COUNT(*) FROM cc_stream_setting"
|
$sql = "SELECT COUNT(*) FROM cc_stream_setting"
|
||||||
." WHERE keyname = '$key'";
|
." WHERE keyname = :key";
|
||||||
|
|
||||||
$result = $con->query($sql)->fetchColumn(0);
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindParam(':key', $key);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$result = $stmt->fetchColumn(0);
|
||||||
|
} else {
|
||||||
|
$msg = implode(',', $stmt->errorInfo());
|
||||||
|
throw new Exception("Error: $msg");
|
||||||
|
}
|
||||||
|
|
||||||
if ($result == 1) {
|
if ($result == 1) {
|
||||||
$sql = "UPDATE cc_stream_setting"
|
$sql = "UPDATE cc_stream_setting"
|
||||||
." SET value = '$value', type='$type'"
|
." SET value = :value, type = :type"
|
||||||
." WHERE keyname = '$key'";
|
." WHERE keyname = :key";
|
||||||
} else {
|
} else {
|
||||||
$sql = "INSERT INTO cc_stream_setting (keyname, value, type)"
|
$sql = "INSERT INTO cc_stream_setting (keyname, value, type)"
|
||||||
." VALUES ('$key', '$value', '$type')";
|
." VALUES (:key, :value, :type)";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $con->exec($sql);
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindParam(':key', $key);
|
||||||
|
$stmt->bindParam(':value', $value);
|
||||||
|
$stmt->bindParam(':type', $type);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
//do nothing
|
||||||
|
} else {
|
||||||
|
$msg = implode(',', $stmt->errorInfo());
|
||||||
|
throw new Exception("Error: $msg");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getValue($key)
|
public static function getValue($key)
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
|
||||||
//Check if key already exists
|
//Check if key already exists
|
||||||
$sql = "SELECT COUNT(*) FROM cc_stream_setting"
|
$sql = "SELECT value FROM cc_stream_setting"
|
||||||
." WHERE keyname = '$key'";
|
." WHERE keyname = :key";
|
||||||
$result = $con->query($sql)->fetchColumn(0);
|
|
||||||
|
|
||||||
if ($result == 0) {
|
$stmt = $con->prepare($sql);
|
||||||
return "";
|
$stmt->bindParam(':key', $key);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$result = $stmt->fetchColumn(0);
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT value FROM cc_stream_setting"
|
$msg = implode(',', $stmt->errorInfo());
|
||||||
." WHERE keyname = '$key'";
|
throw new Exception("Error: $msg");
|
||||||
|
|
||||||
$result = $con->query($sql)->fetchColumn(0);
|
|
||||||
|
|
||||||
return ($result !== false) ? $result : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $result ? $result : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns the id's of all streams that are enabled in an array. An
|
/* Returns the id's of all streams that are enabled in an array. An
|
||||||
|
@ -95,9 +108,18 @@ class Application_Model_StreamSetting
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
$sql = "SELECT * "
|
$sql = "SELECT * "
|
||||||
."FROM cc_stream_setting "
|
."FROM cc_stream_setting "
|
||||||
."WHERE keyname LIKE '${p_streamId}_%'";
|
."WHERE keyname LIKE :stream_id";
|
||||||
|
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindParam(':stream_id', "${p_streamId}_%");
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$rows = $stmt->fetchAll();
|
||||||
|
} else {
|
||||||
|
$msg = implode(',', $stmt->errorInfo());
|
||||||
|
throw new Exception("Error: $msg");
|
||||||
|
}
|
||||||
|
|
||||||
$rows = $con->query($sql)->fetchAll();
|
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
|
@ -197,21 +219,6 @@ class Application_Model_StreamSetting
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Sets indivisual stream setting.
|
|
||||||
*
|
|
||||||
* $data - data array. $data is [].
|
|
||||||
*/
|
|
||||||
public static function setIndivisualStreamSetting($data)
|
|
||||||
{
|
|
||||||
$con = Propel::getConnection();
|
|
||||||
|
|
||||||
foreach ($data as $keyname => $v) {
|
|
||||||
$sql = "UPDATE cc_stream_setting SET value='$v' WHERE keyname='$keyname'";
|
|
||||||
$con->exec($sql);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Stores liquidsoap status if $boot_time > save time.
|
* Stores liquidsoap status if $boot_time > save time.
|
||||||
* save time is the time that user clicked save on stream setting page
|
* save time is the time that user clicked save on stream setting page
|
||||||
|
@ -224,17 +231,37 @@ class Application_Model_StreamSetting
|
||||||
if ($boot_time == null || $boot_time > $update_time) {
|
if ($boot_time == null || $boot_time > $update_time) {
|
||||||
$keyname = "s".$stream_id."_liquidsoap_error";
|
$keyname = "s".$stream_id."_liquidsoap_error";
|
||||||
$sql = "SELECT COUNT(*) FROM cc_stream_setting"
|
$sql = "SELECT COUNT(*) FROM cc_stream_setting"
|
||||||
." WHERE keyname = '$keyname'";
|
." WHERE keyname = :keyname";
|
||||||
$result = $con->query($sql)->fetchColumn(0);
|
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindParam(':keyname', $keyname);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$result= $stmt->fetchColumn(0);
|
||||||
|
} else {
|
||||||
|
$msg = implode(',', $stmt->errorInfo());
|
||||||
|
throw new Exception("Error: $msg");
|
||||||
|
}
|
||||||
|
|
||||||
if ($result == 1) {
|
if ($result == 1) {
|
||||||
$sql = "UPDATE cc_stream_setting"
|
$sql = "UPDATE cc_stream_setting"
|
||||||
." SET value = '$msg'"
|
." SET value = :msg"
|
||||||
." WHERE keyname = '$keyname'";
|
." WHERE keyname = :keyname";
|
||||||
} else {
|
} else {
|
||||||
$sql = "INSERT INTO cc_stream_setting (keyname, value, type)"
|
$sql = "INSERT INTO cc_stream_setting (keyname, value, type)"
|
||||||
." VALUES ('$keyname', '$msg', 'string')";
|
." VALUES (:keyname, :msg, 'string')";
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindParam(':keyname', $keyname);
|
||||||
|
$stmt->bindParam(':msg', $msg);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
//do nothing
|
||||||
|
} else {
|
||||||
|
$msg = implode(',', $stmt->errorInfo());
|
||||||
|
throw new Exception("Error: $msg");
|
||||||
}
|
}
|
||||||
$res = $con->exec($sql);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,8 +271,17 @@ class Application_Model_StreamSetting
|
||||||
|
|
||||||
$keyname = "s".$stream_id."_liquidsoap_error";
|
$keyname = "s".$stream_id."_liquidsoap_error";
|
||||||
$sql = "SELECT value FROM cc_stream_setting"
|
$sql = "SELECT value FROM cc_stream_setting"
|
||||||
." WHERE keyname = '$keyname'";
|
." WHERE keyname = :keyname";
|
||||||
$result = $con->query($sql)->fetchColumn(0);
|
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindParam(':keyname', $keyname);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$result= $stmt->fetchColumn(0);
|
||||||
|
} else {
|
||||||
|
$msg = implode(',', $stmt->errorInfo());
|
||||||
|
throw new Exception("Error: $msg");
|
||||||
|
}
|
||||||
|
|
||||||
return ($result !== false) ? $result : null;
|
return ($result !== false) ? $result : null;
|
||||||
}
|
}
|
||||||
|
@ -256,15 +292,19 @@ class Application_Model_StreamSetting
|
||||||
|
|
||||||
$keyname = "s" . $stream_id . "_enable";
|
$keyname = "s" . $stream_id . "_enable";
|
||||||
$sql = "SELECT value FROM cc_stream_setting"
|
$sql = "SELECT value FROM cc_stream_setting"
|
||||||
." WHERE keyname = '$keyname'";
|
." WHERE keyname = :keyname";
|
||||||
$result = $con->query($sql)->fetchColumn(0);
|
|
||||||
if ($result == 'false') {
|
$stmt = $con->prepare($sql);
|
||||||
$result = false;
|
$stmt->bindParam(':keyname', $keyname);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$result= $stmt->fetchColumn(0);
|
||||||
} else {
|
} else {
|
||||||
$result = true;
|
$msg = implode(',', $stmt->errorInfo());
|
||||||
|
throw new Exception("Error: $msg");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return ($result != 'false');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -279,13 +319,22 @@ class Application_Model_StreamSetting
|
||||||
$enabled_stream = self::getEnabledStreamIds();
|
$enabled_stream = self::getEnabledStreamIds();
|
||||||
|
|
||||||
foreach ($enabled_stream as $stream) {
|
foreach ($enabled_stream as $stream) {
|
||||||
$keys = "'".$stream."_output', "."'".$stream."_type', "."'"
|
$keys = array("{$stream}_output", "{$stream}_type", "{$stream}_bitrate", "{$stream}_host");
|
||||||
.$stream."_bitrate', "."'".$stream."_host'";
|
$key_csv = implode(',', $keys);
|
||||||
|
|
||||||
$sql = "SELECT keyname, value FROM cc_stream_setting"
|
$sql = "SELECT keyname, value FROM cc_stream_setting"
|
||||||
." WHERE keyname IN ($keys)";
|
." WHERE keyname IN (:key_csv)";
|
||||||
|
|
||||||
|
$stmt = $con->prepare($sql);
|
||||||
|
$stmt->bindParam(':key_csv', $key_csv);
|
||||||
|
|
||||||
|
if ($stmt->execute()) {
|
||||||
|
$rows = $stmt->fetchAll();
|
||||||
|
} else {
|
||||||
|
$msg = implode(',', $stmt->errorInfo());
|
||||||
|
throw new Exception("Error: $msg");
|
||||||
|
}
|
||||||
|
|
||||||
$rows = $con->query($sql)->fetchAll();
|
|
||||||
$info = array();
|
$info = array();
|
||||||
foreach ($rows as $r) {
|
foreach ($rows as $r) {
|
||||||
$temp = explode("_", $r['keyname']);
|
$temp = explode("_", $r['keyname']);
|
||||||
|
|
|
@ -35,15 +35,10 @@ cd $target
|
||||||
|
|
||||||
echo "Checking out tag airtime-${suffix}"
|
echo "Checking out tag airtime-${suffix}"
|
||||||
git checkout airtime-${suffix}
|
git checkout airtime-${suffix}
|
||||||
git submodule init
|
|
||||||
git submodule update
|
|
||||||
|
|
||||||
cd python_apps/pypo/liquidsoap_bin/
|
|
||||||
git checkout master
|
|
||||||
git pull origin master
|
|
||||||
|
|
||||||
cd $target
|
cd $target
|
||||||
rm -rf .git .gitignore .gitmodules .zfproject.xml dev_tools/ audio_samples/ python_apps/pypo/liquidsoap_bin/.git
|
rm -rf .git .gitignore .gitmodules .zfproject.xml dev_tools/ audio_samples/
|
||||||
|
|
||||||
#echo "Minimizing Airtime Javascript files..."
|
#echo "Minimizing Airtime Javascript files..."
|
||||||
#cd $dir
|
#cd $dir
|
||||||
|
|
|
@ -488,15 +488,15 @@ def toposort(data):
|
||||||
"""
|
"""
|
||||||
Topological sort on 'data' where 'data' is of the form:
|
Topological sort on 'data' where 'data' is of the form:
|
||||||
data = [
|
data = [
|
||||||
'one' : set('two','three'),
|
'one' : set('two','three'),
|
||||||
'two' : set('three'),
|
'two' : set('three'),
|
||||||
'three' : set()
|
'three' : set()
|
||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
for k, v in data.items():
|
for k, v in data.items():
|
||||||
v.discard(k) # Ignore self dependencies
|
v.discard(k) # Ignore self dependencies
|
||||||
extra_items_in_deps = reduce(set.union, data.values()) - set(data.keys())
|
extra_items_in_deps = reduce(set.union, data.values()) - set(data.keys())
|
||||||
data.update({item:set() for item in extra_items_in_deps})
|
data.update(dict((item,set()) for item in extra_items_in_deps))
|
||||||
while True:
|
while True:
|
||||||
ordered = set(item for item,dep in data.items() if not dep)
|
ordered = set(item for item,dep in data.items() if not dep)
|
||||||
if not ordered: break
|
if not ordered: break
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#Hack to parse rabbitmq pid and place it into the correct directory. This is also
|
/etc/init.d/rabbitmq-server status | grep "\[{pid"
|
||||||
#done in our rabbitmq init.d script, but placing it here so that monit recognizes
|
pid_found="$?"
|
||||||
# it faster (in time for the upcoming airtime-check-system)
|
|
||||||
codename=`lsb_release -cs`
|
if [ "$pid_found" == "0" ]; then
|
||||||
if [ "$codename" = "lucid" -o "$codename" = "maverick" -o "$codename" = "natty" -o "$codename" = "squeeze" ]
|
#PID is available in the status message
|
||||||
then
|
|
||||||
rabbitmqpid=`sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids`
|
|
||||||
else
|
|
||||||
#RabbitMQ in Ubuntu Oneiric and newer have a different way of storing the PID.
|
|
||||||
rabbitmqstatus=`/etc/init.d/rabbitmq-server status | grep "\[{pid"`
|
rabbitmqstatus=`/etc/init.d/rabbitmq-server status | grep "\[{pid"`
|
||||||
rabbitmqpid=`echo $rabbitmqstatus | sed "s/.*,\(.*\)\}.*/\1/"`
|
rabbitmqpid=`echo $rabbitmqstatus | sed "s/.*,\(.*\)\}.*/\1/"`
|
||||||
|
else
|
||||||
|
#PID should be available from file
|
||||||
|
rabbitmqpid=`sed "s/.*,\(.*\)\}.*/\1/" /var/lib/rabbitmq/pids`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "RabbitMQ PID: $rabbitmqpid"
|
echo "RabbitMQ PID: $rabbitmqpid"
|
||||||
echo "$rabbitmqpid" > /var/run/rabbitmq.pid
|
echo "$rabbitmqpid" > /var/run/rabbitmq.pid
|
||||||
|
|
Loading…
Reference in New Issue