Skip to content

Commit

Permalink
Disable broken plugins on start and add last login in user edit
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMicky-FR committed Aug 27, 2020
1 parent d5cef20 commit 4c93cd3
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 15 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Azuriom

[![Build Status](https://img.shields.io/travis/Azuriom/Azuriom/master?style=flat-square)](https://travis-ci.org/Azuriom/Azuriom)
[![Code Quality](https://img.shields.io/scrutinizer/quality/g/Azuriom/Azuriom?style=flat-square)](https://scrutinizer-ci.com/g/Azuriom/Azuriom/)
[![Style](https://github.styleci.io/repos/237486333/shield)](https://github.styleci.io/repos/237486333)
[![Latest release](https://img.shields.io/github/v/release/Azuriom/Azuriom?style=flat-square&include_prereleases)](http://github.com/Azuriom/Azuriom/releases)
[![Chat](https://img.shields.io/discord/625774284823986183?color=7289da&label=Discord&logo=discord&logoColor=fff&style=flat-square)](https://azuriom.com/discord)
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/ThemeCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function handle()
if ($this->files->exists($path)) {
$this->error('The theme '.$path.' already exists!');

return false;
return 1;
}

$this->files->makeDirectory($path);
Expand Down
22 changes: 13 additions & 9 deletions app/Extensions/Plugin/PluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,25 @@ public function loadPlugins(Application $app)

$this->autoloadPlugin($pluginId, $composer, $plugin->composer);

foreach ($plugin->providers ?? [] as $pluginProvider) {
$provider = new $pluginProvider($app);
$providers = array_map(function ($provider) use ($app) {
return new $provider($app);
}, $plugin->providers ?? []);

foreach ($providers as $provider) {
if (method_exists($provider, 'bindPlugin')) {
$provider->bindPlugin($plugin);
}

$app->register($provider);
}
} catch (Throwable $t) {
if (! $app->isProduction()) {
throw $t;
}

report($t);

$this->disable($pluginId);
}
}
}
Expand Down Expand Up @@ -137,8 +145,8 @@ public function pluginsPublicPath(string $path = '')
* Get the path of the specified plugin.
*
* @param string $path
* @param string|null $plugin
* @return string|null
* @param string $plugin
* @return string
*/
public function path(string $plugin, string $path = '')
{
Expand Down Expand Up @@ -194,10 +202,6 @@ public function findDescription(string $plugin)
{
$path = $this->path($plugin, 'plugin.json');

if ($path === null) {
return null;
}

$json = $this->getJson($path);

if ($json === null) {
Expand Down Expand Up @@ -427,7 +431,7 @@ protected function getPlugins()

return $this->plugins;
} catch (FileNotFoundException $e) {
$this->plugins = $this->cachePlugins();
$this->plugins = $this->cachePlugins()->all();

return $this->plugins;
}
Expand Down
4 changes: 0 additions & 4 deletions app/Extensions/Theme/ThemeManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,6 @@ public function findDescription(string $theme)
{
$path = $this->path('theme.json', $theme);

if ($path === null) {
return null;
}

$json = $this->getJson($path);

if ($json === null) {
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class SettingsController extends Controller
/**
* The application cache.
*
* @var \Illuminate\Cache\Repository
* @var \Illuminate\Contracts\Cache\Repository
*/
private $cache;

Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@

'fields' => [
'register-date' => 'Register at',
'last-login' => 'Last login at',
'email-verified' => 'Email Address verified',
'2fa' => 'Two Factor Authentication',
'ip' => 'IP Address',
Expand Down
1 change: 1 addition & 0 deletions resources/lang/fr/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
'fields' => [
'register-date' => 'Inscrit le',
'email-verified' => 'Adresse Email vérifiée',
'last-login' => 'Dernière connexion',
'2fa' => 'Authentification à deux facteurs',
'ip' => 'Adresse IP',
],
Expand Down
7 changes: 7 additions & 0 deletions resources/views/admin/users/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@
<input type="text" class="form-control" id="registerInput" value="{{ format_date_compact($user->created_at) }}" disabled>
</div>

@if($user->last_login_at)
<div class="form-group">
<label for="lastLoginInput">{{ trans('admin.users.fields.last-login') }}</label>
<input type="text" class="form-control" id="lastLoginInput" value="{{ format_date_compact($user->last_login_at) }}" disabled>
</div>
@endif

<form action="{{ route('admin.users.verify', $user) }}" method="POST">
@csrf

Expand Down

0 comments on commit 4c93cd3

Please sign in to comment.