mirror of
https://github.com/Mibew/mibew.git
synced 2025-03-03 18:38:31 +03:00
Add info about current plugin state
This commit is contained in:
parent
2bdfebc428
commit
097ec6ef1a
@ -213,9 +213,40 @@ class PluginController extends AbstractController
|
|||||||
'canBeDisabled' => $plugin->canBeDisabled(),
|
'canBeDisabled' => $plugin->canBeDisabled(),
|
||||||
'canBeUninstalled' => $plugin->canBeUninstalled(),
|
'canBeUninstalled' => $plugin->canBeUninstalled(),
|
||||||
'canBeUpdated' => $plugin->canBeUpdated(),
|
'canBeUpdated' => $plugin->canBeUpdated(),
|
||||||
|
'state' => $this->getPluginState($plugin),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $plugins;
|
return $plugins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets string representation of the current plugin state.
|
||||||
|
*
|
||||||
|
* @param PluginInfo $plugin Plugin to get state for.
|
||||||
|
* @return string Human readable representation of plugin's state.
|
||||||
|
*/
|
||||||
|
protected function getPluginState(PluginInfo $plugin)
|
||||||
|
{
|
||||||
|
if (!$plugin->isEnabled()) {
|
||||||
|
// The plugin is just disabled
|
||||||
|
return getlocal('disabled');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PluginManager::getInstance()->hasPlugin($plugin->getName())) {
|
||||||
|
// The plugin is enabled and works well
|
||||||
|
return getlocal('working');
|
||||||
|
}
|
||||||
|
|
||||||
|
// The plugin is enabled but something is wrong.
|
||||||
|
if ($plugin->needsUpdate()) {
|
||||||
|
// The plugin is not working because it needs to be updated.
|
||||||
|
return getlocal('needs update');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Actually we do not know why the plugin does not work. The only thing
|
||||||
|
// that can be said is the plugin was not initialized correctly by some
|
||||||
|
// reasons.
|
||||||
|
return getlocal('not initialized');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
<th>{{l10n "Name"}}</th>
|
<th>{{l10n "Name"}}</th>
|
||||||
<th>{{l10n "Version"}}</th>
|
<th>{{l10n "Version"}}</th>
|
||||||
<th>{{l10n "Dependencies"}}</th>
|
<th>{{l10n "Dependencies"}}</th>
|
||||||
|
<th>{{l10n "State"}}</th>
|
||||||
<th>{{l10n "Edit"}}</th>
|
<th>{{l10n "Edit"}}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@ -27,6 +28,9 @@
|
|||||||
<td class="notlast">
|
<td class="notlast">
|
||||||
{{#each dependencies}}{{#unless @first}}, {{/unless}}{{@key}}({{this}}){{/each}}
|
{{#each dependencies}}{{#unless @first}}, {{/unless}}{{@key}}({{this}}){{/each}}
|
||||||
</td>
|
</td>
|
||||||
|
<td class="notlast">
|
||||||
|
{{state}}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{{#if enabled}}
|
{{#if enabled}}
|
||||||
{{#if canBeDisabled}}
|
{{#if canBeDisabled}}
|
||||||
|
Loading…
Reference in New Issue
Block a user