Merge branch 'saas' into cc-5709-airtime-analyzer-buy-now-saas
This commit is contained in:
commit
f40cdbc8cd
70 changed files with 49423 additions and 46970 deletions
|
@ -757,6 +757,28 @@ class ApiController extends Zend_Controller_Action
|
|||
Logging::info("Registered Component: ".$component."@".$remoteAddr);
|
||||
|
||||
Application_Model_ServiceRegister::Register($component, $remoteAddr);
|
||||
|
||||
//send ip, subdomain
|
||||
if ($component == "pypo"){
|
||||
$split = explode('.', $_SERVER['SERVER_NAME']);
|
||||
$subdomain = array();
|
||||
foreach ($split as $value) {
|
||||
if ($value == 'airtime') {
|
||||
break;
|
||||
} else {
|
||||
$subdomain[] = $value;
|
||||
}
|
||||
}
|
||||
if (count($subdomain) > 0){
|
||||
$subDomain = implode('.',$subdomain);
|
||||
|
||||
$md = array();
|
||||
$md["sub_domain"] = $subDomain;
|
||||
$md["pypo_ip"] = $remoteAddr;
|
||||
|
||||
Application_Model_RabbitMq::SendMessageToHaproxyConfigDaemon($md);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function updateLiquidsoapStatusAction()
|
||||
|
|
|
@ -23,9 +23,7 @@ class PreferenceController extends Zend_Controller_Action
|
|||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
$request = $this->getRequest();
|
||||
|
||||
$isSaas = Application_Model_Preference::GetPlanLevel() == 'disabled'?false:true;
|
||||
|
||||
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/preferences.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
@ -52,16 +50,6 @@ class PreferenceController extends Zend_Controller_Action
|
|||
Application_Model_Preference::SetDefaultTimezone($values["timezone"]);
|
||||
Application_Model_Preference::SetWeekStartDay($values["weekStartDay"]);
|
||||
|
||||
Application_Model_Preference::SetEnableSystemEmail($values["enableSystemEmail"]);
|
||||
Application_Model_Preference::SetSystemEmail($values["systemEmail"]);
|
||||
Application_Model_Preference::SetMailServerConfigured($values["configureMailServer"]);
|
||||
Application_Model_Preference::SetMailServer($values["mailServer"]);
|
||||
Application_Model_Preference::SetMailServerEmailAddress($values["email"]);
|
||||
Application_Model_Preference::SetMailServerPassword($values["ms_password"]);
|
||||
Application_Model_Preference::SetMailServerPort($values["port"]);
|
||||
Application_Model_Preference::SetMailServerRequiresAuth($values["msRequiresAuth"]);
|
||||
|
||||
Application_Model_Preference::SetAutoUploadRecordedShowToSoundcloud($values["UseSoundCloud"]);
|
||||
Application_Model_Preference::SetUploadToSoundcloudOption($values["UploadToSoundcloudOption"]);
|
||||
Application_Model_Preference::SetSoundCloudDownloadbleOption($values["SoundCloudDownloadbleOption"]);
|
||||
Application_Model_Preference::SetSoundCloudUser($values["SoundCloudUser"]);
|
||||
|
@ -96,20 +84,11 @@ class PreferenceController extends Zend_Controller_Action
|
|||
$form = new Application_Form_SupportSettings();
|
||||
if ($request->isPost()) {
|
||||
$values = $request->getPost();
|
||||
|
||||
if ($values["Publicise"] != 1) {
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||
if (isset($values["Privacy"])) {
|
||||
Application_Model_Preference::SetPrivacyPolicyCheck($values["Privacy"]);
|
||||
}
|
||||
} else if ($form->isValid($values)) {
|
||||
if ($form->isValid($values)) {
|
||||
Application_Model_Preference::SetHeadTitle($values["stationName"], $this->view);
|
||||
Application_Model_Preference::SetPhone($values["Phone"]);
|
||||
Application_Model_Preference::SetEmail($values["Email"]);
|
||||
Application_Model_Preference::SetStationWebSite($values["StationWebSite"]);
|
||||
Application_Model_Preference::SetSupportFeedback($values["SupportFeedback"]);
|
||||
Application_Model_Preference::SetPublicise($values["Publicise"]);
|
||||
|
||||
$form->Logo->receive();
|
||||
$imagePath = $form->Logo->getFileName();
|
||||
|
@ -140,15 +119,6 @@ class PreferenceController extends Zend_Controller_Action
|
|||
|
||||
public function directoryConfigAction()
|
||||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
|
||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/serverbrowse/serverbrowser.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/preferences/musicdirs.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
||||
$watched_dirs_pref = new Application_Form_WatchedDirPreferences();
|
||||
$this->view->form = $watched_dirs_pref;
|
||||
}
|
||||
|
||||
public function streamSettingAction()
|
||||
|
@ -250,8 +220,6 @@ class PreferenceController extends Zend_Controller_Action
|
|||
|
||||
$error = false;
|
||||
if ($form->isValid($values)) {
|
||||
$values['output_sound_device'] = $form->getValue('output_sound_device');
|
||||
$values['output_sound_device_type'] = $form->getValue('output_sound_device_type');
|
||||
|
||||
$values['icecast_vorbis_metadata'] = $form->getValue('icecast_vorbis_metadata');
|
||||
$values['streamFormat'] = $form->getValue('streamFormat');
|
||||
|
@ -284,33 +252,6 @@ class PreferenceController extends Zend_Controller_Action
|
|||
//Application_Model_RabbitMq::PushSchedule();
|
||||
}
|
||||
|
||||
if (!Application_Model_Preference::GetMasterDjConnectionUrlOverride()) {
|
||||
$master_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["master_harbor_input_port"]."/".$values["master_harbor_input_mount_point"];
|
||||
if (empty($values["master_harbor_input_port"]) || empty($values["master_harbor_input_mount_point"])) {
|
||||
Application_Model_Preference::SetMasterDJSourceConnectionURL('N/A');
|
||||
} else {
|
||||
Application_Model_Preference::SetMasterDJSourceConnectionURL($master_connection_url);
|
||||
}
|
||||
} else {
|
||||
Application_Model_Preference::SetMasterDJSourceConnectionURL($values["master_dj_connection_url"]);
|
||||
}
|
||||
|
||||
if (!Application_Model_Preference::GetLiveDjConnectionUrlOverride()) {
|
||||
$live_connection_url = "http://".$_SERVER['SERVER_NAME'].":".$values["dj_harbor_input_port"]."/".$values["dj_harbor_input_mount_point"];
|
||||
if (empty($values["dj_harbor_input_port"]) || empty($values["dj_harbor_input_mount_point"])) {
|
||||
Application_Model_Preference::SetLiveDJSourceConnectionURL('N/A');
|
||||
} else {
|
||||
Application_Model_Preference::SetLiveDJSourceConnectionURL($live_connection_url);
|
||||
}
|
||||
} else {
|
||||
Application_Model_Preference::SetLiveDJSourceConnectionURL($values["live_dj_connection_url"]);
|
||||
}
|
||||
|
||||
// extra info that goes into cc_stream_setting
|
||||
Application_Model_StreamSetting::setMasterLiveStreamPort($values["master_harbor_input_port"]);
|
||||
Application_Model_StreamSetting::setMasterLiveStreamMountPoint($values["master_harbor_input_mount_point"]);
|
||||
Application_Model_StreamSetting::setDjLiveStreamPort($values["dj_harbor_input_port"]);
|
||||
Application_Model_StreamSetting::setDjLiveStreamMountPoint($values["dj_harbor_input_mount_point"]);
|
||||
Application_Model_StreamSetting::setOffAirMeta($values['offAirMeta']);
|
||||
|
||||
// store stream update timestamp
|
||||
|
|
|
@ -167,6 +167,15 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$deltaDay = $this->_getParam('day');
|
||||
$deltaMin = $this->_getParam('min');
|
||||
|
||||
$log_vars = array();
|
||||
$log_vars["url"] = $_SERVER['HTTP_HOST'];
|
||||
$log_vars["action"] = "schedule/move-show";
|
||||
$log_vars["params"] = array();
|
||||
$log_vars["params"]["instance id"] = $this->_getParam('showInstanceId');
|
||||
$log_vars["params"]["delta day"] = $deltaDay;
|
||||
$log_vars["params"]["delta minute"] = $deltaMin;
|
||||
Logging::info($log_vars);
|
||||
|
||||
try {
|
||||
$service_calendar = new Application_Service_CalendarService(
|
||||
$this->_getParam('showInstanceId'));
|
||||
|
@ -174,7 +183,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$this->view->show_error = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
$error = $service_calendar->moveShow($deltaDay, $deltaMin);
|
||||
if (isset($error)) {
|
||||
$this->view->error = $error;
|
||||
|
@ -188,6 +197,15 @@ class ScheduleController extends Zend_Controller_Action
|
|||
$showId = $this->_getParam('showId');
|
||||
$instanceId = $this->_getParam('instanceId');
|
||||
|
||||
$log_vars = array();
|
||||
$log_vars["url"] = $_SERVER['HTTP_HOST'];
|
||||
$log_vars["action"] = "schedule/resize-show";
|
||||
$log_vars["params"] = array();
|
||||
$log_vars["params"]["instance id"] = $instanceId;
|
||||
$log_vars["params"]["delta day"] = $deltaDay;
|
||||
$log_vars["params"]["delta minute"] = $deltaMin;
|
||||
Logging::info($log_vars);
|
||||
|
||||
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
|
||||
$user = new Application_Model_User($userInfo->id);
|
||||
|
||||
|
@ -211,6 +229,13 @@ class ScheduleController extends Zend_Controller_Action
|
|||
{
|
||||
$instanceId = $this->_getParam('id');
|
||||
|
||||
$log_vars = array();
|
||||
$log_vars["url"] = $_SERVER['HTTP_HOST'];
|
||||
$log_vars["action"] = "schedule/delete-show-instance";
|
||||
$log_vars["params"] = array();
|
||||
$log_vars["params"]["instance id"] = $instanceId;
|
||||
Logging::info($log_vars);
|
||||
|
||||
$service_show = new Application_Service_ShowService();
|
||||
$showId = $service_show->deleteShow($instanceId, true);
|
||||
|
||||
|
@ -223,6 +248,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
public function uploadToSoundCloudAction()
|
||||
{
|
||||
$show_instance = $this->_getParam('id');
|
||||
|
||||
try {
|
||||
$show_inst = new Application_Model_ShowInstance($show_instance);
|
||||
} catch (Exception $e) {
|
||||
|
@ -250,6 +276,13 @@ class ScheduleController extends Zend_Controller_Action
|
|||
public function clearShowAction()
|
||||
{
|
||||
$instanceId = $this->_getParam('id');
|
||||
|
||||
$log_vars = array();
|
||||
$log_vars["url"] = $_SERVER['HTTP_HOST'];
|
||||
$log_vars["action"] = "schedule/clear-show";
|
||||
$log_vars["params"] = array();
|
||||
$log_vars["params"]["instance id"] = $instanceId;
|
||||
Logging::info($log_vars);
|
||||
|
||||
$service_scheduler = new Application_Service_SchedulerService();
|
||||
|
||||
|
@ -425,6 +458,13 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
$data['add_show_hosts'] = $this->_getParam('hosts');
|
||||
|
||||
$log_vars = array();
|
||||
$log_vars["url"] = $_SERVER['HTTP_HOST'];
|
||||
$log_vars["action"] = "schedule/edit-repeating-show-instance";
|
||||
$log_vars["params"] = array();
|
||||
$log_vars["params"]["form_data"] = $data;
|
||||
Logging::info($log_vars);
|
||||
|
||||
$service_showForm = new Application_Service_ShowFormService(
|
||||
$data["add_show_id"], $data["add_show_instance_id"]);
|
||||
$service_show = new Application_Service_ShowService(null, $data);
|
||||
|
@ -476,6 +516,13 @@ class ScheduleController extends Zend_Controller_Action
|
|||
if ($data['add_show_day_check'] == "") {
|
||||
$data['add_show_day_check'] = null;
|
||||
}
|
||||
|
||||
$log_vars = array();
|
||||
$log_vars["url"] = $_SERVER['HTTP_HOST'];
|
||||
$log_vars["action"] = "schedule/edit-show";
|
||||
$log_vars["params"] = array();
|
||||
$log_vars["params"]["form_data"] = $data;
|
||||
Logging::info($log_vars);
|
||||
|
||||
$forms = $this->createShowFormAction();
|
||||
|
||||
|
@ -496,7 +543,7 @@ class ScheduleController extends Zend_Controller_Action
|
|||
if (!$validateStartTime) {
|
||||
$this->view->when->getElement('add_show_start_time')->setOptions(array('disabled' => true));
|
||||
}
|
||||
$this->view->rr->getElement('add_show_record')->setOptions(array('disabled' => true));
|
||||
//$this->view->rr->getElement('add_show_record')->setOptions(array('disabled' => true));
|
||||
$this->view->addNewShow = false;
|
||||
$this->view->action = "edit-show";
|
||||
$this->view->form = $this->view->render('schedule/add-show-form.phtml');
|
||||
|
@ -525,6 +572,13 @@ class ScheduleController extends Zend_Controller_Action
|
|||
if ($data['add_show_day_check'] == "") {
|
||||
$data['add_show_day_check'] = null;
|
||||
}
|
||||
|
||||
$log_vars = array();
|
||||
$log_vars["url"] = $_SERVER['HTTP_HOST'];
|
||||
$log_vars["action"] = "schedule/add-show";
|
||||
$log_vars["params"] = array();
|
||||
$log_vars["params"]["form_data"] = $data;
|
||||
Logging::info($log_vars);
|
||||
|
||||
$forms = $this->createShowFormAction();
|
||||
|
||||
|
@ -572,10 +626,17 @@ class ScheduleController extends Zend_Controller_Action
|
|||
public function deleteShowAction()
|
||||
{
|
||||
$instanceId = $this->_getParam('id');
|
||||
|
||||
$log_vars = array();
|
||||
$log_vars["url"] = $_SERVER['HTTP_HOST'];
|
||||
$log_vars["action"] = "schedule/delete-show";
|
||||
$log_vars["params"] = array();
|
||||
$log_vars["params"]["instance id"] = $instanceId;
|
||||
Logging::info($log_vars);
|
||||
|
||||
$service_show = new Application_Service_ShowService();
|
||||
$showId = $service_show->deleteShow($instanceId);
|
||||
|
||||
|
||||
if (!$showId) {
|
||||
$this->view->show_error = true;
|
||||
}
|
||||
|
@ -584,6 +645,13 @@ class ScheduleController extends Zend_Controller_Action
|
|||
|
||||
public function cancelCurrentShowAction()
|
||||
{
|
||||
$log_vars = array();
|
||||
$log_vars["url"] = $_SERVER['HTTP_HOST'];
|
||||
$log_vars["action"] = "schedule/cancel-current-show";
|
||||
$log_vars["params"] = array();
|
||||
$log_vars["params"]["instance id"] = $this->_getParam('id');
|
||||
Logging::info($log_vars);
|
||||
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
|
||||
if ($user->isUserType(array(UTYPE_SUPERADMIN, UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
|
||||
|
|
|
@ -28,6 +28,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$user = Application_Model_User::GetCurrentUser();
|
||||
$userType = $user->getType();
|
||||
$this->view->headScript()->appendScript("localStorage.setItem( 'user-type', '$userType' );");
|
||||
$this->view->headScript()->appendScript($this->generateGoogleTagManagerDataLayerJavaScript());
|
||||
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/contextmenu/jquery.contextMenu.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
$this->view->headScript()->appendFile($baseUrl.'js/datatables/js/jquery.dataTables.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
||||
|
@ -323,8 +324,17 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
public function scheduleAddAction()
|
||||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
$mediaItems = $request->getParam("mediaIds", array());
|
||||
$scheduledItems = $request->getParam("schedIds", array());
|
||||
|
||||
$log_vars = array();
|
||||
$log_vars["url"] = $_SERVER['HTTP_HOST'];
|
||||
$log_vars["action"] = "showbuilder/schedule-add";
|
||||
$log_vars["params"] = array();
|
||||
$log_vars["params"]["media_items"] = $mediaItems;
|
||||
$log_vars["params"]["scheduled_items"] = $scheduledItems;
|
||||
Logging::info($log_vars);
|
||||
|
||||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
|
@ -342,6 +352,13 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
{
|
||||
$request = $this->getRequest();
|
||||
$items = $request->getParam("items", array());
|
||||
|
||||
$log_vars = array();
|
||||
$log_vars["url"] = $_SERVER['HTTP_HOST'];
|
||||
$log_vars["action"] = "showbuilder/schedule-remove";
|
||||
$log_vars["params"] = array();
|
||||
$log_vars["params"]["removed_items"] = $items;
|
||||
Logging::info($log_vars);
|
||||
|
||||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
|
@ -360,6 +377,14 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$request = $this->getRequest();
|
||||
$selectedItems = $request->getParam("selectedItem");
|
||||
$afterItem = $request->getParam("afterItem");
|
||||
|
||||
$log_vars = array();
|
||||
$log_vars["url"] = $_SERVER['HTTP_HOST'];
|
||||
$log_vars["action"] = "showbuilder/schedule-move";
|
||||
$log_vars["params"] = array();
|
||||
$log_vars["params"]["selected_items"] = $selectedItems;
|
||||
$log_vars["params"]["destination_after_item"] = $afterItem;
|
||||
Logging::info($log_vars);
|
||||
|
||||
try {
|
||||
$scheduler = new Application_Model_Scheduler();
|
||||
|
@ -378,4 +403,98 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
throw new Exception("this controller is/was a no-op please fix your
|
||||
code");
|
||||
}
|
||||
|
||||
/** Returns a string containing the JavaScript code to pass some billing account info
|
||||
* into Google Tag Manager / Google Analytics, so we can track things like the plan type.
|
||||
*/
|
||||
private static function generateGoogleTagManagerDataLayerJavaScript()
|
||||
{
|
||||
$code = "";
|
||||
|
||||
try
|
||||
{
|
||||
$accessKey = $_SERVER["WHMCS_ACCESS_KEY"];
|
||||
$username = $_SERVER["WHMCS_USERNAME"];
|
||||
$password = $_SERVER["WHMCS_PASSWORD"];
|
||||
$url = "https://account.sourcefabric.com/includes/api.php?accesskey=" . $accessKey; # URL to WHMCS API file goes here
|
||||
|
||||
$postfields = array();
|
||||
$postfields["username"] = $username;
|
||||
$postfields["password"] = md5($password);
|
||||
$postfields["action"] = "getclientsdetails";
|
||||
$postfields["stats"] = true;
|
||||
$postfields["clientid"] = Application_Model_Preference::GetClientId();
|
||||
$postfields["responsetype"] = "json";
|
||||
|
||||
$query_string = "";
|
||||
foreach ($postfields AS $k=>$v) $query_string .= "$k=".urlencode($v)."&";
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5); //Aggressive 5 second timeout
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
$jsondata = curl_exec($ch);
|
||||
if (curl_error($ch)) {
|
||||
//die("Connection Error: ".curl_errno($ch).' - '.curl_error($ch));
|
||||
throw new Exception("WHMCS server down or invalid request.");
|
||||
}
|
||||
curl_close($ch);
|
||||
|
||||
$arr = json_decode($jsondata); # Decode JSON String
|
||||
|
||||
$client = $arr->client;
|
||||
$stats = $arr->stats;
|
||||
$currencyCode = $client->currency_code;
|
||||
//$incomeCents = NumberFormatter::parseCurrency($stats->income, $currencyCode);
|
||||
|
||||
$isTrial = true;
|
||||
if (strpos($stats->income, "0.00") === FALSE) {
|
||||
$isTrial = false;
|
||||
}
|
||||
/*
|
||||
if ($incomeCents > 0) {
|
||||
$isTrial = false;
|
||||
}*/
|
||||
$plan = Application_Model_Preference::GetPlanLevel();
|
||||
$country = $client->country;
|
||||
$postcode = $client->postcode;
|
||||
|
||||
//Figure out how long the customer has been around using a mega hack.
|
||||
//(I'm avoiding another round trip to WHMCS for now...)
|
||||
//We calculate it based on the trial end date...
|
||||
$trialEndDateStr = Application_Model_Preference::GetTrialEndingDate();
|
||||
if ($trialEndDateStr == '') {
|
||||
$accountDuration = 0;
|
||||
} else {
|
||||
$today = new DateTime();
|
||||
$trialEndDate = new DateTime($trialEndDateStr);
|
||||
$trialDuration = new DateInterval("P30D"); //30 day trial duration
|
||||
$accountCreationDate = $trialEndDate->sub($trialDuration);
|
||||
$interval = $today->diff($accountCreationDate);
|
||||
$accountDuration = $interval->days;
|
||||
}
|
||||
|
||||
$code = "$( document ).ready(function() {
|
||||
dataLayer.push({
|
||||
'ZipCode': '" . $postcode . "',
|
||||
'UserID': '" . $client->id . "',
|
||||
'Customer': 'Customer',
|
||||
'PlanType': '" . $plan . "',
|
||||
'Trial': '" . $isTrial . "',
|
||||
'Country': '" . $country . "',
|
||||
'AccountDuration': '" . strval($accountDuration) . "'
|
||||
});
|
||||
});";
|
||||
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return $code;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ class UpgradeController extends Zend_Controller_Action
|
|||
//create a temporary maintenance notification file
|
||||
//when this file is on the server, zend framework redirects all
|
||||
//requests to the maintenance page and sets a 503 response code
|
||||
|
||||
$maintenanceFile = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."maintenance.txt" : "/tmp/maintenance.txt";
|
||||
$file = fopen($maintenanceFile, 'w');
|
||||
fclose($file);
|
||||
|
@ -31,16 +32,10 @@ class UpgradeController extends Zend_Controller_Action
|
|||
//Begin upgrade
|
||||
|
||||
//Update disk_usage value in cc_pref
|
||||
$musicDir = CcMusicDirsQuery::create()
|
||||
->filterByType('stor')
|
||||
->filterByExists(true)
|
||||
->findOne();
|
||||
$storPath = $musicDir->getDirectory();
|
||||
|
||||
$freeSpace = disk_free_space($storPath);
|
||||
$totalSpace = disk_total_space($storPath);
|
||||
|
||||
Application_Model_Preference::setDiskUsage($totalSpace - $freeSpace);
|
||||
$storDir = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."srv/airtime/stor" : "/srv/airtime/stor";
|
||||
$diskUsage = shell_exec("du -sb $storDir | awk '{print $1}'");
|
||||
|
||||
Application_Model_Preference::setDiskUsage($diskUsage);
|
||||
|
||||
//TODO: clear out the cache
|
||||
|
||||
|
|
|
@ -7,13 +7,9 @@ class RabbitMqPlugin extends Zend_Controller_Plugin_Abstract
|
|||
if (Application_Model_RabbitMq::$doPush) {
|
||||
$md = array('schedule' => Application_Model_Schedule::getSchedule());
|
||||
Application_Model_RabbitMq::SendMessageToPypo("update_schedule", $md);
|
||||
if (!isset($_SERVER['AIRTIME_SRV'])) {
|
||||
Application_Model_RabbitMq::SendMessageToShowRecorder("update_recorder_schedule");
|
||||
}
|
||||
}
|
||||
|
||||
if (memory_get_peak_usage() > 30*pow(2, 20)) {
|
||||
|
||||
Logging::debug("Peak memory usage: "
|
||||
.(memory_get_peak_usage()/1000000)
|
||||
." MB while accessing URI ".$_SERVER['REQUEST_URI']);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue