Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/3.2.16' into release/3.4.0
Browse files Browse the repository at this point in the history
Conflicts:
	assets/contao/js/core.js
	system/docs/CHANGELOG.md
	system/modules/core/classes/Frontend.php
	system/modules/core/widgets/MetaWizard.php
  • Loading branch information
leofeyer committed Nov 17, 2014
2 parents 3233dd4 + 8e3d193 commit 921adb7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
27 changes: 24 additions & 3 deletions contao/classes/News.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ class News extends \Frontend
/**
* Update a particular RSS feed
* @param integer
* @param boolean
*/
public function generateFeed($intId, $blnIsFeedId=false)
public function generateFeed($intId)
{
$objFeed = $blnIsFeedId ? \NewsFeedModel::findByPk($intId) : \NewsFeedModel::findByArchive($intId);
$objFeed = \NewsFeedModel::findByPk($intId);

if ($objFeed === null)
{
Expand Down Expand Up @@ -82,6 +81,28 @@ public function generateFeeds()
}


/**
* Generate all feeds including a certain archive
* @param integer
*/
public function generateFeedsByArchive($intId)
{
$objFeed = \NewsFeedModel::findByArchive($intId);

if ($objFeed !== null)
{
while ($objFeed->next())
{
$objFeed->feedName = $objFeed->alias ?: 'news' . $objFeed->id;

// Update the XML file
$this->generateFiles($objFeed->row());
$this->log('Generated news feed "' . $objFeed->feedName . '.xml"', __METHOD__, TL_CRON);
}
}
}


/**
* Generate an XML files and save them to the root directory
* @param array
Expand Down
4 changes: 2 additions & 2 deletions contao/dca/tl_news.php
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ public function generateFeed()

foreach ($session as $id)
{
$this->News->generateFeed($id);
$this->News->generateFeedsByArchive($id);
}

$this->import('Automator');
Expand Down Expand Up @@ -979,6 +979,6 @@ public function toggleVisibility($intId, $blnVisible, DataContainer $dc=null)
// Update the RSS feed (for some reason it does not work without sleep(1))
sleep(1);
$this->import('News');
$this->News->generateFeed(CURRENT_ID);
$this->News->generateFeedsByArchive(CURRENT_ID);
}
}
2 changes: 1 addition & 1 deletion contao/dca/tl_news_archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public function generateFeed()

foreach ($session as $id)
{
$this->News->generateFeed($id);
$this->News->generateFeedsByArchive($id);
}

$this->import('Automator');
Expand Down
2 changes: 1 addition & 1 deletion contao/dca/tl_news_feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public function generateFeed()

foreach ($session as $id)
{
$this->News->generateFeed($id, true);
$this->News->generateFeedsByArchive($id);
}

$this->import('Automator');
Expand Down

0 comments on commit 921adb7

Please sign in to comment.