summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDoug Green2008-08-24 11:30:48 (GMT)
committer Doug Green2008-08-24 11:30:48 (GMT)
commit6d928c045f1bb7b7a46617cee766558ed24e0a0e (patch)
tree70f22c253319ae9f946257bc2674009ac0a7feab
parent92af6699434ba1e6b44110739e6958308544c85b (diff)
better handling for missing files
-rw-r--r--coder.module12
1 files changed, 7 insertions, 5 deletions
diff --git a/coder.module b/coder.module
index 2e8f3a1..f11fb41 100644
--- a/coder.module
+++ b/coder.module
@@ -939,10 +939,12 @@ function do_coder_reviews($coder_args) {
if ($use_cache = variable_get('coder_cache', 1) && empty($coder_args['#patch'])) {
// Load the cached results if they exist.
$cache_key = 'coder:'. implode(':', array_keys($coder_args['#reviews'])) . $coder_args['#severity'] .':'. $coder_args['#filename'];
- $cache_mtime = filemtime(realpath($coder_args['#filename']));
- if ($cache_results = cache_get($cache_key)) {
- if ($cache_results->data['mtime'] == $cache_mtime && _coder_modified() < $cache_results->created) {
- return $cache_results->data['results'];
+ if (file_exists($filepath = realpath($coder_args['#filename']))) {
+ $cache_mtime = filemtime($filepath);
+ if ($cache_results = cache_get($cache_key)) {
+ if ($cache_results->data['mtime'] == $cache_mtime && _coder_modified() < $cache_results->created) {
+ return $cache_results->data['results'];
+ }
}
}
}
@@ -1003,7 +1005,7 @@ function do_coder_reviews($coder_args) {
*/
function _coder_read_and_parse_file(&$coder_args) {
// Get the path to the module file.
- if (!empty($coder_args['#patch']) || ($filepath = realpath($coder_args['#filename']))) {
+ if (!empty($coder_args['#patch']) || (($filepath = realpath($coder_args['#filename'])) && file_exists($filepath))) {
$in_php = 0;
$in_allphp = 0;
$in_comment = 0;