コード例 #1
0
ファイル: Cli.class.php プロジェクト: davbfr/cf
 public static function configuration()
 {
     $set = self::addSwitch("set", "Set an option");
     $global = self::addSwitch("global", "Set the option in global configuration");
     $get = self::addSwitch("get", "Get an option");
     if ($set || $get) {
         $keys = self::getInputs("key", "Key and value to set or search");
     }
     self::enableHelp();
     if ($set) {
         if (count($keys) > 1) {
             $val = $keys[1];
         } else {
             $val = null;
         }
         if (strtolower($val) == "true") {
             $val = true;
         } elseif (strtolower($val) == "false") {
             $val = false;
         } elseif ((string) (int) $val == $val) {
             $val = (int) $val;
         }
         Options::updateConf(array(strtoupper($keys[0]) => $val), !$global);
     } else {
         $opts = Options::getAll();
         ksort($opts);
         foreach ($opts as $key => $val) {
             if (!$get || strtoupper($key) == strtoupper($keys[0])) {
                 if (is_bool($val)) {
                     $val = $val ? "true" : "false";
                 }
                 self::pln($key . ' = ' . $val);
             }
         }
     }
 }
コード例 #2
0
ファイル: Core.plugin.php プロジェクト: davbfr/cf
 public function preupdate()
 {
     Cli::pinfo(" * Create folders");
     foreach (Options::getAll() as $key => $val) {
         if (substr($key, -4) == "_DIR") {
             System::ensureDir($val);
         }
     }
 }