Skip to content

Commit a114f33

Browse files
committed
Refactor installation process
1 parent 803bd08 commit a114f33

File tree

18 files changed

+27
-7546
lines changed

18 files changed

+27
-7546
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ include/config.php
33
.idea/
44
nbproject/
55
lang/French
6+
.htaccess

COPYING

Lines changed: 0 additions & 340 deletions
This file was deleted.

controller/admin/index.php

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,25 @@ public function __autoload($class_name)
2626
{
2727
require FEATHER_ROOT . $class_name . '.php';
2828
}
29+
30+
public function remove_install_folder($directory)
31+
{
32+
foreach(glob("{$directory}/*") as $file)
33+
{
34+
if(is_dir($file)) {
35+
$this->remove_install_folder($file);
36+
} else {
37+
unlink($file);
38+
}
39+
}
40+
$deleted = rmdir($directory);
41+
42+
return $deleted;
43+
}
2944

3045
public function display($action = null)
3146
{
32-
global $lang_common, $lang_admin_common;
47+
global $lang_common, $lang_admin_common, $lang_admin_index;
3348

3449
require FEATHER_ROOT.'include/common_admin.php';
3550

@@ -59,9 +74,9 @@ public function display($action = null)
5974
message(sprintf($lang_admin_index['New version available message'], '<a href="http://featherbb.org/">FeatherBB.org</a>'));
6075
}
6176
}
62-
// Remove install.php
77+
// Remove /install
6378
elseif ($action == 'remove_install_file') {
64-
$deleted = @unlink(FEATHER_ROOT.'install.php');
79+
$deleted = $this->remove_install_folder(FEATHER_ROOT.'install');
6580

6681
if ($deleted) {
6782
redirect(get_link('admin/'), $lang_admin_index['Deleted install.php redirect']);
@@ -70,7 +85,7 @@ public function display($action = null)
7085
}
7186
}
7287

73-
$install_file_exists = is_file(FEATHER_ROOT.'install.php');
88+
$install_folder_exists = is_dir(FEATHER_ROOT.'install');
7489

7590
$page_title = array(feather_escape($this->config['o_board_title']), $lang_admin_common['Admin'], $lang_admin_common['Index']);
7691

@@ -82,7 +97,7 @@ public function display($action = null)
8297

8398
$this->feather->render('admin/index.php', array(
8499
'lang_admin_index' => $lang_admin_index,
85-
'install_file_exists' => $install_file_exists,
100+
'install_file_exists' => $install_folder_exists,
86101
'feather_config' => $this->config,
87102
)
88103
);

0 commit comments

Comments
 (0)