Improved error handling for table creation
This commit is contained in:
parent
7e2936325f
commit
fbf8309e44
@ -119,16 +119,18 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|||||||
|
|
||||||
# Read file
|
# Read file
|
||||||
$file = __DIR__ . '/../database/settings_table.sql';
|
$file = __DIR__ . '/../database/settings_table.sql';
|
||||||
$query = file_get_contents($file);
|
$query = @file_get_contents($file);
|
||||||
|
|
||||||
# Create table
|
# Create table
|
||||||
|
if (!isset($query)||$query===false) return false;
|
||||||
if (!$database->query($query)) return false;
|
if (!$database->query($query)) return false;
|
||||||
|
|
||||||
# Read file
|
# Read file
|
||||||
$file = __DIR__ . '/../database/settings_content.sql';
|
$file = __DIR__ . '/../database/settings_content.sql';
|
||||||
$query = file_get_contents($file);
|
$query = @file_get_contents($file);
|
||||||
|
|
||||||
# Add content
|
# Add content
|
||||||
|
if (!isset($query)||$query===false) return false;
|
||||||
if (!$database->query($query)) return false;
|
if (!$database->query($query)) return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -138,9 +140,10 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|||||||
|
|
||||||
# Read file
|
# Read file
|
||||||
$file = __DIR__ . '/../database/albums_table.sql';
|
$file = __DIR__ . '/../database/albums_table.sql';
|
||||||
$query = file_get_contents($file);
|
$query = @file_get_contents($file);
|
||||||
|
|
||||||
# Create table
|
# Create table
|
||||||
|
if (!isset($query)||$query===false) return false;
|
||||||
if (!$database->query($query)) return false;
|
if (!$database->query($query)) return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -150,9 +153,10 @@ if(!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
|
|||||||
|
|
||||||
# Read file
|
# Read file
|
||||||
$file = __DIR__ . '/../database/photos_table.sql';
|
$file = __DIR__ . '/../database/photos_table.sql';
|
||||||
$query = file_get_contents($file);
|
$query = @file_get_contents($file);
|
||||||
|
|
||||||
# Create table
|
# Create table
|
||||||
|
if (!isset($query)||$query===false) return false;
|
||||||
if (!$database->query($query)) return false;
|
if (!$database->query($query)) return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user