/var/www/(Del)hsihk.com/wp-content/plugins/backupbuddy/classes/api/_getPreDeployInfo.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
$upload_max_filesize 
str_ireplace'M''', @ini_get'upload_max_filesize' ) );
if ( ( ! 
is_numeric$upload_max_filesize ) ) || ( == $upload_max_filesize ) ) {
    
$upload_max_filesize 1;
}

$max_execution_time str_ireplace's''', @ini_get'max_execution_time' ) );
if ( ( ! 
is_numeric$max_execution_time ) ) || ( == $max_execution_time ) ) {
    
$max_execution_time 30;
}

$memory_limit str_ireplace'M''', @ini_get'memory_limit' ) );
if ( ( ! 
is_numeric$memory_limit ) ) || ( == $memory_limit ) ) {
    
$memory_limit 32;
}

$max_post_size str_ireplace'M''', @ini_get'post_max_size' ) );
if ( ( ! 
is_numeric$max_post_size ) ) || ( == $max_post_size ) ) {
    
$max_post_size 8;
}


$dbTables = array();
global 
$wpdb;
$rows $wpdb->get_results"SHOW TABLE STATUS"ARRAY_A );
foreach( 
$rows as $row ) {
    
$dbTables[] = $row['Name'];
}



function 
backupbuddy_hashGlob$root ) {
    
$generate_sha1 true;
    
$files = (array) pb_backupbuddy::$filesystem->deepglob$root );
    
$root_len strlen$root );
    
$hashedFiles = array();
    foreach( 
$files as $file_id => &$file ) {
        
$stat stat$file );
        if ( 
FALSE === $stat ) { pb_backupbuddy::status'error''Unable to read file `' $file '` stat.' ); }
        
$new_file substr$file$root_len );
        
        
$sha1 '';
        if ( ( 
true === $generate_sha1 ) && ( $stat['size'] < 1073741824 ) ) { // < 100mb
            
$sha1 sha1_file$file );
        }
        
        
$hashedFiles[$new_file] = array(
            
'size'        => $stat['size'],
            
'modified'    => $stat['mtime'],
            
'sha1'        => $sha1,
        );
        unset( 
$files[$file_id] ); // Better to free memory or leave out for performance?
        
    
}
    unset( 
$files );
    
    return 
$hashedFiles;
}


// List
function backupbuddy_dbMediaSince() {
    global 
$wpdb;
    
$wpdb->show_errors(); // Turn on error display.
    
    
$mediaFiles = array();
    
    
$sql "select " $wpdb->prefix "postmeta.meta_value as file," $wpdb->prefix "posts.post_modified as file_modified from " $wpdb->prefix "postmeta," $wpdb->prefix "posts WHERE meta_key='_wp_attached_file' AND " $wpdb->prefix "postmeta.post_id = " $wpdb->prefix "posts.id";
    
$results $wpdb->get_results$sqlARRAY_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 ) {
        
$mediaFiles$result['file'] ] = array(
            
'modified'    => $result['file_modified']
        );
    }
    unset( 
$results );
    return 
$mediaFiles;
}

$mediaSignatures backupbuddy_dbMediaSince();

global 
$wp_version;
return array(
    
'backupbuddyVersion'        => pb_backupbuddy::settings'version' ),
    
'wordpressVersion'            => $wp_version,
    
'localTime'                    => time(),
    
'php'                        => array(
                                    
'upload_max_filesize' => $upload_max_filesize,
                                    
'max_execution_time' => $max_execution_time,
                                    
'memory_limit' => $memory_limit,
                                    
'max_post_size' => $max_post_size,
                                    ),
    
'abspath'                    => ABSPATH,
    
'siteurl'                    => site_url(),
    
'homeurl'                    => home_url(),
    
'tables'                    => $dbTables,
    
'dbPrefix'                    => $wpdb->prefix,
    
'activePlugins'                => backupbuddy_api::getActivePlugins(),
    
'activeTheme'                => get_template(),
    
'themeSignatures'            => backupbuddy_hashGlobget_template_directory() ),
    
'mediaSignatures'            => $mediaSignatures,
    
'mediaCount'                => count$mediaSignatures ),
    
'notifications'                => array(), // Array of string notification messages.
);

unset( 
$mediaSignatures );