public/wordpress/wp-content/plugins/backupbuddy/classes/api/_getPreDeployInfo.php
/* backupbuddy_dbMediasince()
 *
 * Generate list of media files with modified times. Optionally include thumbnail media files (default).
 *
 * @return	array 			Array of media files arrays. Eg array( 'filename.jpg' => array( 'modified' => 1111111111
 *
 */
backupbuddy_dbMediasince()
Generate list of media files with modified times. Optionally include thumbnail media files (default).

@return      array                   Array of media files arrays.
backupbuddy_dbMediasince () Generate list of media files with modified times . Optionally include thumbnail media files ( default ) . @return array Array of media files arrays .
function backupbuddy_dbMediaSince( $includeThumbs = true ) {
	global $wpdb;
	$wpdb->show_errors(); 
	$mediaFiles = array();
	$sql = "select " . $wpdb->prefix . "postmeta.meta_value as file," . $wpdb->prefix . "posts.post_modified as file_modified," . $wpdb->prefix . "postmeta.meta_key as meta_key from " . $wpdb->prefix . "postmeta," . $wpdb->prefix . "posts WHERE ( meta_key='_wp_attached_file' OR meta_key='_wp_attachment_metadata' ) AND " . $wpdb->prefix . "postmeta.post_id = " . $wpdb->prefix . "posts.id ORDER BY meta_key ASC";
	$results = $wpdb->get_results( $sql, ARRAY_A );
	if ( ( null === $results ) || ( false === $results ) ) {
		pb_backupbuddy::status( 'error', 'Error #238933: Unable to calculate media with query `' . $sql . '`. Check database permissions or contact host.' );
	}
	foreach( (array)$results as $result ) {
		if ( $result['meta_key'] == '_wp_attached_file' ) {
			$mediaFiles[ $result['file'] ] = array(
				'modified'	=> $result['file_modified']
			);
		}
		if ( true === $includeThumbs ) {
			if ( $result['meta_key'] == '_wp_attachment_metadata' ) {
				$data = unserialize( $result['file'] );
				foreach( $data['sizes'] as $size ) { 
					$mediaFiles[ $size['file'] ] = array(
						'modified'	=> $mediaFiles[ $data['file'] ]['modified']
					);
				}
			}
		}
	} 
	unset( $results );
	return $mediaFiles;
}
function backupbuddy_dbMediaSince ( $ includeThumbs = true ) { global $ wpdb ; $ wpdb -> show_errors ( ) ; $ mediaFiles = array ( ) ; $ sql = " select  " . $ wpdb -> prefix . " postmeta.meta_value as file, " . $ wpdb -> prefix . " posts.post_modified as file_modified, " . $ wpdb -> prefix . " postmeta.meta_key as meta_key from  " . $ wpdb -> prefix . " postmeta, " . $ wpdb -> prefix . " posts WHERE ( meta_key='_wp_attached_file' OR meta_key='_wp_attachment_metadata' ) AND  " . $ wpdb -> prefix . " postmeta.post_id =  " . $ wpdb -> prefix . " posts.id ORDER BY meta_key ASC " ; $ results = $ wpdb -> get_results ( $ sql , ARRAY_A ) ; if ( ( null === $ results ) || ( false === $ results ) ) { pb_backupbuddy :: status ( 'error' , 'Error #238933: Unable to calculate media with query `' . $ sql . '`. Check database permissions or contact host.' ) ; } foreach ( ( array ) $ results as $ result ) { if ( $ result [ 'meta_key' ] == '_wp_attached_file' ) { $ mediaFiles [ $ result [ 'file' ] ] = array ( 'modified' => $ result [ 'file_modified' ] ) ; } if ( true === $ includeThumbs ) { if ( $ result [ 'meta_key' ] == '_wp_attachment_metadata' ) { $ data = unserialize ( $ result [ 'file' ] ) ; foreach ( $ data [ 'sizes' ] as $ size ) { $ mediaFiles [ $ size [ 'file' ] ] = array ( 'modified' => $ mediaFiles [ $ data [ 'file' ] ] [ 'modified' ] ) ; } } } } unset ( $ results ) ; return $ mediaFiles ; }
backupbuddy_dbMediasince()
 Generate list of media files with modified times.
backupbuddy_dbMediasince () Generate list of media files with modified times .
// Turn on error display. // Select all media attachments. // Include thumbnail image files. // Go through each sized thumbnail file. // end foreach $results.