Correction of few bugs.
Warn if RSS-Bridge cannot write to disk. Try/Catch the bridge RSS generation. Signed-off-by: teromene <teromene@teromene.fr>
This commit is contained in:
parent
1efaba5c7c
commit
43f0fc93b7
4 changed files with 26 additions and 18 deletions
|
@ -24,7 +24,13 @@ class FileCache extends CacheAbstract{
|
||||||
public function saveData($datas){
|
public function saveData($datas){
|
||||||
$this->isPrepareCache();
|
$this->isPrepareCache();
|
||||||
|
|
||||||
file_put_contents($this->getCacheFile(), json_encode($datas));
|
$writeStream = file_put_contents($this->getCacheFile(), json_encode($datas));
|
||||||
|
|
||||||
|
if(!$writeStream) {
|
||||||
|
|
||||||
|
throw new \Exception("Cannot write the cache... Do you have the right permissions ?");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
14
index.php
14
index.php
|
@ -1,5 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
$time_start = microtime(true);
|
|
||||||
/*
|
/*
|
||||||
TODO :
|
TODO :
|
||||||
- manage SSL detection because if library isn't loaded, some bridge crash !
|
- manage SSL detection because if library isn't loaded, some bridge crash !
|
||||||
|
@ -14,7 +13,7 @@ TODO :
|
||||||
|
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
error_reporting(0);
|
error_reporting(0);
|
||||||
ini_set('display_errors','1'); error_reporting(E_ALL); // For debugging only.
|
//ini_set('display_errors','1'); error_reporting(E_ALL); // For debugging only.
|
||||||
|
|
||||||
// extensions check
|
// extensions check
|
||||||
if (!extension_loaded('openssl'))
|
if (!extension_loaded('openssl'))
|
||||||
|
@ -98,6 +97,7 @@ try{
|
||||||
$bridge->setDatas($_REQUEST);
|
$bridge->setDatas($_REQUEST);
|
||||||
$bridge->loadMetadatas();
|
$bridge->loadMetadatas();
|
||||||
// Data transformation
|
// Data transformation
|
||||||
|
try {
|
||||||
$format = Format::create($format);
|
$format = Format::create($format);
|
||||||
$format
|
$format
|
||||||
->setDatas($bridge->getDatas())
|
->setDatas($bridge->getDatas())
|
||||||
|
@ -106,6 +106,11 @@ try{
|
||||||
'uri' => $bridge->getURI(),
|
'uri' => $bridge->getURI(),
|
||||||
))
|
))
|
||||||
->display();
|
->display();
|
||||||
|
} catch(Exception $e) {
|
||||||
|
|
||||||
|
echo "The brige has crashed. You should report this to the bridges maintainer";
|
||||||
|
|
||||||
|
}
|
||||||
die;
|
die;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -273,10 +278,7 @@ $formats = Format::searchInformation();
|
||||||
?>
|
?>
|
||||||
<footer>
|
<footer>
|
||||||
<?= $activeFoundBridgeCount; ?>/<?= count($whitelist_selection) ?> active bridges (<a href="?show_inactive=1">Show inactive</a>)<br />
|
<?= $activeFoundBridgeCount; ?>/<?= count($whitelist_selection) ?> active bridges (<a href="?show_inactive=1">Show inactive</a>)<br />
|
||||||
<a href="https://github.com/sebsauvage/rss-bridge">RSS-Bridge alpha 0.1 ~ Public Domain</a>
|
<a href="https://github.com/sebsauvage/rss-bridge">RSS-Bridge alpha 0.2 ~ Public Domain</a>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<?php
|
|
||||||
echo "Ran for ". (microtime(true) - $time_start);
|
|
||||||
?>
|
|
||||||
|
|
Loading…
Reference in a new issue