From 1cdb3e051dd6e6025a1ec6501b48b05eedd8dcf3 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 11 Apr 2013 13:52:55 +0200 Subject: [PATCH] #19 - flock rss.xml and rss errors doesn't block adding anymore --- 0.3/class_rssfeed.php | 4 ++-- 0.3/functions.php | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/0.3/class_rssfeed.php b/0.3/class_rssfeed.php index 3528e78..59fd431 100755 --- a/0.3/class_rssfeed.php +++ b/0.3/class_rssfeed.php @@ -198,8 +198,8 @@ class FileRSSFeed extends RSSFeed { foreach($merger->getFeeds(20) as $f) { parent::addItem($f->title,$f->link,$f->description,$f->author,$f->guid,$f->time); } - - file_put_contents( $this->filename, $this->xml->asXML() ); + + file_put_contents( $this->filename, $this->xml->asXML(), LOCK_EX ); } } diff --git a/0.3/functions.php b/0.3/functions.php index 7cb6408..bd8e732 100755 --- a/0.3/functions.php +++ b/0.3/functions.php @@ -89,9 +89,14 @@ function createAutoblog($type, $sitename, $siteurl, $rssurl, $error = array()) { /** * RSS **/ - require_once('class_rssfeed.php'); - $rss = new AutoblogRSS(RSS_FILE); - $rss->addNewAutoblog($sitename, $foldername, $siteurl, $rssurl); + try { + require_once('class_rssfeed.php'); + $rss = new AutoblogRSS(RSS_FILE); + $rss->addNewAutoblog($sitename, $foldername, $siteurl, $rssurl); + } + catch (Exception $e) { + ; + } $fp = fopen($foldername .'/index.php', 'w+'); if( !fwrite($fp, "") )