====== MigrationService ====== **Layer:** ''Service'' · **Source:** ''lib/service/MigrationService.php:29'' (lines 29–1016) ---- final class MigrationService MigrationService Main service for handling content import from various platforms ======= Docblock Metadata ======= ^ Tag ^ Value ^ | ''@category'' | Service Class | | ''@author'' | M.Noermoehammad | | ''@license'' | MIT | | ''@version'' | 1.0 | | ''@since'' | Since Release 1.0 | ======= Inheritance ======= //No parent, interface or trait. This is a root type.// ======= Constants (4) ======= ^ Visibility ^ Name ^ Value ^ Line ^ | ''-'' | ''SOURCE_WORDPRESS'' | '''wordpress';'' | 47 | | ''-'' | ''SOURCE_GHOST'' | '''ghost';'' | 48 | | ''-'' | ''SOURCE_BLOGSPOT'' | '''blogspot';'' | 49 | | ''-'' | ''SOURCE_SCRIPTLOG'' | '''scriptlog';'' | 50 | ======= Properties (7) ======= ^ Visibility ^ Type ^ Name ^ Default ^ Line ^ | ''private'' | ''(untyped)'' | ''$dbc'' | | 31 | | ''private'' | ''(untyped)'' | ''$sanitizer'' | | 32 | | ''private'' | ''(untyped)'' | ''$userDao'' | | 39 | | ''private'' | ''(untyped)'' | ''$authorId'' | | 41 | | ''private'' | ''(untyped)'' | ''$importStats'' | | 42 | | ''private'' | ''(untyped)'' | ''$categoryMap'' | ''[]'' | 44 | | ''private'' | ''(untyped)'' | ''$postIdMap'' | ''[]'' | 45 | ======= Methods (31) ======= ^ Visibility ^ Method ^ Summary ^ Line ^ | public | ''__construct()'' | MigrationService constructor. | 58 | | public | ''setAuthorId()'' | Set author ID for imported content | 85 | | public | ''getStats()'' | Get import statistics | 95 | | public | ''getImportUsers()'' | Get users available as import authors for the import form. | 107 | | public | ''resetStats()'' | Reset import statistics | 119 | | public | ''importFromWordPress()'' | Import content from WordPress WXR file | 142 | | public | ''importFromGhost()'' | Import content from Ghost JSON file | 177 | | public | ''importFromBlogspot()'' | Import content from Blogspot XML file | 212 | | public | ''importFromScriptlog()'' | Import content from Scriptlog native JSON file | 250 | | private | ''importScriptlogTopics()'' | Import topics from Scriptlog export | 302 | | private | ''importScriptlogPosts()'' | Import posts from Scriptlog export | 337 | | private | ''importScriptlogPages()'' | Import pages from Scriptlog export | 393 | | private | ''importScriptlogComments()'' | Import comments from Scriptlog export | 447 | | private | ''importScriptlogMenus()'' | Import menus from Scriptlog export | 490 | | private | ''importScriptlogSettings()'' | Import settings from Scriptlog export | 519 | | public | ''previewImport()'' | Preview import data without importing | 559 | | private | ''importCategories()'' | Import categories/topics | 631 | | private | ''importPosts()'' | Import posts | 666 | | private | ''importPages()'' | Import pages | 733 | | private | ''importComments()'' | Import comments | 777 | | private | ''assignCategories()'' | Assign categories to post | 821 | | private | ''findTopicBySlug()'' | Find topic by slug | 853 | | private | ''findPostBySlug()'' | Find post by slug | 866 | | private | ''createTopic()'' | Create topic | 880 | | private | ''createPost()'' | Create post | 900 | | private | ''createComment()'' | Create comment | 917 | | private | ''ensureUniqueSlug()'' | Ensure unique slug | 934 | | private | ''sanitizeInput()'' | Sanitize input | 953 | | private | ''mapStatus()'' | Map post status | 968 | | private | ''mapCommentStatus()'' | Map comment status | 987 | | private | ''formatDate()'' | Format date | 1007 | ======== __construct() ======== public function __construct(Sanitize $sanitizer, UserDao $userDao) //lines 58–78 (21)// MigrationService constructor. ^ Parameter ^ Type ^ Default ^ Description ^ | ''$sanitizer'' | [[scriptlog:lib:core:sanitize|''Sanitize'']] | //required// | Input sanitizer for import data | | ''$userDao'' | [[scriptlog:lib:dao:userdao|''UserDao'']] | //required// | Data access for import author lookups | ======== setAuthorId() ======== public function setAuthorId($authorId) //lines 85–88 (4)// Set author ID for imported content ^ Parameter ^ Type ^ Default ^ Description ^ | ''$authorId'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' ======== getStats() ======== public function getStats() //lines 95–98 (4)// Get import statistics //Takes no parameters.// **Returns:** ''(none declared)'' — array ======== getImportUsers() ======== public function getImportUsers(): array //lines 107–112 (6)// Get users available as import authors for the import form. Normalizes the DAO result to an array so callers never receive false. //Takes no parameters.// **Returns:** ''array'' — array List of user rows, empty when no users exist ======== resetStats() ======== public function resetStats() //lines 119–134 (16)// Reset import statistics //Takes no parameters.// **Returns:** ''(none declared)'' — void ======== importFromWordPress() ======== public function importFromWordPress($wxrContent) //lines 142–169 (28)// Import content from WordPress WXR file ^ Parameter ^ Type ^ Default ^ Description ^ | ''$wxrContent'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — array ======== importFromGhost() ======== public function importFromGhost($jsonContent) //lines 177–204 (28)// Import content from Ghost JSON file ^ Parameter ^ Type ^ Default ^ Description ^ | ''$jsonContent'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — array ======== importFromBlogspot() ======== public function importFromBlogspot($xmlContent) //lines 212–242 (31)// Import content from Blogspot XML file ^ Parameter ^ Type ^ Default ^ Description ^ | ''$xmlContent'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — array ======== importFromScriptlog() ======== public function importFromScriptlog($jsonContent) //lines 250–295 (46)// Import content from Scriptlog native JSON file ^ Parameter ^ Type ^ Default ^ Description ^ | ''$jsonContent'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — array ======== importScriptlogTopics() ======== private function importScriptlogTopics($topics) //lines 302–330 (29)// Import topics from Scriptlog export ^ Parameter ^ Type ^ Default ^ Description ^ | ''$topics'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' ======== importScriptlogPosts() ======== private function importScriptlogPosts($posts) //lines 337–386 (50)// Import posts from Scriptlog export ^ Parameter ^ Type ^ Default ^ Description ^ | ''$posts'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' ======== importScriptlogPages() ======== private function importScriptlogPages($pages) //lines 393–440 (48)// Import pages from Scriptlog export ^ Parameter ^ Type ^ Default ^ Description ^ | ''$pages'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' ======== importScriptlogComments() ======== private function importScriptlogComments($comments) //lines 447–483 (37)// Import comments from Scriptlog export ^ Parameter ^ Type ^ Default ^ Description ^ | ''$comments'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' ======== importScriptlogMenus() ======== private function importScriptlogMenus($menus) //lines 490–512 (23)// Import menus from Scriptlog export ^ Parameter ^ Type ^ Default ^ Description ^ | ''$menus'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' ======== importScriptlogSettings() ======== private function importScriptlogSettings($settings) //lines 519–550 (32)// Import settings from Scriptlog export ^ Parameter ^ Type ^ Default ^ Description ^ | ''$settings'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' ======== previewImport() ======== public function previewImport($content, $source) //lines 559–624 (66)// Preview import data without importing ^ Parameter ^ Type ^ Default ^ Description ^ | ''$content'' | ''(untyped)'' | //required// | //none// | | ''$source'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — array ======== importCategories() ======== private function importCategories($categories) //lines 631–659 (29)// Import categories/topics ^ Parameter ^ Type ^ Default ^ Description ^ | ''$categories'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' ======== importPosts() ======== private function importPosts($posts) //lines 666–726 (61)// Import posts ^ Parameter ^ Type ^ Default ^ Description ^ | ''$posts'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' ======== importPages() ======== private function importPages($pages) //lines 733–769 (37)// Import pages ^ Parameter ^ Type ^ Default ^ Description ^ | ''$pages'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' ======== importComments() ======== private function importComments($comments, $postId) //lines 777–813 (37)// Import comments ^ Parameter ^ Type ^ Default ^ Description ^ | ''$comments'' | ''(untyped)'' | //required// | //none// | | ''$postId'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' ======== assignCategories() ======== private function assignCategories($postId, $categories) //lines 821–845 (25)// Assign categories to post ^ Parameter ^ Type ^ Default ^ Description ^ | ''$postId'' | ''(untyped)'' | //required// | //none// | | ''$categories'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' ======== findTopicBySlug() ======== private function findTopicBySlug($slug) //lines 853–858 (6)// Find topic by slug ^ Parameter ^ Type ^ Default ^ Description ^ | ''$slug'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — array|null ======== findPostBySlug() ======== private function findPostBySlug($slug) //lines 866–871 (6)// Find post by slug ^ Parameter ^ Type ^ Default ^ Description ^ | ''$slug'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — array|null ======== createTopic() ======== private function createTopic($name, $slug) //lines 880–892 (13)// Create topic ^ Parameter ^ Type ^ Default ^ Description ^ | ''$name'' | ''(untyped)'' | //required// | //none// | | ''$slug'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — int|false ======== createPost() ======== private function createPost($data) //lines 900–909 (10)// Create post ^ Parameter ^ Type ^ Default ^ Description ^ | ''$data'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — int|false ======== createComment() ======== private function createComment($data) //lines 917–926 (10)// Create comment ^ Parameter ^ Type ^ Default ^ Description ^ | ''$data'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — int|false ======== ensureUniqueSlug() ======== private function ensureUniqueSlug($slug) //lines 934–945 (12)// Ensure unique slug ^ Parameter ^ Type ^ Default ^ Description ^ | ''$slug'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — string ======== sanitizeInput() ======== private function sanitizeInput($input) //lines 953–960 (8)// Sanitize input ^ Parameter ^ Type ^ Default ^ Description ^ | ''$input'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — string ======== mapStatus() ======== private function mapStatus($status) //lines 968–979 (12)// Map post status ^ Parameter ^ Type ^ Default ^ Description ^ | ''$status'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — string ======== mapCommentStatus() ======== private function mapCommentStatus($status) //lines 987–999 (13)// Map comment status ^ Parameter ^ Type ^ Default ^ Description ^ | ''$status'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — string ======== formatDate() ======== private function formatDate($date) //lines 1007–1015 (9)// Format date ^ Parameter ^ Type ^ Default ^ Description ^ | ''$date'' | ''(untyped)'' | //required// | //none// | **Returns:** ''(none declared)'' — string ======= Imports ======= ^ Alias ^ Fully-qualified name ^ | ''ImportException'' | [[scriptlog:lib:core:importexception|''Scriptlog\Core\ImportException'']] | | ''Registry'' | [[scriptlog:lib:core:registry|''Scriptlog\Core\Registry'']] | | ''Sanitize'' | [[scriptlog:lib:core:sanitize|''Scriptlog\Core\Sanitize'']] | | ''UserDao'' | [[scriptlog:lib:dao:userdao|''Scriptlog\Dao\UserDao'']] | | ''BlogspotImporter'' | [[scriptlog:lib:utility:blogspotimporter|''BlogspotImporter'']] | | ''GhostImporter'' | [[scriptlog:lib:utility:ghostimporter|''GhostImporter'']] | | ''ScriptlogImporter'' | [[scriptlog:lib:utility:scriptlogimporter|''ScriptlogImporter'']] | | ''WordPressImporter'' | [[scriptlog:lib:utility:wordpressimporter|''WordPressImporter'']] | ---- //This page is generated from source by 'tools/gendoc'. Edits will be overwritten.//