开发者

FTP Mirroring with Codeigniter creates folder, but no files uploaded

I am using Codeigniter to backup mysql tables and write the sql file to the local webserver's htdocs/application/backups directory.

I want that directory to be mirrored on my remote webserver (dreamhost backups user account) but it's not working, I'm not seeing the sql files in the remote directory.

I'm using CI's FTP library and it's mirror() function to copy the contents of my local backups directory to my remote server.

In my database backup model I开发者_如何学Go set variables to use in the scrip:

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 the 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 the mirror() from my backup function. The sql files are created and stored locally by the backup function, but the local folder isn't mirrored to the webserver.

the remote backup directory permissions are '777' and test runs of $this->ftp->list_files and $this->ftp->mkdir() work just fine.

Any ideas why files won't be uploaded?


I'm posting an answer to my own question because the problem was my own ignorance.

private $server_folder = 'my_server_directory/';

should have been

private $server_folder = '/my_server_directory/';

I swear I tried that syntax while trouble shooting my problem, but I must have changed something else too that broke the mirroring at the same time, hiding the answer from me.

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


If

$this->ftp->mkdir()

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

If

$this->ftp->list_files()

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

I guess your SQL backup files are starting with dot

See in

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜