This patch was pulled from the LiveJournal.com repository.
Patch by mark.
diffs (188 lines):
diff -r 34b82504fb2d -r 775ff749c945 bin/worker/ping-hubbub
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/worker/ping-hubbub Tue Aug 25 23:15:51 2009 +0000
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+
+use strict;
+use lib "$ENV{LJHOME}/cgi-bin";
+
+require 'ljlib.pl';
+
+use LJ::Worker::TheSchwartz;
+use TheSchwartz::Worker::PubSubHubbubPublish;
+
+schwartz_decl( "TheSchwartz::Worker::PubSubHubbubPublish" );
+schwartz_work();
+
+
+1;
diff -r 34b82504fb2d -r 775ff749c945 cgi-bin/ljfeed.pl
--- a/cgi-bin/ljfeed.pl Tue Aug 25 18:26:14 2009 +0000
+++ b/cgi-bin/ljfeed.pl Tue Aug 25 23:15:51 2009 +0000
@@ -293,7 +293,8 @@ sub create_view_rss
# header
$ret .= "<?xml version='1.0' encoding='$opts->{'saycharset'}' ?>\n";
$ret .= LJ::run_hook("bot_director", "<!-- ", " -->") . "\n";
- $ret .= "<rss version='2.0'
xmlns:lj='http://www.livejournal.org/rss/lj/1.0/'>\n";
+ $ret .= "<rss version='2.0'
xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' " .
+ "xmlns:atom10='http://www.w3.org/2005/Atom'>\n";
# channel attributes
$ret .= "<channel>\n";
@@ -306,6 +307,12 @@ sub create_view_rss
$ret .= " <lj:journal>" . $u->user . "</lj:journal>\n";
$ret .= " <lj:journaltype>" . $u->journaltype_readable .
"</lj:journaltype>\n";
# TODO: add 'language' field when user.lang has more useful information
+
+ if ( LJ::is_enabled( 'hubbub' ) ) {
+ foreach my $hub (@LJ::HUBBUB_HUBS) {
+ $ret .= " <atom10:link rel='hub' href='" . LJ::exml($hub) . "'
/>\n";
+ }
+ }
### image block, returns info for their current userpic
if ($u->{'defaultpicid'}) {
@@ -408,7 +415,7 @@ sub create_view_atom
my ( $rel, $type, $href, $title ) = @_;
my $link = XML::Atom::Link->new( Version => 1 );
$link->rel($rel);
- $link->type($type);
+ $link->type($type) if $type;
$link->href($href);
$link->title( $title ) if $title;
return $link;
@@ -473,6 +480,12 @@ sub create_view_atom
'Create a new entry'
)
) if $opts->{'apilinks'};
+
+ if ( LJ::is_enabled( 'hubbub' ) ) {
+ foreach my $hub (@LJ::HUBBUB_HUBS) {
+ $feed->add_link($make_link->('hub', undef, $hub));
+ }
+ }
}
my $posteru = LJ::load_userids( map { $_->{posterid} } @$cleanitems);
@@ -1062,5 +1075,30 @@ sub create_view_comments
return $ret;
}
+sub generate_hubbub_jobs {
+ my ( $u, $joblist ) = @_;
+
+ return unless LJ::is_enabled( 'hubbub' );
+
+ foreach my $hub ( @LJ::HUBBUB_HUBS ) {
+ my $make_hubbub_job = sub {
+ my $type = shift;
+
+ my $topic_url = $u->journal_base . "/data/$type";
+ return TheSchwartz::Job->new(
+ funcname => 'TheSchwartz::Worker::PubSubHubbubPublish',
+ arg => {
+ hub => $hub,
+ topic_url => $topic_url,
+ },
+ coalesce => $hub,
+ );
+ };
+
+ push @$joblist, $make_hubbub_job->("rss");
+ push @$joblist, $make_hubbub_job->("atom");
+ }
+}
+
1;
diff -r 34b82504fb2d -r 775ff749c945 cgi-bin/ljlib.pl
--- a/cgi-bin/ljlib.pl Tue Aug 25 18:26:14 2009 +0000
+++ b/cgi-bin/ljlib.pl Tue Aug 25 23:15:51 2009 +0000
@@ -2408,7 +2408,7 @@ sub is_enabled {
my $remote = LJ::get_remote();
return 1 if $remote && $remote->get_cap( 'beta_payments' );
}
- return ! LJ::conf_test($LJ::DISABLED{$conf}, @_);
+ return ! LJ::conf_test( $LJ::DISABLED{$conf}, @_ );
}
package LJ::CleanHTML;
diff -r 34b82504fb2d -r 775ff749c945 cgi-bin/ljprotocol.pl
--- a/cgi-bin/ljprotocol.pl Tue Aug 25 18:26:14 2009 +0000
+++ b/cgi-bin/ljprotocol.pl Tue Aug 25 23:15:51 2009 +0000
@@ -1526,7 +1526,7 @@ sub postevent
# but still fire the logging events
unless ( $flags->{nonotify} ) {
push @jobs, LJ::Event::JournalNewEntry->new($entry)->fire_job;
- push @jobs, LJ::Event::UserNewEntry->new($entry)->fire_job if (
LJ::is_enabled('esn-userevents') || $LJ::_T_FIRE_USERNEWENTRY );
+ push @jobs, LJ::Event::UserNewEntry->new($entry)->fire_job if
LJ::is_enabled('esn-userevents') || $LJ::_T_FIRE_USERNEWENTRY;
push @jobs, LJ::Event::OfficialPost->new($entry)->fire_job if
$uowner->is_official;
}
push @jobs, LJ::EventLogRecord::NewEntry->new($entry)->fire_job;
@@ -1535,6 +1535,9 @@ sub postevent
if ( @LJ::SPHINX_SEARCHD ) {
push @jobs, TheSchwartz::Job->new_from_array(
'DW::Worker::Sphinx::Copier', { userid => $uowner->id } );
}
+
+ # PubSubHubbub Support
+ LJ::Feed::generate_hubbub_jobs( $uowner, \...@jobs );
my $sclient = LJ::theschwartz();
if ($sclient && @jobs) {
@@ -1889,7 +1892,17 @@ sub editevent
$sclient->insert_jobs( TheSchwartz::Job->new_from_array(
'DW::Worker::Sphinx::Copier', { userid => $ownerid } ) );
}
- LJ::run_hooks("editpost", $entry);
+ # PubSubHubbub Support
+ my @jobs;
+ LJ::Feed::generate_hubbub_jobs( $uowner, \...@jobs );
+
+ LJ::run_hooks( "editpost", $entry, \...@jobs );
+
+ my $sclient = LJ::theschwartz();
+ if ( $sclient && @jobs ) {
+ my @handles = $sclient->insert_jobs(@jobs);
+ # TODO: error on failure? depends on the job I suppose? property of
the job?
+ }
return $res;
}
diff -r 34b82504fb2d -r 775ff749c945 cvs/multicvs.conf
--- a/cvs/multicvs.conf Tue Aug 25 18:26:14 2009 +0000
+++ b/cvs/multicvs.conf Tue Aug 25 23:15:51 2009 +0000
@@ -35,6 +35,7 @@ SVN(Test-FakeApache) = http://code.
SVN(Test-FakeApache) =
http://code.livejournal.org/svn/Test-FakeApache/trunk/
SVN(LJ-UserSearch) =
http://code.livejournal.org/svn/LJ-UserSearch/trunk/
SVN(TheSchwartz-Worker-SendEmail) =
http://code.livejournal.org/svn/TheSchwartz-Worker-SendEmail/trunk/
+SVN(hubbub) =
http://pubsubhubbub.googlecode.com/svn/trunk/publisher_clients/
dw-free .
@@ -77,6 +78,9 @@ memcached/api/perl/lib/
ddlockd/api/perl/DDLockClient.pm cgi-bin/DDLockClient.pm
ddlockd/server/ddlockd bin/ddlockd
+
+hubbub/perl/lib/Net/PubSubHubbub/Publisher.pm
cgi-bin/Net/PubSubHubbub/Publisher.pm
+hubbub/perl-schwartz/lib/TheSchwartz/Worker/PubSubHubbubPublish.pm
cgi-bin/TheSchwartz/Worker/PubSubHubbubPublish.pm
mogilefs/api/perl/MogileFS-Client/lib cgi-bin
mogilefs/utils/mogadm bin/mogadm
diff -r 34b82504fb2d -r 775ff749c945 doc/config-private.pl.txt
--- a/doc/config-private.pl.txt Tue Aug 25 18:26:14 2009 +0000
+++ b/doc/config-private.pl.txt Tue Aug 25 23:15:51 2009 +0000
@@ -98,6 +98,12 @@
# lazy in their typing. For example, leave off the trailing slash (/bots
# instead of /bots/) if your URI is a directory.
#$BLOCKED_BOT_URI = '/bots';
+
+ # If you wish to publish PubSubHubbub notifications, uncomment this. You
can
+ # use this default hub location, as it's supported by Google, or you can
run
+ # your own (or use any other hub you want).
+ # @HUBBUB_HUBS = ( 'http://pubsubhubbub.appspot.com/' );
+
}
{
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog