|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
namespace Spip\Cli\Command;
|
|
|
|
|
|
|
|
|
|
use Spip\Cli\Console\Command;
|
|
|
|
|
use Spip\Cli\Plugins\ErrorsTrait;
|
|
|
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
|
|
|
use Symfony\Component\Console\Input\InputOption;
|
|
|
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
@ -10,6 +11,8 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
|
|
|
|
|
class PluginsLister extends Command {
|
|
|
|
|
|
|
|
|
|
use ErrorsTrait;
|
|
|
|
|
|
|
|
|
|
protected function configure() {
|
|
|
|
|
$this->setName("plugins:lister")
|
|
|
|
|
->setDescription("Liste les plugins du site.")
|
|
|
|
@ -254,49 +257,4 @@ class PluginsLister extends Command {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Retourne un tableau ['message d’erreur' => [liste détaillée]]
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function getPluginsErrors() {
|
|
|
|
|
$alertes = [];
|
|
|
|
|
if (isset($GLOBALS['meta']['message_crash_plugins'])
|
|
|
|
|
and $GLOBALS['meta']['message_crash_plugins']
|
|
|
|
|
and is_array($msg = unserialize($GLOBALS['meta']['message_crash_plugins']))
|
|
|
|
|
) {
|
|
|
|
|
$msg = implode(', ', array_map('joli_repertoire', array_keys($msg)));
|
|
|
|
|
$msg = _T('plugins_erreur', array('plugins' => $msg));
|
|
|
|
|
$msg = $this->html_entity_to_utf8($msg);
|
|
|
|
|
$alertes[$msg] = [];
|
|
|
|
|
}
|
|
|
|
|
if (isset($GLOBALS['meta']['plugin_erreur_activation'])) {
|
|
|
|
|
include_spip('inc/plugin');
|
|
|
|
|
$erreurs = plugin_donne_erreurs(true);
|
|
|
|
|
foreach ($erreurs as $plugin => $liste) {
|
|
|
|
|
$msg = _T('plugin_impossible_activer', array('plugin' => $plugin));
|
|
|
|
|
$msg = $this->html_entity_to_utf8($msg);
|
|
|
|
|
$alertes[$msg] = $this->html_entity_to_utf8($liste);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return $alertes;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function showPluginsErrors() {
|
|
|
|
|
if ($erreurs = $this->getPluginsErrors()) {
|
|
|
|
|
$this->io->error("Des erreurs sont présentes");
|
|
|
|
|
foreach($erreurs as $msg => $details) {
|
|
|
|
|
$this->io->fail($msg);
|
|
|
|
|
$this->io->listing($details, 2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** Transforme les > en > */
|
|
|
|
|
public function html_entity_to_utf8($msg) {
|
|
|
|
|
if (is_array($msg)) {
|
|
|
|
|
return array_map([$this, 'html_entity_to_utf8'], $msg);
|
|
|
|
|
}
|
|
|
|
|
return html_entity_decode($msg, ENT_COMPAT | ENT_HTML401, 'UTF-8');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|