Beispiel #1
0
 function onTag($tag, array $props)
 {
     if ($tag == '@uuid') {
         \Cherry\Log(\Cherry\LOG_DEBUG, "Generating UUID for @uuid metatag.");
         return \Cherry\Crypto\Uuid::getInstance()->generate();
     }
 }
Beispiel #2
0
     }
     $cfg = array('application' => array());
 } else {
     $log->write("Updating application configuration...\n");
     $cfg = parse_ini_file($cfgpath, true);
 }
 $cfg['application']['namespace'] = $data['appns'];
 if (empty($cfg['application']['appname'])) {
     $cfg['application']['appname'] = 'MVC Application';
 }
 if (empty($cfg['application']['version'])) {
     $cfg['application']['version'] = '1.0.0';
 }
 if (empty($cfg['application']['uuid']) || $data['replace']) {
     printf("Generating new UUID...");
     $uuid = \cherry\crypto\Uuid::getInstance()->generate(\cherry\crypto\Uuid::UUID_V4);
     //$uuid = trim(exec('uuidgen'));
     printf("%s\n", $uuid);
     $cfg['application']['uuid'] = $uuid;
 } else {
     $log->write("UUID already set. If you wish to regenerate it, use +replace.\n");
 }
 $out = '';
 foreach ($cfg as $group => $cfgvals) {
     $out .= sprintf("[%s]\n", $group);
     foreach ($cfgvals as $k => $v) {
         if (is_string($v)) {
             $v = '"' . $v . '"';
         }
         $out .= sprintf("%s=%s\n", $k, $v);
         if ($cfgvals[$k] == end($cfgvals)) {
Beispiel #3
0
 protected function createFragment()
 {
     $this->fragmentid = Uuid::getInstance()->generate(Uuid::UUID_V4);
 }