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
5959bcb0
Commit
5959bcb0
authored
14 years ago
by
Alex Barth
Browse files
Options
Downloads
Patches
Plain Diff
#867892 alex_b: PubSubHubbub - slow down import frequency of feeds that are subscribed to hub.
parent
f544c313
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.txt
+2
-0
2 additions, 0 deletions
CHANGELOG.txt
includes/FeedsSource.inc
+7
-1
7 additions, 1 deletion
includes/FeedsSource.inc
plugins/FeedsFetcher.inc
+13
-0
13 additions, 0 deletions
plugins/FeedsFetcher.inc
plugins/FeedsHTTPFetcher.inc
+9
-0
9 additions, 0 deletions
plugins/FeedsHTTPFetcher.inc
with
31 additions
and
1 deletion
CHANGELOG.txt
+
2
−
0
View file @
5959bcb0
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
Feeds 6.x xxxxxxxxxxxxxxxxxxxxxx
Feeds 6.x xxxxxxxxxxxxxxxxxxxxxx
--------------------------------
--------------------------------
- #867892 alex_b: PubSubHubbub - slow down import frequency of feeds that are
subscribed to hub.
- #908964 alex_b: Break out scheduler. Note: Features depends on Job Scheduler
- #908964 alex_b: Break out scheduler. Note: Features depends on Job Scheduler
module now: http://drupal.org/project/job_scheduler
module now: http://drupal.org/project/job_scheduler
- #663860 funkmasterjones, infojunkie, alex_b et. al.: hook_feeds_after_parse().
- #663860 funkmasterjones, infojunkie, alex_b et. al.: hook_feeds_after_parse().
...
...
This diff is collapsed.
Click to expand it.
includes/FeedsSource.inc
+
7
−
1
View file @
5959bcb0
...
@@ -198,12 +198,18 @@ class FeedsSource extends FeedsConfigurable {
...
@@ -198,12 +198,18 @@ class FeedsSource extends FeedsConfigurable {
* Schedule this source.
* Schedule this source.
*/
*/
public
function
schedule
()
{
public
function
schedule
()
{
// Check whether any fetcher is overriding the import period.
$period
=
$this
->
importer
->
config
[
'import_period'
];
$fetcher_period
=
$this
->
importer
->
fetcher
->
importPeriod
(
$this
);
if
(
is_numeric
(
$fetcher_period
))
{
$period
=
$fetcher_period
;
}
$job
=
array
(
$job
=
array
(
'callback'
=>
'feeds_source_import'
,
'callback'
=>
'feeds_source_import'
,
'type'
=>
$this
->
id
,
'type'
=>
$this
->
id
,
'id'
=>
$this
->
feed_nid
,
'id'
=>
$this
->
feed_nid
,
// Schedule as soon as possible if a batch is active.
// Schedule as soon as possible if a batch is active.
'period'
=>
$this
->
batch
?
0
:
$
this
->
importer
->
config
[
'import_
period
'
]
,
'period'
=>
$this
->
batch
?
0
:
$period
,
'periodic'
=>
TRUE
,
'periodic'
=>
TRUE
,
);
);
if
(
$job
[
'period'
]
!=
FEEDS_SCHEDULE_NEVER
)
{
if
(
$job
[
'period'
]
!=
FEEDS_SCHEDULE_NEVER
)
{
...
...
This diff is collapsed.
Click to expand it.
plugins/FeedsFetcher.inc
+
13
−
0
View file @
5959bcb0
...
@@ -94,4 +94,17 @@ abstract class FeedsFetcher extends FeedsPlugin {
...
@@ -94,4 +94,17 @@ abstract class FeedsFetcher extends FeedsPlugin {
* Source information for unsubscribing.
* Source information for unsubscribing.
*/
*/
public
function
unsubscribe
(
FeedsSource
$source
)
{}
public
function
unsubscribe
(
FeedsSource
$source
)
{}
/**
* Override import period settings. This can be used to force a certain import
* interval.
*
* @param $source
* A FeedsSource object.
*
* @return
* A time span in seconds if periodic import should be overridden for given
* $source, NULL otherwise.
*/
public
function
importPeriod
(
FeedsSource
$source
)
{}
}
}
This diff is collapsed.
Click to expand it.
plugins/FeedsHTTPFetcher.inc
+
9
−
0
View file @
5959bcb0
...
@@ -192,6 +192,15 @@ class FeedsHTTPFetcher extends FeedsFetcher {
...
@@ -192,6 +192,15 @@ class FeedsHTTPFetcher extends FeedsFetcher {
$this
->
subscriber
(
$source
->
feed_nid
)
->
unsubscribe
(
$source_config
[
'source'
],
url
(
$this
->
path
(
$source
->
feed_nid
),
array
(
'absolute'
=>
TRUE
)));
$this
->
subscriber
(
$source
->
feed_nid
)
->
unsubscribe
(
$source_config
[
'source'
],
url
(
$this
->
path
(
$source
->
feed_nid
),
array
(
'absolute'
=>
TRUE
)));
}
}
/**
* Implement FeedsFetcher::importPeriod().
*/
public
function
importPeriod
(
FeedsSource
$source
)
{
if
(
$this
->
subscriber
(
$source
->
feed_nid
)
->
subscribed
())
{
return
259200
;
// Delay for three days if there is a successful subscription.
}
}
/**
/**
* Convenience method for instantiating a subscriber object.
* Convenience method for instantiating a subscriber object.
*/
*/
...
...
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