Environment::getMode(DEVELOPMENT) je NULL na localhost
- MIKI
- Člen | 34
Verzia Nette: Nette Framework 2.0-dev (revision 7616569 released on 2011–03–10)
Viem, ze je to mozno blbost, ale i tak mi to nedalo, a trochu som to pozeral
(nie vo vnutri Nette, len zvonku). Totizto najprv som na overenie development
rezimu pouzil NEnvironment::getMode(NEnvironment::DEVELOPMENT)
, a
to mi nefungovalo. Pri testovani som nasiel funkciu isProduction()
,
ktora funguje.
Vystup tohto kodu:
<?php
use \Nette\Environment as NEnvironment;
use \Nette\Debug as NDebug;
var_dump(NEnvironment::getMode(NEnvironment::DEVELOPMENT), NEnvironment::DEVELOPMENT);
NDebug::barDump(NEnvironment::getMode(NEnvironment::DEVELOPMENT), 'environment');
NDebug::barDump(NEnvironment::getMode(NEnvironment::PRODUCTION));
NDebug::barDump(NEnvironment::isProduction());
// NDebug::barDump(NEnvironment::isDevelopment());
NDebug::barDump(NEnvironment::getName());
?>
na localhoste je nasledovny:
NULL, string(11) "development"
NULL
FALSE
FALSE
"development" (11)
Taktiez som prave skusil pridat do bootstrap.php
<?php
Environment::setMode(Environment::PRODUCTION);
?>
vystup:
NULL, string(11) "development"
NULL
TRUE
TRUE
"production" (10)
a ked som tam pridal este dalsi riadok, cize teraz v
bootstrap.php
je:
<?php
Environment::setMode(Environment::PRODUCTION);
Environment::setMode(Environment::DEVELOPMENT);
?>
vystup je zabavnejsi :)
bool(true), string(11) "development"
TRUE
TRUE
TRUE
"production" (10)
Nie je to trochu divne chovanie? :) (Min. v prvom pripade by som ocakaval,
ze pre getMode('development')
to vrati true
, a
nie NULL
Prave som si precital https://forum.nette.org/…-ip-10-x-x-x
Podla Nette sudim, ze vysledok zatial stale nejasny.
Napriek vsetkemu, zaciatok je zaujimavy, preco je
mode[DEVELOPMENT] == NULL
a mode[PRODUCTION] == false
pri auto-detekcii