Skip to content

Commit

Permalink
Fix for errors when DB files not exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
Elias-Black authored Nov 30, 2017
1 parent 1d41ba6 commit 607a69f
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions cms/_classes/db.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,25 @@ public static function getPrivateContent($safe_replace = false)
try
{

if( is_readable($private_db_path) !== TRUE )
if( file_exists($private_db_path) )
{
throw new Exception();
}

$content = file_get_contents($private_db_path);
if( is_readable($private_db_path) !== TRUE )
{
throw new Exception();
}

$content = file_get_contents($private_db_path);

if($content === FALSE)
{
throw new Exception();
}

if($content === FALSE)
}
else
{
throw new Exception();
$content = '';
}

}
Expand Down Expand Up @@ -175,7 +184,7 @@ public static function updatePassword($password)
try
{

if( is_writable($password_db_path) !== TRUE )
if( is_writable($password_db_path) !== TRUE && file_exists($password_db_path) )
{
throw new Exception();
}
Expand Down Expand Up @@ -218,7 +227,7 @@ private static function updatePrivateContent($content)
try
{

if( is_writable($private_db_path) !== TRUE )
if( is_writable($private_db_path) !== TRUE && file_exists($private_db_path) )
{
throw new Exception();
}
Expand Down Expand Up @@ -257,7 +266,7 @@ private static function updatePublicContent($content)
try
{

if( is_writable($public_db_path) !== TRUE )
if( is_writable($public_db_path) !== TRUE && file_exists($public_db_path) )
{
throw new Exception();
}
Expand Down

0 comments on commit 607a69f

Please sign in to comment.