Skip to content
Snippets Groups Projects
Commit d4954e02 authored by Yassine Doghri's avatar Yassine Doghri
Browse files

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.
parent da7076fc
No related branches found
No related tags found
No related merge requests found
Pipeline #12141 canceled
Pipeline: Castopod

#12144

    ...@@ -14,22 +14,12 @@ use App\Models\PodcastModel; ...@@ -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'
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment