mirror of
https://github.com/e107inc/e107.git
synced 2025-04-14 17:42:10 +02:00
More export tweaks
This commit is contained in:
parent
2cdae5662c
commit
23a1f952ff
@ -9,8 +9,8 @@
|
||||
* Administration - Database Utilities
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_admin/db.php,v $
|
||||
* $Revision: 1.29 $
|
||||
* $Date: 2009-09-05 23:02:23 $
|
||||
* $Revision: 1.30 $
|
||||
* $Date: 2009-09-06 01:02:01 $
|
||||
* $Author: e107coders $
|
||||
*
|
||||
*/
|
||||
@ -70,7 +70,7 @@ if(isset($_POST['verify_sql']) || varset($_GET['mode'])=='verify_sql')
|
||||
|
||||
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->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');
|
||||
$tp = e107::getParser();
|
||||
$emessage = eMessage::getInstance();
|
||||
|
||||
if(vartrue($_POST['package_images']))
|
||||
//TODO LANs
|
||||
|
||||
if(vartrue($package))
|
||||
{
|
||||
|
||||
$xml->convertFilePaths = TRUE;
|
||||
@ -725,14 +733,13 @@ function exportXmlFile($prefs,$tables,$debug=FALSE)
|
||||
$desinationFolder = $tp->replaceConstants($xml->filePathDestination);
|
||||
|
||||
if(!is_writable($desinationFolder))
|
||||
{
|
||||
|
||||
$emessage->add($desinationFolder."is not writable", E_MESSAGE_ERROR);
|
||||
{
|
||||
$emessage->add($desinationFolder." is not writable", E_MESSAGE_ERROR);
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
//TODO LANs
|
||||
|
||||
if($xml->e107Export($prefs,$tables,$debug))
|
||||
{
|
||||
$emessage->add("Created: ".$desinationFolder."install.xml", E_MESSAGE_SUCCESS);
|
||||
@ -742,7 +749,7 @@ function exportXmlFile($prefs,$tables,$debug=FALSE)
|
||||
{
|
||||
$file = basename($oldfile);
|
||||
$newfile = $desinationFolder.$file;
|
||||
if(copy($oldfile,$newfile))
|
||||
if($oldfile == $newfile || (copy($oldfile,$newfile)))
|
||||
{
|
||||
$emessage->add("Copied: ".$newfile, E_MESSAGE_SUCCESS);
|
||||
}
|
||||
@ -783,7 +790,7 @@ function table_list()
|
||||
|
||||
if($count)
|
||||
{
|
||||
$tabs[$e107tab] = $count; // mysql_num_rows($t);
|
||||
$tabs[$e107tab] = $count;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@
|
||||
* Simple XML Parser
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/xml_class.php,v $
|
||||
* $Revision: 1.22 $
|
||||
* $Date: 2009-09-05 23:02:23 $
|
||||
* $Revision: 1.23 $
|
||||
* $Date: 2009-09-06 01:02:01 $
|
||||
* $Author: e107coders $
|
||||
*/
|
||||
|
||||
@ -544,7 +544,12 @@ class xmlClass
|
||||
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]);
|
||||
$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)
|
||||
{
|
||||
if($this->convertFilePaths)
|
||||
@ -579,13 +588,15 @@ class xmlClass
|
||||
|
||||
/**
|
||||
* 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 $tables - table names with the prefix
|
||||
* @param array $tables - table names without the prefix
|
||||
* @param boolean $debug [optional]
|
||||
* @return text / file for download
|
||||
*/
|
||||
public function e107Export($xmlprefs,$tables,$debug=FALSE)
|
||||
{
|
||||
|
||||
require_once(e_ADMIN."ver.php");
|
||||
|
||||
$text = "<?xml version='1.0' encoding='utf-8' ?>\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user