Skip to content

Commit

Permalink
Installer: Prevent crash when views directory is not writable
Browse files Browse the repository at this point in the history
Use plain PHP templates instead of Blade templates so there is nothing
that needs to be written.

closes #376
  • Loading branch information
tobyzerner committed Aug 31, 2015
1 parent c72bdc8 commit 5e22458
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 20 deletions.
2 changes: 0 additions & 2 deletions src/Install/Actions/IndexAction.php
Expand Up @@ -38,8 +38,6 @@ public function render(Request $request, array $routeParams = [])
{
$view = $this->view->make('flarum.install::app');

$view->logo = $this->view->make('flarum.install::logo');

$errors = [];

if (version_compare(PHP_VERSION, '5.5.0', '<')) {
Expand Down
4 changes: 2 additions & 2 deletions views/install/app.blade.php → views/install/app.php
Expand Up @@ -162,11 +162,11 @@
<body>
<div class="container">
<h1>
{!! $logo !!}
<?php include 'logo.svg'; ?>
</h1>

<div class="animated fadeIn">
{!! $content !!}
<?php echo $content; ?>
</div>
</div>
</body>
Expand Down
14 changes: 0 additions & 14 deletions views/install/errors.blade.php

This file was deleted.

14 changes: 14 additions & 0 deletions views/install/errors.php
@@ -0,0 +1,14 @@
<h2>Hold Up!</h2>

<p>These errors must be resolved before you can continue the installation. If you're having trouble, get help on the <a href="http://flarum.org/docs/installation" target="_blank">Flarum website</a>.</p>

<div class="Errors">
<?php foreach ($errors as $error): ?>
<div class="Error">
<h3 class="Error-message"><?php echo $error['message']; ?></h3>
<?php if (! empty($error['detail'])): ?>
<p class="Error-detail"><?php echo $error['detail']; ?></p>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
@@ -1,6 +1,6 @@
<h2>Install Flarum</h2>

<p>Set up your forum by filling out your details below. If you have any trouble, get help on the <a href="http://flarum.org/docs/troubleshooting" target="_blank">Flarum website</a>.</p>
<p>Set up your forum by filling out your details below. If you have any trouble, get help on the <a href="http://flarum.org/docs/installation" target="_blank">Flarum website</a>.</p>

<form>
<div id="error" style="display:none"></div>
Expand Down
2 changes: 1 addition & 1 deletion views/install/logo.php → views/install/logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit 5e22458

@franzliedke
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha! I like that solution. :)

Please sign in to comment.