Changeset 421867
- Timestamp:
- 08/10/2011 09:14:06 PM (14 years ago)
- Location:
- forumconverter
- Files:
-
- 13 added
- 2 edited
-
tags/1.05 (added)
-
tags/1.05/Forum.php (added)
-
tags/1.05/ForumConverter.php (added)
-
tags/1.05/PhpbbAuth.php (added)
-
tags/1.05/PhpbbToBbpress.php (added)
-
tags/1.05/PhpbbToBpforums.php (added)
-
tags/1.05/fc-auth.php (added)
-
tags/1.05/fc-main.php (added)
-
tags/1.05/fc-options.php (added)
-
tags/1.05/license.txt (added)
-
tags/1.05/readme.txt (added)
-
tags/1.05/screenshot-1.png (added)
-
tags/1.05/wp-pass-ex.php (added)
-
trunk/PhpbbToBbpress.php (modified) (9 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
forumconverter/trunk/PhpbbToBbpress.php
r421376 r421867 36 36 $this->processAttachments = true; 37 37 $this->forumLoginSrc = $forumSrc; 38 39 //timeouts - this may require adjusting based on amount of posts that need to be converted 40 set_time_limit(3600); 38 41 } 39 42 … … 502 505 503 506 $fdb = new wpdb($this->forumLoginSrc->username, $this->forumLoginSrc->password, $this->forumLoginSrc->databasename, $this->forumLoginSrc->hostname); 504 //$fdb->show_errors(); 505 //$wpdb->show_errors(); 507 //$fdb->query("set session wait_timeout=1"); 508 $fdb->show_errors(); 509 $wpdb->show_errors(); 506 510 507 511 //trash existing topics … … 619 623 if ($this->processAttachments) 620 624 { 625 //create a folder to dump the attachments 626 $dir = wp_upload_dir(); 627 if (is_dir ($dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId) == FALSE) 628 mkdir($dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId,0644,true); 629 621 630 if (strpos($postText, '[attachment=') !== FALSE) 622 631 { … … 637 646 if ($data->post_attachment) 638 647 { 639 //create a folder to dump the attachments640 $dir = wp_upload_dir();641 if (is_dir ($dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId) == FALSE)642 mkdir($dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId,0644,true);643 644 648 //insert as attachment 645 649 $attachment = $fdb->get_row('SELECT * FROM '.$this->forumLoginSrc->prefix.'attachments WHERE post_msg_id='.$data->post_id.' AND real_filename="'.$filename.'"'); … … 655 659 $status = copy($this->forumLoginSrc->uploadpath.DIRECTORY_SEPARATOR.$attachment->physical_filename, $dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId.DIRECTORY_SEPARATOR.$filename); 656 660 if ($status == FALSE) 657 $this->fc_echo('failed to copy file ');661 $this->fc_echo('failed to copy file<br/>'); 658 662 659 663 $attachmenturl = content_url().'/uploads/bbpress/'.$insertId.'/'.$filename; … … 729 733 else 730 734 { 735 731 736 //lookup attachment 732 $attachments = $fdb->get_results('SELECT * FROM '.$this->forumLoginSrc->prefix.' fc_attachments WHERE post_msg_id='.$data->post_id);737 $attachments = $fdb->get_results('SELECT * FROM '.$this->forumLoginSrc->prefix.'attachments WHERE post_msg_id='.$data->post_id); 733 738 if ($attachments === false) 734 $this->fc_die('failed to check attachment'.$ wpdb->last_error);739 $this->fc_die('failed to check attachment'.$fdb->last_error); 735 740 if ($wpdb->num_rows > 0) 736 741 { … … 738 743 foreach ($attachments as $attachment) 739 744 { 740 //$this->fc_echo('adding post/reply attachment<br/>');745 $this->fc_echo('adding post/reply attachment<br/>'); 741 746 742 747 //add download link 743 748 if ($data->post_attachment) 744 749 { 745 //create a folder to dump the attachments746 $dir = wp_upload_dir();747 if (is_dir ($dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId) == FALSE)748 mkdir($dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId,0644,true);749 750 //insert as attachment751 $attachment = $fdb->get_row('SELECT * FROM '.$this->forumLoginSrc->prefix.'attachments WHERE post_msg_id='.$data->post_id.' AND real_filename="'.$filename.'"');752 753 750 //try to maintain the original filename name without any extra fancy script 754 751 //copy attachment to wordpress uploads folder … … 761 758 $status = copy($this->forumLoginSrc->uploadpath.DIRECTORY_SEPARATOR.$attachment->physical_filename, $dir['basedir'].DIRECTORY_SEPARATOR.'bbpress'.DIRECTORY_SEPARATOR.$insertId.DIRECTORY_SEPARATOR.$filename); 762 759 if ($status == FALSE) 763 $this->fc_echo('failed to copy file ');760 $this->fc_echo('failed to copy file<br/>'); 764 761 765 762 $attachmenturl = content_url().'/uploads/bbpress/'.$insertId.'/'.$filename; … … 820 817 ); 821 818 822 $postText .= '<p>Download <a href="'.$attachmenturl.'">'.$attachment->real_filename.'</a>. ( Caution: This file may not be virus scanned.)</p>';819 $postText .= '<p>Download <a href="'.$attachmenturl.'">'.$attachment->real_filename.'</a>. (1Caution: This file may not be virus scanned.)</p>'; 823 820 } 824 821 } -
forumconverter/trunk/readme.txt
r421376 r421867 119 119 120 120 == Upgrade Notice == 121 = 1.05 = 122 None 123 121 124 = 1.04 = 122 125 None … … 132 135 133 136 == Changelog == 137 = 1.05 = 138 * Bugfix: increase execution time to 1 hour for those who don't have it in their php.ini 139 * Bugfix: fix attachments for those not attached inline 140 134 141 = 1.04 = 135 142 * Remove end of file whitespace to get rid of plugin activation warnings.
Note: See TracChangeset
for help on using the changeset viewer.