Exemplo n.º 1
0
 /**
  * Loads an array of settings from a file into the object with the specified name;
  *
  * @param string $File A string containing the path to a file that contains the settings array.
  * @param string $Name The name of the variable and initial group settings.
  *   Note: When $Name is 'Configuration' then the data will be set to the root of the config.
  * @param boolean $Dynamic Optional, whether to treat this as the request's "dynamic" config, and
  *   to save config changes here. These settings will also be re-applied later when "OverlayDynamic"
  *   is called after all defaults are loaded.
  * @return boolean
  */
 public function Load($File, $Name = 'Configuration', $Dynamic = FALSE)
 {
     $ConfigurationSource = Gdn_ConfigurationSource::FromFile($this, $File, $Name);
     if (!$ConfigurationSource) {
         return FALSE;
     }
     $UseSplitting = $this->Splitting;
     $ConfigurationSource->Splitting($UseSplitting);
     if (!$ConfigurationSource) {
         return FALSE;
     }
     $SourceTag = "file:{$File}";
     $this->Sources[$SourceTag] = $ConfigurationSource;
     if ($Dynamic) {
         $this->Dynamic = $ConfigurationSource;
     }
     if (!$UseSplitting) {
         $this->MassImport($ConfigurationSource->Export());
     } else {
         self::MergeConfig($this->Data, $ConfigurationSource->Export());
     }
 }