public/wordpress/wp-content/plugins/backupbuddy/classes/core.php
/* calculateArchiveFilename()
	 *
	 * Calculates the backup zip filename.
	 *
	 */
calculateArchiveFilename()
Calculates the backup zip filename.
calculateArchiveFilename () Calculates the backup zip filename .
public static function calculateArchiveFilename( $serial, $type, $profile ) {
		$siteurl_stripped = backupbuddy_core::backup_prefix();
		if ( empty( pb_backupbuddy::$options['archive_name_profile'] ) || empty( $profile['title'] ) ) {
			$backupfile_profile = '';
		} else {
			$backupfile_profile = sanitize_file_name( strtolower( $profile['title'] ) );
			$backupfile_profile = str_replace( '/', '_', $backupfile_profile );
			$backupfile_profile = str_replace( '\\', '_', $backupfile_profile );
			$backupfile_profile = str_replace( '.', '_', $backupfile_profile );
			$backupfile_profile = str_replace( ' ', '_', $backupfile_profile );
			$backupfile_profile = str_replace( '-', '_', $backupfile_profile );
			$backupfile_profile .= '-';
		}
		if ( pb_backupbuddy::$options['archive_name_format'] == 'datetime' ) { 
			$backupfile_datetime = date( backupbuddy_constants::ARCHIVE_NAME_FORMAT_DATETIME, pb_backupbuddy::$format->localize_time( time() ) );
		} elseif ( pb_backupbuddy::$options['archive_name_format'] == 'datetime24' ) { 
			$backupfile_datetime = date( backupbuddy_constants::ARCHIVE_NAME_FORMAT_DATETIME24, pb_backupbuddy::$format->localize_time( time() ) );
		} elseif ( pb_backupbuddy::$options['archive_name_format'] == 'timestamp' ) { 
			$backupfile_datetime = pb_backupbuddy::$format->localize_time( time() );
		} else { 
			$backupfile_datetime = date( backupbuddy_constants::ARCHIVE_NAME_FORMAT_DATE, pb_backupbuddy::$format->localize_time( time() ) );
		}
		$archiveFile = backupbuddy_core::getBackupDirectory() . 'backup-' . $siteurl_stripped . '-' . $backupfile_datetime . '-' . $backupfile_profile . $type . '-' . $serial . '.zip';
		pb_backupbuddy::anti_directory_browsing( backupbuddy_core::getBackupDirectory(), $die = false );
		if ( ! file_exists( backupbuddy_core::getBackupDirectory() ) ) {
			pb_backupbuddy::status( 'error', 'Error #84893434: Backup storage directory `' . backupbuddy_core::getBackupDirectory() . '` does not exist and unable to create it. Check permissions. If using a custom path verify it is correct.' );
		}
		pb_backupbuddy::status( 'details', 'Calculated archive file: `' . $archiveFile . '`.' );
		return $archiveFile;
	}
public static function calculateArchiveFilename ( $ serial , $ type , $ profile ) { $ siteurl_stripped = backupbuddy_core :: backup_prefix ( ) ; if ( empty ( pb_backupbuddy :: $ options [ 'archive_name_profile' ] ) || empty ( $ profile [ 'title' ] ) ) { $ backupfile_profile = '' ; } else { $ backupfile_profile = sanitize_file_name ( strtolower ( $ profile [ 'title' ] ) ) ; $ backupfile_profile = str_replace ( '/' , '_' , $ backupfile_profile ) ; $ backupfile_profile = str_replace ( '\\' , '_' , $ backupfile_profile ) ; $ backupfile_profile = str_replace ( '.' , '_' , $ backupfile_profile ) ; $ backupfile_profile = str_replace ( ' ' , '_' , $ backupfile_profile ) ; $ backupfile_profile = str_replace ( '-' , '_' , $ backupfile_profile ) ; $ backupfile_profile .= '-' ; } if ( pb_backupbuddy :: $ options [ 'archive_name_format' ] == 'datetime' ) { $ backupfile_datetime = date ( backupbuddy_constants :: ARCHIVE_NAME_FORMAT_DATETIME , pb_backupbuddy :: $ format -> localize_time ( time ( ) ) ) ; } elseif ( pb_backupbuddy :: $ options [ 'archive_name_format' ] == 'datetime24' ) { $ backupfile_datetime = date ( backupbuddy_constants :: ARCHIVE_NAME_FORMAT_DATETIME24 , pb_backupbuddy :: $ format -> localize_time ( time ( ) ) ) ; } elseif ( pb_backupbuddy :: $ options [ 'archive_name_format' ] == 'timestamp' ) { $ backupfile_datetime = pb_backupbuddy :: $ format -> localize_time ( time ( ) ) ; } else { $ backupfile_datetime = date ( backupbuddy_constants :: ARCHIVE_NAME_FORMAT_DATE , pb_backupbuddy :: $ format -> localize_time ( time ( ) ) ) ; } $ archiveFile = backupbuddy_core :: getBackupDirectory ( ) . 'backup-' . $ siteurl_stripped . '-' . $ backupfile_datetime . '-' . $ backupfile_profile . $ type . '-' . $ serial . '.zip' ; pb_backupbuddy :: anti_directory_browsing ( backupbuddy_core :: getBackupDirectory ( ) , $ die = false ) ; if ( ! file_exists ( backupbuddy_core :: getBackupDirectory ( ) ) ) { pb_backupbuddy :: status ( 'error' , 'Error #84893434: Backup storage directory `' . backupbuddy_core :: getBackupDirectory ( ) . '` does not exist and unable to create it. Check permissions. If using a custom path verify it is correct.' ) ; } pb_backupbuddy :: status ( 'details' , 'Calculated archive file: `' . $ archiveFile . '`.' ) ; return $ archiveFile ; }
calculateArchiveFilename()
 Calculates the backup zip filename.
calculateArchiveFilename () Calculates the backup zip filename .
// Prepare some values for setting up the backup data. // Add profile to filename if set in options and exists // Calculate customizable section of archive filename (date vs date+time). // "datetime" = Date + time. // "datetime" = Date + time in 24hr format. // "datetime" = Date + time in 24hr format. // "date" = date only (the default). // Make dure we can make backup dir & it exists & is protected.