modifs.mineures sans commentaires
This commit is contained in:
parent
c76dc98c31
commit
014825f09d
@ -9,6 +9,7 @@ use nulib\ExitError;
|
|||||||
use nulib\os\path;
|
use nulib\os\path;
|
||||||
use nulib\os\sh;
|
use nulib\os\sh;
|
||||||
use nulib\php\func;
|
use nulib\php\func;
|
||||||
|
use nulib\ref\ref_profiles;
|
||||||
use nulib\str;
|
use nulib\str;
|
||||||
use nulib\ValueException;
|
use nulib\ValueException;
|
||||||
|
|
||||||
@ -114,13 +115,21 @@ class app {
|
|||||||
static function get_profile(?bool &$productionMode=null): string {
|
static function get_profile(?bool &$productionMode=null): string {
|
||||||
return self::get()->getProfile($productionMode);
|
return self::get()->getProfile($productionMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function is_production_mode(): bool {
|
||||||
|
return self::get()->isProductionMode();
|
||||||
|
}
|
||||||
|
|
||||||
static function is_prod(): bool {
|
static function is_prod(): bool {
|
||||||
return self::get_profile() === "prod";
|
return self::get_profile() === ref_profiles::PROD;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function is_test(): bool {
|
||||||
|
return self::get_profile() === ref_profiles::TEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function is_devel(): bool {
|
static function is_devel(): bool {
|
||||||
return self::get_profile() === "devel";
|
return self::get_profile() === ref_profiles::DEVEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function set_profile(?string $profile=null, ?bool $productionMode=null): void {
|
static function set_profile(?string $profile=null, ?bool $productionMode=null): void {
|
||||||
|
@ -14,6 +14,7 @@ use nulib\output\console;
|
|||||||
use nulib\output\log;
|
use nulib\output\log;
|
||||||
use nulib\output\msg;
|
use nulib\output\msg;
|
||||||
use nulib\output\std\StdMessenger;
|
use nulib\output\std\StdMessenger;
|
||||||
|
use nulib\ref\ref_profiles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Application: application de base
|
* Class Application: application de base
|
||||||
@ -257,9 +258,9 @@ EOT);
|
|||||||
"action" => [app::class, "set_profile"],
|
"action" => [app::class, "set_profile"],
|
||||||
"help" => "spécifier le profil d'exécution",
|
"help" => "spécifier le profil d'exécution",
|
||||||
],
|
],
|
||||||
["-P", "--prod", "action" => [app::class, "set_profile", "prod"]],
|
["-P", "--prod", "action" => [app::class, "set_profile", ref_profiles::PROD]],
|
||||||
["-T", "--test", "action" => [app::class, "set_profile", "test"]],
|
["-T", "--test", "action" => [app::class, "set_profile", ref_profiles::TEST]],
|
||||||
["--devel", "action" => [app::class, "set_profile", "devel"]],
|
["--devel", "action" => [app::class, "set_profile", ref_profiles::DEVEL]],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -307,9 +308,9 @@ EOT);
|
|||||||
}
|
}
|
||||||
|
|
||||||
const PROFILE_COLORS = [
|
const PROFILE_COLORS = [
|
||||||
"prod" => "@r",
|
ref_profiles::PROD => "@r",
|
||||||
"test" => "@g",
|
ref_profiles::TEST => "@g",
|
||||||
"devel" => "@w",
|
ref_profiles::DEVEL => "@w",
|
||||||
];
|
];
|
||||||
const DEFAULT_PROFILE_COLOR = "y";
|
const DEFAULT_PROFILE_COLOR = "y";
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ namespace nulib\app\config;
|
|||||||
|
|
||||||
use nulib\app\app;
|
use nulib\app\app;
|
||||||
use nulib\app\config;
|
use nulib\app\config;
|
||||||
|
use nulib\ref\ref_profiles;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ProfileManager: gestionnaire de profils
|
* Class ProfileManager: gestionnaire de profils
|
||||||
@ -21,10 +22,7 @@ class ProfileManager {
|
|||||||
const PROFILES = null;
|
const PROFILES = null;
|
||||||
|
|
||||||
/** @var array profils dont le mode production doit être actif */
|
/** @var array profils dont le mode production doit être actif */
|
||||||
const PRODUCTION_MODES = [
|
const PRODUCTION_MODES = ref_profiles::PRODUCTION_MODES;
|
||||||
"prod" => true,
|
|
||||||
"test" => true,
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array mapping profil d'application --> profil effectif
|
* @var array mapping profil d'application --> profil effectif
|
||||||
@ -114,7 +112,7 @@ class ProfileManager {
|
|||||||
$profile ??= $this->getConfigProfile();
|
$profile ??= $this->getConfigProfile();
|
||||||
$profile ??= $this->getDefaultProfile();
|
$profile ??= $this->getDefaultProfile();
|
||||||
if ($this->isAppProfile) {
|
if ($this->isAppProfile) {
|
||||||
$profile ??= $this->profiles[0] ?? "prod";
|
$profile ??= $this->profiles[0] ?? ref_profiles::PROD;
|
||||||
} else {
|
} else {
|
||||||
$profile ??= $this->mapProfile(app::get_profile());
|
$profile ??= $this->mapProfile(app::get_profile());
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ use nulib\NoMoreDataException;
|
|||||||
use nulib\os\EOFException;
|
use nulib\os\EOFException;
|
||||||
use nulib\os\IOException;
|
use nulib\os\IOException;
|
||||||
use nulib\php\iter\AbstractIterator;
|
use nulib\php\iter\AbstractIterator;
|
||||||
use nulib\ref\file\csv\ref_csv;
|
use nulib\ref\ref_csv;
|
||||||
use nulib\str;
|
use nulib\str;
|
||||||
use nulib\ValueException;
|
use nulib\ValueException;
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
namespace nulib\file\csv;
|
namespace nulib\file\csv;
|
||||||
|
|
||||||
use nulib\cl;
|
use nulib\cl;
|
||||||
use nulib\ref\file\csv\ref_csv;
|
use nulib\ref\ref_csv;
|
||||||
use nulib\str;
|
use nulib\str;
|
||||||
|
|
||||||
class csv_flavours {
|
class csv_flavours {
|
||||||
|
11
php/src/ref/ref_cache.php
Normal file
11
php/src/ref/ref_cache.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
namespace nulib\ref;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ref_cache: référence des durées de mise en cache
|
||||||
|
*/
|
||||||
|
class ref_cache {
|
||||||
|
const MINUTE = 60;
|
||||||
|
const HOUR = 60 * self::MINUTE;
|
||||||
|
const DAY = 24 * self::HOUR;
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace nulib\ref\file\csv;
|
namespace nulib\ref;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class ref_csv: références des valeurs normalisées pour les fichiers CSV à
|
* Class ref_csv: références des valeurs normalisées pour les fichiers CSV à
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace nulib\ref\php;
|
namespace nulib\ref;
|
||||||
|
|
||||||
class ref_func {
|
class ref_func {
|
||||||
const CALL_ALL_PARAMS_SCHEMA = [
|
const CALL_ALL_PARAMS_SCHEMA = [
|
15
php/src/ref/ref_jquery.php
Normal file
15
php/src/ref/ref_jquery.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace nulib\ref;
|
||||||
|
|
||||||
|
class ref_jquery {
|
||||||
|
const HAVE_JQUERY = true;
|
||||||
|
|
||||||
|
function printJquery(): void {
|
||||||
|
?>
|
||||||
|
<script type="text/javascript">
|
||||||
|
jQuery.noConflict()(function($) {
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace nulib\ref\web;
|
namespace nulib\ref;
|
||||||
|
|
||||||
class ref_mimetypes {
|
class ref_mimetypes {
|
||||||
const TXT = "text/plain";
|
const TXT = "text/plain";
|
22
php/src/ref/ref_profiles.php
Normal file
22
php/src/ref/ref_profiles.php
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
namespace nulib\ref;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ref_profiles: noms de profils normalisés
|
||||||
|
*/
|
||||||
|
class ref_profiles {
|
||||||
|
const PROD = "prod";
|
||||||
|
const TEST = "test";
|
||||||
|
const DEVEL = "devel";
|
||||||
|
|
||||||
|
const PROFILES = [
|
||||||
|
self::PROD,
|
||||||
|
self::TEST,
|
||||||
|
self::DEVEL,
|
||||||
|
];
|
||||||
|
|
||||||
|
const PRODUCTION_MODES = [
|
||||||
|
self::PROD => true,
|
||||||
|
self::TEST => true,
|
||||||
|
];
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user