Skip to content
Snippets Groups Projects
Commit e3c741eb authored by Arthur Suzuki's avatar Arthur Suzuki
Browse files

hotline#89458: added a script to remove unused interests

parent 2671abea
Branches
Tags
2 merge requests!3555Hotline,!3545hotline#89458: added a script to remove unused interests
Pipeline #10381 passed with stage
in 45 minutes and 15 seconds
- ticket #89458 : Ajout d'un script de suppression des centres d'interets devenus inutiles
\ No newline at end of file
<?php
error_reporting(E_ERROR | E_PARSE);
require(__DIR__.'/../console.php');
echo "\n\nWelcome\n\n";
$matching = [];
Class Script_Interet_Cleaner {
public function findAllInteretWithoutNotices () {
echo 'nombre de centre d\'interet:' . count(Class_CodifCentreInteret::findAll());
return array_filter(Class_CodifCentreInteret::findAll(),
function($codif) {
return (!Class_Notice::findFirstBy(['where' => 'match(facettes) against(\'F' . $codif->getId() . '\')']));
});
}
}
$script = new Script_Interet_Cleaner();
array_map(
function($codif) {
echo "delete ".$codif->getLibelle()."\n";
$codif->delete();
},
$script->findAllInteretWithoutNotices());
echo "\n\nDONE !!!!\n\n";
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment