Skip to content

Commit

Permalink
Use is_file, performance optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
joanhey committed Jun 17, 2020
1 parent 95bf344 commit f5e4137
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/kumbia/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static function &read($file, $force = false)
*/
private static function load($file)
{
if (file_exists(APP_PATH."config/$file.php")) {
if (is_file(APP_PATH."config/$file.php")) {
self::$vars[$file] = require APP_PATH."config/$file.php";

return;
Expand Down
2 changes: 1 addition & 1 deletion core/libs/auth/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private function active_session()
{
$user_hash = md5(serialize($this->extra_args));
$filename = APP_PATH.'temp/cache/'.base64_encode('auth');
if (file_exists($filename)) {
if (is_file($filename)) {
$fp = fopen($filename, 'r');
while (!feof($fp)) {
$line = fgets($fp);
Expand Down
2 changes: 1 addition & 1 deletion core/libs/cache/drivers/file_cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function get($id, $group='default')
$this->_group = $group;

$filename = APP_PATH . 'temp/cache/' . $this->_getFilename($id, $group);
if (file_exists($filename)) {
if (is_file($filename)) {
$fh = fopen($filename, 'r');

$lifetime = trim(fgets($fh));
Expand Down
2 changes: 1 addition & 1 deletion core/libs/upload/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ protected function _overwrite($name) {
if ($this->_overwrite) {
return TRUE;
}
if (file_exists("$this->_path/$name")) {
if (is_file("$this->_path/$name")) {
Flash::error('Error: ya existe este fichero. Y no se permite reescribirlo');
return FALSE;
}
Expand Down

0 comments on commit f5e4137

Please sign in to comment.