Exemplo n.º 1
0
 /**
  * @dataProvider includeDataProvider
  */
 public function testInclude($yamlFile, $yamlResultFile)
 {
     $yamlString = file_get_contents($this->fixtures . $yamlFile);
     $yaml = Horde_Yaml::load($yamlString);
     $yamlResultString = file_get_contents($this->fixtures . $yamlResultFile);
     $yamlResult = Horde_Yaml::load($yamlResultString);
     $this->directives->process($yaml);
     $this->assertEquals(json_encode($yamlResult), json_encode($yaml));
 }
Exemplo n.º 2
0
 /**
  * Install a profile
  * 
  * @param Tiki_Profile $profile		Profile object
  * @param string $empty_cache		all|templates_c|temp_cache|temp_public|modules_cache|prefs (default all)
  */
 function install(Tiki_Profile $profile, $empty_cache = 'all')
 {
     global $tikidomain;
     $cachelib = TikiLib::lib('cache');
     $tikilib = TikiLib::lib('tiki');
     try {
         // Apply directives, note Directives should be and are a runtime thing
         $yamlDirectives = new Yaml_Directives(new Yaml_Filter_ReplaceUserData($profile, $this->userData), $profile->getPath());
         $data = $profile->getData();
         $yamlDirectives->process($data);
         $profile->setData($data);
         $profile->fetchExternals();
         // there might be new externals as a result of the directives processing
         $profile->getObjects();
         // need to be refreshed before installation in case any have changed due to replacements
         if (!($profiles = $this->getInstallOrder($profile))) {
             return false;
         }
         foreach ($profiles as $p) {
             $this->doInstall($p);
         }
         if (count($this->getFeedback()) == count($profiles)) {
             $this->setFeedback(tra('Nothing was changed. Please check the profile for errors'));
         }
         $cachelib->empty_cache($empty_cache, 'profile');
         return true;
     } catch (Exception $e) {
         $this->setFeedback(tra('An error occurred: ') . $e->getMessage());
         return false;
     }
 }