style(legacy): force semicolon on same line (#1534)

This commit is contained in:
Jonas L 2022-01-23 19:15:55 +01:00 committed by GitHub
parent 522d989cab
commit 8569af9328
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
85 changed files with 396 additions and 789 deletions

View file

@ -316,8 +316,7 @@ class Application_Service_CalendarService
$rebroadcasts = CcShowInstancesQuery::create()
->filterByDbOriginalShow($this->ccShow->getDbId())
->filterByDbStarts($minRebroadcastStart->format(DEFAULT_TIMESTAMP_FORMAT), Criteria::LESS_THAN)
->find()
;
->find();
if (count($rebroadcasts) > 0) {
throw new Exception(_("Can't move a recorded show less than 1 hour before its rebroadcasts."));
@ -327,8 +326,7 @@ class Application_Service_CalendarService
if ($this->ccShow->isRebroadcast()) {
$recordedShow = CcShowInstancesQuery::create()
->filterByCcShow($this->ccShowInstance->getDbOriginalShow())
->findOne()
;
->findOne();
if (is_null($recordedShow)) {
$this->ccShowInstance->delete();
@ -363,8 +361,7 @@ class Application_Service_CalendarService
$this->ccShowInstance
->setDbStarts($newStartsDateTime)
->setDbEnds($newEndsDateTime)
->save($con)
;
->save($con);
if (!$this->ccShowInstance->getCcShow()->isRebroadcast()) {
//we can get the first show day because we know the show is
@ -374,8 +371,7 @@ class Application_Service_CalendarService
$ccShowDay
->setDbFirstShow($newStartsDateTime->setTimezone($showTimezone)->format('Y-m-d'))
->setDbStartTime($newStartsDateTime->format('H:i'))
->save($con)
;
->save($con);
}
$diff = $newStartsDateTime->getTimestamp() - $oldStartDateTime->getTimestamp();

View file

@ -450,8 +450,7 @@ class Application_Service_HistoryService
$hostRecords = CcShowHostsQuery::create()
->filterByDbHost($user->getId())
->filterByDbShow($showIds)
->find($this->con)
;
->find($this->con);
$filteredShowIds = [];
@ -563,8 +562,7 @@ class Application_Service_HistoryService
->filterByDbStarts($recordStart)
->filterByDbEnds($recordEnd)
->filterByDbFileId($fileId)
->findOne($this->con)
;
->findOne($this->con);
if (empty($prevRecord)) {
$history = new CcPlayoutHistory();
@ -1172,8 +1170,7 @@ class Application_Service_HistoryService
try {
$query = CcPlayoutHistoryTemplateQuery::create()
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND)
;
->setFormatter(ModelCriteria::FORMAT_ON_DEMAND);
if (isset($type)) {
$templates = $query->findByDbType($type);

View file

@ -137,8 +137,7 @@ class Application_Service_MediaService
self::$_pendingFiles = CcFilesQuery::create()
->filterByDbImportStatus(CcFiles::IMPORT_STATUS_PENDING)
->filterByDbUtime($oneHourAgo, Criteria::LESS_EQUAL)
->find()
;
->find();
$pendingEpisodes = Application_Service_PodcastEpisodeService::getStuckPendingImports();
return !self::$_pendingFiles->isEmpty() || !empty($pendingEpisodes);

View file

@ -269,8 +269,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
PodcastEpisodesQuery::create()
->filterByDbPodcastId($id)
->findOneByDbFileId($fileId)
->delete()
;
->delete();
}
/**
@ -286,8 +285,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
public function getPublishStatus($fileId)
{
$stationPodcast = StationPodcastQuery::create()
->findOneByDbPodcastId(Application_Model_Preference::getStationPodcastId())
;
->findOneByDbPodcastId(Application_Model_Preference::getStationPodcastId());
return (int) $stationPodcast->hasEpisodeForFile($fileId);
}
@ -305,18 +303,15 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
$timeout = gmdate(DEFAULT_TIMESTAMP_FORMAT, (microtime(true) - self::PENDING_EPISODE_TIMEOUT_SECONDS));
$episodes = PodcastEpisodesQuery::create()
->filterByDbFileId()
->find()
;
->find();
$stuckImports = [];
foreach ($episodes as $episode) {
$ref = ThirdPartyTrackReferencesQuery::create()
->findOneByDbForeignId(strval($episode->getDbId()))
;
->findOneByDbForeignId(strval($episode->getDbId()));
if (!empty($ref)) {
$task = CeleryTasksQuery::create()
->filterByDbDispatchTime($timeout, Criteria::LESS_EQUAL)
->findOneByDbTrackReference($ref->getDbId())
;
->findOneByDbTrackReference($ref->getDbId());
if (!empty($task)) {
array_push($stuckImports, $episode);
}
@ -372,8 +367,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
$isStationPodcast = $podcastId == Application_Model_Preference::getStationPodcastId();
$episodes = PodcastEpisodesQuery::create()
->filterByDbPodcastId($podcastId)
;
->filterByDbPodcastId($podcastId);
if ($isStationPodcast && $limit != 0) {
$episodes = $episodes->setLimit($limit);
}
@ -382,8 +376,7 @@ class Application_Service_PodcastEpisodeService extends Application_Service_Thir
$episodes = $episodes->joinWith('PodcastEpisodes.CcFiles', Criteria::LEFT_JOIN)
->setOffset($offset)
->orderBy($sortColumn, $sortDir)
->find()
;
->find();
return $isStationPodcast ? $this->_getStationPodcastEpisodeArray($episodes)
: $this->_getImportedPodcastEpisodeArray($podcast, $episodes);

View file

@ -236,8 +236,7 @@ class Application_Service_PodcastService
$defaultOwner = CcSubjsQuery::create()
->filterByDbType('A')
->orderByDbId()
->findOne()
;
->findOne();
if (!$defaultOwner) {
// what to do if there is no admin user?
// should we handle this case?

View file

@ -54,8 +54,7 @@ class Application_Service_SchedulerService
$ccSchedules = CcScheduleQuery::create()
->filterByDbInstanceId($instanceIds, Criteria::IN)
->find($con)
;
->find($con);
$interval = new DateInterval('PT' . abs($diff) . 'S');
if ($diff < 0) {
@ -69,8 +68,7 @@ class Application_Service_SchedulerService
$ccSchedule
->setDbStarts($newStart)
->setDbEnds($newEnd)
->save($con)
;
->save($con);
}
}
}
@ -94,16 +92,14 @@ class Application_Service_SchedulerService
->filterByDbInstanceId($instance->getDbId())
->filterByDbId($schedIds, Criteria::NOT_IN)
->orderByDbStarts()
->find()
;
->find();
foreach ($ccScheduleItems as $ccSchedule) {
//DateTime object
$itemEnd = $this->findEndTime($itemStart, $ccSchedule->getDbClipLength());
$ccSchedule->setDbStarts($itemStart)
->setDbEnds($itemEnd)
;
->setDbEnds($itemEnd);
$itemStart = $itemEnd;
}
@ -184,8 +180,7 @@ class Application_Service_SchedulerService
->filterByDbId($instancsIdsToFill, Criteria::NOT_IN)
->orderByDbStarts(Criteria::DESC)
->limit(1)
->findOne()
;
->findOne();
if (is_null($showInstanceWithMostRecentSchedule)) {
return null;
@ -341,8 +336,7 @@ class Application_Service_SchedulerService
foreach ($ccShow->getCcShowInstancess() as $ccShowInstance) {
$ccSchedules = CcScheduleQuery::create()
->filterByDbInstanceId($ccShowInstance->getDbId())
->find()
;
->find();
if ($ccSchedules->isEmpty()) {
$nextStartDT = $ccShowInstance->getDbStarts(null);
@ -363,8 +357,7 @@ class Application_Service_SchedulerService
->setDbCueOut($item->getDbCueOut())
->setDbInstanceId($ccShowInstance->getDbId())
->setDbPosition($item->getDbPosition())
->save()
;
->save();
$nextStartDT = self::findTimeDifference(
$endTimeDT,
@ -375,8 +368,7 @@ class Application_Service_SchedulerService
$ccShowInstance
->setDbTimeFilled($timeFilled)
->setDbLastScheduled(gmdate(DEFAULT_TIMESTAMP_FORMAT))
->save()
;
->save();
}
}
}
@ -450,8 +442,7 @@ class Application_Service_SchedulerService
$ccSchedules = CcScheduleQuery::create()
->filterByDbInstanceId($instanceIds, Criteria::IN)
->setDistinct(CcSchedulePeer::FILE_ID)
->find()
;
->find();
$fileIds = [];
foreach ($ccSchedules as $ccSchedule) {
$fileIds[] = $ccSchedule->getDbFileId();
@ -460,8 +451,7 @@ class Application_Service_SchedulerService
// Clear out the schedule
CcScheduleQuery::create()
->filterByDbInstanceId($instanceIds, Criteria::IN)
->delete()
;
->delete();
/* Now that the schedule has been cleared we need to make
* sure we do not update the is_scheduled flag for tracks

View file

@ -217,8 +217,7 @@ class Application_Service_ShowFormService
->filterByDbModifiedInstance(false)
->filterByDbStarts(gmdate('Y-m-d H:i:s'), Criteria::GREATER_THAN)
->orderByDbStarts()
->findOne()
;
->findOne();
if (!$ccShowInstance) {
return null;
@ -517,8 +516,7 @@ class Application_Service_ShowFormService
->filterByDbModifiedInstance(false)
->filterByDbStarts(gmdate('Y-m-d H:i:s'), Criteria::GREATER_EQUAL)
->orderByDbStarts()
->findOne()
;
->findOne();
if (!$ccShowInstance) {
return null;

View file

@ -73,8 +73,7 @@ class Application_Service_ShowService
//get the ccShow object to which this instance belongs
//so we can get the original start date and time
$this->ccShow = CcShowQuery::create()
->findPk($showId)
;
->findPk($showId);
//DateTime in shows's local time
$newStartDateTime = new DateTime(
@ -84,8 +83,7 @@ class Application_Service_ShowService
);
$ccShowInstanceOrig = CcShowInstancesQuery::create()
->findPk($showData['add_show_instance_id'])
;
->findPk($showData['add_show_instance_id']);
//convert original start time into the show's local timezone
$origLocalStartDateTime = $ccShowInstanceOrig->getLocalStartDateTime();
@ -120,8 +118,7 @@ class Application_Service_ShowService
->filterByDbRepeatType(-1)
->filterByDbFirstShow($origLocalStartDateTime->format('Y-m-d'))
->filterByDbStartTime($origLocalStartDateTime->format('H:i:s'))
->delete()
;
->delete();
/*
* Set the new cc_show_day record
@ -139,8 +136,7 @@ class Application_Service_ShowService
->filterByDbRepeatType(-1)
->filterByDbFirstShow($showData['add_show_start_date'])
->filterByDbStartTime($showData['add_show_start_time'] . ':00')
->findOne()
;
->findOne();
$ccShowInstance = $this->createNonRepeatingInstance(
$showDay,
@ -159,15 +155,13 @@ class Application_Service_ShowService
$ccShowInstance->updateScheduleStatus($con);
$ccShowInstance
->setDbDescription($showData['add_show_instance_description'])
->save()
;
->save();
//delete the edited instance from the repeating sequence
$ccShowInstanceOrig
->setDbModifiedInstance(true)
->setDbDescription($showData['add_show_instance_description'])
->save()
;
->save();
$con->commit();
Application_Model_RabbitMq::PushSchedule();
@ -346,8 +340,7 @@ class Application_Service_ShowService
*/
$ccShowDays = CcShowDaysQuery::create()
->filterByDbShowId($this->ccShow->getDbId())
->find()
;
->find();
}
}
@ -521,8 +514,7 @@ SQL;
{
CcShowDaysQuery::create()
->filterByDbShowId($showId)
->delete()
;
->delete();
}
/**
@ -776,8 +768,7 @@ SQL;
CcShowDaysQuery::create()
->filterByDbShowId($showId)
->filterByDbDay($day)
->delete()
;
->delete();
}
$uncheckedDays = pg_escape_string(implode(',', $daysRemovedUTC));
@ -812,8 +803,7 @@ SQL;
}
$ccShowInstance = CcShowInstancesQuery::create()
->findPk($instanceId)
;
->findPk($instanceId);
if (!$ccShowInstance) {
throw new Exception('Could not find show instance');
}
@ -830,8 +820,7 @@ SQL;
$ccShowInstances = CcShowInstancesQuery::create()
->filterByDbShowId($showId)
->filterByDbStarts($ccShowInstance->getDbStarts(), Criteria::GREATER_EQUAL)
->find()
;
->find();
}
if (gmdate(DEFAULT_TIMESTAMP_FORMAT) <= $ccShowInstance->getDbEnds()) {
@ -863,29 +852,25 @@ SQL;
$ccShowInstance
->setDbModifiedInstance(true)
->save()
;
->save();
//delete the rebroadcasts of the removed recorded show
if ($ccShowInstance->isRecorded()) {
CcShowInstancesQuery::create()
->filterByDbOriginalShow($instanceId)
->delete()
;
->delete();
}
//delete all files scheduled in cc_schedules table
CcScheduleQuery::create()
->filterByDbInstanceId($instanceId)
->delete()
;
->delete();
}
if ($this->checkToDeleteCcShow($showId)) {
CcShowQuery::create()
->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
@ -903,8 +888,7 @@ SQL;
->filterByDbModifiedInstance(false)
->filterByDbRebroadcast(0)
->orderByDbStarts()
->find()
;
->find();
/* 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
@ -935,8 +919,7 @@ SQL;
->filterByDbShowId($showId)
->filterByDbDay($dayOfWeek)
->filterByDbRepeatType(-1, Criteria::NOT_EQUAL)
->findOne()
;
->findOne();
if (isset($ccShowDay)) {
$lastShowStartDT->setTimeZone(new DateTimeZone(
@ -950,8 +933,7 @@ SQL;
$ccShowDay
->setDbLastShow($lastShowEndDT->format('Y-m-d'))
->save()
;
->save();
}
}
@ -962,8 +944,7 @@ SQL;
->filterByDbShowId($showId)
->filterByDbRepeatType(0, Criteria::GREATER_EQUAL)
->filterByDbLastShow(null)
->find()
;
->find();
foreach ($showDays as $showDay) {
$showDay->setDbLastShow($showDay->getDbFirstShow())->save();
}
@ -977,8 +958,7 @@ SQL;
->filterByDbModifiedInstance(false)
->filterByDbRebroadcast(0)
->orderByDbStarts()
->find()
;
->find();
if ($ccShowInstances->isEmpty()) {
return true;
@ -1612,8 +1592,7 @@ SQL;
//->filterByDbModifiedInstance(false, Criteria::EQUAL)
->filterByDbRebroadcast(0, Criteria::EQUAL)
->limit(1)
->find()
;
->find();
if ($ccShowInstance->isEmpty()) {
return false;
@ -1634,8 +1613,7 @@ SQL;
->filterByDbDay($day)
->filterByDbRepeatType($repeatType)
->limit(1)
->find()
;
->find();
if ($ccShowDay->isEmpty()) {
return false;
@ -1728,8 +1706,7 @@ SQL;
$showDay = CcShowDaysQuery::create()
->filterByDbShowId($showId)
->filterByDbRepeatType($this->origCcShowDay->getDbRepeatType())
->findOne()
;
->findOne();
if (!$showDay) {
//repeat type changed so we have to create a new show_day rule
$showDay = new CcShowDays();
@ -1778,8 +1755,7 @@ SQL;
->filterByDbShowId($showId)
->filterByDbRepeatType($this->origCcShowDay->getDbRepeatType())
->filterByDbDay($day)
->findOne()
;
->findOne();
if (!$showDay) {
//if no show day object was found it is because a new
//repeating day of the week was added OR the repeat
@ -1959,11 +1935,9 @@ SQL;
->filterByDbShowId($showId)
->filterByDbDay($day)
->filterByDbRepeatType(-1, Criteria::NOT_EQUAL)
->findOne()
;
->findOne();
$repeatInfo->setDbNextPopDate($nextInfo[0])
->save()
;
->save();
}
}

View file

@ -104,8 +104,7 @@ abstract class Application_Service_ThirdPartyCeleryService extends Application_S
{
static::updateTask($task, $status);
$ref = ThirdPartyTrackReferencesQuery::create()
->findOneByDbId($trackId)
;
->findOneByDbId($trackId);
if (is_null($ref)) {
$ref = new ThirdPartyTrackReferences();
}

View file

@ -35,8 +35,7 @@ abstract class Application_Service_ThirdPartyService
// If the file ID given is null, create a new reference
$ref = is_null($fileId) ? null : ThirdPartyTrackReferencesQuery::create()
->filterByDbService(static::$_SERVICE_NAME)
->findOneByDbFileId($fileId)
;
->findOneByDbFileId($fileId);
if (is_null($ref)) {
$ref = new ThirdPartyTrackReferences();
}
@ -61,8 +60,7 @@ abstract class Application_Service_ThirdPartyService
{
$ref = ThirdPartyTrackReferencesQuery::create()
->filterByDbService(static::$_SERVICE_NAME)
->findOneByDbFileId($fileId)
;
->findOneByDbFileId($fileId);
$ref->delete();
}
@ -79,7 +77,7 @@ abstract class Application_Service_ThirdPartyService
$ref = ThirdPartyTrackReferencesQuery::create()
->filterByDbService(static::$_SERVICE_NAME)
->findOneByDbFileId($fileId) // There shouldn't be duplicates!
;
;
return empty($ref) ? '' : $ref->getDbForeignId();
}
@ -97,13 +95,11 @@ abstract class Application_Service_ThirdPartyService
{
$ref = ThirdPartyTrackReferencesQuery::create()
->filterByDbService(static::$_SERVICE_NAME)
->findOneByDbFileId($fileId)
;
->findOneByDbFileId($fileId);
if (!empty($ref)) {
$task = CeleryTasksQuery::create()
->orderByDbDispatchTime(Criteria::DESC)
->findOneByDbTrackReference($ref->getDbId())
;
->findOneByDbTrackReference($ref->getDbId());
return $task->getDbStatus() == CELERY_PENDING_STATUS ? -1
: ($task->getDbStatus() == CELERY_FAILED_STATUS ? 0 : 1);