-Allow etc and stor directories to be configurable

This commit is contained in:
Martin Konecny 2011-12-22 17:21:18 -05:00
parent ac50c279f7
commit a55b47efff
4 changed files with 20 additions and 7 deletions

View File

@ -8,7 +8,9 @@
* that the user can customize these. * that the user can customize these.
*/ */
$ini = parse_ini_file('/etc/airtime/airtime.conf', true);
$configFile = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
$ini = parse_ini_file($configFile, true);
$dbhost = $ini['database']['host']; $dbhost = $ini['database']['host'];
$dbname = $ini['database']['dbname']; $dbname = $ini['database']['dbname'];

View File

@ -23,7 +23,9 @@ $CC_CONFIG = array(
'phingPath' => dirname(__FILE__).'/../../library/phing' 'phingPath' => dirname(__FILE__).'/../../library/phing'
); );
Config::loadConfig("/etc/airtime/airtime.conf");
$configFile = isset($_SERVER['AIRTIME_CONF']) ? $_SERVER['AIRTIME_CONF'] : "/etc/airtime/airtime.conf";
Config::loadConfig($configFile);
// Add database table names // Add database table names
$CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist'; $CC_CONFIG['playListTable'] = $CC_CONFIG['tblNamePrefix'].'playlist';

View File

@ -7,7 +7,9 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract
if (Application_Model_RabbitMq::$doPush) { if (Application_Model_RabbitMq::$doPush) {
$md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists()); $md = array('schedule' => Application_Model_Schedule::GetScheduledPlaylists());
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md); Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
Application_Model_RabbitMq::SendMessageToShowRecorder("update_schedule"); if (!isset($_SERVER['AIRTIME_SRV'])){
Application_Model_RabbitMq::SendMessageToShowRecorder("update_schedule");
}
} }
} }
} }

View File

@ -409,11 +409,13 @@ class Application_Model_StoredFile {
* @return string * @return string
*/ */
public function getFilePath() public function getFilePath()
{ {
$music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory()); $music_dir = Application_Model_MusicDir::getDirByPK($this->_file->getDbDirectory());
$directory = $music_dir->getDirectory();
$filepath = $this->_file->getDbFilepath(); $filepath = $this->_file->getDbFilepath();
return $music_dir->getDirectory().$filepath; return $directory.$filepath;
} }
/** /**
@ -877,8 +879,13 @@ class Application_Model_StoredFile {
$audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName; $audio_stor = $stor . DIRECTORY_SEPARATOR . $fileName;
$r = @copy($audio_file, $audio_stor); Logging::log("copyFileToStor: moving file $audio_file to $audio_stor");
$r = @unlink($audio_file);
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
$r = @rename($audio_file, $audio_stor);
//$r = @copy($audio_file, $audio_stor);
//$r = @unlink($audio_file);
} }
public static function getFileCount() public static function getFileCount()