1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-31 20:00:37 +02:00

More export tweaks

This commit is contained in:
CaMer0n
2009-09-06 01:02:01 +00:00
parent 2cdae5662c
commit 23a1f952ff
2 changed files with 35 additions and 17 deletions

View File

@@ -9,8 +9,8 @@
* Administration - Database Utilities * Administration - Database Utilities
* *
* $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $ * $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $
* $Revision: 1.29 $ * $Revision: 1.30 $
* $Date: 2009-09-05 23:02:23 $ * $Date: 2009-09-06 01:02:01 $
* $Author: e107coders $ * $Author: e107coders $
* *
*/ */
@@ -70,7 +70,7 @@ if(isset($_POST['verify_sql']) || varset($_GET['mode'])=='verify_sql')
if(isset($_POST['exportXmlFile'])) if(isset($_POST['exportXmlFile']))
{ {
if(exportXmlFile($_POST['xml_prefs'],$_POST['xml_tables'])) if(exportXmlFile($_POST['xml_prefs'],$_POST['xml_tables'],$_POST['package_images']))
{ {
$emessage = eMessage::getInstance(); $emessage = eMessage::getInstance();
$emessage->add(LAN_SUCCESS, E_MESSAGE_SUCCESS); $emessage->add(LAN_SUCCESS, E_MESSAGE_SUCCESS);
@@ -709,14 +709,22 @@ function db_adminmenu()
} }
/**
function exportXmlFile($prefs,$tables,$debug=FALSE) * Export XML File and Copy Images.
* @param object $prefs
* @param object $tables
* @param object $debug [optional]
* @return
*/
function exportXmlFile($prefs,$tables,$package=FALSE,$debug=FALSE)
{ {
$xml = e107::getSingleton('xmlClass'); $xml = e107::getSingleton('xmlClass');
$tp = e107::getParser(); $tp = e107::getParser();
$emessage = eMessage::getInstance(); $emessage = eMessage::getInstance();
if(vartrue($_POST['package_images'])) //TODO LANs
if(vartrue($package))
{ {
$xml->convertFilePaths = TRUE; $xml->convertFilePaths = TRUE;
@@ -726,13 +734,12 @@ function exportXmlFile($prefs,$tables,$debug=FALSE)
if(!is_writable($desinationFolder)) if(!is_writable($desinationFolder))
{ {
$emessage->add($desinationFolder." is not writable", E_MESSAGE_ERROR);
$emessage->add($desinationFolder."is not writable", E_MESSAGE_ERROR);
return ; return ;
} }
} }
//TODO LANs
if($xml->e107Export($prefs,$tables,$debug)) if($xml->e107Export($prefs,$tables,$debug))
{ {
$emessage->add("Created: ".$desinationFolder."install.xml", E_MESSAGE_SUCCESS); $emessage->add("Created: ".$desinationFolder."install.xml", E_MESSAGE_SUCCESS);
@@ -742,7 +749,7 @@ function exportXmlFile($prefs,$tables,$debug=FALSE)
{ {
$file = basename($oldfile); $file = basename($oldfile);
$newfile = $desinationFolder.$file; $newfile = $desinationFolder.$file;
if(copy($oldfile,$newfile)) if($oldfile == $newfile || (copy($oldfile,$newfile)))
{ {
$emessage->add("Copied: ".$newfile, E_MESSAGE_SUCCESS); $emessage->add("Copied: ".$newfile, E_MESSAGE_SUCCESS);
} }
@@ -783,7 +790,7 @@ function table_list()
if($count) if($count)
{ {
$tabs[$e107tab] = $count; // mysql_num_rows($t); $tabs[$e107tab] = $count;
} }
} }

View File

@@ -9,8 +9,8 @@
* Simple XML Parser * Simple XML Parser
* *
* $Source: /cvs_backup/e107_0.8/e107_handlers/xml_class.php,v $ * $Source: /cvs_backup/e107_0.8/e107_handlers/xml_class.php,v $
* $Revision: 1.22 $ * $Revision: 1.23 $
* $Date: 2009-09-05 23:02:23 $ * $Date: 2009-09-06 01:02:01 $
* $Author: e107coders $ * $Author: e107coders $
*/ */
@@ -544,7 +544,12 @@ class xmlClass
return false; return false;
} }
function replaceFilePaths($text) /**
* Convert file path for inclusion in XML file.
* @param callback function $text - see e107ExportValue()
* @return converted file path
*/
private function replaceFilePaths($text)
{ {
$fullpath = e107::getParser()->replaceConstants($text[1]); $fullpath = e107::getParser()->replaceConstants($text[1]);
$this->fileConvertLog[] = $fullpath; $this->fileConvertLog[] = $fullpath;
@@ -555,7 +560,11 @@ class xmlClass
} }
/**
* Process data values for XML file. If $this->convertFilePaths is TRUE, convert paths - see replaceFilePaths()
* @param mixed $val
* @return mixed
*/
private function e107ExportValue($val) private function e107ExportValue($val)
{ {
if($this->convertFilePaths) if($this->convertFilePaths)
@@ -579,13 +588,15 @@ class xmlClass
/** /**
* Create an e107 Export File in XML format * Create an e107 Export File in XML format
* Note: If $this->filePathDestination has a value, then the file will be saved there.
* @param array $prefs - see e_core_pref $aliases (eg. core, ipool etc) * @param array $prefs - see e_core_pref $aliases (eg. core, ipool etc)
* @param array $tables - table names with the prefix * @param array $tables - table names without the prefix
* @param boolean $debug [optional] * @param boolean $debug [optional]
* @return text / file for download * @return text / file for download
*/ */
public function e107Export($xmlprefs,$tables,$debug=FALSE) public function e107Export($xmlprefs,$tables,$debug=FALSE)
{ {
require_once(e_ADMIN."ver.php"); require_once(e_ADMIN."ver.php");
$text = "<?xml version='1.0' encoding='utf-8' ?>\n"; $text = "<?xml version='1.0' encoding='utf-8' ?>\n";