Skip to content
Browse files

some fixes

  • Loading branch information...
1 parent 9fdedf3 commit 5309d8c5481c544df0eca676a35bd5cfb37721fb @chregu committed
Showing with 22 additions and 10 deletions.
  1. +12 −8 libs/aggregator.php
  2. +10 −2 libs/magpierss/rss_parse.inc
View
20 libs/aggregator.php
@@ -1,6 +1,6 @@
<?php
-while (getLoad() > 7) {
- print "load > 7. wait 20 sec. \n";
+while (getLoad() > 15) {
+ print "load > 15. wait 20 sec. \n";
sleep(20);
}
@@ -29,7 +29,7 @@ function aggregateAllBlogs($id = null) {
if ($id) {
$where = "where ID = $id";
}
- $res = $this->mdb->query("select ID,blogsID as blogsid, link, cats, section from feeds $where");
+ $res = $this->mdb->query("select ID,blogsID as blogsid, link, cats, section from feeds $where order by rand()");
if (MDB2::isError($res)) {
print $res->getMessage();
print "\n";
@@ -38,13 +38,14 @@ function aggregateAllBlogs($id = null) {
}
while ($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC)) {
//get remote feed from magpie
- while (getLoad() > 8) {
- print "load > 8. wait 20 sec. \n";
+ while (getLoad() > 20) {
+ print "load > 20. wait 20 sec. \n";
sleep(20);
}
-
+
$feed = $this->getRemoteFeed($row['link']);
if(!$feed) {
+ print "Somethings wrong with " . $row['link'] ."\n";
continue;
}
//check if this blog already exists
@@ -56,8 +57,10 @@ function aggregateAllBlogs($id = null) {
}
}
-
-
+ var_dump($feed->channel);
+ if ($feed->channel['link_html']) {
+ $feed->channel['link'] = $feed->channel['link_html'];
+ } else {
if (!$feed->channel['link']) {
if (isset($feed->channel['link_'])) {
$feed->channel['link'] = $feed->channel['link_'];
@@ -69,6 +72,7 @@ function aggregateAllBlogs($id = null) {
print "NO channel/link... PLEASE FIX THIS\n";
continue;
}
+ }
}
if (isset($feed->channel['link_hub'])) {
View
12 libs/magpierss/rss_parse.inc
@@ -190,6 +190,11 @@ class MagpieRSS {
xml_set_character_data_handler( $this->parser, 'feed_cdata' );
+ $dom = new domdocument();
+ $dom->recover = true;
+ $dom->loadXML($source);
+ $source = $dom->saveXML();
+
$status = xml_parse( $this->parser, $source );
if (! $status ) {
@@ -242,7 +247,6 @@ class MagpieRSS {
}
return;
}
-
if ( $el == 'channel' )
{
$this->inchannel = true;
@@ -306,7 +310,11 @@ class MagpieRSS {
//
elseif ($this->feed_type == ATOM and $el == 'link' )
{
- if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
+ if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' and $attrs['type'] == 'text/html')
+ {
+ $link_el = 'link_html';
+ }
+ else if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
{
$link_el = 'link';
}

0 comments on commit 5309d8c

Please sign in to comment.
Something went wrong with that request. Please try again.