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

View File

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