mirror of
https://code.castopod.org/adaures/castopod
synced 2025-04-23 01:01:20 +00:00
55 lines
1.3 KiB
PHP
55 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* @copyright 2022 Ad Aures
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html AGPL3
|
|
* @link https://castopod.org/
|
|
*/
|
|
|
|
namespace Modules\Admin\Controllers;
|
|
|
|
use CodeIgniter\HTTP\RedirectResponse;
|
|
use Config\App;
|
|
use Config\Services;
|
|
|
|
class AboutController extends BaseController
|
|
{
|
|
public function index(): string
|
|
{
|
|
$instanceInfo = [
|
|
'host_name' => current_domain(),
|
|
'version' => CP_VERSION,
|
|
'php_version' => PHP_VERSION,
|
|
'os' => PHP_OS,
|
|
'languages' => implode(', ', config(App::class)->supportedLocales),
|
|
];
|
|
|
|
return view('about', [
|
|
'info' => $instanceInfo,
|
|
]);
|
|
}
|
|
|
|
public function updateAction(): RedirectResponse
|
|
{
|
|
if ($this->request->getPost('action') === 'database') {
|
|
return $this->migrateDatabase();
|
|
}
|
|
|
|
return redirect()->back()
|
|
->with('error', lang('Security.disallowedAction'));
|
|
}
|
|
|
|
public function migrateDatabase(): RedirectResponse
|
|
{
|
|
$migrate = Services::migrations();
|
|
|
|
$migrate->setNamespace(null)
|
|
->latest();
|
|
|
|
return redirect()->back()
|
|
->with('message', lang('AboutCastopod.messages.databaseUpdateSuccess'));
|
|
}
|
|
}
|