Changeset 3168

Show
Ignore:
Timestamp:
07/20/2008 08:34:36 PM (3 months ago)
Author:
Shadowhand
Message:

Replacing file_exists calls with is_file and is_dir, where possible.

Location:
trunk
Files:
14 modified

Legend:

Unmodified
Added
Removed
  • trunk/index.php

    r2750 r3168  
    9393{ 
    9494        // Check APPPATH 
    95         if ( ! (is_dir(APPPATH) AND file_exists(APPPATH.'config/config'.EXT))) 
     95        if ( ! (is_dir(APPPATH) AND is_file(APPPATH.'config/config'.EXT))) 
    9696        { 
    9797                die 
     
    106106 
    107107        // Check SYSPATH 
    108         if ( ! (is_dir(SYSPATH) AND file_exists(SYSPATH.'core/Bootstrap'.EXT))) 
     108        if ( ! (is_dir(SYSPATH) AND is_file(SYSPATH.'core/Bootstrap'.EXT))) 
    109109        { 
    110110                die 
  • trunk/modules/archive/libraries/Archive.php

    r3163 r3168  
    6262                empty($name) and $name = $path; 
    6363 
    64                 if (file_exists($path) AND is_dir($path)) 
     64                if (is_dir($path)) 
    6565                { 
    6666                        // Force directories to end with a slash 
     
    109109                        throw new Kohana_Exception('archive.directory_unwritable', $directory); 
    110110 
    111                 if (file_exists($filename)) 
     111                if (is_file($filename)) 
    112112                { 
    113113                        // Unable to write to the file 
  • trunk/modules/payment/libraries/drivers/Payment/Yourpay.php

    r3163 r3168  
    5656        { 
    5757                // Check to make sure the certificate is valid 
    58                 $this->certificate = (file_exists($config['certificate'])) ? $config['certificate'] : FALSE; 
     58                $this->certificate = is_file($config['certificate']) ? $config['certificate'] : FALSE; 
    5959 
    6060                if (!$this->certificate) 
  • trunk/modules/smarty/controllers/smarty_demo.php

    r2532 r3168  
    66        const ALLOW_PRODUCTION = FALSE;     
    77 
    8     public function index() 
    9     { 
    10         $welcome = new View('demo'); 
    11         $welcome->message = "Welcome to the Kohana!"; 
     8        public function index() 
     9        { 
     10                $welcome = new View('demo'); 
     11                $welcome->message = "Welcome to the Kohana!"; 
    1212 
    13         $welcome->render(TRUE); 
    14     } 
     13                $welcome->render(TRUE); 
     14        } 
    1515} 
  • trunk/modules/smarty/libraries/MY_Smarty.php

    r3163 r3168  
    6060        public function checkDirectory($directory) 
    6161        { 
    62                 if ((! file_exists($directory) AND ! @mkdir($directory, 0755)) OR ! is_writeable($directory) OR !is_executable($directory))  
     62                if ((! file_exists($directory) AND ! @mkdir($directory, 0755)) OR ! is_writable($directory) OR !is_executable($directory))  
    6363                { 
    6464                        $error = 'Compile/Cache directory "%s" is not writeable/executable'; 
  • trunk/system/config/routes.php

    r2568 r3168  
    33 * @package  Core 
    44 * 
    5  * Default route to use when no URI segments are available. 
     5 * Sets the default route to "welcome" 
    66 */ 
    77$config['_default'] = 'welcome'; 
  • trunk/system/core/Kohana.php

    r3164 r3168  
    563563                $filename = self::log_directory().date('Y-m-d').'.log'.EXT; 
    564564 
    565                 if ( ! file_exists($filename)) 
     565                if ( ! is_file($filename)) 
    566566                { 
    567567                        // Write the SYSPATH checking header 
     
    605605                        $dir = realpath($dir); 
    606606 
    607                         if (file_exists($dir) AND is_dir($dir) AND is_writable($dir)) 
     607                        if (is_dir($dir) AND is_writable($dir)) 
    608608                        { 
    609609                                // Change the log directory 
     
    634634                        $path = APPPATH.'cache/kohana_'.$name; 
    635635 
    636                         if (file_exists($path)) 
     636                        if (is_file($path)) 
    637637                        { 
    638638                                // Check the file modification time 
     
    671671                        { 
    672672                                // Delete cache 
    673                                 return (file_exists($path) and unlink($path)); 
     673                                return (is_file($path) and unlink($path)); 
    674674                        } 
    675675                        else 
  • trunk/system/helpers/file.php

    r3160 r3168  
    3636        { 
    3737                // Make sure the file is readable 
    38                 if ( ! file_exists($filename) OR ! is_file($filename) OR ! is_readable($filename)) 
     38                if ( ! (is_file($filename) AND is_readable($filename))) 
    3939                        return FALSE; 
    4040 
  • trunk/system/helpers/upload.php

    r3160 r3168  
    4848                $directory = rtrim($directory, '/').'/'; 
    4949 
    50                 if ( ! file_exists($directory) AND Kohana::config('upload.create_directories') === TRUE) 
     50                if ( ! is_dir($directory) AND Kohana::config('upload.create_directories') === TRUE) 
    5151                { 
    5252                        // Create the upload directory 
  • trunk/system/libraries/Captcha.php

    r3160 r3168  
    105105                        self::$config['background'] = str_replace('\\', '/', realpath($config['background'])); 
    106106 
    107                         if ( ! file_exists(self::$config['background'])) 
     107                        if ( ! is_file(self::$config['background'])) 
    108108                                throw new Kohana_Exception('captcha.file_not_found', self::$config['background']); 
    109109                } 
     
    116116                        foreach ($config['fonts'] as $font) 
    117117                        { 
    118                                 if ( ! file_exists(self::$config['fontpath'].$font)) 
     118                                if ( ! is_file(self::$config['fontpath'].$font)) 
    119119                                        throw new Kohana_Exception('captcha.file_not_found', self::$config['fontpath'].$font); 
    120120                        } 
  • trunk/system/libraries/Image.php

    r3160 r3168  
    7272 
    7373                // Check to make sure the image exists 
    74                 if ( ! file_exists($image)) 
     74                if ( ! is_file($image)) 
    7575                        throw new Kohana_Exception('image.file_not_found', $image); 
    7676 
  • trunk/system/libraries/Router.php

    r3160 r3168  
    109109                                $dir .= 'controllers/'; 
    110110 
    111                                 if (file_exists($dir.$controller_path) OR file_exists($dir.$controller_path.EXT)) 
     111                                if (is_dir($dir.$controller_path) OR is_file($dir.$controller_path.EXT)) 
    112112                                { 
    113113                                        // Valid path 
  • trunk/system/libraries/drivers/Cache/Sqlite.php

    r3160 r3168  
    4343 
    4444                // Make sure the cache database is writable 
    45                 if (file_exists($filename) AND ! is_writable($filename)) 
     45                if (is_file($filename) AND ! is_writable($filename)) 
    4646                        throw new Kohana_Exception('cache.unwritable', $filename); 
    4747 
  • trunk/system/libraries/drivers/Image/ImageMagick.php

    r2709 r3168  
    4343 
    4444                // Check to make sure the provided path is correct 
    45                 if ( ! file_exists(realpath($config['directory']).'/convert'.$this->ext)) 
     45                if ( ! is_file(realpath($config['directory']).'/convert'.$this->ext)) 
    4646                        throw new Kohana_Exception('image.imagemagick.not_found', 'convert'.$this->ext); 
    4747