Codeigniter FTP mirroring creates a folder but files are not uploaded

I use Codeigniter to backup mysql tables and write the sql file to the local web server directory htdocs / application / backups.

I want this directory to be mirrored on my remote web server (dreamhost backups user account) , but it does not work . I do not see sql files in the remote directory.

I use the CI FTP library and the mirror() function to copy the contents of my local backup directory to my remote server.

In my database backup model, I set variables for use in the script:

 private $local_folder = 'my_directory/'; private $server_folder = 'my_server_directory/'; private $server_credentials = array( 'hostname'=>'my.hostname.com', 'username'=>'my_username', 'password'=>'my_password' ); 

Also in the database backup model I have a mirror function:

 function mirror(){ $this->load->library('ftp'); $this->ftp->connect($this->server_credentials); $result = $this->ftp->mirror($this->local_folder,$this->server_folder); var_dump($result); //shows "true" $this->ftp->close(); } 

I call mirror() from my backup function. The sql files are created and saved locally by the backup function, but the local folder is not mirrored on the web server.

remote backup permissions are "777", and test runs $this->ftp->list_files and $this->ftp->mkdir() work fine.

Any ideas why the files will not be downloaded?

+4
source share
2 answers

I am posting the answer to my question because the problem was in my own ignorance.

private $server_folder = 'my_server_directory/';

should be

private $server_folder = '/my_server_directory/';

I swear I tried this syntax when the problem was resolved, but I must have changed something else that upset the mirroring at the same time, hiding the answer from me.

Thanks for your comments and answers @Damien Pirsy and @Edinho Almeida.

+1
source

If

 $this->ftp->mkdir() 

works fine, I'm sure your resolution settings are ok.

If

 $this->ftp->list_files() 

works great, I'm sure your connection settings are fine too.

I think your SQL backup files start with a dot

Cm.

 system/libraries/Ftp.php at lines 547 and 551 
0
source

All Articles