mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
add phpDoc comment in importer module
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10790 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
812f059823
commit
0280c474e4
5 changed files with 312 additions and 127 deletions
|
|
@ -1,33 +1,97 @@
|
|||
<?php
|
||||
/**
|
||||
* @class extract
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief Class to save each file by using tags in the large xml
|
||||
**/
|
||||
/**
|
||||
* extract class
|
||||
* Class to save each file by using tags in the large xml
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/importer
|
||||
* @version 0.1
|
||||
*/
|
||||
class extract {
|
||||
/**
|
||||
* Temp file's key. made by md5 with filename
|
||||
* @var string
|
||||
*/
|
||||
var $key = '';
|
||||
/**
|
||||
* Temp cache file path
|
||||
* @var string
|
||||
*/
|
||||
var $cache_path = './files/cache/importer';
|
||||
/**
|
||||
* Temp index cache file path
|
||||
* @var string
|
||||
*/
|
||||
var $cache_index_file = './files/cache/importer';
|
||||
|
||||
/**
|
||||
* File name
|
||||
* @var string
|
||||
*/
|
||||
var $filename = null;
|
||||
/**
|
||||
* Start tag
|
||||
* @var string
|
||||
*/
|
||||
var $startTag = '';
|
||||
/**
|
||||
* End tag
|
||||
* @var string
|
||||
*/
|
||||
var $endTag = '';
|
||||
/**
|
||||
* Item start tag
|
||||
* @var string
|
||||
*/
|
||||
var $itemStartTag = '';
|
||||
/**
|
||||
* Item end tag
|
||||
* @var string
|
||||
*/
|
||||
var $itemEndTag = '';
|
||||
|
||||
/**
|
||||
* File resource
|
||||
* @var string
|
||||
*/
|
||||
var $fd = null;
|
||||
/**
|
||||
* Index file resource
|
||||
* @var string
|
||||
*/
|
||||
var $index_fd = null;
|
||||
|
||||
/**
|
||||
* Start tag open status
|
||||
* @var bool
|
||||
*/
|
||||
var $isStarted = false;
|
||||
/**
|
||||
* End tag close status
|
||||
* @var bool
|
||||
*/
|
||||
var $isFinished = true;
|
||||
|
||||
/**
|
||||
* Buffer
|
||||
* @var string
|
||||
*/
|
||||
var $buff = 0;
|
||||
|
||||
/**
|
||||
* File count
|
||||
* @var int
|
||||
*/
|
||||
var $index = 0;
|
||||
|
||||
/**
|
||||
* @brief Get arguments for constructor, file name, start tag, end tag, tag name for each item
|
||||
**/
|
||||
/**
|
||||
* Get arguments for constructor, file name, start tag, end tag, tag name for each item
|
||||
* @param string $filename
|
||||
* @param string $startTag
|
||||
* @param string $endTag
|
||||
* @param string $itemTag
|
||||
* @param string $itemEndTag
|
||||
* @return Object
|
||||
*/
|
||||
function set($filename, $startTag, $endTag, $itemTag, $itemEndTag) {
|
||||
$this->filename = $filename;
|
||||
|
||||
|
|
@ -46,9 +110,10 @@
|
|||
return $this->openFile();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Open an indicator of the file
|
||||
**/
|
||||
/**
|
||||
* Open an indicator of the file
|
||||
* @return Object
|
||||
*/
|
||||
function openFile() {
|
||||
FileHandler::removeFile($this->cache_index_file);
|
||||
$this->index_fd = fopen($this->cache_index_file,"a");
|
||||
|
|
@ -104,7 +169,11 @@
|
|||
|
||||
return new Object();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Close an indicator of the file
|
||||
* @return void
|
||||
*/
|
||||
function closeFile() {
|
||||
$this->isFinished = true;
|
||||
fclose($this->fd);
|
||||
|
|
@ -115,6 +184,10 @@
|
|||
return $this->isFinished || !$this->fd || feof($this->fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save item
|
||||
* @return void
|
||||
*/
|
||||
function saveItems() {
|
||||
FileHandler::removeDir($this->cache_path.$this->key);
|
||||
$this->index = 0;
|
||||
|
|
@ -123,6 +196,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge item
|
||||
* @return void
|
||||
*/
|
||||
function mergeItems($filename) {
|
||||
$this->saveItems();
|
||||
|
||||
|
|
@ -144,6 +221,10 @@
|
|||
fclose($fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get item. Put data to buff
|
||||
* @return void
|
||||
*/
|
||||
function getItem() {
|
||||
if($this->isFinished()) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,26 +1,37 @@
|
|||
<?php
|
||||
/**
|
||||
* @class importerAdminController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief admin controller class of importer module
|
||||
**/
|
||||
|
||||
@set_time_limit(0);
|
||||
require_once('./modules/importer/extract.class.php');
|
||||
|
||||
/**
|
||||
* importerAdminController class
|
||||
* admin controller class of importer module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/importer
|
||||
* @version 0.1
|
||||
*/
|
||||
class importerAdminController extends importer {
|
||||
|
||||
/**
|
||||
* Unit count
|
||||
* @var int
|
||||
*/
|
||||
var $unit_count = 300;
|
||||
/**
|
||||
* Xml parser
|
||||
* @var XmlParser
|
||||
*/
|
||||
var $oXmlParser = null;
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
/**
|
||||
* Initialization
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check whether the passing filename exists or not. Detect the file type, too.
|
||||
* Check whether the passing filename exists or not. Detect the file type, too.
|
||||
* @return void
|
||||
*/
|
||||
function procImporterAdminCheckXmlFile() {
|
||||
global $lang;
|
||||
|
|
@ -77,9 +88,10 @@
|
|||
$this->add('result_message', $resultMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief sync member information with document information
|
||||
**/
|
||||
/**
|
||||
* Sync member information with document information
|
||||
* @return void
|
||||
*/
|
||||
function procImporterAdminSync() {
|
||||
/* DBMS가 CUBRID인 경우 MySQL과 동일한 방법으로는 문서 및 댓글에 대한 사용자 정보를 동기화 할 수 없으므로 예외 처리 합니다.
|
||||
CUBRID를 사용하지 않는 경우에만 보편적인 기존 질의문을 사용합니다. */
|
||||
|
|
@ -131,9 +143,10 @@
|
|||
$this->setMessage('msg_sync_completed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Pre-analyze the xml file and cache it
|
||||
**/
|
||||
/**
|
||||
* Pre-analyze the xml file and cache it
|
||||
* @return void
|
||||
*/
|
||||
function procImporterAdminPreProcessing() {
|
||||
// Get the target xml file to import
|
||||
$xml_file = Context::get('xml_file');
|
||||
|
|
@ -230,9 +243,10 @@
|
|||
$this->add('status',0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Migrate data after completing xml file extraction
|
||||
**/
|
||||
/**
|
||||
* Migrate data after completing xml file extraction
|
||||
* @return void
|
||||
*/
|
||||
function procImporterAdminImport() {
|
||||
// Variable setting
|
||||
$type = Context::get('type');
|
||||
|
|
@ -284,9 +298,13 @@
|
|||
} else $this->setMessage( sprintf(Context::getLang('msg_importing'), $total, $cur) );
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Import member information
|
||||
**/
|
||||
/**
|
||||
* Import member information
|
||||
* @param int $key
|
||||
* @param int $cur
|
||||
* @param string $index_file
|
||||
* @return int
|
||||
*/
|
||||
function importMember($key, $cur, $index_file) {
|
||||
if(!$cur) $cur = 0;
|
||||
// Create the xmlParser object
|
||||
|
|
@ -426,9 +444,13 @@
|
|||
return $idx-1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Import message information parsed from a given xml file
|
||||
**/
|
||||
/**
|
||||
* Import message information parsed from a given xml file
|
||||
* @param int $key
|
||||
* @param int $cur
|
||||
* @param string $index_file
|
||||
* @return int
|
||||
*/
|
||||
function importMessage($key, $cur, $index_file) {
|
||||
if(!$cur) $cur = 0;
|
||||
// Create the xmlParser object
|
||||
|
|
@ -515,9 +537,14 @@
|
|||
return $idx-1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Import data in module.xml format
|
||||
**/
|
||||
/**
|
||||
* Import data in module.xml format
|
||||
* @param int $key
|
||||
* @param int $cur
|
||||
* @param string $index_file
|
||||
* @param int $module_srl
|
||||
* @return int
|
||||
*/
|
||||
function importModule($key, $cur, $index_file, $module_srl) {
|
||||
// Pre-create the objects needed
|
||||
$this->oXmlParser = new XmlParser();
|
||||
|
|
@ -720,9 +747,13 @@
|
|||
return $idx-1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Trackbacks
|
||||
**/
|
||||
/**
|
||||
* Trackbacks
|
||||
* @param resource $fp
|
||||
* @param int $module_srl
|
||||
* @param int $document_srl
|
||||
* @return int
|
||||
*/
|
||||
function importTrackbacks($fp, $module_srl, $document_srl) {
|
||||
$started = false;
|
||||
$buff = null;
|
||||
|
|
@ -761,9 +792,13 @@
|
|||
return $cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Comments
|
||||
**/
|
||||
/**
|
||||
* Comments
|
||||
* @param resource $fp
|
||||
* @param int $module_srl
|
||||
* @param int $document_srl
|
||||
* @return int
|
||||
*/
|
||||
function importComments($fp, $module_srl, $document_srl) {
|
||||
$started = false;
|
||||
$buff = null;
|
||||
|
|
@ -870,9 +905,14 @@
|
|||
return $cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Import attachment
|
||||
**/
|
||||
/**
|
||||
* Import attachment
|
||||
* @param resource $fp
|
||||
* @param int $module_srl
|
||||
* @param int $upload_target_srl
|
||||
* @param array $files
|
||||
* @return int
|
||||
*/
|
||||
function importAttaches($fp, $module_srl, $upload_target_srl, &$files) {
|
||||
$uploaded_count = 0;
|
||||
|
||||
|
|
@ -973,9 +1013,10 @@
|
|||
return $uploaded_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* @biref Return a filename to temporarily use
|
||||
**/
|
||||
/**
|
||||
* Return a filename to temporarily use
|
||||
* @return string
|
||||
*/
|
||||
function getTmpFilename() {
|
||||
$path = "./files/cache/importer";
|
||||
if(!is_dir($path)) FileHandler::makeDir($path);
|
||||
|
|
@ -984,9 +1025,11 @@
|
|||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read buff until key value comes out from a specific file point
|
||||
**/
|
||||
/**
|
||||
* Read buff until key value comes out from a specific file point
|
||||
* @param resource $fp
|
||||
* @return string
|
||||
*/
|
||||
function saveTemporaryFile($fp) {
|
||||
$temp_filename = $this->getTmpFilename();
|
||||
$f = fopen($temp_filename, "w");
|
||||
|
|
@ -1008,9 +1051,11 @@
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set extra variables
|
||||
**/
|
||||
/**
|
||||
* Set extra variables
|
||||
* @param resource $fp
|
||||
* @return array
|
||||
*/
|
||||
function importExtraVars($fp) {
|
||||
$buff = null;
|
||||
while(!feof($fp)) {
|
||||
|
|
|
|||
|
|
@ -1,23 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* @class importerAdminView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief admin view class of the importer module
|
||||
**/
|
||||
|
||||
/**
|
||||
* importerAdminView class
|
||||
* admin view class of the importer module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/importer
|
||||
* @version 0.1
|
||||
*/
|
||||
class importerAdminView extends importer {
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
*
|
||||
* Importer module is divided by general use and administrative use \n
|
||||
**/
|
||||
/**
|
||||
* Initialization
|
||||
* Importer module is divided by general use and administrative use \n
|
||||
* @return void
|
||||
*/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display a form to upload the xml file
|
||||
**/
|
||||
/**
|
||||
* Display a form to upload the xml file
|
||||
* @return void
|
||||
*/
|
||||
function dispImporterAdminContent() {
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
|
||||
|
|
@ -54,9 +56,10 @@
|
|||
$this->setTemplateFile($template_filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display a form to upload the xml file
|
||||
**/
|
||||
/**
|
||||
* Display a form to upload the xml file
|
||||
* @return void
|
||||
*/
|
||||
function dispImporterAdminImportForm() {
|
||||
$oDocumentModel = &getModel('document'); //for document lang use in this page
|
||||
|
||||
|
|
|
|||
|
|
@ -1,36 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @class importer
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief high class of importer module
|
||||
**/
|
||||
|
||||
/**
|
||||
* importer
|
||||
* high class of importer module
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/importer
|
||||
* @version 0.1
|
||||
*/
|
||||
class importer extends ModuleObject {
|
||||
|
||||
/**
|
||||
* @brief Implement if additional tasks are necessary when installing
|
||||
**/
|
||||
/**
|
||||
* Implement if additional tasks are necessary when installing
|
||||
* @return Object
|
||||
*/
|
||||
function moduleInstall() {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief a method to check if successfully installed
|
||||
**/
|
||||
/**
|
||||
* A method to check if successfully installed
|
||||
* @return bool
|
||||
*/
|
||||
function checkUpdate() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Execute update
|
||||
**/
|
||||
/**
|
||||
* Execute update
|
||||
* @return Object
|
||||
*/
|
||||
function moduleUpdate() {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Re-generate the cache file
|
||||
**/
|
||||
/**
|
||||
* Re-generate the cache file
|
||||
* @return void
|
||||
*/
|
||||
function recompileCache() {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* @class ttimport
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief ttxml import class
|
||||
**/
|
||||
|
||||
@set_time_limit(0);
|
||||
@require_once('./modules/importer/extract.class.php');
|
||||
|
||||
/**
|
||||
* ttimport class
|
||||
* ttxml import class
|
||||
*
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @package /modules/importer
|
||||
* @version 0.1
|
||||
*/
|
||||
class ttimport {
|
||||
|
||||
/**
|
||||
* Xml Parse
|
||||
* @var XmlParser
|
||||
*/
|
||||
var $oXmlParser = null;
|
||||
|
||||
/**
|
||||
* @brief import data in module.xml format
|
||||
**/
|
||||
/**
|
||||
* Import data in module.xml format
|
||||
* @param int $key
|
||||
* @param int $cur
|
||||
* @param string $index_file
|
||||
* @param int $unit_count
|
||||
* @param int $module_srl
|
||||
* @param int $guestbook_module_srl
|
||||
* @param string $user_id
|
||||
* @param string $module_name
|
||||
* @return int
|
||||
*/
|
||||
function importModule($key, $cur, $index_file, $unit_count, $module_srl, $guestbook_module_srl, $user_id, $module_name=null) {
|
||||
// Pre-create the objects needed
|
||||
$this->oXmlParser = new XmlParser();
|
||||
|
|
@ -330,7 +344,16 @@
|
|||
return $idx-1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insert textyle guest book
|
||||
* @param object $val
|
||||
* @param int $module_srl
|
||||
* @param object $member_info
|
||||
* @param int $textyle_guestbook_srl
|
||||
* @param int $parent_srl
|
||||
* @param int $author_xml_id
|
||||
* @return int|bool
|
||||
*/
|
||||
function insertTextyleGuestbookItem($val, $module_srl, $member_info, $textyle_guestbook_srl,$parent_srl = 0, $author_xml_id=null) {
|
||||
$tobj = null;
|
||||
if($textyle_guestbook_srl>0){
|
||||
|
|
@ -372,9 +395,15 @@
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Attachment
|
||||
**/
|
||||
/**
|
||||
* Attachment
|
||||
* @param resource $fp
|
||||
* @param int $module_srl
|
||||
* @param int $upload_target_srl
|
||||
* @param array $files
|
||||
* @param string $buff
|
||||
* @return bool
|
||||
*/
|
||||
function importAttaches($fp, $module_srl, $upload_target_srl, &$files, $buff) {
|
||||
$uploaded_count = 0;
|
||||
|
||||
|
|
@ -441,9 +470,10 @@
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @biref Return a filename to temporarily use
|
||||
**/
|
||||
/**
|
||||
* Return a filename to temporarily use
|
||||
* @return string
|
||||
*/
|
||||
function getTmpFilename() {
|
||||
$path = "./files/cache/importer";
|
||||
if(!is_dir($path)) FileHandler::makeDir($path);
|
||||
|
|
@ -452,9 +482,12 @@
|
|||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read buff until key value comes out from a specific file point
|
||||
**/
|
||||
/**
|
||||
* Read buff until key value comes out from a specific file point
|
||||
* @param resource $fp
|
||||
* @param string $buff
|
||||
* @return string
|
||||
*/
|
||||
function saveTemporaryFile($fp, $buff) {
|
||||
$temp_filename = $this->getTmpFilename();
|
||||
$buff = substr($buff, 9);
|
||||
|
|
@ -473,9 +506,11 @@
|
|||
return $temp_filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Replace img tag in the ttxml
|
||||
**/
|
||||
/**
|
||||
* Replace img tag in the ttxml
|
||||
* @param array $matches
|
||||
* @return string
|
||||
*/
|
||||
function _replaceTTAttach($matches) {
|
||||
$name = $matches[2];
|
||||
if(!$name) return $matches[0];
|
||||
|
|
@ -496,9 +531,10 @@
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert the video file
|
||||
**/
|
||||
/**
|
||||
* Convert the video file
|
||||
* @return string
|
||||
*/
|
||||
function _replaceTTMovie($matches) {
|
||||
$key = $matches[1];
|
||||
if(!$key) return $matches[0];
|
||||
|
|
@ -513,9 +549,16 @@
|
|||
'</object>';
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Comment
|
||||
**/
|
||||
/**
|
||||
* Comment
|
||||
* @param object $val
|
||||
* @param int $module_srl
|
||||
* @param int $document_srl
|
||||
* @param object $member_info
|
||||
* @param int $parent_srl
|
||||
* @param int $author_xml_id
|
||||
* @return bool|int|object
|
||||
*/
|
||||
function insertComment($val, $module_srl, $document_srl, $member_info, $parent_srl = 0, $author_xml_id) {
|
||||
$tobj = null;
|
||||
$tobj->comment_srl = getNextSequence();
|
||||
|
|
@ -580,7 +623,15 @@
|
|||
}
|
||||
return false;
|
||||
}
|
||||
// List category
|
||||
|
||||
/**
|
||||
* List category
|
||||
* @param object $obj
|
||||
* @param array $category
|
||||
* @param int $idx
|
||||
* @param int $parent
|
||||
* @return void
|
||||
*/
|
||||
function arrangeCategory($obj, &$category, &$idx, $parent = 0) {
|
||||
if(!$obj->category) return;
|
||||
if(!is_array($obj->category)) $c = array($obj->category);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue