public function get_bakup_location()
{
if (defined('MW_API_CALL')) {
if (defined('MW_CRON_EXEC')) {
} elseif (!is_admin()) {
return 'must be admin';
}
}
$loc = $this->backups_folder;
if ($loc != false) {
return $loc;
}
$here = userfiles_path() . 'backup' . DS;
if (!is_dir($here)) {
mkdir_recursive($here);
$hta = $here . '.htaccess';
if (!is_file($hta)) {
touch($hta);
file_put_contents($hta, 'Deny from all');
}
}
$here = userfiles_path() . 'backup' . DS . get_table_prefix() . DS;
$here2 = mw()->option_manager->get('backup_location', 'admin/backup');
if ($here2 != false and is_string($here2) and trim($here2) != 'default' and trim($here2) != '') {
$here2 = normalize_path($here2, true);
if (!is_dir($here2)) {
mkdir_recursive($here2);
}
if (is_dir($here2)) {
$here = $here2;
}
}
if (!is_dir($here)) {
mkdir_recursive($here);
}
$loc = $here;
$this->backups_folder = $loc;
return $here;
}