mirror of
https://github.com/flarum/core.git
synced 2025-10-12 07:24:27 +02:00
Merge branch 'master' into 1236-database-changes
This commit is contained in:
@@ -40,6 +40,7 @@ class InstallServiceProvider extends AbstractServiceProvider
|
||||
'mbstring',
|
||||
'openssl',
|
||||
'pdo_mysql',
|
||||
'tokenizer',
|
||||
]),
|
||||
new WritablePaths([
|
||||
base_path(),
|
||||
@@ -53,8 +54,6 @@ class InstallServiceProvider extends AbstractServiceProvider
|
||||
$this->app->singleton('flarum.install.routes', function () {
|
||||
return new RouteCollection;
|
||||
});
|
||||
|
||||
$this->loadViewsFrom(__DIR__.'/../../views/install', 'flarum.install');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,6 +61,8 @@ class InstallServiceProvider extends AbstractServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->loadViewsFrom(__DIR__.'/../../views/install', 'flarum.install');
|
||||
|
||||
$this->populateRoutes($this->app->make('flarum.install.routes'));
|
||||
}
|
||||
|
||||
|
@@ -23,12 +23,37 @@ class WritablePaths extends AbstractPrerequisite
|
||||
public function check()
|
||||
{
|
||||
foreach ($this->paths as $path) {
|
||||
if (! is_writable($path)) {
|
||||
if (! file_exists($path)) {
|
||||
$this->errors[] = [
|
||||
'message' => 'The '.realpath($path).' directory is not writable.',
|
||||
'message' => 'The '.$this->getAbsolutePath($path).' directory doesn\'t exist',
|
||||
'detail' => 'This directory is necessary for the installation. Please create the folder.',
|
||||
];
|
||||
} elseif (! is_writable($path)) {
|
||||
$this->errors[] = [
|
||||
'message' => 'The '.$this->getAbsolutePath($path).' directory is not writable.',
|
||||
'detail' => 'Please chmod this directory'.($path !== public_path() ? ' and its contents' : '').' to 0775.'
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function getAbsolutePath($path)
|
||||
{
|
||||
$path = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $path);
|
||||
$parts = array_filter(explode(DIRECTORY_SEPARATOR, $path), 'strlen');
|
||||
$absolutes = [];
|
||||
|
||||
foreach ($parts as $part) {
|
||||
if ('.' == $part) {
|
||||
continue;
|
||||
}
|
||||
if ('..' == $part) {
|
||||
array_pop($absolutes);
|
||||
} else {
|
||||
$absolutes[] = $part;
|
||||
}
|
||||
}
|
||||
|
||||
return (substr($path, 0, 1) == '/' ? '/' : '').implode(DIRECTORY_SEPARATOR, $absolutes);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user