Conversie codeigniter 4

This commit is contained in:
2026-01-09 11:41:28 +01:00
parent dbd8c8aed2
commit f0b9c6ad40
242 changed files with 20034 additions and 346 deletions
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace App\Controllers;
use CodeIgniter\HTTP\ResponseInterface;
class DownloadDB extends BaseController
{
public function initController(\CodeIgniter\HTTP\RequestInterface $request, \CodeIgniter\HTTP\ResponseInterface $response, \Psr\Log\LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
if (!defined('AUTHENTICATED') || AUTHENTICATED === false) {
die('NO ACCESS');
}
}
public function index(): ResponseInterface
{
$db = \Config\Database::connect();
$dbutil = \Config\Database::utils();
$filename = "backupDBOIS_" . date('YmdHis');
$prefs = [
'tables' => [], // Array of tables to backup
'ignore' => [], // List of tables to omit from the backup
'format' => '', // gzip, zip, txt
'filename' => null, // File name - NEEDED ONLY WITH ZIP FILES
'add_drop' => true, // Whether to add DROP TABLE statements to backup file
'add_insert' => true, // Whether to add INSERT data to backup file
'newline' => "\n" // Newline character used in backup file
];
$backup = $dbutil->backup($prefs);
return $this->response->download($filename . '.sql', $backup);
}
}