• Resources
  • After phpBB import, Sticky post excerpt always showing text of post with id=1

-oz- So it was a glitch in the conversion process? I wonder if it was just a simple fault during yours or if the conversion script needs some tweaking.

Let us know if resyncing the discussions works.

Yeah maybe a glitch during the process. I'm not (so) fluent in php. It was easier for me to drop a 10liner in ruby and resync everything, sorry ?

Works fine so far !

Interesting enough, now that the first and last posts are correctly associated with the discussions, I get some 500 Internal Server Error when the first post is not correctly parsed :

=> 'InvalidArgumentException' with message 'DTDs, CDATA nodes and comments are not allowed'

My issue is to identify the post in question, because the error message does not mention the triggering post_id or discussion_id.

    -oz- Is it picking up on a certain type of formatting phpBB posts used? Can you search post content for CDATA to root out the offending posts?

    I looped through all the posts and removed the CDATA. Works fine now !

      7 days later

      -oz- I looped through all the posts and removed the CDATA. Works fine now !

      Any pointers how you did this? Script? phpmyadmin? Same issue here with an imported phpBB board.

      Hi,

      Here the quick'n dirty script I made to loop through the post and remove the cdata.

      Use at your own risk (ie: backup your data before).

      #!/usr/bin/env ruby
      
      require 'mysql2'
      
      host = 'localhost'
      username = 'mydbusername'
      password = 'mydbpassword'
      database = 'mydbname'
      
      client = Mysql2::Client.new(:host => host, 
                                  :username => username, 
                                  :password => password, 
                                  :database => database)
      
      posts = client.query("select * from flarum_posts")
      
      posts.each do |p|
         content = p['content']
         r = /<!-- .+ -->/
         if r =~ content
      	puts "  MATCH: #{p['id']}"
              new_content = content.gsub(r,'') # remove the cdata
              new_content = new_content.gsub("'","''") # escape the quotes
              client.query("update flarum_posts set content='#{new_content}' where id=#{p['id']}")
         end
      end
        jordanjay29 changed the title to After phpBB import, Sticky post excerpt always showing text of post with id=1 .

        -oz- Thanks for posting your script. I moved this to Resources in case other phpBB converts encounter similar issues.

          jordanjay29 thank you so much for this, works perfectly​ on the couple of test runs I have done so far

          EDIT:
          Sorry, wrong mention, was meant for -oz-