From cc109cb153e799ffc9865f6a47d961fd4627742e Mon Sep 17 00:00:00 2001 From: Cerdic <cedric@yterium.com> Date: Thu, 6 Feb 2020 15:37:36 +0100 Subject: [PATCH] un flag bon_a_pousser qui permet de marquer un module comme pret a etre pousse, quand on a fini de le traduire, et une option sur ouvrager pour ouvrager tous les modules bon_a_pousser --- action/tradlang_bon_a_pousser.php | 28 ++++++++++++++++++++++++++++ base/tradlang.php | 3 ++- paquet.xml | 2 +- spip-cli/SalvatoreOuvrager.php | 4 ++++ tradlang_administrations.php | 4 ++++ 5 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 action/tradlang_bon_a_pousser.php diff --git a/action/tradlang_bon_a_pousser.php b/action/tradlang_bon_a_pousser.php new file mode 100644 index 0000000..c14c3ab --- /dev/null +++ b/action/tradlang_bon_a_pousser.php @@ -0,0 +1,28 @@ +<?php +/** + * + * Trad-lang v2 + * Plugin SPIP de traduction de fichiers de langue + * © Florent Jugla, Fil, kent1 + * + * Action permettant de récupérer un fichier de langue + * + */ +if (!defined('_ECRIRE_INC_VERSION')) { + return; +} + +function action_tradlang_bon_a_pousser_dist(){ + $securiser_action = charger_fonction('securiser_action', 'inc'); + $arg = $securiser_action(); + + $id_tradlang_module = intval($arg); + + if (!$id_tradlang_module){ + spip_log("action_tradlang_bon_a_pousser $arg pas compris", 'tradlang.' . _LOG_ERREUR); + return false; + } + + sql_updateq("spip_tradlang_modules", array('bon_a_pousser' => 1), 'id_tradlang_module=' . intval($id_tradlang_module)); + +} diff --git a/base/tradlang.php b/base/tradlang.php index e10a91e..efa6dd6 100644 --- a/base/tradlang.php +++ b/base/tradlang.php @@ -45,7 +45,8 @@ function tradlang_declarer_tables_objets_sql($tables) { "priorite" => "varchar(128) NOT NULL", "gestionnaire" => "varchar(32) DEFAULT 'spip' NOT NULL", "lang_prefix" => "varchar(32) NOT NULL", - "limite_trad" => "tinyint NOT NULL DEFAULT 0" + "limite_trad" => "tinyint NOT NULL DEFAULT 0", + "bon_a_pousser" => "tinyint NOT NULL DEFAULT 0" ), 'key' => array( 'PRIMARY KEY' => 'id_tradlang_module', diff --git a/paquet.xml b/paquet.xml index 633dbf9..cc3822a 100644 --- a/paquet.xml +++ b/paquet.xml @@ -5,7 +5,7 @@ etat="test" compatibilite="[3.2.0;3.3.*]" logo="images/spip_lang.png" - schema="1.2.0" + schema="1.2.1" > <nom>Trad-Lang</nom> diff --git a/spip-cli/SalvatoreOuvrager.php b/spip-cli/SalvatoreOuvrager.php index 2100389..dde262c 100644 --- a/spip-cli/SalvatoreOuvrager.php +++ b/spip-cli/SalvatoreOuvrager.php @@ -101,6 +101,10 @@ class SalvatoreOuvrager extends Command { $modules = $input->getOption('module'); if ($modules = trim($modules)) { + if ($modules === 'bon_a_pousser') { + $modules = sql_allfetsel('DISTINCT module', 'spip_tradlang_modules', 'bon_a_pousser>0'); + $modules = array_column($modules, 'module'); + } $liste_trad = salvatore_filtrer_liste_traductions($liste_trad, $modules); $n = count($liste_trad); $output->writeln("<info>$n modules à traiter : " . $modules . "</info>"); diff --git a/tradlang_administrations.php b/tradlang_administrations.php index a5fb35a..c0ed475 100644 --- a/tradlang_administrations.php +++ b/tradlang_administrations.php @@ -130,6 +130,10 @@ function tradlang_upgrade($nom_meta_base_version, $version_cible) { array('tradlang_nommer_modules'), ); + $maj['1.2.1'] = array( + array('sql_alter','TABLE spip_tradlang_modules ADD bon_a_pousser tinyint NOT NULL DEFAULT 0'), + ); + include_spip('base/upgrade'); maj_plugin($nom_meta_base_version, $version_cible, $maj); } -- GitLab