#17: Fixed a crash in the installer when the app is not configured

This commit is contained in:
Andy Heathershaw 2017-08-30 20:42:35 +01:00
parent f3e69512e2
commit 6b704e67fd
3 changed files with 17 additions and 2 deletions

View File

@ -3,7 +3,7 @@
<component name="WebServers">
<option name="servers">
<webServer id="b14a34b0-0127-4886-964a-7be75a2281ac" name="Development" url="http://blue-twilight-dev.andys.eu">
<fileTransfer host="scar.andys.eu" port="22" privateKey="$USER_HOME$/.ssh/id_rsa" rootFolder="/srv/www/blue-twilight-dev" accessType="SFTP" keyPair="true">
<fileTransfer host="orlando.andys.eu" port="22" privateKey="$USER_HOME$/.ssh/id_rsa" rootFolder="/srv/www/blue-twilight-dev" accessType="SFTP" keyPair="true">
<advancedOptions>
<advancedOptions dataProtectionLevel="Private" />
</advancedOptions>

View File

@ -60,6 +60,12 @@ class MiscHelper
public static function getEnvironmentSetting($settingName)
{
$envFile = MiscHelper::getEnvironmentFilePath();
if (!file_exists($envFile))
{
return null;
}
$matches = null;
if (preg_match(sprintf('/^\s*%s\s*=\s*(.+)$/im', preg_quote($settingName)), file_get_contents($envFile), $matches))
{
@ -69,6 +75,11 @@ class MiscHelper
return null;
}
public static function isAppInstalled()
{
return MiscHelper::getEnvironmentSetting('APP_INSTALLED');
}
/**
* Tests whether the provided URL belongs to the current application (i.e. both scheme and hostname match.)
* @param $url

View File

@ -5,6 +5,7 @@ namespace App\Providers;
use App\Album;
use App\Helpers\ConfigHelper;
use App\Helpers\ImageHelper;
use App\Helpers\MiscHelper;
use App\Helpers\ThemeHelper;
use App\Helpers\ValidationHelper;
use App\ModelObservers\AlbumObserver;
@ -48,7 +49,10 @@ class AppServiceProvider extends ServiceProvider
Album::observe(AlbumObserver::class);
// Configure our default pager
LengthAwarePaginator::defaultView($themeHelper->viewName('partials.pager_links'));
if (MiscHelper::isAppInstalled())
{
LengthAwarePaginator::defaultView($themeHelper->viewName('partials.pager_links'));
}
}
/**