Skip to content
Permalink
Browse files

Try and correct incorrect import file paths

  • Loading branch information...
chrisgraham committed Jul 19, 2019
1 parent 63b28d4 commit 1eab8d71b5091a19dfe48f31613e7731aa93f3dd
Showing with 13 additions and 2 deletions.
  1. +13 −2 adminzone/pages/modules/admin_import.php
@@ -403,10 +403,22 @@ public function choose_actions($extra = '')
$object = object_factory('Hook_' . filter_naughty_harsh($importer));
$info = $object->info();
// Get source path, and try and fix if it is incorrect
$old_base_dir = either_param_string('old_base_dir');
if (!file_exists($old_base_dir)) {
if ((substr($old_base_dir, 0, 1) != '/') && (file_exists('/' . $old_base_dir))) {
$old_base_dir = '/' . $old_base_dir;
} elseif ((substr($old_base_dir, 0, 1) != '/') && (file_exists(get_file_base() . '/' . $old_base_dir))) {
$old_base_dir = get_file_base() . '/' . $old_base_dir;
} elseif (file_exists(get_file_base() . '/' . $old_base_dir)) {
$old_base_dir = get_file_base() . $old_base_dir;
}
}
// Load/probe DB details
$db_host = get_db_site_host();
if ((method_exists($object, 'probe_db_access')) && (get_param_integer('keep_manual_import_config', 0) == 0)) {
$probe = $object->probe_db_access(either_param_string('old_base_dir'));
$probe = $object->probe_db_access($old_base_dir);
if (array_key_exists(4, $probe)) {
$db_host = $probe[4];
if ($db_host === null) {
@@ -441,7 +453,6 @@ public function choose_actions($extra = '')
unset($import_source);
// Save data from choose_session2 step
$old_base_dir = either_param_string('old_base_dir');
$refresh_time = either_param_integer('refresh_time', 0); // Shouldn't default, but reported on some systems to do so
$GLOBALS['SITE_DB']->query_delete('import_session', array('imp_session' => get_session_id()), '', 1);
$GLOBALS['SITE_DB']->query_insert('import_session', array(

0 comments on commit 1eab8d7

Please sign in to comment.
You can’t perform that action at this time.