1 (edited by User33 2008-12-23 21:57)

Topic: [Release] XML Backup

NOTE: THE EXTENSION IS IN BETA STATE! IF YOU WANT TO USE IT, FIRST TRY IT ON A TEST FORUM AND SEE IF IT WORKS PROPERLY. EITHER WAY, POST YOUR RESULTS HERE. Thanks! smile

Allows the creation of database backups in XML format. (Only for MySQL and MySQLi)

The Backup Control Panel can be found on Administration » Start » Backup (If you think it should be placed somewhere else, let me know)

Download Link: http://punbb.informer.com/unofficial/pu … backup.zip

If you find any bugs or have any tips, please post them here.

Updates

  • 1.2.1: Fixed small bugs.

  • 1.2: Added UTF-8 support (to be tested), made some fixes, and more.

  • 1.1: Added local backups

  • 1.0: First release

2

Re: [Release] XML Backup

Wow, you just became my best friend smile

Outputting the database in XML format allows for easy migration of your data.

Re: [Release] XML Backup

My test installation has no prefix, and 'extensions' and 'extension_hooks' were not checked.

There are some problems with encodings. For example, the title of my forum is "Название форума", and it's become into

            <row_3>
                <conf_name>o_board_title</conf_name>
                <conf_value>&ETH;ќ&ETH;&deg;&ETH;&middot;&ETH;&sup2;&ETH;&deg;&ETH;&frac12;&ETH;&cedil;&ETH;&micro; &Ntilde;„&ETH;&frac34;&Ntilde;Ђ&Ntilde;ѓ&ETH;&frac14;&ETH;&deg;</conf_value>
            </row_3>

When I tried to recover the forum from the file obtained before, it displayed the following error:

An error was encountered

The error occurred on line 151 in Z:\home\punbb\www\extensions\xml_backup\functions.php

Database reported: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(uJ', 'test2@my.email', 'Ddsf', '1', '1', '1', '1', '1', '1', 'English', 'Oxyg' at line 1 (Errno: 1064).

Re: [Release] XML Backup

And I think that recovering from a backup by sending a file via the POST method is not the best way. For example, db size here is 125 Mb smile

Re: [Release] XML Backup

Yes, I'm aware of it not selecting extensions and extensions_hooks. I don't see why they need to be backed up.

I don't have experience with encodings so I just used htmlentities() to keep the XML valid and then html_entity_decode(). What should I use instead?

Re: [Release] XML Backup

What other way could the file be uploaded?

Re: [Release] XML Backup

Garciat wrote:

The Backup Control Panel can be found on Administration » Start » Backup (If you think it should be placed somewhere else, let me know)

Maybe Administration » Management » Backup?

Garciat wrote:

What other way could the file be uploaded?

By FTP or SSH to a directory, for example. The extension could write backups in the same direcrory. In this case, for example, admin can make a db-snapshot before updating forum and if something has gone wrong he can simply restore the database to the shapshot without uploading/downloading.

The best way is to support both uploading and restoring from a file on server.

Garciat wrote:

Yes, I'm aware of it not selecting extensions and extensions_hooks. I don't see why they need to be backed up.

Admin can make a full backup on a server 1 and after transferring files one can restore the whole forum on a server 2 with all extensions without installing extensions again.

Garciat wrote:

I don't have experience with encodings so I just used htmlentities() to keep the XML valid and then html_entity_decode(). What should I use instead?

You have to escape the values. I'm afraid I can't say which way is the best. Try to google or to make some experiments wink

Re: [Release] XML Backup

I'll see what I can do about all that smile

Re: [Release] XML Backup

Updated to 1.1. It doesn't use FTP or SSH file upload because I don't really know how to do it smile If you show me some examples, I could give it a try.

10

Re: [Release] XML Backup

Could anyone test it? smile

Re: [Release] XML Backup

The issue with utf-8 chars is still here. Maybe it causes the following error:

Warning: Invalid argument supplied for foreach() in Z:\home\punbb\www\extensions\xml_backup\functions.php on line 124

I obtained it while restoring from a backup. And restoring actually don't work.

I think you have to convert some entities. Try to set the encoding in htmlentities(). And your function xml2array() seems to be UTF-8 incompatible. Why not to use the function xml_to_array()?

Also there can be issues with the "backups" directory. Shared hostings have PHP safe mode turned on, and users will have to set permissions for this directory manually. Why not to store backups in the "cache" directory? What do you think about this?

Garciat wrote:

It doesn't use FTP or SSH file upload because I don't really know how to do it

I meant just what you have done smile

12

Re: [Release] XML Backup

Updated to 1.2.

13 (edited by mihalis 2008-12-19 02:24)

Re: [Release] XML Backup

New to this extension; any files I show modify first before trying to install? I'm getting this error:

The error occurred on line 351 in /path/to/my/forum/include/dblayer/mysql.php

Database reported: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tables TEXT NOT NULL, uploaded INT(1) UNSIGNED DEFAULT 0, created INT(10) UNSIGN' at line 3 (Errno: 1064).

Re: [Release] XML Backup

Really nice extension, I have encountered a bug or two when attempting to restore the backup, but overall its a good tool.

15 (edited by User33 2008-12-19 16:42)

Re: [Release] XML Backup

Yeah, I think the main idea is really good, but it's not really cross-database... It still needs lots of work...

and testing...

16

Re: [Release] XML Backup

With what database types has this been tested?

17 (edited by User33 2008-12-23 20:57)

Re: [Release] XML Backup

MySQLi and standard characters.

18 (edited by User33 2008-12-23 22:28)

Re: [Release] XML Backup

Updated to 1.2.1.

Please test it and post your results smile

Thanks!

19

Re: [Release] XML Backup

I use SQlite, not sure if this would work for me.

20

Re: [Release] XML Backup

Nope, it won't... sorry sad

21

Re: [Release] XML Backup

That's fine. smile

Re: [Release] XML Backup

No me importa los archivos descargados, y tampoco los restaura:

The uploaded file did not validate as correct XML backup genereated by the extension.