function _ftp_cdn_cron_create_path in CDN 5
1 call to _ftp_cdn_cron_create_path()
- ftp_cdn_cron_perform_sync in sync_plugins/
ftp.inc - Implementation of pseudo-hook hook_cdn_cron_perform_sync().
File
- sync_plugins/
ftp.inc, line 135 - FTP synchronization plugin for the CDN integration module.
Code
function _ftp_cdn_cron_create_path($fs, $file) {
$success = TRUE;
$dirs = explode('/', $file);
unset($dirs[count($dirs) - 1]);
// Remove the file from the dirs array.
// Create the path.
for ($i = 0; $success && $i < count($dirs); $i++) {
if (!in_array($dirs[$i], ftp_nlist($fs, '.'))) {
$success = ftp_mkdir($fs, $dirs[$i]);
}
ftp_chdir($fs, $dirs[$i]);
}
// Go back to the original working directory.
$chdir = '';
for ($i = 0; $i < count($dirs); $i++) {
if ($chdir) {
$chdir .= '/';
}
$chdir .= '..';
}
ftp_chdir($fs, $chdir);
return $success;
}