Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
How do I decipher the CSS from the MySQL database ?
Hello,
My server crashed down. It was restored, but I can’t log back ; there is this “database not found” when I want to load my pages. I can’t install, since “the database exists”. Sure it is existing : I had a backup and it does not seem corrupted. I don’t want to erase my database until I can decipher the CSS from my database.
It seems my css is written like :
LOCK TABLES txp_css WRITE;
INSERT INTO txp_css VALUES (‘default’,’Ym9keQ0Kew0KCWJhY2tncm91bmQtY29sb3I6 […]
So, am I right thinking that this is my stylesheet ?
If so, why does Textpattern do not create a static css ?
(At least, I could not find one. I find this a strange design choice – I think a static css takes less server juice.)
If so, I can I have it back ?
If so, how ?
Maybe a way around this intriguing question is : can I install textpattern using a “used” database ?
Kindest regards,
Benoit St-Pierre
PS : This post has already been posted under How do I..? But a gentleman told me I should have posted it here. So here it is.
Offline
#2 2006-01-31 17:01:04
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How do I decipher the CSS from the MySQL database ?
What you can do is export the database (mysqldump), set up a new Textpattern install with a new database, and then import the mysqldump into the new database. As far as I know you can’t set up a new Textpattern install with an existing (“used”) database.
The CSS in the database is encoded. Don’t ask me why, I read an explanation somewhere on this forum a long time ago, but can’t find it now. It’s probably in the database because of easy upgrading or things like that…
Last edited by doggiez (2006-01-31 17:03:33)
Offline
Re: How do I decipher the CSS from the MySQL database ?
hi benoitstpierre
look at here:
http://forum.textpattern.com/viewtopic.php?id=9589
Last edited by maniqui (2006-01-31 17:12:59)
Offline
Re: How do I decipher the CSS from the MySQL database ?
Or directly, go here:
http://makcoder.sourceforge.net/demo/base64.php
Last edited by maniqui (2006-01-31 17:22:09)
Offline
Re: How do I decipher the CSS from the MySQL database ?
What an extraordinary help : in 30 minutes, I got all the answers I asked for !
I did not understand I could just “import” the old dump.
But to restart with a new database, e.g. to turn to a UTF-8 database, one needs the decoder. So I’ll paste all my entries and my css back. (I only have five entries, but I spent two weeks tuning the css of my main page.)
I just do not understand this design choice about a file that should be static, but for now, I have what I wanted.
Thanks a lot !
Offline
#6 2006-01-31 23:06:25
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How do I decipher the CSS from the MySQL database ?
benoitstpierre wrote:
But to restart with a new database, e.g. to turn to a UTF-8 database, one needs the decoder. So I’ll paste all my entries and my css back. (I only have five entries, but I spent two weeks tuning the css of my main page.)
??? You don’t need to decode, nor paste, after import of the dump you’ll have your site back just as it was. Or do I misunderstand you?
Offline
Re: How do I decipher the CSS from the MySQL database ?
Here is my line of thought. My server crashed because it upgraded MySQL from 3.x to 4.1. If I import my data, how will I be able to convert my latin1 entries to UTF-8 ? If you respond, “you won’t have anything special to do”, then I will import it.
I admit that this event made me so mad at Textpattern that I just wanted my css back to build my site “by hand”. Now, this would be a legitimate reason to decode it, along not having backed it up.
But this forum’s prompt responses pumped me back into Textpattern !
Offline
#8 2006-02-01 14:57:18
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: How do I decipher the CSS from the MySQL database ?
My server crashed because it upgraded MySQL from 3.x to 4.1. If I import my data, how will I be able to convert my latin1 entries to UTF-8 ?
Ah, I see. I’m not going to tell you that you don’t have to do anything special then (though that still could be the case). I just don’t know.
If you don’t get an answer in this thread soon, it might be wise to start a new topic with a title that describes this problem better. That will attract the right readers ;)
Offline
Re: How do I decipher the CSS from the MySQL database ?
benoitstpierre wrote:
My server crashed because it upgraded MySQL from 3.x to 4.1. If I import my data, how will I be able to convert my latin1 entries to UTF-8 ?
Take a look at this thread:
http://forum.textpattern.com/viewtopic.php?id=14277
And also this textsnippet: http://textsnippets.com/posts/show/84
Offline
Re: How do I decipher the CSS from the MySQL database ?
Interesting pointers !
I already read the entry about UTF-8 support of the Textbook Project, but had not clicked on an inline link, which was a must for my question. Essential links should be cited at the end of a documentation article, in a reference list, like any serious paper.
Basically, this paper inspires me this strategy : (1) wait till PHP 6 ; (2) until then, leave the problem to the browser by specifying UTF-8 in the heads of your templates ; (3) if this works, do not try to circumvent the problem by outputting any HTML entities but the “special five” ; (4) when ready, dump the database, run iconv from Terminal to convert to UTF-8, and import back the database.
Notes about the scope of what is being said. This strategy is conservative : I do not want to mess with PHP functions. I could ask my server admin to install iconv from PHP 5, but will not. If I have the translating (sed) scripts available, I tend to relax a bit. If I have a tool to do the translating job (i.e. iconv out of osx box), then I completely forget about his issue. The strategy proposed is not maximal, and may be even not correct (e.g. not sure about the html entity part). I am not an authority on these matter, so I do not propose this as a solution. Please feel free to correct anything I said that you do not feel clear enough or even blatantly untrue.
The important lesson I learn from this is : MySQL lets me dump a textfile ; I can then use any tool from my toolkit ; in my toolkit, there this utility named iconv I should know about.
So thanks again for all the inspiration you all gave me,
Time to return to my site,
Cheers,
Ben
References
===
Textbook’s entry about Unicode support in Textpattern — http://forum.textpattern.com/viewtopic.php?id=14277
PHP note about UTF-8 — http://www.phpwact.org/php/i18n/charsets?s=utf8
Iconv Manual — http://www.scit.wlv.ac.uk/cgi-bin/mansec?1+iconv
As to your snippet, I am not sure how to do this with my phpwebadmin panel.
Offline
Re: How do I decipher the CSS from the MySQL database ?
As to your snippet, I am not sure how to do this with my phpwebadmin panel.
Hi benoitstpierre
You need to access using SSH, with a program like the terminal PuTTy (free)
Maybe, you will need to ask to your hosting company to allow access to your account by using a terminal.
I’m not an expert on this, so maybe any user in this forum can bring some light.
Offline
Re: How do I decipher the CSS from the MySQL database ?
My hosting company will not allow me that. In any case, it is speedier to enter again my five entries, my css and my forms.
Have a wonderful day !
Offline