Skip to content
Snippets Groups Projects
Commit 24c755d9 authored by Alex Barth's avatar Alex Barth
Browse files

#850638: Introduce FeedsSource::preview().

parent 12f870a3
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
Feeds 6.x 1.X XXXX
------------------
- #850638 alex_b: Introduce FeedsSource::preview().
- #850298 alex_b: ParserCSV: Support batching (only affects library, full parser
level batch support to be added later with #744660).
- Minor cleanup of admin UI language and CSS.
......
......@@ -271,10 +271,7 @@ function feeds_nodeapi(&$node, $op, $form) {
if (trim($node->title) == '') {
try {
$source->addConfig($node_feeds);
// @todo Too many indirections. Clean up.
$batch = $source->importer->fetcher->fetch($source);
$source->importer->parser->parse($batch, $source);
if (!$last_title = $batch->getTitle()) {
if (!$last_title = $source->preview()->getTitle()) {
throw new Exception();
}
}
......
......@@ -110,6 +110,21 @@ class FeedsSource extends FeedsConfigurable {
$this->load();
}
/**
* Preview = fetch and parse a feed.
*
* @return
* FeedsImportBatch object, fetched and parsed.
*
* @throws
* Throws Exception if an error occurs when fetching or parsing.
*/
public function preview() {
$batch = $this->importer->fetcher->fetch($this);
$this->importer->parser->parse($batch, $this);
return $batch;
}
/**
* Import a feed: execute, fetching, parsing and processing stage.
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment