Skip to content

Commit

Permalink
Fix errors on fresh install
Browse files Browse the repository at this point in the history
  • Loading branch information
stefansl committed Mar 2, 2021
1 parent d5eb153 commit 5a835db
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/Model/NewsPodcastsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class NewsPodcastsModel extends \NewsModel
public static function findPublishedByPids($arrPids, $blnFeatured = null, $intLimit = 0, $intOffset = 0, array $arrAddColumns = [], array $arrOptions = [])
{
if (!\is_array($arrPids) || empty($arrPids)) {
return null;
return [];
}

$t = static::$strTable;
Expand Down
29 changes: 14 additions & 15 deletions src/NewsPodcasts.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,18 @@ public function generateFeed($intId): void
{
$objFeed = NewsPodcastsFeedModel::findByArchive($intId);

if (null === $objFeed) {
return;
}

$objFeed->feedName = $objFeed->alias ?: 'podcast_' . $objFeed->id;

// Delete XML file
if ('delete' === Input::get('act')) {
Files::getInstance()->delete($objFeed->feedName . '.xml');
} // Update XML file
else {
$this->generateFiles($objFeed->row());
$logger = System::getContainer()->get('monolog.logger.contao');
$logger->log(LogLevel::INFO, 'Generated podcast feed "' . $objFeed->feedName . '.xml"', ['contao' => new ContaoContext(__METHOD__, TL_CRON)]);
if (null !== $objFeed) {
$objFeed->feedName = $objFeed->alias ?: 'podcast_' . $objFeed->id;

// Delete XML file
if ('delete' === Input::get('act')) {
Files::getInstance()->delete($objFeed->feedName . '.xml');
} // Update XML file
else {
$this->generateFiles($objFeed->row());
$logger = System::getContainer()->get('monolog.logger.contao');
$logger->log(LogLevel::INFO, 'Generated podcast feed "' . $objFeed->feedName . '.xml"', ['contao' => new ContaoContext(__METHOD__, TL_CRON)]);
}
}
}

Expand Down Expand Up @@ -188,7 +186,8 @@ protected static function generateFiles($arrFeed): void


// Add filter, if newsCategories is installed
$arrOptions = [];
$arrOptions = [];
$arrColumns = [];
if(null !== $arrFeed['news_categoriesRoot'] && NewsPodcastsBackend::checkNewsCategoriesBundle()) {

$db = System::getContainer()->get('database_connection');
Expand Down
7 changes: 6 additions & 1 deletion src/NewsPodcastsBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,12 @@ public function getAllowedArchives()
public function preservePodcastFeeds()
{
$objFeeds = NewsPodcastsFeedModel::findAll();
while ($objFeeds->next()) {

if (null === $objFeeds) {
return [];
}

while ($objFeeds->next()) {
$arrFeeds[] = $objFeeds->alias ?: 'news' . $objFeeds->id;
}

Expand Down

0 comments on commit 5a835db

Please sign in to comment.