private static function write($meta, $data) { $root = self::getTmpDir(); FileHelper::write($root, 'content.xml', $data['content']); FileHelper::write($root, 'Revisions/' . $meta['id'] . '/revisions.xml', $data['revisions']); FileHelper::write($root, 'Revisions/' . $meta['id'] . '/rev-1-' . $meta['timestamp'] . '.xml', $data['rev']); FileHelper::write($root, 'meta.xml', $data['meta']); FileHelper::write($root, '/META-INF/manifest.xml', $data['manifest']); if (count($data['attachments']) > 0) { mkdir($root . 'attachments'); foreach ($data['attachments'] as $attach) { rename($attach['origin'], $root . $attach['filepath']); } } return $root; }