Merge branch '2.5.x' of github.com:sourcefabric/Airtime into 2.5.x

Conflicts:
	install_minimal/include/airtime-install.php
This commit is contained in:
drigato 2013-12-03 11:25:09 -05:00
commit 3b539b7c04
6 changed files with 89 additions and 16 deletions

25
CREDITS
View File

@ -2,11 +2,34 @@
CREDITS
=======
Version 2.5.1
Albert Santoni (albert.santoni@sourcefabric.org)
Role: Developer Team Lead
Denise Rigato (denise.rigato@sourcefabric.org)
Role: Software Developer
Naomi Aro (naomi.aro@sourcefabric.org)
Role: Software Developer
Cliff Wang (cliff.wang@sourcefabric.org)
Role: QA
Daniel James (daniel.james@sourcefabric.org)
Role: Documentor & QA
Community Contributors:
John Chewter
Version 2.5.0
-------------
Albert Santoni (albert.santoni@sourcefabric.org)
Rold: Developer Team Lead
Role: Developer Team Lead
Denise Rigato (denise.rigato@sourcefabric.org)
Role: Software Developer

View File

@ -626,19 +626,32 @@ class Application_Model_Scheduler
$pos = Application_Common_Database::prepareAndExecute(
$maxPos_sql, array(), Application_Common_Database::COLUMN);
$linkedItem_sql = "SELECT ends FROM cc_schedule ".
"WHERE instance_id = {$instanceId} ".
"AND position = {$pos} ".
"AND playout_status != -1";
$linkedItemEnds = Application_Common_Database::prepareAndExecute(
$linkedItem_sql, array(), Application_Common_Database::COLUMN);
//show instance has no scheduled tracks
if (empty($pos)) {
$pos = 0;
$nextStartDT = new DateTime($instance["starts"], new DateTimeZone("UTC"));
} else {
$linkedItem_sql = "SELECT ends FROM cc_schedule ".
"WHERE instance_id = {$instanceId} ".
"AND position = {$pos} ".
"AND playout_status != -1";
$linkedItemEnds = Application_Common_Database::prepareAndExecute(
$linkedItem_sql, array(), Application_Common_Database::COLUMN);
$nextStartDT = $this->findNextStartTime(
new DateTime($linkedItemEnds, new DateTimeZone("UTC")),
$instanceId);
}
} else {
$nextStartDT = $this->findNextStartTime(
new DateTime($linkedItemEnds, new DateTimeZone("UTC")),
$instanceId);
$pos++;
}
$nextStartDT = $this->findNextStartTime(
new DateTime($linkedItemEnds, new DateTimeZone("UTC")),
$instanceId);
$pos++;
//$pos++;
}
//selected empty row to add after
else {
@ -722,6 +735,13 @@ class Application_Model_Scheduler
$sched = Application_Common_Database::prepareAndExecute(
$movedItem_sql, array(), Application_Common_Database::SINGLE);
}
/* If we don't find a schedule item it means the linked
* shows have a different amount of items (dyanmic block)
* and we should skip the item move for this show instance
*/
if (!$sched) {
continue;
}
$excludeIds[] = intval($sched["id"]);
$file["cliplength"] = $sched["clip_length"];
@ -1160,6 +1180,7 @@ class Application_Model_Scheduler
foreach ($instances as $instance) {
$instance->updateScheduleStatus($this->con);
$instance->correctSchedulePositions();
}
//update the last scheduled timestamp.

View File

@ -138,6 +138,29 @@ class CcShowInstances extends BaseCcShowInstances {
$this->setDbLastScheduled(gmdate("Y-m-d H:i:s"));
$this->save($con);
}
/**
*
* This function resets the cc_schedule table's position numbers so that
* tracks for each cc_show_instances start at position 1
*
* The position numbers can become out of sync when the user deletes items
* from linekd shows filled with dyanmic smart blocks, where each instance
* has a different amount of scheduled items
*/
public function correctSchedulePositions()
{
$schedule = CcScheduleQuery::create()
->filterByDbInstanceId($this->id)
->orderByDbStarts()
->find();
$pos = 0;
foreach ($schedule as $item) {
$item->setDbPosition($pos)->save();
$pos++;
}
}
/**
* Computes the value of the aggregate column time_filled

View File

@ -896,7 +896,13 @@ SQL;
if ($utcStartDateTime->getTimestamp() < $populateUntil->getTimestamp()) {
$ccShowInstance = new CcShowInstances();
if ($this->isUpdate) {
$ccShowInstance = $this->getInstance($utcStartDateTime);
//use original cc_show_day object to get the current cc_show_instance
$origStartDateTime = new DateTime(
$this->origCcShowDay->getDbFirstShow()." ".$this->origCcShowDay->getDbStartTime(),
new DateTimeZone($this->origCcShowDay->getDbTimezone())
);
$origStartDateTime->setTimezone(new DateTimeZone("UTC"));
$ccShowInstance = $this->getInstance($origStartDateTime);
}
$ccShowInstance->setDbShowId($this->ccShow->getDbId());

View File

@ -224,7 +224,7 @@ class AirtimeInstall
return true;
}
$command = "su postgres -c \"createdb $database --encoding UTF8 --owner $username\"";
$command = "sudo -i -u postgres psql postgres -c \"CREATE DATABASE ".$database." WITH ENCODING 'UTF8' TEMPLATE template0 OWNER ".$username."\"";
@exec($command, $output, $results);
if ($results == 0) {

View File

@ -12,9 +12,9 @@ require_once(__DIR__.'/airtime-constants.php');
// The only way we get here is if we are doing a new install or a reinstall.
// -------------------------------------------------------------------------
//Enforce a minimum PHP version
if (!AirtimeInstall::checkPHPVersion())
if (PHP_VERSION_ID < 50400) //PHP 5.4
{
echo("ERROR: Your PHP version is too old!\nAirtime requires PHP 5.4 or greater.\n");
exit(1);
}