本文整理汇总了PHP中Logging::info方法的典型用法代码示例。如果您正苦于以下问题:PHP Logging::info方法的具体用法?PHP Logging::info怎么用?PHP Logging::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logging
的用法示例。
在下文中一共展示了Logging::info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetPlayOrderRange
/**
* Returns data related to the scheduled items.
*
* @param int $p_prev
* @param int $p_next
* @return date
*/
public static function GetPlayOrderRange($p_prev = 1, $p_next = 1)
{
//Everything in this function must be done in UTC. You will get a swift kick in the pants if you mess that up.
if (!is_int($p_prev) || !is_int($p_next)) {
//must enter integers to specify ranges
Logging::info("Invalid range parameters: {$p_prev} or {$p_next}");
return array();
}
$utcNow = new DateTime("now", new DateTimeZone("UTC"));
$shows = Application_Model_Show::getPrevCurrentNext($utcNow);
$previousShowID = count($shows['previousShow']) > 0 ? $shows['previousShow'][0]['instance_id'] : null;
$currentShowID = count($shows['currentShow']) > 0 ? $shows['currentShow'][0]['instance_id'] : null;
$nextShowID = count($shows['nextShow']) > 0 ? $shows['nextShow'][0]['instance_id'] : null;
$results = self::GetPrevCurrentNext($previousShowID, $currentShowID, $nextShowID, $utcNow);
$range = array("env" => APPLICATION_ENV, "schedulerTime" => $utcNow->format("Y-m-d H:i:s"), "previous" => $results['previous'] != null ? $results['previous'] : (count($shows['previousShow']) > 0 ? $shows['previousShow'][0] : null), "current" => $results['current'] != null ? $results['current'] : (count($shows['currentShow']) > 0 && $shows['currentShow'][0]['record'] == 1 ? $shows['currentShow'][0] : null), "next" => $results['next'] != null ? $results['next'] : (count($shows['nextShow']) > 0 ? $shows['nextShow'][0] : null), "currentShow" => $shows['currentShow'], "nextShow" => $shows['nextShow']);
return $range;
}
示例2: playoutHistoryFeedAction
public function playoutHistoryFeedAction()
{
$request = $this->getRequest();
$current_time = time();
$params = $request->getParams();
$starts_epoch = $request->getParam("start", $current_time - 60 * 60 * 24);
$ends_epoch = $request->getParam("end", $current_time);
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
Logging::info("history starts {$startsDT->format("Y-m-d H:i:s")}");
Logging::info("history ends {$endsDT->format("Y-m-d H:i:s")}");
$history = new Application_Model_PlayoutHistory($startsDT, $endsDT, $params);
$r = $history->getItems();
$this->view->sEcho = $r["sEcho"];
$this->view->iTotalDisplayRecords = $r["iTotalDisplayRecords"];
$this->view->iTotalRecords = $r["iTotalRecords"];
$this->view->history = $r["history"];
}
示例3: GetPlayOrderRange
/**
* Returns data related to the scheduled items.
*
* @param int $p_prev
* @param int $p_next
* @return date
*/
public static function GetPlayOrderRange($p_prev = 1, $p_next = 1)
{
if (!is_int($p_prev) || !is_int($p_next)) {
//must enter integers to specify ranges
Logging::info("Invalid range parameters: {$p_prev} or {$p_next}");
return array();
}
$date = new Application_Common_DateHelper();
$timeNow = $date->getTimestamp();
$utcTimeNow = $date->getUtcTimestamp();
$shows = Application_Model_Show::getPrevCurrentNext($utcTimeNow);
$previousShowID = count($shows['previousShow']) > 0 ? $shows['previousShow'][0]['instance_id'] : null;
$currentShowID = count($shows['currentShow']) > 0 ? $shows['currentShow'][0]['instance_id'] : null;
$nextShowID = count($shows['nextShow']) > 0 ? $shows['nextShow'][0]['instance_id'] : null;
$results = self::GetPrevCurrentNext($previousShowID, $currentShowID, $nextShowID, $utcTimeNow);
$range = array("env" => APPLICATION_ENV, "schedulerTime" => $timeNow, "previous" => $results['previous'] != null ? $results['previous'] : (count($shows['previousShow']) > 0 ? $shows['previousShow'][0] : null), "current" => $results['current'] != null ? $results['current'] : (count($shows['currentShow']) > 0 && $shows['currentShow'][0]['record'] == 1 ? $shows['currentShow'][0] : null), "next" => $results['next'] != null ? $results['next'] : (count($shows['nextShow']) > 0 ? $shows['nextShow'][0] : null), "currentShow" => $shows['currentShow'], "nextShow" => $shows['nextShow'], "timezone" => date("T"), "timezoneOffset" => date("Z"));
return $range;
}
示例4: indexAction
public function indexAction()
{
$CC_CONFIG = Config::getConfig();
$request = $this->getRequest();
$baseUrl = Application_Common_OsPath::getBaseDir();
$this->view->headScript()->appendFile($baseUrl . 'js/flot/jquery.flot.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/flot/jquery.flot.crosshair.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/listenerstat/listenerstat.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/timepicker/jquery.ui.timepicker.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/buttons/buttons.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/utilities/utilities.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
$this->view->headLink()->appendStylesheet($baseUrl . 'css/jquery.ui.timepicker.css?' . $CC_CONFIG['airtime_version']);
//default time is the last 24 hours.
$now = time();
$from = $request->getParam("from", $now - 24 * 60 * 60);
$to = $request->getParam("to", $now);
$utcTimezone = new DateTimeZone("UTC");
$displayTimeZone = new DateTimeZone(Application_Model_Preference::GetTimezone());
$start = DateTime::createFromFormat("U", $from, $utcTimezone);
$start->setTimezone($displayTimeZone);
$end = DateTime::createFromFormat("U", $to, $utcTimezone);
$end->setTimezone($displayTimeZone);
$form = new Application_Form_DateRange();
$form->populate(array('his_date_start' => $start->format("Y-m-d"), 'his_time_start' => $start->format("H:i"), 'his_date_end' => $end->format("Y-m-d"), 'his_time_end' => $end->format("H:i")));
$errorStatus = Application_Model_StreamSetting::GetAllListenerStatErrors();
Logging::info($errorStatus);
$out = array();
foreach ($errorStatus as $v) {
$key = explode('_listener_stat_error', $v['keyname']);
if ($v['value'] != 'OK') {
$v['value'] = _("Please make sure admin user/password is correct on System->Streams page.");
}
$out[$key[0]] = $v['value'];
}
$this->view->errorStatus = $out;
$this->view->date_form = $form;
}
示例5: scheduleMoveAction
public function scheduleMoveAction()
{
$request = $this->getRequest();
$selectedItems = $request->getParam("selectedItem");
$afterItem = $request->getParam("afterItem");
try {
$scheduler = new Application_Model_Scheduler();
$scheduler->moveItem($selectedItems, $afterItem);
} catch (OutDatedScheduleException $e) {
$this->view->error = $e->getMessage();
Logging::info($e->getMessage());
} catch (Exception $e) {
$this->view->error = $e->getMessage();
Logging::info($e->getMessage());
}
}
示例6: getListofFilesMeetCriteria
public function getListofFilesMeetCriteria()
{
$storedCrit = $this->getCriteria();
$qry = CcFilesQuery::create();
$qry->useFkOwnerQuery("subj", "left join");
if (isset($storedCrit["crit"])) {
foreach ($storedCrit["crit"] as $crit) {
$i = 0;
foreach ($crit as $criteria) {
//$spCriteriaPhpName = self::$criteria2PeerMap[$criteria['criteria']];
$spCriteria = $criteria['criteria'];
$spCriteriaModifier = $criteria['modifier'];
$column = CcFilesPeer::getTableMap()->getColumnByPhpName(self::$criteria2PeerMap[$spCriteria]);
// if the column is timestamp, convert it into UTC
if ($column->getType() == PropelColumnTypes::TIMESTAMP) {
$spCriteriaValue = Application_Common_DateHelper::ConvertToUtcDateTimeString($criteria['value']);
/* Check if only a date was supplied and trim
* the time after it is converted to UTC time
*/
if (strlen($criteria['value']) <= 10) {
//extract date only from timestamp in db
$spCriteria = 'date(' . $spCriteria . ')';
$spCriteriaValue = substr($spCriteriaValue, 0, 10);
}
if (isset($criteria['extra'])) {
$spCriteriaExtra = Application_Common_DateHelper::ConvertToUtcDateTimeString($criteria['extra']);
if (strlen($criteria['extra']) <= 10) {
$spCriteriaExtra = substr($spCriteriaExtra, 0, 10);
}
}
} elseif ($spCriteria == "bit_rate" || $spCriteria == 'sample_rate') {
// multiply 1000 because we store only number value
// e.g 192kps is stored as 192000
$spCriteriaValue = $criteria['value'] * 1000;
if (isset($criteria['extra'])) {
$spCriteriaExtra = $criteria['extra'] * 1000;
}
/*
* If user is searching for an exact match of length we need to
* search as if it starts with the specified length because the
* user only sees the rounded version (i.e. 4:02.7 is 4:02.761625
* in the database)
*/
} elseif ($spCriteria == 'length' && $spCriteriaModifier == "is") {
$spCriteriaModifier = "starts with";
$spCriteria = $spCriteria . '::text';
$spCriteriaValue = $criteria['value'];
} else {
/* Propel does not escape special characters properly when using LIKE/ILIKE
* We have to add extra slashes in these cases
*/
$tempModifier = trim(self::$modifier2CriteriaMap[$spCriteriaModifier]);
if ($tempModifier == 'ILIKE') {
$spCriteriaValue = addslashes($criteria['value']);
// addslashes() does not esapce '%' so we have to do it manually
$spCriteriaValue = str_replace('%', '\\%', $spCriteriaValue);
} else {
$spCriteriaValue = $criteria['value'];
}
$spCriteriaExtra = $criteria['extra'];
}
if ($spCriteriaModifier == "starts with") {
$spCriteriaValue = "{$spCriteriaValue}%";
} elseif ($spCriteriaModifier == "ends with") {
$spCriteriaValue = "%{$spCriteriaValue}";
} elseif ($spCriteriaModifier == "contains" || $spCriteriaModifier == "does not contain") {
$spCriteriaValue = "%{$spCriteriaValue}%";
} elseif ($spCriteriaModifier == "is in the range") {
$spCriteriaValue = "{$spCriteria} >= '{$spCriteriaValue}' AND {$spCriteria} <= '{$spCriteriaExtra}'";
}
$spCriteriaModifier = self::$modifier2CriteriaMap[$spCriteriaModifier];
try {
if ($spCriteria == "owner_id") {
$spCriteria = "subj.login";
}
if ($i > 0) {
$qry->addOr($spCriteria, $spCriteriaValue, $spCriteriaModifier);
} else {
$qry->add($spCriteria, $spCriteriaValue, $spCriteriaModifier);
}
if ($spCriteriaModifier == Criteria::NOT_ILIKE || $spCriteriaModifier == Criteria::NOT_EQUAL) {
$qry->addOr($spCriteria, null, Criteria::ISNULL);
}
} catch (Exception $e) {
Logging::info($e);
}
$i++;
}
}
// check if file exists
$qry->add("file_exists", "true", Criteria::EQUAL);
$qry->addAscendingOrderByColumn('random()');
}
// construct limit restriction
$limits = array();
if (isset($storedCrit['limit'])) {
if ($storedCrit['limit']['modifier'] == "items") {
$limits['time'] = 1440 * 60;
$limits['items'] = $storedCrit['limit']['value'];
} else {
//.........这里部分代码省略.........
示例7: smartBlockGenerateAction
public function smartBlockGenerateAction()
{
$request = $this->getRequest();
$params = $request->getPost();
//make sure block exists
try {
$bl = new Application_Model_Block($params['obj_id']);
$form = new Application_Form_SmartBlockCriteria();
$form->startForm($params['obj_id']);
if ($form->isValid($params)) {
$result = $bl->generateSmartBlock($params['data']);
$this->_helper->json->sendJson(array("result" => 0, "html" => $this->createFullResponse($bl, true, true)));
} else {
$this->view->obj = $bl;
$this->view->id = $bl->getId();
$this->view->form = $form;
$viewPath = 'playlist/smart-block.phtml';
$result['html'] = $this->view->render($viewPath);
$result['result'] = 1;
$this->_helper->json->sendJson($result);
}
} catch (BlockNotFoundException $e) {
$this->playlistNotFound('block', true);
} catch (Exception $e) {
Logging::info($e);
$this->playlistUnknownError($e);
}
}
示例8: insertAfter
private function insertAfter($scheduleItems, $schedFiles, $adjustSched = true)
{
try {
$affectedShowInstances = array();
//dont want to recalculate times for moved items.
$excludeIds = array();
foreach ($schedFiles as $file) {
if (isset($file["sched_id"])) {
$excludeIds[] = intval($file["sched_id"]);
}
}
$startProfile = microtime(true);
foreach ($scheduleItems as $schedule) {
$id = intval($schedule["id"]);
if ($id !== 0) {
$schedItem = CcScheduleQuery::create()->findPK($id, $this->con);
$instance = $schedItem->getCcShowInstances($this->con);
$schedItemEndDT = $schedItem->getDbEnds(null);
$nextStartDT = $this->findNextStartTime($schedItemEndDT, $instance);
} else {
$instance = CcShowInstancesQuery::create()->findPK($schedule["instance"], $this->con);
$showStartDT = $instance->getDbStarts(null);
$nextStartDT = $this->findNextStartTime($showStartDT, $instance);
}
if (!in_array($instance->getDbId(), $affectedShowInstances)) {
$affectedShowInstances[] = $instance->getDbId();
}
if ($adjustSched === true) {
$pstart = microtime(true);
$followingSchedItems = CcScheduleQuery::create()->filterByDBStarts($nextStartDT->format("Y-m-d H:i:s.u"), Criteria::GREATER_EQUAL)->filterByDbInstanceId($instance->getDbId())->filterByDbId($excludeIds, Criteria::NOT_IN)->orderByDbStarts()->find($this->con);
$pend = microtime(true);
Logging::debug("finding all following items.");
Logging::debug(floatval($pend) - floatval($pstart));
}
foreach ($schedFiles as $file) {
$endTimeDT = $this->findEndTime($nextStartDT, $file['cliplength']);
//item existed previously and is being moved.
//need to keep same id for resources if we want REST.
if (isset($file['sched_id'])) {
$sched = CcScheduleQuery::create()->findPK($file['sched_id'], $this->con);
} else {
$sched = new CcSchedule();
}
Logging::info($file);
$sched->setDbStarts($nextStartDT)->setDbEnds($endTimeDT)->setDbCueIn($file['cuein'])->setDbCueOut($file['cueout'])->setDbFadeIn($file['fadein'])->setDbFadeOut($file['fadeout'])->setDbClipLength($file['cliplength'])->setDbInstanceId($instance->getDbId());
switch ($file["type"]) {
case 0:
$sched->setDbFileId($file['id']);
break;
case 1:
$sched->setDbStreamId($file['id']);
break;
default:
break;
}
$sched->save($this->con);
$nextStartDT = $endTimeDT;
}
if ($adjustSched === true) {
$pstart = microtime(true);
//recalculate the start/end times after the inserted items.
foreach ($followingSchedItems as $item) {
$endTimeDT = $this->findEndTime($nextStartDT, $item->getDbClipLength());
$item->setDbStarts($nextStartDT);
$item->setDbEnds($endTimeDT);
$item->save($this->con);
$nextStartDT = $endTimeDT;
}
$pend = microtime(true);
Logging::debug("adjusting all following items.");
Logging::debug(floatval($pend) - floatval($pstart));
}
}
$endProfile = microtime(true);
Logging::debug("finished adding scheduled items.");
Logging::debug(floatval($endProfile) - floatval($startProfile));
//update the status flag in cc_schedule.
$instances = CcShowInstancesQuery::create()->filterByPrimaryKeys($affectedShowInstances)->find($this->con);
$startProfile = microtime(true);
foreach ($instances as $instance) {
$instance->updateScheduleStatus($this->con);
}
$endProfile = microtime(true);
Logging::debug("updating show instances status.");
Logging::debug(floatval($endProfile) - floatval($startProfile));
$startProfile = microtime(true);
//update the last scheduled timestamp.
CcShowInstancesQuery::create()->filterByPrimaryKeys($affectedShowInstances)->update(array('DbLastScheduled' => new DateTime("now", new DateTimeZone("UTC"))), $this->con);
$endProfile = microtime(true);
Logging::debug("updating last scheduled timestamp.");
Logging::debug(floatval($endProfile) - floatval($startProfile));
} catch (Exception $e) {
Logging::debug($e->getMessage());
throw $e;
}
}
示例9: getSoundCloudUploads
public static function getSoundCloudUploads()
{
try {
$con = Propel::getConnection();
$sql = <<<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;
$rows = $con->query($sql)->fetchAll();
return count($rows);
} catch (Exception $e) {
header('HTTP/1.0 503 Service Unavailable');
Logging::info("Could not connect to database.");
exit;
}
}
示例10: updateFileItemAction
public function updateFileItemAction()
{
$request = $this->getRequest();
$params = $request->getPost();
Logging::info($params);
$historyService = new Application_Service_HistoryService();
$json = $historyService->editPlayedFile($params);
$this->_helper->json->sendJson($json);
}
示例11: cancelCurrentShowAction
public function cancelCurrentShowAction()
{
$user = Application_Model_User::getCurrentUser();
if ($user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER))) {
$id = $this->_getParam('id');
try {
$scheduler = new Application_Model_Scheduler();
$scheduler->cancelShow($id);
// send kick out source stream signal to pypo
$data = array("sourcename" => "live_dj");
Application_Model_RabbitMq::SendMessageToPypo("disconnect_source", $data);
} catch (Exception $e) {
$this->view->error = $e->getMessage();
Logging::info($e->getMessage());
}
}
}
示例12: create
/**
* create new database table for current DatabaseTable object
* @param $force bool indicates if existing database table should be removed (FALSE if not provided)
* @return bool indicates if table has been created
*/
function create($force = FALSE)
{
global $firstthingsfirst_field_descriptions;
$this->_log->trace("creating DatabaseTable (table=" . $this->table_name . ")");
# check if database connection is working
if ($this->_check_database_connection() == FALSE) {
return FALSE;
}
# check if database table already exists
if ($this->_database->table_exists($this->table_name)) {
# drop the existing table
if ($force) {
$this->_log->debug("dropping table (table=" . $this->table_name . ")");
$query = "DROP TABLE " . $this->table_name;
$result = $this->_database->query($query);
if ($result == FALSE) {
$this->_handle_error("could not drop DatabaseTable", "ERROR_DATABASE_PROBLEM");
return FALSE;
}
} else {
# do not drop the table by force
$this->_handle_error("table (table=" . $this->table_name . ") already exists and (force=FALSE)", "ERROR_DUPLICATE_LIST_NAME");
return FALSE;
}
}
$query_postfix = "";
$query = "CREATE TABLE " . $this->table_name . " (";
foreach ($this->db_field_names as $db_field_name) {
$field_type = $this->fields[$db_field_name][1];
$field_options = $this->fields[$db_field_name][2];
$this->_log->trace("found field (db_field_name=" . $db_field_name . ", field_type=" . $field_type . ", field_options=" . $field_options . ")");
$query .= $db_field_name . " " . $firstthingsfirst_field_descriptions[$field_type][FIELD_DESCRIPTION_FIELD_DB_DEFINITION] . ", ";
# check for postfix
if ($this->fields[$db_field_name][2] == DATABASETABLE_UNIQUE_FIELD) {
$query_postfix .= ", " . DATABASETABLE_UNIQUE_FIELD . " " . $db_field_name . " (" . $db_field_name . ")";
}
}
# add archiver name and datetime
if ($this->metadata_str[DATABASETABLE_METADATA_ENABLE_ARCHIVE] != DATABASETABLE_METADATA_FALSE) {
$query .= DB_ARCHIVER_FIELD_NAME . " " . DB_DATATYPE_USERNAME . ", ";
$query .= DB_TS_ARCHIVED_FIELD_NAME . " " . DB_DATATYPE_DATETIME . ", ";
}
# add creator name and datetime
if ($this->metadata_str[DATABASETABLE_METADATA_ENABLE_CREATE] != DATABASETABLE_METADATA_FALSE) {
$query .= DB_CREATOR_FIELD_NAME . " " . DB_DATATYPE_USERNAME . ", ";
$query .= DB_TS_CREATED_FIELD_NAME . " " . DB_DATATYPE_DATETIME . ", ";
}
# add modifier name and datetime
if ($this->metadata_str[DATABASETABLE_METADATA_ENABLE_MODIFY] != DATABASETABLE_METADATA_FALSE) {
$query .= DB_MODIFIER_FIELD_NAME . " " . DB_DATATYPE_USERNAME . ", ";
$query .= DB_TS_MODIFIED_FIELD_NAME . " " . DB_DATATYPE_DATETIME . ", ";
}
$query .= "PRIMARY KEY (" . DB_ID_FIELD_NAME . ")";
# add postfix
if (strlen($query_postfix) > 0) {
$query .= $query_postfix;
}
$query .= ") ENGINE=MyISAM";
$result = $this->_database->query($query);
if ($result == FALSE) {
$this->_handle_error("could not create DatabaseTable", "ERROR_DATABASE_PROBLEM");
return FALSE;
}
$this->_log->info("created DatabaseTable (table_name=" . $this->table_name . ")");
return TRUE;
}
示例13: getOrderingMap
public static function getOrderingMap($pref_param)
{
$v = self::getValue($pref_param, true);
$id = function ($x) {
return $x;
};
if ($v === '') {
return $id;
}
$ds = unserialize($v);
if (!array_key_exists('ColReorder', $ds)) {
return $id;
}
return function ($x) use($ds) {
if (array_key_exists($x, $ds['ColReorder'])) {
return $ds['ColReorder'][$x];
} else {
/*For now we just have this hack for debugging. We should not
rely on this crappy behaviour in case of failure*/
Logging::info("Pref: {$pref_param}");
Logging::warn("Index {$x} does not exist preferences");
Logging::warn("Defaulting to identity and printing preferences");
Logging::warn($ds);
return $x;
}
};
}
示例14: removeGaps
public function removeGaps($showInstance, $exclude = null)
{
Logging::info("removing gaps from show instance #" . $showInstance);
$instance = CcShowInstancesQuery::create()->findPK($showInstance, $this->con);
if (is_null($instance)) {
throw new OutDatedScheduleException(_("The schedule you're viewing is out of date!"));
}
$itemStartDT = $instance->getDbStarts(null);
$schedule = CcScheduleQuery::create()->filterByDbInstanceId($showInstance)->filterByDbId($exclude, Criteria::NOT_IN)->orderByDbStarts()->find($this->con);
foreach ($schedule as $item) {
$itemEndDT = $this->findEndTime($itemStartDT, $item->getDbClipLength());
$item->setDbStarts($itemStartDT)->setDbEnds($itemEndDT);
$itemStartDT = $itemEndDT;
}
$schedule->save($this->con);
}
示例15: emptyShowContent
public function emptyShowContent($instanceId)
{
try {
$ccShowInstance = CcShowInstancesQuery::create()->findPk($instanceId);
$instances = array();
$instanceIds = array();
if ($ccShowInstance->getCcShow()->isLinked()) {
foreach ($ccShowInstance->getCcShow()->getCcShowInstancess() as $instance) {
$instanceIds[] = $instance->getDbId();
$instances[] = $instance;
}
} else {
$instanceIds[] = $ccShowInstance->getDbId();
$instances[] = $ccShowInstance;
}
/* Get the file ids of the tracks we are about to delete
* from cc_schedule. We need these so we can update the
* is_scheduled flag in cc_files
*/
$ccSchedules = CcScheduleQuery::create()->filterByDbInstanceId($instanceIds, Criteria::IN)->setDistinct(CcSchedulePeer::FILE_ID)->find();
$fileIds = array();
foreach ($ccSchedules as $ccSchedule) {
$fileIds[] = $ccSchedule->getDbFileId();
}
/* Clear out the schedule */
CcScheduleQuery::create()->filterByDbInstanceId($instanceIds, Criteria::IN)->delete();
/* Now that the schedule has been cleared we need to make
* sure we do not update the is_scheduled flag for tracks
* that are scheduled in other shows
*/
$futureScheduledFiles = Application_Model_Schedule::getAllFutureScheduledFiles();
foreach ($fileIds as $k => $v) {
if (in_array($v, $futureScheduledFiles)) {
unset($fileIds[$k]);
}
}
$selectCriteria = new Criteria();
$selectCriteria->add(CcFilesPeer::ID, $fileIds, Criteria::IN);
$updateCriteria = new Criteria();
$updateCriteria->add(CcFilesPeer::IS_SCHEDULED, false);
BasePeer::doUpdate($selectCriteria, $updateCriteria, Propel::getConnection());
Application_Model_RabbitMq::PushSchedule();
$con = Propel::getConnection(CcShowInstancesPeer::DATABASE_NAME);
foreach ($instances as $instance) {
$instance->updateDbTimeFilled($con);
}
return true;
} catch (Exception $e) {
Logging::info($e->getMessage());
return false;
}
}