Example #1
0
function uuid()
{
    return Ramsey\Uuid\Uuid::uuid4()->toString();
}
Example #2
0
 /**
  * @return string
  */
 protected function _getMachineId()
 {
     // Global machine-id from systemd https://www.freedesktop.org/software/systemd/man/machine-id.html
     $file = new CM_File('/etc/machine-id');
     if (!$file->exists()) {
         // Local machine-id as a backup
         $serviceManager = CM_Service_Manager::getInstance();
         $file = new CM_File('machine-id', $serviceManager->getFilesystems()->getData());
         if (!$file->exists()) {
             $uuid = Ramsey\Uuid\Uuid::uuid4()->toString();
             $file->write($uuid);
         }
     }
     return trim($file->read());
 }