Loading admin/src/DataGen.php +34 −2 Changes for admin/src/DataGen.php: 34 added lines, 2 removed lines. Original line number Diff line number Diff line <?php class DataGen { use \BddAdmin\Logger\LoggerAwareTrait; Loading Loading @@ -129,7 +132,7 @@ class DataGen [ 'table' => 'INDICATEUR', 'context' => ['install', 'update'], 'key' => 'NUMERO', 'key' => ['TYPE_INDICATEUR_ID', 'NUMERO'], ], [ 'table' => 'FORMULE', Loading Loading @@ -356,31 +359,36 @@ class DataGen ]; public function __construct(OseAdmin $oseAdmin) { $this->oseAdmin = $oseAdmin; $this->setLogger($oseAdmin->getConsole()); $this->setLogger($oseAdmin->getBdd()->getLogger()); } public function install(string $table = null) { return $this->action('install', $table); } public function update(string $table = null) { return $this->action('update', $table); } public function updatePrivileges() { return $this->action('privileges'); } private function action(string $action, string $table = null) { $this->logBegin($this->actions[$action]); Loading @@ -394,12 +402,15 @@ class DataGen } } if (!$table) { $this->logMsg('Mise à jour du point d\'indice pour les HETD ...', true); $this->oseAdmin->getBdd()->exec('BEGIN OSE_FORMULE.UPDATE_ANNEE_TAUX_HETD; END;'); } $this->logEnd(); } private function syncTable(string $table, array $params) { $tableObject = $this->oseAdmin->getBdd()->getTable($table); Loading Loading @@ -448,6 +459,7 @@ class DataGen } private function getAnneeCourante(): int { $now = new \DateTime(); Loading @@ -460,6 +472,7 @@ class DataGen } public function ANNEE() { $annees = []; Loading @@ -484,6 +497,7 @@ class DataGen } public function DEPARTEMENT() { $departements = []; Loading Loading @@ -511,6 +525,7 @@ class DataGen } public function IMPORT_TABLES() { $data = require $this->oseAdmin->getOseDir() . 'data/import_tables.php'; Loading @@ -528,12 +543,14 @@ class DataGen } public function ETAT_SORTIE() { return require $this->oseAdmin->getOseDir() . 'data/etats_sortie.php'; } public function CATEGORIE_PRIVILEGE() { $data = require $this->oseAdmin->getOseDir() . 'data/privileges.php'; Loading @@ -550,6 +567,7 @@ class DataGen } public function PRIVILEGE() { $data = require $this->oseAdmin->getOseDir() . 'data/privileges.php'; Loading @@ -571,6 +589,7 @@ class DataGen } public function FORMULE() { $data = $this->nomenclature['FORMULE']; Loading @@ -589,6 +608,7 @@ class DataGen } public function PLAFOND() { $data = require $this->oseAdmin->getOseDir() . 'data/plafonds.php'; Loading @@ -600,6 +620,7 @@ class DataGen $plafond = [ 'NUMERO' => $numero, 'LIBELLE' => $p['libelle'], 'MESSAGE' => $p['message'] ?? null, 'PLAFOND_PERIMETRE_ID' => $perimetreId, 'REQUETE' => $p['requete'], ]; Loading @@ -610,6 +631,7 @@ class DataGen } public function PLAFOND_ETAT() { $data = require $this->oseAdmin->getOseDir() . 'data/plafonds.php'; Loading @@ -630,6 +652,7 @@ class DataGen } public function PLAFOND_PERIMETRE() { $data = require $this->oseAdmin->getOseDir() . 'data/plafonds.php'; Loading @@ -649,6 +672,7 @@ class DataGen } public function TYPE_INDICATEUR() { $data = require $this->oseAdmin->getOseDir() . 'data/indicateurs.php'; Loading @@ -667,6 +691,7 @@ class DataGen } public function INDICATEUR() { $data = require $this->oseAdmin->getOseDir() . 'data/indicateurs.php'; Loading @@ -686,10 +711,16 @@ class DataGen } } $pis = $this->oseAdmin->getBdd()->select('SELECT * FROM V_PLAFOND_INDICATEURS'); foreach ($pis as $pi) { $indicateurs[] = $pi; } return $indicateurs; } public function WF_ETAPE() { $data = require $this->oseAdmin->getOseDir() . 'data/workflow_etapes.php'; Loading @@ -705,6 +736,7 @@ class DataGen } public function PARAMETRE() { $bdd = $this->oseAdmin->getBdd(); Loading admin/src/OseAdmin.php +31 −20 Changes for admin/src/OseAdmin.php: 31 added lines, 20 removed lines. Original line number Diff line number Diff line Loading @@ -9,20 +9,11 @@ class OseAdmin const OSE_ORIGIN = 'https://git.unicaen.fr/open-source/OSE.git'; const MIN_VERSION = 14; // version minimum installable /** * @var self */ private static $instance; private static ?OseAdmin $instance = null; /** * @var Console */ protected $console; protected Console $console; /** * @var Bdd */ protected $bdd; protected ?\BddAdmin\Bdd $bdd = null; /** * @var array Loading Loading @@ -56,21 +47,19 @@ class OseAdmin /** * OseAdmin constructor. * * @param Console $console */ public function __construct(Console $console) private function __construct() { $this->console = $console; self::$instance = $this; } public static function getInstance(): self { if (!self::$instance) { self::$instance = new self(); self::$instance->init(); } return self::$instance; } Loading @@ -78,6 +67,26 @@ class OseAdmin public function init() { spl_autoload_register(function ($class) { $root = self::getInstance()->getOseDir(); $dirs = [ $root . '/admin/src/', $root . '/admin/actul/src/', ]; foreach ($dirs as $dir) { $filename = $dir . str_replace('\\', '/', $class) . '.php'; if (file_exists($filename)) { require_once $filename; break; } } }); $this->console = new Console(); $this->version = $this->currentVersion(); $this->oldVersion = $this->version; Loading Loading @@ -309,8 +318,10 @@ class OseAdmin . "\nVeuillez contrôler vos paramètres de configuration s'il vous plaît, avant de refaire une tentative de MAJ de la base de données (./bin/ose update-bdd)."); } $this->bdd = new \BddAdmin\Bdd(Config::getBdd()); if (PHP_SAPI == 'cli') { $this->bdd->setLogger($this->console); } } return $this->bdd; } Loading bin/ose +3 −19 Changes for bin/ose: 3 added lines, 19 removed lines. Original line number Diff line number Diff line #!/usr/bin/env php <?php spl_autoload_register(function ($class) { $root = dirname(__DIR__); require_once dirname(__DIR__) . '/admin/src/OseAdmin.php'; $dirs = [ $root . '/admin/src/', $root . '/admin/actul/src/', ]; $oa = OseAdmin::getInstance(); foreach($dirs as $dir) { $filename = $dir . str_replace('\\', '/', $class) . '.php'; if (file_exists($filename)) { require_once $filename; break; } } }); $c = new Console(); $oa = new OseAdmin($c); $oa->init(); $c = $oa->getConsole(); $oa->run($c->getArg(1) ?: 'help'); No newline at end of file code/DiagrammeBdd.php +1 −1 Changes for code/DiagrammeBdd.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ * @var $viewFile string */ $bdd = adminBdd(); $bdd = oseAdmin()->getBdd(); /*$tables = [ [ Loading code/Requêtes en cours.php +2 −3 Changes for code/Requêtes en cours.php: 2 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -8,8 +8,7 @@ * @var $viewFile string */ $bdd = adminBdd(); $bdd = oseAdmin()->getBdd(); $sql = " SELECT Loading Loading @@ -59,7 +58,7 @@ foreach ($res as $s) { <b>Objet qui bloque : </b><?= $s['OBJET_BLOQUANT'] ?>, <b>Evénement : </b><?= $s['EVENEMENT'] ?>, <?php AdminUtil::highlight($s['REQUETE_SQL'], 'sql-f'); sqlDump($s['REQUETE_SQL']); } ?> Loading Loading
admin/src/DataGen.php +34 −2 Changes for admin/src/DataGen.php: 34 added lines, 2 removed lines. Original line number Diff line number Diff line <?php class DataGen { use \BddAdmin\Logger\LoggerAwareTrait; Loading Loading @@ -129,7 +132,7 @@ class DataGen [ 'table' => 'INDICATEUR', 'context' => ['install', 'update'], 'key' => 'NUMERO', 'key' => ['TYPE_INDICATEUR_ID', 'NUMERO'], ], [ 'table' => 'FORMULE', Loading Loading @@ -356,31 +359,36 @@ class DataGen ]; public function __construct(OseAdmin $oseAdmin) { $this->oseAdmin = $oseAdmin; $this->setLogger($oseAdmin->getConsole()); $this->setLogger($oseAdmin->getBdd()->getLogger()); } public function install(string $table = null) { return $this->action('install', $table); } public function update(string $table = null) { return $this->action('update', $table); } public function updatePrivileges() { return $this->action('privileges'); } private function action(string $action, string $table = null) { $this->logBegin($this->actions[$action]); Loading @@ -394,12 +402,15 @@ class DataGen } } if (!$table) { $this->logMsg('Mise à jour du point d\'indice pour les HETD ...', true); $this->oseAdmin->getBdd()->exec('BEGIN OSE_FORMULE.UPDATE_ANNEE_TAUX_HETD; END;'); } $this->logEnd(); } private function syncTable(string $table, array $params) { $tableObject = $this->oseAdmin->getBdd()->getTable($table); Loading Loading @@ -448,6 +459,7 @@ class DataGen } private function getAnneeCourante(): int { $now = new \DateTime(); Loading @@ -460,6 +472,7 @@ class DataGen } public function ANNEE() { $annees = []; Loading @@ -484,6 +497,7 @@ class DataGen } public function DEPARTEMENT() { $departements = []; Loading Loading @@ -511,6 +525,7 @@ class DataGen } public function IMPORT_TABLES() { $data = require $this->oseAdmin->getOseDir() . 'data/import_tables.php'; Loading @@ -528,12 +543,14 @@ class DataGen } public function ETAT_SORTIE() { return require $this->oseAdmin->getOseDir() . 'data/etats_sortie.php'; } public function CATEGORIE_PRIVILEGE() { $data = require $this->oseAdmin->getOseDir() . 'data/privileges.php'; Loading @@ -550,6 +567,7 @@ class DataGen } public function PRIVILEGE() { $data = require $this->oseAdmin->getOseDir() . 'data/privileges.php'; Loading @@ -571,6 +589,7 @@ class DataGen } public function FORMULE() { $data = $this->nomenclature['FORMULE']; Loading @@ -589,6 +608,7 @@ class DataGen } public function PLAFOND() { $data = require $this->oseAdmin->getOseDir() . 'data/plafonds.php'; Loading @@ -600,6 +620,7 @@ class DataGen $plafond = [ 'NUMERO' => $numero, 'LIBELLE' => $p['libelle'], 'MESSAGE' => $p['message'] ?? null, 'PLAFOND_PERIMETRE_ID' => $perimetreId, 'REQUETE' => $p['requete'], ]; Loading @@ -610,6 +631,7 @@ class DataGen } public function PLAFOND_ETAT() { $data = require $this->oseAdmin->getOseDir() . 'data/plafonds.php'; Loading @@ -630,6 +652,7 @@ class DataGen } public function PLAFOND_PERIMETRE() { $data = require $this->oseAdmin->getOseDir() . 'data/plafonds.php'; Loading @@ -649,6 +672,7 @@ class DataGen } public function TYPE_INDICATEUR() { $data = require $this->oseAdmin->getOseDir() . 'data/indicateurs.php'; Loading @@ -667,6 +691,7 @@ class DataGen } public function INDICATEUR() { $data = require $this->oseAdmin->getOseDir() . 'data/indicateurs.php'; Loading @@ -686,10 +711,16 @@ class DataGen } } $pis = $this->oseAdmin->getBdd()->select('SELECT * FROM V_PLAFOND_INDICATEURS'); foreach ($pis as $pi) { $indicateurs[] = $pi; } return $indicateurs; } public function WF_ETAPE() { $data = require $this->oseAdmin->getOseDir() . 'data/workflow_etapes.php'; Loading @@ -705,6 +736,7 @@ class DataGen } public function PARAMETRE() { $bdd = $this->oseAdmin->getBdd(); Loading
admin/src/OseAdmin.php +31 −20 Changes for admin/src/OseAdmin.php: 31 added lines, 20 removed lines. Original line number Diff line number Diff line Loading @@ -9,20 +9,11 @@ class OseAdmin const OSE_ORIGIN = 'https://git.unicaen.fr/open-source/OSE.git'; const MIN_VERSION = 14; // version minimum installable /** * @var self */ private static $instance; private static ?OseAdmin $instance = null; /** * @var Console */ protected $console; protected Console $console; /** * @var Bdd */ protected $bdd; protected ?\BddAdmin\Bdd $bdd = null; /** * @var array Loading Loading @@ -56,21 +47,19 @@ class OseAdmin /** * OseAdmin constructor. * * @param Console $console */ public function __construct(Console $console) private function __construct() { $this->console = $console; self::$instance = $this; } public static function getInstance(): self { if (!self::$instance) { self::$instance = new self(); self::$instance->init(); } return self::$instance; } Loading @@ -78,6 +67,26 @@ class OseAdmin public function init() { spl_autoload_register(function ($class) { $root = self::getInstance()->getOseDir(); $dirs = [ $root . '/admin/src/', $root . '/admin/actul/src/', ]; foreach ($dirs as $dir) { $filename = $dir . str_replace('\\', '/', $class) . '.php'; if (file_exists($filename)) { require_once $filename; break; } } }); $this->console = new Console(); $this->version = $this->currentVersion(); $this->oldVersion = $this->version; Loading Loading @@ -309,8 +318,10 @@ class OseAdmin . "\nVeuillez contrôler vos paramètres de configuration s'il vous plaît, avant de refaire une tentative de MAJ de la base de données (./bin/ose update-bdd)."); } $this->bdd = new \BddAdmin\Bdd(Config::getBdd()); if (PHP_SAPI == 'cli') { $this->bdd->setLogger($this->console); } } return $this->bdd; } Loading
bin/ose +3 −19 Changes for bin/ose: 3 added lines, 19 removed lines. Original line number Diff line number Diff line #!/usr/bin/env php <?php spl_autoload_register(function ($class) { $root = dirname(__DIR__); require_once dirname(__DIR__) . '/admin/src/OseAdmin.php'; $dirs = [ $root . '/admin/src/', $root . '/admin/actul/src/', ]; $oa = OseAdmin::getInstance(); foreach($dirs as $dir) { $filename = $dir . str_replace('\\', '/', $class) . '.php'; if (file_exists($filename)) { require_once $filename; break; } } }); $c = new Console(); $oa = new OseAdmin($c); $oa->init(); $c = $oa->getConsole(); $oa->run($c->getArg(1) ?: 'help'); No newline at end of file
code/DiagrammeBdd.php +1 −1 Changes for code/DiagrammeBdd.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ * @var $viewFile string */ $bdd = adminBdd(); $bdd = oseAdmin()->getBdd(); /*$tables = [ [ Loading
code/Requêtes en cours.php +2 −3 Changes for code/Requêtes en cours.php: 2 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -8,8 +8,7 @@ * @var $viewFile string */ $bdd = adminBdd(); $bdd = oseAdmin()->getBdd(); $sql = " SELECT Loading Loading @@ -59,7 +58,7 @@ foreach ($res as $s) { <b>Objet qui bloque : </b><?= $s['OBJET_BLOQUANT'] ?>, <b>Evénement : </b><?= $s['EVENEMENT'] ?>, <?php AdminUtil::highlight($s['REQUETE_SQL'], 'sql-f'); sqlDump($s['REQUETE_SQL']); } ?> Loading