WordPress.org

Plugin Directory

Changeset 403756


Ignore:
Timestamp:
07/02/11 15:52:33 (3 years ago)
Author:
Coolkevman
Message:

Reuse already imported content.

Location:
e107-importer/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • e107-importer/trunk/e107-importer.php

    r403752 r403756  
    577577    // Get user list 
    578578    $user_list = $this->get_e107_user_list(); 
    579     foreach ($user_list as $user) 
     579    foreach ($user_list as $user) { 
     580      // Do not import a user that was previously imported 
     581      if (array_key_exists((int)$user['user_id'], $this->user_mapping)) 
     582        continue; 
    580583      $this->import_user($user); 
     584    } 
    581585  } 
    582586 
     
    676680    // Import categories 
    677681    $category_list = $this->get_e107_category_list(); 
    678     foreach ($category_list as $category) 
     682    foreach ($category_list as $category) { 
     683      // Do not import a category that was previously imported 
     684      if (array_key_exists((int)$category['category_id'], $this->category_mapping)) 
     685        continue; 
    679686      $this->import_category($category); 
     687    } 
    680688    // Import news 
    681689    $news_list = $this->get_e107_news_list(); 
    682     foreach ($news_list as $news) 
     690    foreach ($news_list as $news) { 
     691      // Do not import a news that was previously imported 
     692      if (array_key_exists((int)$news['news_id'], $this->news_mapping)) 
     693        continue; 
    683694      $this->import_news($news); 
     695    } 
    684696  } 
    685697 
     
    688700  function import_category($category) { 
    689701    extract($category); 
     702    $category_id = (int) $category_id; 
    690703    $cat_id = category_exists($category_name); 
    691704    if (!$cat_id) { 
     
    779792  function import_pages() { 
    780793    $page_list = $this->get_e107_page_list(); 
    781     foreach ($page_list as $page) 
     794    foreach ($page_list as $page) { 
     795      // Do not import a page that was previously imported 
     796      if (array_key_exists((int)$page['page_id'], $this->page_mapping)) 
     797        continue; 
    782798      $this->import_page($page); 
     799    } 
    783800  } 
    784801 
     
    839856  function import_comments() { 
    840857    $comment_list = $this->get_e107_comment_list(); 
    841     foreach ($comment_list as $comment) 
     858    foreach ($comment_list as $comment) { 
     859      // Do not import a comment that was previously imported 
     860      if (array_key_exists((int)$comment['comment_id'], $this->comment_mapping)) 
     861        continue; 
    842862      $this->import_comment($comment); 
     863    } 
    843864  } 
    844865 
     
    936957    // Import all forum 
    937958    $forum_list = $this->get_e107_forum_list($forum_id_list); 
    938     foreach ($forum_list as $forum) 
     959    foreach ($forum_list as $forum) { 
     960      // If the original forum ID is found in the mapping, it means this forum was already imported by this plugin some times ago, so let's proceed to the next. 
     961      if (array_key_exists((int)$forum['forum_id'], $this->forum_mapping)) 
     962        continue; 
    939963      $this->import_forum($forum, $user_classes); 
     964    } 
    940965  } 
    941966 
     
    10501075  function import_forum_threads($forum_id_list = array()) { 
    10511076    $forum_post_list = $this->get_e107_forum_post_list($forum_id_list); 
    1052     foreach ($forum_post_list as $thread) 
     1077    foreach ($forum_post_list as $thread) { 
     1078      // Do not import a forum thread that was previously imported 
     1079      if (array_key_exists((int)$thread['thread_id'], $this->forum_post_mapping)) 
     1080        continue; 
    10531081      $this->import_forum_thread($thread); 
     1082    } 
    10541083  } 
    10551084 
  • e107-importer/trunk/readme.txt

    r403755 r403756  
    142142 
    143143= 1.4 = 
     144* Reuse already imported content. 
    144145* Fix BBCode's quote tag transformation by enhanced parser. 
    145146 
Note: See TracChangeset for help on using the changeset viewer.