backup_controller seems to work, but returns nothing

backup_controller seems to work, but returns nothing

by Matthew Davidson -
Number of replies: 2
Picture of Core developers Picture of Plugin developers

in my plugin I use this code:


$bc = new backup_controller(backup::TYPE_1COURSE, $course_to_backup, backup::FORMAT_MOODLE,

                                        backup::INTERACTIVE_NO, backup::MODE_AUTOMATED, $user_doing_the_backup);

    

$bc->execute_plan();  // Execute backup

$results = $bc->get_results(); // Get the file information needed

$file = $results['backup_destination'];


On my local dev server (WAMP) it is working wonderfully, but on our LAMP testing server, I get nothing back in $results.  

The log says this...

PHP message: instantiating backup controller a89137dfd504a856931dc2d8943fbcb9

PHP message: setting controller status to 100

PHP message: loading controller plan

PHP message: setting controller status to 300

PHP message: applying plan defaults

PHP message: setting controller status to 400

PHP message: setting file inclusion to 1

PHP message: checking plan security

PHP message: setting controller status to 700

PHP message: saving controller to db

PHP message: calculating controller checksum d4e38f0f796bce816be92e119b891f85

PHP message: loading controller from db

PHP message: setting controller status to 800

PHP message: setting controller status to 1000

PHP message: saving controller to db" while reading upstream

And that is it...  Why would my results come back empty?

Average of ratings: -
In reply to Matthew Davidson

Re: backup_controller seems to work, but returns nothing

by Matthew Davidson -
Picture of Core developers Picture of Plugin developers

Found that our dev server has an automated backup path given /moodledata/backup
So the file is already being moved, and I think this causes results to return empty..so how do I go about finding the backup file that was created and move it again? or keep it from moving in the first place?

In reply to Matthew Davidson

Re: backup_controller seems to work, but returns nothing

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers

Hi Matthew,

maybe your programatic backup is being sent to the configured automated area because, in your code... you're using backup::MODE_AUTOMATED and that makes backup to use the scheduled backup configured options to decide about final destination.

Surely using backup::MODE_GENERALinstead will do the trick and you'll get a backup file stored into Moodle file area (personal backup area if the backup does not include users info and course backup area if the backup does include users info).

Hope it helps, ciao smile