<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><blockquote type="cite"><div>Could you describe this process in more details ? then we could look<br>for enhancements ;)</div></blockquote><div><br></div>OK. Apps will provide an import and export function. See and examples for the bookmarks app here: <a href="http://gitorious.org/owncloud/owncloud/blobs/691103acd5aad2673b6375726ba24fb56e88451b/apps/bookmarks/lib/migrate.php">http://gitorious.org/owncloud/owncloud/blobs/691103acd5aad2673b6375726ba24fb56e88451b/apps/bookmarks/lib/migrate.php</a><div><br></div><div>When ownCloud needs to export a user, it will run OC_Migration::export($userid). This will then execute all of the 'export' functions for apps that have registered as migration providers. Once it receives data back from these functions it wraps it all up into either XML, JSON or something along those lines and exports it to a file. When importing, its pretty much the reverse of this, except each app will be passed its portion of the export file. It can then run through that and add items back into the database.</div><div><br></div><div>The backend will do the dirty work to make it easier for devs. For example, on export it will add in information from the apps info.xml file so this can be accessed when importing. The backend will also pass a $uid to the import functions because this may have changed from the original install (because of a conflict on the new install).</div><div><br></div><div>The question is how we should export the data? XML, JSON... ? I tried using JSON this afternoon and it saved a lot of time because apps could just pass an array structure for their 'export' function and then all the backend has to do is merge some arrays and run json_encode(). Also creating arrays is much easier than playing with DOMDocument ;)</div><div><br></div><div>Also, I found a function that will format the json output so that it is still human readable.</div><div><br></div><div>Thanks,</div><div>Tom</div><div><br><div apple-content-edited="true">
Tom Needham<br><a href="mailto:tom@owncloud.com">tom@owncloud.com</a><br><br><br>
</div>
<br><div><div>On 3 Mar 2012, at 20:37, Bartek Przybylski wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi Tom!<br>Could you describe this process in more details ? then we could look<br>for enhancements ;)<br><br>bartek<br><br>2012/3/3 Tom Needham <<a href="mailto:tom@owncloud.com">tom@owncloud.com</a>>:<br><blockquote type="cite">Hi All,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">So I'm currently doing some work on a backend for app data migration.<br></blockquote><blockquote type="cite">Basically apps can register as migration providers (much like they do with<br></blockquote><blockquote type="cite">search) and provide and import and export function.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Originally I was planning to use XML as the overall output format but we<br></blockquote><blockquote type="cite">just had a chat in IRC and possibly JSON would be easier? Apps could just<br></blockquote><blockquote type="cite">provide an array structure on export and be given the same one on import.<br></blockquote><blockquote type="cite">The backend will do all the hard work of mashing all the arrays together,<br></blockquote><blockquote type="cite">and adding in various other data (app version numbers, owncloud version<br></blockquote><blockquote type="cite">number..) and then just run json_encode() and export to a .json file.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">What does everyone thing? Thought I'd get your feedback before going ahead<br></blockquote><blockquote type="cite">with it.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Cheers,<br></blockquote><blockquote type="cite">Tom<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Tom Needham<br></blockquote><blockquote type="cite"><a href="mailto:tom@owncloud.com">tom@owncloud.com</a><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">_______________________________________________<br></blockquote><blockquote type="cite">Owncloud mailing list<br></blockquote><blockquote type="cite"><a href="mailto:Owncloud@kde.org">Owncloud@kde.org</a><br></blockquote><blockquote type="cite"><a href="https://mail.kde.org/mailman/listinfo/owncloud">https://mail.kde.org/mailman/listinfo/owncloud</a><br></blockquote><blockquote type="cite"><br></blockquote></div></blockquote></div><br></div></body></html>