On my install application routes.php in CodeIgniter I would like to check if two files exist and set them according.
Where, if the files exist then it would be upgraded, else go to step one.
Is there a better and more safer way?
$admin = dirname(FCPATH) . '/admin/config/database.php';
$catalog = dirname(FCPATH) . '/catalog/config/database.php';
if (file_exists($admin, $catalog)) {
$route['default_controller'] = "upgrade/index";
$route['404_override'] = '';
} else {
$route['default_controller'] = "step_1/index";
$route['404_override'] = '';
}
Try this:
You need to check the file existence separately.
if (file_exists($admin) && file_exists($catalog)) {
$route['default_controller'] = "upgrade/index";
$route['404_override'] = '';
} else {
$route['default_controller'] = "step_1/index";
$route['404_override'] = '';
}
You can read on the manual, file_exists.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With