fix syntax, add logging, debug xml output instead of zip

This commit is contained in:
Tom Needham 2012-02-03 20:48:32 +00:00
parent 5507db9b15
commit 0bbc9ade7d
2 changed files with 14 additions and 11 deletions

View File

@ -49,21 +49,22 @@ if (isset($_POST['user_migrate'])) {
// adding owncloud system files
OC_Log::write('user_migrate',"Adding app data to user export",OC_Log::INFO);
// Call to OC_Migrate for the xml file.
$appdatafile = $tempdir . "/appdata.xml";
$fh = fopen($appdatafile, 'w');
//$appdatafile = $tempdir . "/appdata.xml";
//$fh = fopen($appdatafile, 'w');
$appdata = OC_Migrate::export(OC_User::getUser());
fwrite($fh, $appdata);
$zip->addFile($appdatafile, "appdata.xml");
fclose($fh);
//fwrite($fh, $appdata);
//$zip->addFile($appdatafile, "appdata.xml");
//fclose($fh);
}
$zip->close();
header("Content-Type: application/zip");
header("Content-Disposition: attachment; filename=" . basename($filename));
header("Content-Length: " . filesize($filename));
@ob_end_clean();
readfile($filename);
//header("Content-Type: application/zip");
//header("Content-Disposition: attachment; filename=" . basename($filename));
//header("Content-Length: " . filesize($filename));
//@ob_end_clean();
echo $appdata;
//readfile($filename);
unlink($filename);
} else {
// fill template

View File

@ -41,11 +41,13 @@ class OC_Migrate{
* @return string xml of app data
*/
public static function export($uid){
OC_Log::write('user_migrate','Starting user appdata export for: '.$uid,OC_Log::INFO);
$xml = '';
foreach(self::$providers as $provider){
OC_Log::write('user_migrate','Getting app data for app:'.$provider->appid,OC_Log::INFO);
$xml .= '<app>';
$xml .= self::appInfoXML($provider->$appid);
$xml .= $provider->export($uid));
$xml .= $provider->export($uid);
$xml .= '</app>';
}
return $xml;