Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Desactiver des plugins d'un site SPIP depuis la ligne de commande. Lancer le script depuis la racine du site SPIP, ou depuis le dossier ecrire/ ou le dossier plugins/
$desactiver = $argv;
if (!is_dir('ecrire/') AND is_dir('../ecrire/')) chdir('../');
if (!defined('_DIR_RESTREINT_ABS')) define('_DIR_RESTREINT_ABS', '');
include_once _DIR_RESTREINT_ABS.'inc_version.php';
$plugins = unserialize($GLOBALS['meta']['plugin']);
echo "Plugins actifs : \n".implode(", ",array_map('strtolower',array_keys($plugins)));
echo "\n";
echo "\n";
if (!count($desactiver)){
echo "Indiquez la liste des plugins a desactiver par leur prefixe. Par exemple :
site-desactive-plugin.php mailshot newsletters
Pour desactiver tous les plugins, utilisez l'argument --all :
site-desactive-plugin.php --all
else {
if (reset($desactiver)=="--all"){
$desactiver = array_map('strtolower',array_keys($plugins));
$dirs_un = array();
foreach($desactiver as $prefixe){
$prefixeup = strtoupper($prefixe);
if (!isset($plugins[$prefixeup])){
echo "Plugin $prefixe introuvable dans les plugins actifs\n";
else {
$dir = constant($plugins[$prefixeup]['dir_type']).$plugins[$prefixeup]['dir'];
echo "Desactiver plugin $prefixe (repertoire $dir)\n";
$dirs_un[] = $plugins[$prefixeup]['dir'];
if (count($dirs_un)){
$plugins = unserialize($GLOBALS['meta']['plugin']);
echo "\nPlugins actifs : \n".implode(", ",array_map('strtolower',array_keys($plugins)));
echo "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.