Skip to content

Commit 54ab21c

Browse files
committed
Validateed for empty database
1 parent a56aa96 commit 54ab21c

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

Diff for: includes/model/import_model.php

+8
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,12 @@ function import_tables() {
1717
return false;
1818
}
1919
}
20+
21+
function test_import() {
22+
global $DB_NAME;
23+
$sql = "SHOW TABLES FROM $DB_NAME";
24+
$result = sql_query($sql);
25+
return $result;
26+
}
27+
2028
?>

Diff for: includes/sys_auth.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ function privileges_for_group($group_id) {
6767
$privileges[] = $guest_priv['name'];
6868
return $privileges;
6969
}
70-
?>
70+
?>

Diff for: includes/sys_menu.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,12 @@ function page_link_to_absolute($page) {
1515
*/
1616
function header_toolbar() {
1717
global $p, $privileges, $user, $enable_tshirt_size, $max_freeloadable_shifts;
18-
$settings = Settings();
19-
$no_migrated = $settings[0]['table_migrated'];
18+
$settings = array();
19+
$no_migrated = "";
20+
if (test_import()) {
21+
$settings = Settings();
22+
$no_migrated = $settings[0]['table_migrated'];
23+
}
2024
$toolbar_items = array();
2125

2226
if (isset($user))

Diff for: install.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ function install_admin() {
99
$msg = "";
1010
$username = "";
1111
$mail = "";
12-
$settings = Settings();
12+
$settings = array();
13+
if (test_import())
14+
$settings = Settings();
1315
if ($settings == false) {
1416
$no_migrated = 0;
1517
}

0 commit comments

Comments
 (0)