supress fopen errors, return false if cache file won't load

This commit is contained in:
mohrt
2001-11-02 15:07:41 +00:00
parent 41448a1555
commit 6621495b0a
5 changed files with 14 additions and 8 deletions

2
NEWS
View File

@@ -1,3 +1,5 @@
- added index key example to QUICKSTART guide (Monte)
Version 1.4.6
-------------
- fixed bug with {assign ...} when passing an empty value. (Monte)

View File

@@ -1070,7 +1070,7 @@ function _run_mod_handler()
function _read_file($filename)
{
if (!($fd = fopen($filename, 'r'))) {
if (!($fd = @fopen($filename, 'r'))) {
$this->_trigger_error_msg("problem reading '$filename.'");
return false;
}
@@ -1089,7 +1089,7 @@ function _run_mod_handler()
if ($create_dirs)
$this->_create_dir_structure(dirname($filename));
if (!($fd = fopen($filename, 'w'))) {
if (!($fd = @fopen($filename, 'w'))) {
$this->_trigger_error_msg("problem writing '$filename.'");
return false;
}
@@ -1227,6 +1227,10 @@ function _run_mod_handler()
{
$results = $this->_read_file($cache_file);
if(empty($results)) {
return false;
}
// get the files involved with this cache from the first line
$contents = explode("\n", $results, 2);

View File

@@ -1,7 +1,5 @@
<?php
require("Smarty.class.php");
$smarty = new Smarty;
$smarty->compile_check = true;

View File

@@ -1,7 +1,5 @@
<?php
require("Smarty.class.php");
$smarty = new Smarty;
$smarty->compile_check = true;

View File

@@ -1070,7 +1070,7 @@ function _run_mod_handler()
function _read_file($filename)
{
if (!($fd = fopen($filename, 'r'))) {
if (!($fd = @fopen($filename, 'r'))) {
$this->_trigger_error_msg("problem reading '$filename.'");
return false;
}
@@ -1089,7 +1089,7 @@ function _run_mod_handler()
if ($create_dirs)
$this->_create_dir_structure(dirname($filename));
if (!($fd = fopen($filename, 'w'))) {
if (!($fd = @fopen($filename, 'w'))) {
$this->_trigger_error_msg("problem writing '$filename.'");
return false;
}
@@ -1227,6 +1227,10 @@ function _run_mod_handler()
{
$results = $this->_read_file($cache_file);
if(empty($results)) {
return false;
}
// get the files involved with this cache from the first line
$contents = explode("\n", $results, 2);