app['url']->forceScheme('https'); } // If APP_KEY is not set, redirect to /install.php if (!\Config::get('app.key') && !app()->runningInConsole() && !file_exists(storage_path('.installed'))) { // Not defined here yet //\Artisan::call("freescout:clear-cache"); redirect('/install.php')->send(); } // Process module registration error - disable module and show error to admin \Eventy::addFilter('modules.register_error', function ($exception, $module) { // request() does is empty at this stage if (!empty($_POST['action']) && $_POST['action'] == 'activate') { // During module activation in case of any error we have to deactivate module. \App\Module::deactiveModule($module->getAlias()); // if (\App::runningInConsole()) { // echo __('The plugin :module_name has been deactivated due to an error: :error_message', ['module_name' => $module->getName(), 'error_message' => $exception->getMessage()]); // } else { \Session::flash('flashes_floating', [[ 'text' => __('The plugin :module_name has been deactivated due to an error: :error_message', ['module_name' => $module->getName(), 'error_message' => $exception->getMessage()]), 'type' => 'danger', 'role' => \App\User::ROLE_ADMIN, ]]); return; } elseif (empty($_POST)) { // failed to open stream: No such file or directory if (strstr($exception->getMessage(), 'No such file or directory')) { \App\Module::deactiveModule($module->getAlias()); \Session::flash('flashes_floating', [[ 'text' => __('The plugin :module_name has been deactivated due to an error: :error_message', ['module_name' => $module->getName(), 'error_message' => $exception->getMessage()]), 'type' => 'danger', 'role' => \App\User::ROLE_ADMIN, ]]); } return; } return $exception; }, 10, 2); } }