Jump to content


Photo

automatic backup script


  • Please log in to reply
5 replies to this topic

#1 kkroo

kkroo
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 17 June 2006 - 06:39 PM

i have a automatic backup script for phpBB
this dude who has my script is getting blank backups, i got access to the script on his server and saw that i can echo the data but not put it into variables, u know what might cause this?
ive been working with it for like 3 hours, i am out of ideas
and anything after defining the variable in the script it cut off
and there are no syntax or fatal errors
could this be with mod interference? the same exact code works on a fresh install of phpBB on the same server

here is where the script screws up:

            //
            // Build the sql script file...
            //
            $backup = "#\n";
            $backup .= "# Automatic phpBB Backup Script\n";
            $backup .= "# Script By: Omar Ramadan\n";
            $backup .= "#     http://phpbb-login.sourceforge.net\n";
            $backup .= "#    princeomz2004 AT hotmail DOT com\n";
            $backup .= "#\n";
            $backup .= "# Dump of tables for $dbname\n";
            $backup .= "#\n# DATE : " .  gmdate("d-m-Y H:i:s", $time) . " GMT\n";
            $backup .= "#\n";
            $backup .= "\n";


            for($i = 0; $i < count($tables); $i++)
            {
                $table_name = $tables[$i];

                switch (SQL_LAYER)
                {
                    case 'postgresql':
                        $table_def_function = "get_table_def_postgresql";
                        $table_content_function = "get_table_content_postgresql";
                        break;

                    case 'mysql':
                    case 'mysql4':
                        $table_def_function = "get_table_def_mysql";
                        $table_content_function = "get_table_content_mysql";
                        break;
                }
                if ( !empty($table_name) )
                {
                    if($backup_type != 'data')
                    {
                        $backup .= "#\n# TABLE: " . $table_name . "\n#\n";
                        $backup .= $table_def_function($table_name, "\n") . "\n";
                    }
                    
                    if($backup_type != 'structure')
                    {
                        $backup .= $table_content_function($table_name, "output_table_content");
                    }
                }
            }

if i change the part were it defines $backup it to
                    if($backup_type != 'data')
                    {
                        echo "#\n# TABLE: " . $table_name . "\n#\n";
                        echo $table_def_function($table_name, "\n") . "\n";
                    }
                    
                    if($backup_type != 'structure')
                    {
                        echo $table_content_function($table_name, "output_table_content");
                    }

it outputs the data

the error is in the file includes/auto_backup.php of this MOD:

[a href=\"http://phpbb-login.strangled.net/forum/dload.php?action=file&file_id=13\" target=\"_blank\"]http://phpbb-login.strangled.net/forum/dlo...file&file_id=13[/a]


Please help me out, this is pissing me off

Thanks in advance

#2 Fyorl

Fyorl
  • Members
  • PipPipPip
  • Advanced Member
  • 273 posts
  • LocationUK

Posted 17 June 2006 - 10:19 PM

try echoing $backup and see what you get.
[table]



Don't worry, the printer fairies will sort it out.

#3 kkroo

kkroo
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 18 June 2006 - 04:17 AM

I can echo $backup after here
            $backup = "#\n";
            $backup .= "# Automatic phpBB Backup Script\n";
            $backup .= "# Script By: Omar Ramadan\n";
            $backup .= "#     http://phpbb-login.sourceforge.net\n";
            $backup .= "#    princeomz2004 AT hotmail DOT com\n";
            $backup .= "#\n";
            $backup .= "# Dump of tables for $dbname\n";
            $backup .= "#\n# DATE : " .  gmdate("d-m-Y H:i:s", $time) . " GMT\n";
            $backup .= "#\n";
            $backup .= "\n";

but not after here
                if ( !empty($table_name) )
                {
                    if($backup_type != 'data')
                    {
                        $backup .= "#\n# TABLE: " . $table_name . "\n#\n";
                        $backup .= $table_def_function($table_name, "\n") . "\n";
                    }
                    
                    if($backup_type != 'structure')
                    {
                        $backup .= $table_content_function($table_name, "output_table_content");
                    }
                }
            }


#4 kkroo

kkroo
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 19 June 2006 - 04:09 AM

bump

#5 kkroo

kkroo
  • Members
  • PipPip
  • Member
  • 25 posts

Posted 19 June 2006 - 01:30 PM

alright, i got that error done with. now there is another error, it gzips the data and saves it to a directory name backups. I open the file and it is 0 bytes. but in the script i echo filesize(filename) and it returns 811632. Why is this happening?

NVM solved

#6 newb

newb
  • Members
  • PipPipPip
  • Advanced Member
  • 454 posts

Posted 19 June 2006 - 08:33 PM

just use cronjobs...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users