Merge branch '2.5.x' into 2.5.x-saas
This commit is contained in:
commit
ed78625fce
|
@ -162,6 +162,13 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* We need to know the show duration broken down into hours and minutes
|
||||||
|
* They are used for checking overlapping shows and for validating
|
||||||
|
* rebroadcast instances
|
||||||
|
*/
|
||||||
|
$hours = $duration->format("%h");
|
||||||
|
$minutes = $duration->format("%i");
|
||||||
|
|
||||||
/* Check if show is overlapping
|
/* Check if show is overlapping
|
||||||
* We will only do this check if the show is valid
|
* We will only do this check if the show is valid
|
||||||
* upto this point
|
* upto this point
|
||||||
|
|
|
@ -515,6 +515,9 @@ class Application_Model_Scheduler
|
||||||
private function insertAfter($scheduleItems, $mediaItems, $filesToInsert=null, $adjustSched=true, $moveAction=false)
|
private function insertAfter($scheduleItems, $mediaItems, $filesToInsert=null, $adjustSched=true, $moveAction=false)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
// temporary fix for CC-5665
|
||||||
|
set_time_limit(180);
|
||||||
|
|
||||||
$affectedShowInstances = array();
|
$affectedShowInstances = array();
|
||||||
|
|
||||||
//dont want to recalculate times for moved items
|
//dont want to recalculate times for moved items
|
||||||
|
|
|
@ -920,41 +920,6 @@ SQL;
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate all the repeating shows in the given range.
|
|
||||||
*
|
|
||||||
* @param DateTime $p_startTimestamp
|
|
||||||
* In UTC format.
|
|
||||||
* @param DateTime $p_endTimestamp
|
|
||||||
* In UTC format.
|
|
||||||
*/
|
|
||||||
public static function populateAllShowsInRange($p_startTimestamp, $p_endTimestamp)
|
|
||||||
{
|
|
||||||
$con = Propel::getConnection();
|
|
||||||
|
|
||||||
$endTimeString = $p_endTimestamp->format("Y-m-d H:i:s");
|
|
||||||
if (!is_null($p_startTimestamp)) {
|
|
||||||
$startTimeString = $p_startTimestamp->format("Y-m-d H:i:s");
|
|
||||||
} else {
|
|
||||||
$today_timestamp = new DateTime("now", new DateTimeZone("UTC"));
|
|
||||||
$startTimeString = $today_timestamp->format("Y-m-d H:i:s");
|
|
||||||
}
|
|
||||||
|
|
||||||
$stmt = $con->prepare("
|
|
||||||
SELECT * FROM cc_show_days
|
|
||||||
WHERE last_show IS NULL
|
|
||||||
OR first_show < :endTimeString AND last_show > :startTimeString");
|
|
||||||
|
|
||||||
$stmt->bindParam(':endTimeString', $endTimeString);
|
|
||||||
$stmt->bindParam(':startTimeString', $startTimeString);
|
|
||||||
$stmt->execute();
|
|
||||||
|
|
||||||
$res = $stmt->fetchAll();
|
|
||||||
foreach ($res as $row) {
|
|
||||||
Application_Model_Show::populateShow($row, $p_endTimestamp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param DateTime $start
|
* @param DateTime $start
|
||||||
|
|
|
@ -667,11 +667,7 @@ SQL;
|
||||||
|
|
||||||
$showId = $ccShowInstance->getDbShowId();
|
$showId = $ccShowInstance->getDbShowId();
|
||||||
if ($singleInstance) {
|
if ($singleInstance) {
|
||||||
$ccShowInstances = CcShowInstancesQuery::create()
|
$ccShowInstances = array($ccShowInstance);
|
||||||
->filterByDbShowId($showId)
|
|
||||||
->filterByDbStarts($ccShowInstance->getDbStarts(), Criteria::GREATER_EQUAL)
|
|
||||||
->filterByDbEnds($ccShowInstance->getDbEnds(), Criteria::LESS_EQUAL)
|
|
||||||
->find();
|
|
||||||
} else {
|
} else {
|
||||||
$ccShowInstances = CcShowInstancesQuery::create()
|
$ccShowInstances = CcShowInstancesQuery::create()
|
||||||
->filterByDbShowId($showId)
|
->filterByDbShowId($showId)
|
||||||
|
@ -680,7 +676,9 @@ SQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gmdate("Y-m-d H:i:s") <= $ccShowInstance->getDbEnds()) {
|
if (gmdate("Y-m-d H:i:s") <= $ccShowInstance->getDbEnds()) {
|
||||||
$this->deleteShowInstances($ccShowInstances, $ccShowInstance->getDbShowId());
|
$this->deleteShowInstances($ccShowInstances, $showId);
|
||||||
|
} else {
|
||||||
|
throw new Exception("Cannot delete a show instance in the past");
|
||||||
}
|
}
|
||||||
|
|
||||||
Application_Model_StoredFile::updatePastFilesIsScheduled();
|
Application_Model_StoredFile::updatePastFilesIsScheduled();
|
||||||
|
@ -688,6 +686,7 @@ SQL;
|
||||||
Application_Model_RabbitMq::PushSchedule();
|
Application_Model_RabbitMq::PushSchedule();
|
||||||
|
|
||||||
$con->commit();
|
$con->commit();
|
||||||
|
|
||||||
return $showId;
|
return $showId;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$con->rollback();
|
$con->rollback();
|
||||||
|
@ -723,12 +722,18 @@ SQL;
|
||||||
CcShowQuery::create()
|
CcShowQuery::create()
|
||||||
->filterByDbId($showId)
|
->filterByDbId($showId)
|
||||||
->delete();
|
->delete();
|
||||||
|
/* There is only one cc_show_instance if the user selects 'Delete This Instance'
|
||||||
|
* There is more than one cc_show_instance if the user selects 'Delete This
|
||||||
|
* Instance and All Following'. We only need to set the last_show value
|
||||||
|
* when 'Delete This Instance and All Following' has been selected
|
||||||
|
*/
|
||||||
|
} elseif (count($ccShowInstances) > 1) {
|
||||||
|
$this->setLastRepeatingShowDate($showId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function checkToDeleteCcShow($showId)
|
private function setLastRepeatingShowDate($showId)
|
||||||
{
|
{
|
||||||
// check if there are any non deleted show instances remaining.
|
|
||||||
$ccShowInstances = CcShowInstancesQuery::create()
|
$ccShowInstances = CcShowInstancesQuery::create()
|
||||||
->filterByDbShowId($showId)
|
->filterByDbShowId($showId)
|
||||||
->filterByDbModifiedInstance(false)
|
->filterByDbModifiedInstance(false)
|
||||||
|
@ -736,13 +741,9 @@ SQL;
|
||||||
->orderByDbStarts()
|
->orderByDbStarts()
|
||||||
->find();
|
->find();
|
||||||
|
|
||||||
if ($ccShowInstances->isEmpty()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/* We need to update the last_show in cc_show_days so the instances
|
/* We need to update the last_show in cc_show_days so the instances
|
||||||
* don't get recreated as the user moves forward in the calendar
|
* don't get recreated as the user moves forward in the calendar
|
||||||
*/
|
*/
|
||||||
else if (count($ccShowInstances) >= 1) {
|
|
||||||
$lastShowDays = array();
|
$lastShowDays = array();
|
||||||
|
|
||||||
//get the show's timezone
|
//get the show's timezone
|
||||||
|
@ -782,6 +783,32 @@ SQL;
|
||||||
->save();
|
->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE: Some cc_show_day records may not get updated because there may not be an instance
|
||||||
|
// left on one of the repeating days so we have to find the entries where the last_show is
|
||||||
|
// still null
|
||||||
|
$showDays = CcShowDaysQuery::create()
|
||||||
|
->filterByDbShowId($showId)
|
||||||
|
->filterByDbRepeatType(0, Criteria::GREATER_EQUAL)
|
||||||
|
->filterByDbLastShow(null)
|
||||||
|
->find();
|
||||||
|
foreach ($showDays as $showDay) {
|
||||||
|
$showDay->setDbLastShow($showDay->getDbFirstShow())->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function checkToDeleteCcShow($showId)
|
||||||
|
{
|
||||||
|
// check if there are any non deleted show instances remaining.
|
||||||
|
$ccShowInstances = CcShowInstancesQuery::create()
|
||||||
|
->filterByDbShowId($showId)
|
||||||
|
->filterByDbModifiedInstance(false)
|
||||||
|
->filterByDbRebroadcast(0)
|
||||||
|
->orderByDbStarts()
|
||||||
|
->find();
|
||||||
|
|
||||||
|
if ($ccShowInstances->isEmpty()) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -1251,6 +1278,18 @@ SQL;
|
||||||
return $dt;
|
return $dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Returns a DateTime object of when the next repeating show that repeats
|
||||||
|
* monthly, by day of the week (i.e. every fourth Tuesday) should be created
|
||||||
|
*
|
||||||
|
* @param DateTime $start
|
||||||
|
* $start only has the year and month of the next show
|
||||||
|
* @param string $timezone
|
||||||
|
* @param string (i.e. '14:30' $startTime
|
||||||
|
* @param string (i.e. 'first', 'second') $weekNumberOfMonth
|
||||||
|
* @param string (i.e. 'Monday') $dayOfWeek
|
||||||
|
*/
|
||||||
private function getNextMonthlyWeeklyRepeatDate(
|
private function getNextMonthlyWeeklyRepeatDate(
|
||||||
$start,
|
$start,
|
||||||
$timezone,
|
$timezone,
|
||||||
|
|
|
@ -221,10 +221,7 @@ class AirtimeCheck {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function show_log_file($log) {
|
public static function show_log_file($log) {
|
||||||
exec("tail -5 $log", $output);
|
self::output_comment("Check the log file $log");
|
||||||
self::output_comment("Displaying log file $log");
|
|
||||||
self::output_comment($output);
|
|
||||||
self::output_comment("");
|
|
||||||
self::output_comment("");
|
self::output_comment("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue