Changeset 3650

Show
Ignore:
Timestamp:
03/21/06 00:14:18 (3 years ago)
Author:
ryan
Message:

Allow alternative table prefix in dotclear importer. Props thomasq. fixes #2388

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/import/dotclear.php

    r3530 r3650  
    158158        $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 
    159159        set_magic_quotes_runtime(0); 
    160         $prefix = get_option('tpre'); 
     160        $dbprefix = get_option('dcdbprefix'); 
    161161 
    162162        // Get Categories 
    163         return $dcdb->get_results('SELECT * FROM dc_categorie', ARRAY_A); 
     163        return $dcdb->get_results('SELECT * FROM '.$dbprefix.'categorie', ARRAY_A); 
    164164    } 
    165165 
     
    170170        $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 
    171171        set_magic_quotes_runtime(0); 
    172         $prefix = get_option('tpre'); 
     172        $dbprefix = get_option('dcdbprefix'); 
    173173 
    174174        // Get Users 
    175175 
    176         return $dcdb->get_results('SELECT * FROM dc_user', ARRAY_A); 
     176        return $dcdb->get_results('SELECT * FROM '.$dbprefix.'user', ARRAY_A); 
    177177    } 
    178178 
     
    182182        $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 
    183183        set_magic_quotes_runtime(0); 
    184         $prefix = get_option('tpre'); 
     184        $dbprefix = get_option('dcdbprefix'); 
    185185 
    186186        // Get Posts 
    187         return $dcdb->get_results('SELECT dc_post.*, dc_categorie.cat_libelle_url AS post_cat_name 
    188                         FROM dc_post INNER JOIN dc_categorie 
    189                           ON dc_post.cat_id = dc_categorie.cat_id', ARRAY_A); 
     187        return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name 
     188                        FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie 
     189                          ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A); 
    190190    } 
    191191 
     
    196196        $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 
    197197        set_magic_quotes_runtime(0); 
    198         $prefix = get_option('tpre'); 
     198        $dbprefix = get_option('dcdbprefix'); 
    199199 
    200200        // Get Comments 
    201         return $dcdb->get_results('SELECT * FROM dc_comment', ARRAY_A); 
     201        return $dcdb->get_results('SELECT * FROM '.$dbprefix.'comment', ARRAY_A); 
    202202    } 
    203203 
     
    207207        $dcdb = new wpdb(get_option('dcuser'), get_option('dcpass'), get_option('dcname'), get_option('dchost')); 
    208208        set_magic_quotes_runtime(0); 
    209         $dbprefix = get_option('dbprefix'); 
     209        $dbprefix = get_option('dcdbprefix'); 
    210210 
    211211        return $dcdb->get_results('SELECT * FROM '.$dbprefix.'link ORDER BY position', ARRAY_A); 
     
    610610    function cleanup_dcimport() 
    611611    { 
    612         delete_option('dbprefix'); 
     612        delete_option('dcdbprefix'); 
    613613        delete_option('dc_cats'); 
    614614        delete_option('dcid2wpid'); 
     
    700700            if($_POST['dbprefix']) 
    701701            { 
    702                 if(get_option('tpre')) 
    703                     delete_option('tpre'); 
    704                 add_option('tpre',$_POST['dbprefix']);  
     702                if(get_option('dcdbprefix')) 
     703                    delete_option('dcdbprefix'); 
     704                add_option('dcdbprefix',$_POST['dbprefix']);  
    705705            } 
    706706