mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-11 02:36:42 +02:00
feat: add about page in admin with instance info + database update button
This commit is contained in:
parent
c668f1c151
commit
d0836f3ee3
13 changed files with 242 additions and 14 deletions
67
modules/Admin/Controllers/AboutController.php
Normal file
67
modules/Admin/Controllers/AboutController.php
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<?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\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')->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('CodeIgniter\Settings')
|
||||
->latest();
|
||||
$migrate->setNamespace('CodeIgniter\Shield')
|
||||
->latest();
|
||||
$migrate->setNamespace('Modules\Fediverse')
|
||||
->latest();
|
||||
$migrate->setNamespace(APP_NAMESPACE)
|
||||
->latest();
|
||||
$migrate->setNamespace('Modules\WebSub')
|
||||
->latest();
|
||||
$migrate->setNamespace('Modules\Auth')
|
||||
->latest();
|
||||
$migrate->setNamespace('Modules\PremiumPodcasts')
|
||||
->latest();
|
||||
$migrate->setNamespace('Modules\Analytics')
|
||||
->latest();
|
||||
|
||||
return redirect()->back()
|
||||
->with('message', lang('AboutCastopod.messages.databaseUpdateSuccess'));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue