Development Retrieve wiki content from mysql blobs

Discussion in 'Software' started by jezmck, 6 Sep 2006.

  1. jezmck

    jezmck Minimodder

    Joined:
    25 Sep 2003
    Posts:
    4,456
    Likes Received:
    36
    Hi all,
    I maintain my company's wiki (http://wiki.carbon-360.com/), and a quite a while back managed to lose a few pages of content after a bodged upgrade.

    I tried to simply import the data back in from a backup, but it failed and I gave up as I had more pressing things to do.

    Can I get the content back from a edit:blog blob stored in a backup (text file)?
    I'll only be doing it for a few pages, so could do it page-by-page, based on the title which is held in plain text.
     
    Last edited: 7 Sep 2006
  2. RTT

    RTT #parp

    Joined:
    12 Mar 2001
    Posts:
    14,120
    Likes Received:
    74
    What's the reason for the failure (anything like max_allowed_packet?)?
     
  3. jezmck

    jezmck Minimodder

    Joined:
    25 Sep 2003
    Posts:
    4,456
    Likes Received:
    36
    unfortunately, it's well beyond that.
    I've got a new install running now, so it's just the data I want out now.

    Can I just enter the text-string from the file into the DB?
    Basically I just want to unencode it.
     
  4. jezmck

    jezmck Minimodder

    Joined:
    25 Sep 2003
    Posts:
    4,456
    Likes Received:
    36
    actually, maybe it's worse than I thought!
    where's the actual content stored? (i.e. which field of which table?!)

    edit: even the titles in the page table are some crazy hex value.
    I'm thinking that perhaps this is a lost cause.

    The only plain text is in the searchindex table, and that of course has no formatting, punctuation or even capital letters!
     
  5. woodshop

    woodshop UnSeenly

    Joined:
    14 Oct 2003
    Posts:
    1,408
    Likes Received:
    8
    depending on how you did the mysql backup you should be able to restore the backup to a different database, then select what you want and copy past it. i dono how you did you backup but i do mysqldump so a restore would go something like.

    mysql -u root -p Database_Of_Greatness < Backup_of_greatness.sql
     
  6. jezmck

    jezmck Minimodder

    Joined:
    25 Sep 2003
    Posts:
    4,456
    Likes Received:
    36
    thanks for the suggestions, but it's actually more complicated than that since even then the data is somehow encoded.
     
  7. RTT

    RTT #parp

    Joined:
    12 Mar 2001
    Posts:
    14,120
    Likes Received:
    74
    Could be anything jazzle, need to know more info. We're not talking about binary logs are we? (just to be sure?)

    Also, it could be "encoded" either because it's in a charset that your viewer doesn't support, or it's blob data which is gonna look like a load of crap anyway when viewed as text...

    Like I said... need error messages and/or more info!
     
  8. jezmck

    jezmck Minimodder

    Joined:
    25 Sep 2003
    Posts:
    4,456
    Likes Received:
    36
    ah, looks like I typo'd in the first post, though I got it right in the thread title.
    It is BLOB data. I assume that that can that be unencoded, but have no idea how.
     
  9. eek

    eek CAMRA ***.

    Joined:
    23 Jan 2002
    Posts:
    1,600
    Likes Received:
    14
    Are you using phpmyadmin at all?

    There is an option in the config file to set it so you can see and edit blog fields (set off by default IIRC).
     
  10. jezmck

    jezmck Minimodder

    Joined:
    25 Sep 2003
    Posts:
    4,456
    Likes Received:
    36
    I am, but it's hosted so I don't think I can edit the config.
    (I hope you meant to write bloB too!)
     
  11. eek

    eek CAMRA ***.

    Joined:
    23 Jan 2002
    Posts:
    1,600
    Likes Received:
    14
    Yeah, you can read/write from them :)

    If you are unable to overright the config file that is already there, then you could always upload phpmyadmin yourself and then you'll have complete control over the config file :)
     
  12. simon w

    simon w What's a Dremel?

    Joined:
    3 Nov 2003
    Posts:
    1,302
    Likes Received:
    0
    Has others have asked, how exactly did you create the backup and how are you trying to restore it?

    Mediawiki uses the serialize and unserialize functions a lot. The encoded data is likely to be the result of the first function.
     
  13. jezmck

    jezmck Minimodder

    Joined:
    25 Sep 2003
    Posts:
    4,456
    Likes Received:
    36
    Thanks, I think that that is almost certainly what I've got in the backup, but there appears to be more to the decoding in this instance. (I am using MediaWiki, I should have said, sorry.)

    I thought blobs must be a mysql encoding for text, I guess not.

    The backup was made using phpmyadmin, so it's just a simple text file.

    It's tempting to upload my own copy of phpmyadmin, and copy the blobs over to a dummy page, but I think that'll be more effort than just editing the searchindex entries. (There aren't many pages, and they're not particularly long either.)
     
  14. eek

    eek CAMRA ***.

    Joined:
    23 Jan 2002
    Posts:
    1,600
    Likes Received:
    14
    if it was serialised by media wiki to start with then you should be ok copying the encoded stuff straight into the database without having to decode it first... media wiki will only encode it again anyway!!
     
  15. jezmck

    jezmck Minimodder

    Joined:
    25 Sep 2003
    Posts:
    4,456
    Likes Received:
    36
    very true. (though with the hosted install of phpmyadmin* I'd have to do it via fileupload, which would be more than a little time consuming)

    I don't think it's going to be worth it now anyway, so thanks for all the suggestions.

    *- stupid name, I always want to write 'myphpadmin', and shouldn't it mention mysql?!
     

Share This Page