/** * Generate a backup path to a given file. * @param type $basePath the base of the backup path. * @param type $fileSeqData the file sequence data. * @param type $retrievedHostname the host the file was retrived from. * @return string the path to place the file in. */ public function generateBackupPath($basePath, $fileSeqData, $retrievedHostname = false) { $backupPath = $basePath; $date = Billrun_Util::fixShortHandYearDate($fileSeqData['date'], $this->backup_date_dir_format); //HACK to fix short hand year. $backupPath .= $retrievedHostname ? DIRECTORY_SEPARATOR . $retrievedHostname : ""; //If theres more then one host or the files were retrived from a named host backup under that host name $backupPath .= DIRECTORY_SEPARATOR . date($this->backup_date_dir_format, strtotime($date) > 0 ? strtotime($date) : time()); // if the file name has a date save under that date else save under tthe current month $backupPath .= $fileSeqData['seq'] ? DIRECTORY_SEPARATOR . substr($fileSeqData['seq'], 0, -$this->backup_seq_granularity) : ""; // break the date to sequence number with varing granularity return $backupPath; }