We maintain over 70 property websites on a single CI application fueled by a database (actually, one database and application for production sites and one database and application for development sites) to provide the necessary differences for each site. We provide a custom CMS so that the property managers can update their site regularly. There is an approval process to push changes made to their development site through the CMS to their production site.
One CMS function is to upload photo albums. Once the album is uploaded on development and approved for production, I need to copy this folder from the development assets to their production assets.
I establish the FTP connection and create the photo album folder without issue using:
$this->ftp->mkdir($path['ftpP'].'photoAlbums/'.$album[0]['albumFolderName'].'/', DIR_WRITE_MODE);
($path[‘ftpP’] looks like this: /httpdocs/edrAssets/propsP/700/
When I try to use the mirror function in the FTP class, I don’t get any errors or warnings but I also don’t get any transfer—- just nothing.
Here is that code:
$dLink = $path['ftpD'].'photoAlbums/'.$album[0]['albumFolderName'].'/';
$pLink = $path['ftpP'].'photoAlbums/'.$album[0]['albumFolderName'].'/';
$this->ftp->mirror($dLink, $pLink);
I have been fighting this since late Thursday night and need some advice. ALL help is appreciated.
Jon
REQUESTED LOG FILE:
DEBUG - 2012-06-18 07:15:31 --> Controller Class Initialized
DEBUG - 2012-06-18 07:15:31 --> Ftp class already loaded. Second attempt ignored.
DEBUG - 2012-06-18 07:15:31 --> Trying to FTP here
ERROR - 2012-06-18 07:15:31 --> Severity: Warning --> opendir() [function.opendir]: Unable to access /httpdocs/edrAssets/propsD/700/photoAlbums/theUSOpen2012/ /var/www/vhosts/edrpropertyoperations.com/httpdocs/WEBdev/system/libraries/Ftp.php 532
ERROR - 2012-06-18 07:15:31 --> Severity: Warning --> opendir(/httpdocs/edrAssets/propsD/700/photoAlbums/theUSOpen2012/) [function.opendir]: failed to open dir: No such file or directory /var/www/vhosts/edrpropertyoperations.com/httpdocs/WEBdev/system/libraries/Ftp.php 532
DEBUG - 2012-06-18 07:15:31 --> Final output sent to browser
DEBUG - 2012-06-18 07:15:31 --> Total execution time: 0.1626
ADDED *
public function approved_create_album( $id ){
$thisTask = $this->mcms->getSingleAdminTask( $id );
$album = $this->mcms->getAlbumByID($thisTask[0]['itemID']);
$path = $this->mcms->path_variables( $album[0]['propNumber']);
$this->load->library('ftp');
$ftp['hostname'] = <REMOVED>;
$ftp['username'] = <REMOVED>;
$ftp['password'] = <REMOVED>;
$ftp['port'] = 21;
$ftp['passive'] = FALSE;
$ftp['debug'] = TRUE;
$ftp['ssl_mode'] = FALSE;
$this->ftp->connect($ftp);
$dLink = $path['ftpD'].'photoAlbums/'.$album[0]['albumFolderName'].'/';
$pLink = $path['ftpP'].'photoAlbums/'.$album[0]['albumFolderName'].'/';
if( !file_exists($pLink) && !is_dir($pLink)){
$this->ftp->mkdir($path['ftpP'].'photoAlbums/'.$album[0]['albumFolderName'].'/', DIR_WRITE_MODE);
} // end if
log_message('debug', 'Trying to FTP here');
$this->ftp->mirror($dLink, $pLink);
echo $dLink . " to " . $pLink;
} // end approved_create_album function