mirror of
https://code.castopod.org/adaures/castopod
synced 2025-05-24 02:52:01 +00:00
revert(homepage): remove redirect to install if database is not setup
After install, the redirect condition is kept even though it would never be triggered again.
This commit is contained in:
parent
da7076fc2d
commit
d4954e026d
@ -14,22 +14,12 @@ use App\Models\PodcastModel;
|
|||||||
use CodeIgniter\Database\Exceptions\DatabaseException;
|
use CodeIgniter\Database\Exceptions\DatabaseException;
|
||||||
use CodeIgniter\HTTP\RedirectResponse;
|
use CodeIgniter\HTTP\RedirectResponse;
|
||||||
use CodeIgniter\HTTP\ResponseInterface;
|
use CodeIgniter\HTTP\ResponseInterface;
|
||||||
use Config\Services;
|
|
||||||
use Modules\Media\FileManagers\FileManagerInterface;
|
use Modules\Media\FileManagers\FileManagerInterface;
|
||||||
|
|
||||||
class HomeController extends BaseController
|
class HomeController extends BaseController
|
||||||
{
|
{
|
||||||
public function index(): RedirectResponse | string
|
public function index(): RedirectResponse | string
|
||||||
{
|
{
|
||||||
$db = db_connect();
|
|
||||||
if ($db->getDatabase() === '' || ! $db->tableExists('podcasts')) {
|
|
||||||
// Database has not been set or could not find the podcasts table
|
|
||||||
// Redirecting to install page because it is likely that Castopod has not been installed yet.
|
|
||||||
// NB: as base_url wouldn't have been defined here, redirect to install wizard manually
|
|
||||||
$route = Services::routes()->reverseRoute('install');
|
|
||||||
return redirect()->to(rtrim(host_url(), '/') . $route);
|
|
||||||
}
|
|
||||||
|
|
||||||
$sortOptions = ['activity', 'created_desc', 'created_asc'];
|
$sortOptions = ['activity', 'created_desc', 'created_asc'];
|
||||||
$sortBy = in_array($this->request->getGet('sort'), $sortOptions, true) ? $this->request->getGet(
|
$sortBy = in_array($this->request->getGet('sort'), $sortOptions, true) ? $this->request->getGet(
|
||||||
'sort'
|
'sort'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user