- saas patch #1
This commit is contained in:
parent
9cd389d16b
commit
b8d6132b52
6 changed files with 69 additions and 25 deletions
|
@ -686,6 +686,22 @@ class ApiController extends Zend_Controller_Action
|
|||
Logging::info("Registered Component: ".$component."@".$remoteAddr);
|
||||
|
||||
Application_Model_ServiceRegister::Register($component, $remoteAddr);
|
||||
|
||||
//send ip, subdomain
|
||||
if (Application_Model_Preference::GetPlanLevel() != 'disabled'){
|
||||
if ($component == "pypo"){
|
||||
$split = explode('.', $_SERVER['SERVER_NAME']);
|
||||
if (count($split) > 0){
|
||||
$subDomain = $split[0];
|
||||
|
||||
$md = array();
|
||||
$md["sub_domain"] = $subDomain;
|
||||
$md["pypo_ip"] = $remoteAddr;
|
||||
|
||||
Application_Model_RabbitMq::SendMessageToHaproxyConfigDaemon($md);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function updateLiquidsoapStatusAction()
|
||||
|
|
|
@ -53,7 +53,6 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_Preference::SetMailServerRequiresAuth($values["preferences_email_server"]["msRequiresAuth"]);
|
||||
}
|
||||
|
||||
Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["preferences_soundcloud"]["UseSoundCloud"]);
|
||||
Application_Model_Preference::SetUploadToSoundcloudOption($values["preferences_soundcloud"]["UploadToSoundcloudOption"]);
|
||||
Application_Model_Preference::SetSoundCloudDownloadbleOption($values["preferences_soundcloud"]["SoundCloudDownloadbleOption"]);
|
||||
Application_Model_Preference::SetSoundCloudUser($values["preferences_soundcloud"]["SoundCloudUser"]);
|
||||
|
|
|
@ -11,16 +11,6 @@ class Application_Form_SoundcloudPreferences extends Zend_Form_SubForm
|
|||
array('ViewScript', array('viewScript' => 'form/preferences_soundcloud.phtml'))
|
||||
));
|
||||
|
||||
//enable soundcloud uploads
|
||||
$this->addElement('checkbox', 'UseSoundCloud', array(
|
||||
'label' => 'Automatically Upload Recorded Shows',
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetAutoUploadRecordedShowToSoundcloud(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
//enable soundcloud uploads option
|
||||
$this->addElement('checkbox', 'UploadToSoundcloudOption', array(
|
||||
'label' => 'Enable SoundCloud Upload',
|
||||
|
|
|
@ -71,4 +71,46 @@ class Application_Model_RabbitMq
|
|||
|
||||
self::sendMessage($exchange, $data);
|
||||
}
|
||||
|
||||
public static function SendMessageToHaproxyConfigDaemon($md){
|
||||
$config = parse_ini_file("/etc/airtime-saas/rabbitmq.ini", true);
|
||||
$conn = new AMQPConnection($config["rabbitmq"]["host"],
|
||||
$config["rabbitmq"]["port"],
|
||||
$config["rabbitmq"]["user"],
|
||||
$config["rabbitmq"]["password"],
|
||||
$config["rabbitmq"]["vhost"]);
|
||||
|
||||
$exchange = $config["rabbitmq"]["queue"];
|
||||
$queue = $config["rabbitmq"]["queue"];
|
||||
|
||||
$ch = $conn->channel();
|
||||
|
||||
|
||||
/*
|
||||
name: $queue
|
||||
passive: false
|
||||
durable: true // the queue will survive server restarts
|
||||
exclusive: false // the queue can be accessed in other channels
|
||||
auto_delete: false //the queue won't be deleted once the channel is closed.
|
||||
*/
|
||||
$ch->queue_declare($queue, false, true, false, false);
|
||||
|
||||
/*
|
||||
name: $exchange
|
||||
type: direct
|
||||
passive: false
|
||||
durable: true // the exchange will survive server restarts
|
||||
auto_delete: false //the exchange won't be deleted once the channel is closed.
|
||||
*/
|
||||
|
||||
$ch->exchange_declare($exchange, 'direct', false, true, false);
|
||||
$ch->queue_bind($queue, $exchange);
|
||||
|
||||
$data = json_encode($md).PHP_EOL;
|
||||
$msg = new AMQPMessage($data, array('content_type' => 'application/json'));
|
||||
|
||||
$ch->basic_publish($msg, $exchange);
|
||||
$ch->close();
|
||||
$conn->close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -329,13 +329,23 @@ class Application_Model_User
|
|||
$res = Application_Model_Datatables::findEntries($con, $displayColumns, $fromTable, $datatables);
|
||||
|
||||
// mark record which is for the current user
|
||||
foreach ($res['aaData'] as &$record) {
|
||||
foreach($res['aaData'] as $key => &$record){
|
||||
if ($record['login'] == $username) {
|
||||
$record['delete'] = "self";
|
||||
} else {
|
||||
$record['delete'] = "";
|
||||
}
|
||||
|
||||
if($record['login'] == 'sourcefabric_admin'){
|
||||
//arrays in PHP are basically associative arrays that can be iterated in order.
|
||||
//Deleting an earlier element does not change the keys of elements that come after it. --MK
|
||||
unset($res['aaData'][$key]);
|
||||
$res['iTotalDisplayRecords']--;
|
||||
$res['iTotalRecords']--;
|
||||
}
|
||||
}
|
||||
|
||||
$res['aaData'] = array_values($res['aaData']);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
|
|
@ -13,19 +13,6 @@
|
|||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dd id="UseSoundCloud-element" class="block-display" style="padding-left:20px; margin:6px 0 10px 0">
|
||||
<label class="optional" for="UseSoundCloud">
|
||||
<?php echo $this->element->getElement('UseSoundCloud') ?>
|
||||
<strong><?php echo $this->element->getElement('UseSoundCloud')->getLabel() ?></strong>
|
||||
</label>
|
||||
<?php if($this->element->getElement('UseSoundCloud')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('UseSoundCloud')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dd id="SoundCloudDownloadbleOption-element" class="block-display" style="padding-left:20px; margin:6px 0 10px 0">
|
||||
<label class="optional" for="SoundCloudDownloadbleOption">
|
||||
<?php echo $this->element->getElement('SoundCloudDownloadbleOption') ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue