Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
feeds
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
feeds
Commits
0ba4a84a
Commit
0ba4a84a
authored
11 years ago
by
klausi
Committed by
Chris Leppanen
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue #2192851 by klausi: Hook_feeds_after_import() should have access to exceptions.
parent
be0b65cd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
feeds.api.php
+7
-0
7 additions, 0 deletions
feeds.api.php
includes/FeedsSource.inc
+10
-0
10 additions, 0 deletions
includes/FeedsSource.inc
with
17 additions
and
0 deletions
feeds.api.php
+
7
−
0
View file @
0ba4a84a
...
@@ -188,6 +188,13 @@ function hook_feeds_after_save(FeedsSource $source, $entity, $item, $entity_id)
...
@@ -188,6 +188,13 @@ function hook_feeds_after_save(FeedsSource $source, $entity, $item, $entity_id)
*/
*/
function
hook_feeds_after_import
(
FeedsSource
$source
)
{
function
hook_feeds_after_import
(
FeedsSource
$source
)
{
// See geotaxonomy module's implementation for an example.
// See geotaxonomy module's implementation for an example.
// We can also check for an exception in this hook. The exception should not
// be thrown here, Feeds will handle it.
if
(
isset
(
$source
->
exception
))
{
watchdog
(
'mymodule'
,
'An exception occurred during importing!'
,
array
(),
WATCHDOG_ERROR
);
mymodule_panic_reaction
(
$source
);
}
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
includes/FeedsSource.inc
+
10
−
0
View file @
0ba4a84a
...
@@ -179,6 +179,9 @@ class FeedsSource extends FeedsConfigurable {
...
@@ -179,6 +179,9 @@ class FeedsSource extends FeedsConfigurable {
// Timestamp when this source was imported the last time.
// Timestamp when this source was imported the last time.
protected
$imported
;
protected
$imported
;
// Holds an exception object in case an exception occurs during importing.
protected
$exception
;
/**
/**
* Instantiate a unique object per class/id/feed_nid. Don't use
* Instantiate a unique object per class/id/feed_nid. Don't use
* directly, use feeds_source() instead.
* directly, use feeds_source() instead.
...
@@ -379,9 +382,16 @@ class FeedsSource extends FeedsConfigurable {
...
@@ -379,9 +382,16 @@ class FeedsSource extends FeedsConfigurable {
// Process.
// Process.
$this
->
importer
->
processor
->
process
(
$this
,
$parser_result
);
$this
->
importer
->
processor
->
process
(
$this
,
$parser_result
);
// Import finished without exceptions, so unset any potentially previously
// recorded exceptions.
unset
(
$this
->
exception
);
}
}
catch
(
Exception
$e
)
{
catch
(
Exception
$e
)
{
// $e is stored and re-thrown once we've had a chance to log our progress.
// $e is stored and re-thrown once we've had a chance to log our progress.
// Set the exception so that other modules can check if an exception
// occurred in hook_feeds_after_import().
$this
->
exception
=
$e
;
}
}
$this
->
releaseLock
();
$this
->
releaseLock
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment