News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Problems converting from Wordpress/bbpress toSMF

Started by Rasyr, December 18, 2021, 08:30:13 AM

Previous topic - Next topic

Rasyr

Ok, I have a site that was primarily Wprdpress, and I added bbpress to it after my last SMF installation (which had lots of mods) crashed and nothing I tried seemed to be able to recover it (I was able to import the SMF forums into bbpress at the time though).

Now, I an supremely tired of woprdpress and I really really dislike bbpress (I miss SMF and its features!!!)

So, I am planning on converting the whole site over to SMF with TinyPortal.

So, this week, I am trying a test SMF installation, and trying to make sure that the import from bbpress goes well before I completely erase the root site and install SMF on it, and then convert the Wordpress/bbpress database to SMF for the live site.

I have the bbpress to smf converter, and I also downloaded the updated SQL file from https://www.simplemachines.org/community/index.php?topic=575897.0

When trying to run it, nothing ever seemed to be happening, either always getting the following error show up at the top of the convert.php file

Unable to find the settings for bbPress 0.8.3. Please double check the path and try again.

Or it would seem to act like it was working, but never do anything.

In investigating, I found the the bbpress_to_smf.sql file has this at the top
/******************************************************************************/
---~ name: "bbPress 2.6.6"
/******************************************************************************/
---~ version: "SMF 2.0"
---~ settings: "/config.php"
---~ from_prefix: "" . BBDB_NAME . ".$bb_table_prefix"
---~ table_test: "{$from_prefix}users"

Except my bbpress is a plug in for Wordpress and it does not have a separate config file, so it uses the wp-config.php like the rest of the site.
and my wordpress database has $table_prefix not $bb_table-prefix

So, I tried changing those two items, so that it read
/******************************************************************************/
---~ name: "bbPress 2.6.6"
/******************************************************************************/
---~ version: "SMF 2.0"
---~ settings: "/wp-config.php"
---~ from_prefix: "" . BBDB_NAME . ".$table_prefix"
---~ table_test: "{$from_prefix}users"
And that just gave me a big wordpress error page, so I changed them back and was back to it doing nothing.

The tables in my wordpress DB are as follows:
wp_accessips
wp_aiowps_events
wp_aiowps_failed_logins
wp_aiowps_global_meta
wp_aiowps_login_activity
wp_aiowps_login_lockdown
wp_aiowps_permanent_block
wp_allowphp_functions
wp_bbp_converter_translator
wp_bp_activity
wp_bp_activity_meta
wp_bp_invitations
wp_bp_notifications
wp_bp_notifications_meta
wp_bp_xprofile_data
wp_bp_xprofile_fields
wp_bp_xprofile_groups
wp_bp_xprofile_meta
wp_commentmeta
wp_comments
wp_cpd_counter
wp_dlm_order
wp_dlm_order_customer
wp_dlm_order_item
wp_dlm_order_transaction
wp_dlm_session
wp_download_log
wp_download_monitor_files
wp_download_monitor_file_meta
wp_download_monitor_formats
wp_download_monitor_log
wp_download_monitor_relationships
wp_download_monitor_stats
wp_download_monitor_taxonomies
wp_kstats_charts
wp_kstats_raw
wp_kstats_raw_temp
wp_kstats_totals
wp_lbakut_user_stats
wp_legacy_upgrade_queue_content
wp_legacy_upgrade_queue_downloads
wp_links
wp_ms_snippets
wp_myStat_data
wp_myStat_dbsize
wp_myStat_main
wp_ngg_album
wp_ngg_gallery
wp_ngg_pictures
wp_options
wp_postmeta
wp_posts
wp_signups
wp_snippets
wp_ss_search
wp_ss_stats
wp_statpress
wp_termmeta
wp_terms
wp_term_relationships
wp_term_taxonomy
wp_usermeta
wp_users
wp_user_registration_sessions
wp_wassup
wp_wassup_meta
wp_wassup_tmp
wp_who_is_online
wp_wiki_subscriptions

And I know that the bbpress forum posts are within the wp_posts DB table and all I am really interest in getting are those forum posts and the user lists.

Any help on this would really be appreciated!!!!

Rasyr

Ok, so I changed the top of the SQL file to this
/******************************************************************************/
---~ name: "bbPress 2.6.6"
/******************************************************************************/
---~ version: "SMF 2.0"
---~ settings: "/wp-config.php"
---~ from_prefix: "" . DB_NAME . ".$table_prefix"
---~ table_test: "{$from_prefix}users"

I changed the settings file name, the DB Name and the Table Prefix.

Then when trying to run it, it gave me this
There has been a critical error on this website.

Learn more about troubleshooting WordPress.

So I pulled up the error_log file and this was what was in it (I emptied it last time I had problems)

[20-Dec-2021 01:02:12 UTC] PHP Warning:  Use of undefined constant who_is_online_widget_register - assumed 'who_is_online_widget_register' (this will throw an Error in a future version of PHP) in /home1/rasyr/firehawkgames.biz/wp-content/plugins/who-is-online/who-is-online.php on line 167
[20-Dec-2021 01:02:12 UTC] PHP Warning:  Use of undefined constant WikiLinksPlugin - assumed 'WikiLinksPlugin' (this will throw an Error in a future version of PHP) in /home1/rasyr/firehawkgames.biz/wp-content/plugins/wiki-page-links/wikipagelinks.php on line 242
[20-Dec-2021 01:02:12 UTC] PHP Warning:  Use of undefined constant WPRBLVERSION - assumed 'WPRBLVERSION' (this will throw an Error in a future version of PHP) in /home1/rasyr/firehawkgames.biz/wp-content/plugins/wp-render-blogroll-links/WP-Render-Blogroll.php on line 19
[20-Dec-2021 01:02:12 UTC] PHP Fatal error:  Cannot redeclare copy_dir() (previously declared in /home1/rasyr/firehawkgames.biz/smf/convert.php:2925) in /home1/rasyr/firehawkgames.biz/wp-admin/includes/file.php on line 1878

The only fatal error seems to be that Wordpress has its own copy_dir() function as part of its core functionality.

The Wordpress copydir() looks like this
/**
 * Copies a directory from one location to another via the WordPress Filesystem
 * Abstraction.
 *
 * Assumes that WP_Filesystem() has already been called and setup.
 *
 * @since 2.5.0
 *
 * @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
 *
 * @param string   $from      Source directory.
 * @param string   $to        Destination directory.
 * @param string[] $skip_list An array of files/folders to skip copying.
 * @return true|WP_Error True on success, WP_Error on failure.
 */
function copy_dir( $from, $to, $skip_list = array() ) {
global $wp_filesystem;

$dirlist = $wp_filesystem->dirlist( $from );

if ( false === $dirlist ) {
return new WP_Error( 'dirlist_failed_copy_dir', __( 'Directory listing failed.' ), basename( $to ) );
}

$from = trailingsla******( $from );
$to   = trailingsla******( $to );

foreach ( (array) $dirlist as $filename => $fileinfo ) {
if ( in_array( $filename, $skip_list, true ) ) {
continue;
}

if ( 'f' === $fileinfo['type'] ) {
if ( ! $wp_filesystem->copy( $from . $filename, $to . $filename, true, FS_CHMOD_FILE ) ) {
// If copy failed, chmod file to 0644 and try again.
$wp_filesystem->chmod( $to . $filename, FS_CHMOD_FILE );

if ( ! $wp_filesystem->copy( $from . $filename, $to . $filename, true, FS_CHMOD_FILE ) ) {
return new WP_Error( 'copy_failed_copy_dir', __( 'Could not copy file.' ), $to . $filename );
}
}

wp_opcache_invalidate( $to . $filename );
} elseif ( 'd' === $fileinfo['type'] ) {
if ( ! $wp_filesystem->is_dir( $to . $filename ) ) {
if ( ! $wp_filesystem->mkdir( $to . $filename, FS_CHMOD_DIR ) ) {
return new WP_Error( 'mkdir_failed_copy_dir', __( 'Could not create directory.' ), $to . $filename );
}
}

// Generate the $sub_skip_list for the subdirectory as a sub-set of the existing $skip_list.
$sub_skip_list = array();

foreach ( $skip_list as $skip_item ) {
if ( 0 === strpos( $skip_item, $filename . '/' ) ) {
$sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item );
}
}

$result = copy_dir( $from . $filename, $to . $filename, $sub_skip_list );

if ( is_wp_error( $result ) ) {
return $result;
}
}
}

return true;
}


and the one from the Convert.php looks like this
function copy_dir($source, $dest)
{
if (!is_dir($source) || !($dir = opendir($source)))
return;

while ($file = readdir($dir))
{
if ($file == '.' || $file == '..')
continue;

// If we have a directory create it on the destination and copy contents into it!
if (is_dir($source . '/' . $file))
{
if (!is_dir($dest))
@mkdir($dest, 0777);
copy_dir($source . '/' . $file, $dest . '/' . $file);
}
else
{
if (!is_dir($dest))
@mkdir($dest, 0777);
copy($source . '/' . $file, $dest . '/' . $file);
}
}
closedir($dir);
}

Should I simply rename the Convet.php files version of this function? From what I am seeing "copy_dir()" only appears in the convert.php file maybe 3 times. On line 2913 (in the copy_smileys function, on line 2925 when it is declaring the function, and on line 2940, inside the copy_dir() function, in what appears to be a in an If statement inside a While Loop.

Could this possibly work?

Any and all input would be greatly appreciated!!!!

Rasyr

OMG!!! That did it!!!

All the forums and posts and users seem to be there (even if my categorization of the various forums is all messed up, all the posts seem to be in the right places, and I can work with the rest of the stuff I need to move over.

 

Rasyr

A word fo Advice for anybody else wanting to convert Wordpress/bbpress to SMF

If you want Wordpress to end up in the same directory that wordpress was, be sure to leave the wp-config.php and the wp-settings.php files as well as the wp-admin and wp-include folders until you are done.

(luckily I backed up my site completely before deleting wordpress of it so that I could install SMF....)

Here is the end result if you are interested in taking a peek...

https://www.firehawkgames.biz/index.php

Kindred

Glad you got it resolved....   the converters are outside of my normal area of support knowledge. I was hoping that one of the other support/dev folks with converter knowledge would chime in -- but it looks like you got it sorted!  Nice work.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Rasyr

Quote from: Kindred on December 20, 2021, 05:25:34 PMGlad you got it resolved....  the converters are outside of my normal area of support knowledge. I was hoping that one of the other support/dev folks with converter knowledge would chime in -- but it looks like you got it sorted!  Nice work.

Way outside my knowledge as well.. heheh

The important parts are that you DO have to change that top section of the SQL file to match the the name of you Wprdpress/bbpress config file and that you need to change the DB name and table_prefix to match what is in that config file.

WHile I am not sure if the copy_dir() function is normal in Wordpress, having it in the Convert.php threw a fatal error cause it was in Wordpress as well, so I just changed the Convert.php file do that the 3 instances it appeared were renamed to copy_dir2() and that cleared that error (yea, reading the error file DOES help... ROFL)

And the only other thing is - if you want to put SMF into the same directory that Wordpress is (I was replacing wordpress with SMF), you need to make sure that the wp-admin and wp-includes folders and their contents remain, along with the wp-config.php and wp-settings.php files in that root directory.

Hopefully this will help anybody else looking to convert from bbpress to SMF!!

Advertisement: