mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
Preparation for drupal import upgrades.
This commit is contained in:
@@ -181,25 +181,27 @@ class import_main_ui extends e_admin_ui
|
|||||||
|
|
||||||
// print_a($_POST);
|
// print_a($_POST);
|
||||||
|
|
||||||
|
if(!empty($_POST['import_delete_existing_data']))
|
||||||
|
{
|
||||||
|
$this->deleteExisting = varset($_POST['import_delete_existing_data'],0);
|
||||||
|
}
|
||||||
|
|
||||||
$this->deleteExisting = varset($_POST['import_delete_existing_data'],0);
|
if(!empty($_POST['classes_select']))
|
||||||
|
|
||||||
if(varset($_POST['classes_select']))
|
|
||||||
{
|
{
|
||||||
$this->checked_class_list = implode(',',$_POST['classes_select']);
|
$this->checked_class_list = implode(',',$_POST['classes_select']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vartrue($_POST['createUserExtended'])) //TODO
|
if(!empty($_POST['createUserExtended'])) //TODO
|
||||||
{
|
{
|
||||||
$this->createUserExtended = true;
|
$this->createUserExtended = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vartrue($_POST['selectedTables']))
|
if(!empty($_POST['selectedTables']))
|
||||||
{
|
{
|
||||||
$this->selectedTables = $_POST['selectedTables'];
|
$this->selectedTables = $_POST['selectedTables'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(vartrue($_POST['runConversion'])) // default method.
|
if(!empty($_POST['runConversion'])) // default method.
|
||||||
{
|
{
|
||||||
$this->runConversion($_POST['import_source']);
|
$this->runConversion($_POST['import_source']);
|
||||||
return;
|
return;
|
||||||
@@ -481,7 +483,7 @@ class import_main_ui extends e_admin_ui
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td >$importType ".LAN_CONVERT_22."</td>
|
<td >$importType ".LAN_CONVERT_22."</td>
|
||||||
<td ><input class='tbox' type='text' name='dbParamDatabase' size='30' value='".varset($_POST['dbParamDatabase'])."' maxlength='100' /></td>
|
<td ><input class='tbox' type='text' name='dbParamDatabase' size='30' value='".varset($_POST['dbParamDatabase'])."' maxlength='100' required /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td >$importType ".LAN_CONVERT_23."</td>
|
<td >$importType ".LAN_CONVERT_23."</td>
|
||||||
@@ -585,8 +587,11 @@ class import_main_ui extends e_admin_ui
|
|||||||
// if(varset($import_source)) { $temp .= "disp('{$import_source}');"; }
|
// if(varset($import_source)) { $temp .= "disp('{$import_source}');"; }
|
||||||
// if (varset($current_db_type)) $temp .= " flagbits('{$current_db_type}');";
|
// if (varset($current_db_type)) $temp .= " flagbits('{$current_db_type}');";
|
||||||
// if (varset($temp)) $text .= "<script type=\"text/javascript\"> {$temp}</script>";
|
// if (varset($temp)) $text .= "<script type=\"text/javascript\"> {$temp}</script>";
|
||||||
|
|
||||||
$ns -> tablerender(LAN_PLUGIN_IMPORT_NAME.SEP.$importType, $mes->render().$text);
|
$this->addTitle($importType);
|
||||||
|
echo $mes->render().$text;
|
||||||
|
|
||||||
|
// $ns -> tablerender(LAN_PLUGIN_IMPORT_NAME.SEP.$importType, $mes->render().$text);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,60 +2,101 @@
|
|||||||
/*
|
/*
|
||||||
* e107 website system
|
* e107 website system
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
* Copyright (C) 2008-2015 e107 Inc (e107.org)
|
||||||
* Released under the terms and conditions of the
|
* Released under the terms and conditions of the
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
*
|
*
|
||||||
*
|
|
||||||
*
|
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_plugins/import/drupal_import_class.php,v $
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Each import file has an identifier which must be the same for:
|
// Each import file has an identifier which must be the same for:
|
||||||
// a) This file name - add '_class.php' to get the file name
|
// a) This file name - add '_class.php' to get the file name
|
||||||
// b) The array index of certain variables
|
// b) The array index of certain variables
|
||||||
// Array element key defines the function prefix and the class name; value is displayed in drop-down selection box
|
|
||||||
// Module based on Drupal 5.7 and 6.1 schemas; may well work with other versions
|
|
||||||
//$import_class_names['drupal_import'] = 'Drupal 5.7/6.1';
|
|
||||||
//$import_class_comment['drupal_import'] = 'Basic import';
|
|
||||||
//$import_class_support['drupal_import'] = array('users');
|
|
||||||
//$import_default_prefix['drupal_import'] = '';
|
|
||||||
|
|
||||||
require_once('import_classes.php');
|
require_once('import_classes.php');
|
||||||
|
|
||||||
class drupal_import extends base_import_class
|
class drupal_import extends base_import_class
|
||||||
{
|
{
|
||||||
|
|
||||||
public $title = 'Drupal 5 - 8';
|
public $title = 'Drupal';
|
||||||
public $description = 'Basic import';
|
public $description = 'Basic import';
|
||||||
public $supported = array('users');
|
public $supported = array('users'); // array('users', 'news','page','links'); //XXX Modify to enable copyNewsData() etc.
|
||||||
public $mprefix = false;
|
public $mprefix = false;
|
||||||
|
|
||||||
|
private $version = null;
|
||||||
|
private $baseUrl = null;
|
||||||
|
private $basePath = null;
|
||||||
|
|
||||||
|
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
if(!empty($_POST['version']))
|
||||||
|
{
|
||||||
|
$this->version = $_POST['version'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($_POST['baseUrl']))
|
||||||
|
{
|
||||||
|
$this->baseUrl =$_POST['baseUrl'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($_POST['basePath']))
|
||||||
|
{
|
||||||
|
$this->basePath = $_POST['basePath'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($_POST))
|
||||||
|
{
|
||||||
|
e107::getMessage()->addDebug(print_a($_POST, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function config()
|
||||||
|
{
|
||||||
|
$frm = e107::getForm();
|
||||||
|
|
||||||
|
$var[0]['caption'] = "Drupal Version";
|
||||||
|
$var[0]['html'] = $frm->text('version', $this->version, 50, 'required=1');
|
||||||
|
|
||||||
|
$var[1]['caption'] = "Drupal Base URL";
|
||||||
|
$var[1]['html'] =$frm->text('baseUrl', $this->baseUrl, 50, 'required=1');
|
||||||
|
|
||||||
|
$var[2]['caption'] = "Drupal Base Path";
|
||||||
|
$var[2]['html'] =$frm->text('basePath', $this->basePath, 50, 'required=1');
|
||||||
|
|
||||||
|
return $var;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Set up a query for the specified task.
|
// Set up a query for the specified task.
|
||||||
// Returns TRUE on success. FALSE on error
|
// Returns TRUE on success. false on error
|
||||||
// If $blank_user is true, certain cross-referencing user info is to be zeroed
|
// If $blank_user is true, certain cross-referencing user info is to be zeroed
|
||||||
function setupQuery($task, $blank_user=FALSE)
|
function setupQuery($task, $blank_user=false)
|
||||||
{
|
{
|
||||||
if ($this->ourDB == NULL) return FALSE;
|
if ($this->ourDB == NULL) return false;
|
||||||
|
|
||||||
switch ($task)
|
switch ($task)
|
||||||
{
|
{
|
||||||
case 'users' :
|
case 'users' :
|
||||||
$result = $this->ourDB->db_Select_gen("SELECT * FROM {$this->DBPrefix}users WHERE `status`=1");
|
$result = $this->ourDB->gen("SELECT * FROM {$this->DBPrefix}users WHERE `status`=1");
|
||||||
if ($result === FALSE) return FALSE;
|
if ($result === false) return false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'polls' :
|
case 'news' :
|
||||||
return FALSE;
|
return false;
|
||||||
case 'news' :
|
break;
|
||||||
return FALSE;
|
|
||||||
default :
|
case 'page' :
|
||||||
return FALSE;
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'links' :
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default :
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->copyUserInfo = !$blank_user;
|
$this->copyUserInfo = !$blank_user;
|
||||||
@@ -91,6 +132,92 @@ class drupal_import extends base_import_class
|
|||||||
return $target;
|
return $target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example Copy News.
|
||||||
|
* @param $target array - default e107 target values for e107_page table.
|
||||||
|
* @param $source array - Drupal table data
|
||||||
|
*/
|
||||||
|
function copyNewsData(&$target, &$source)
|
||||||
|
{
|
||||||
|
$target = array(
|
||||||
|
'news_id' => 1,
|
||||||
|
'news_title' => 'Welcome to e107',
|
||||||
|
'news_sef' => 'welcome-to-e107',
|
||||||
|
'news_body' => '[html]<p>Welcome to your new website!</p>[/html]',
|
||||||
|
'news_extended' => '',
|
||||||
|
'news_meta_keywords' => '',
|
||||||
|
'news_meta_description' => '',
|
||||||
|
'news_datestamp' => '1355612400', // time()
|
||||||
|
'news_author' => 1,
|
||||||
|
'news_category' => 1,
|
||||||
|
'news_allow_comments' => 0,
|
||||||
|
'news_start' => 0, // time()
|
||||||
|
'news_end' => 0, // time()
|
||||||
|
'news_class' => 0,
|
||||||
|
'news_render_type' => 0,
|
||||||
|
'news_comment_total' => 1,
|
||||||
|
'news_summary' => 'summary text',
|
||||||
|
'news_thumbnail' => '', // full path with {e_MEDIA_IMAGE} constant.
|
||||||
|
'news_sticky' => 0
|
||||||
|
);
|
||||||
|
|
||||||
|
return $target;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Example copy e107 Page Table
|
||||||
|
* @param $target array - default e107 target values for e107_page table.
|
||||||
|
* @param $source array - Drupal table data
|
||||||
|
*/
|
||||||
|
function copyPageData(&$target, &$source)
|
||||||
|
{
|
||||||
|
$target = array(
|
||||||
|
'page_id' => 1,
|
||||||
|
'page_title' => 'string',
|
||||||
|
'page_sef' => 'string',
|
||||||
|
'page_chapter' => 0,
|
||||||
|
'page_metakeys' => 'string',
|
||||||
|
'page_metadscr' => '',
|
||||||
|
'page_text' => '',
|
||||||
|
'page_author' => 0, // e107 user_id
|
||||||
|
'page_datestamp' => '1371420000', // time()
|
||||||
|
'page_rating_flag' => 0,
|
||||||
|
'page_comment_flag' => 0, // boolean
|
||||||
|
'page_password' => '', // plain text
|
||||||
|
'page_class' => 0, // e107 userclass
|
||||||
|
'page_ip_restrict' => '',
|
||||||
|
'page_template' => 'default',
|
||||||
|
'page_order' => 0,
|
||||||
|
'menu_name' => 'jumbotron-menu-1', // no spaces, all lowercase
|
||||||
|
'menu_title' => 'string',
|
||||||
|
'menu_text' => '',
|
||||||
|
'menu_image' => '',
|
||||||
|
'menu_icon' => '',
|
||||||
|
'menu_template' => 'button',
|
||||||
|
'menu_class' => 0,
|
||||||
|
'menu_button_url' => '',
|
||||||
|
'menu_button_text' => ''
|
||||||
|
);
|
||||||
|
|
||||||
|
return $target;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user