Welcome Guest, Not a member yet? Register   Sign In
dbutil->backup newline problem (\n)
#1

[eluser]dootzky[/eluser]
Hi guys,

I've used database utility, and I'm using it for my users to quickly download and backup the entire MySQL database. And it works great.

But now I have a problem - in my CMS, I have, for example, "Webpages" control, where users can edit their own webpages, in properly implemented FCK editor. That works great, everything is by the book, etc.

And now, the problem - when ever I backup my database with dbutil class, I can import that database on my local Linux development server, but, FCK texts are getting bunch of "\n" characters all over the place, and it messes up everything in my CMS that uses FCK for editing (Webpages, Email Templates, etc.)

here's my code, it's rather straightforward and simple:

Code:
$folder = 'db_backup/';

        // Load the DB utility class
        $this->load->dbutil();
        
        $prefs = array('newline' => "\n" ); // I've tried everything here: \r, \r\n, \n, even blank - still no luck!

        // Backup your entire database and assign it to a variable
        $backup =& $this->dbutil->backup($prefs);
        
        // Load the file helper and write the file to your server
        $this->load->helper('file');
        $file_name = 'database-backup-'. date("Y-m-d-H:i") .'h.gz';
        write_file($this->config->item('assets_path') . $folder . $file_name, $backup);
        
        // Load the download helper and send the file to your desktop
        $this->load->helper('download');
        force_download($file_name, $backup);

I think that's pretty simple, right? :|
Oh, yes, one more thing that could be helpfull for you to know - when I export the database in the old, classic way from live server, from CPanel->phpMyAdmin->Export, and then I import that file on my server - it works flawlessly. Of course.

The only problem here in my thread is that I'm getting "\n" overhead, and I don't think that dbutil class should insert newline characters in SQL VALUES, but only in SQL commands... ?

Can anyone tell me where I'm mistaken? Or at least point me to some reading materials? (I've already read: http://ellislab.com/codeigniter/user-gui...ities.html , thanks Smile )

Thanks for your time and effort,
dootzky

p.s. please see attachment picture for more graphical explanation...


Messages In This Thread
dbutil->backup newline problem (\n) - by El Forum - 04-14-2009, 12:18 PM
dbutil->backup newline problem (\n) - by El Forum - 04-14-2009, 02:33 PM
dbutil->backup newline problem (\n) - by El Forum - 04-15-2009, 10:20 AM
dbutil->backup newline problem (\n) - by El Forum - 04-15-2009, 10:51 AM
dbutil->backup newline problem (\n) - by El Forum - 04-18-2009, 01:10 AM
dbutil->backup newline problem (\n) - by El Forum - 04-22-2009, 06:15 AM
dbutil->backup newline problem (\n) - by El Forum - 04-23-2009, 09:02 AM
dbutil->backup newline problem (\n) - by El Forum - 04-23-2009, 02:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB