/var/www/(Del)hsihk.com/wp-content/plugins/backupbuddy/controllers/ajax/deploy_status.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
<?php
if ( ! is_admin() ) { die( 'Access denied.' ); }

$backupSerial pb_backupbuddy::_POST'serial' );
$profileID pb_backupbuddy::_POST'profileID' );
$thisStep pb_backupbuddy::_POST'step' );
$stepCounter pb_backupbuddy::_POST'stepCounter' );


if ( 
'0' == $thisStep ) {
    
$backupFiles globbackupbuddy_core::getBackupDirectory() . 'backup*' $backupSerial '*.zip' );
    if ( ! 
is_array$backupFiles ) ) { $backupFiles = array(); }
    if ( 
count$backupFiles ) > ) {
        
$backupFile $backupFiles[0];
        die( 
json_encode( array(
            
'statusStep' => 'backupComplete',
            
'stepTitle' => 'Backup finished. File: ' $backupFile ' -- Next step start sending the file chunks to remote API server via curl.',
            
'nextStep' => 'sendFiles',
        ) ) );
    }

    
$lastBackupStats backupbuddy_api::getLatestBackupStats();
    if ( 
$backupSerial != $lastBackupStats['serial'] ) {
        die( 
json_encode( array( 'stepTitle' => 'Waiting for backup to begin.''statusStep' => 'waitingBackupBegin' ) ) );
    } else { 
// Last backup stats is our deploy backup.
        
die( json_encode( array(
            
'stepTitle' => $lastBackupStats['processStepTitle'] . ' with profile "' pb_backupbuddy::$options['profiles'][ $profileID ]['title'] . '".',
            
'statusStep' => 'backupStats',
            
'stats' => $lastBackupStats,
        ) ) );
        
    }

} elseif ( 
'sendFiles' == $thisStep ) {
    
    if ( 
'0' == $stepCounter ) {
        die( 
json_encode( array(
            
'stepTitle' => 'FIRST SENDFILES RUN',
            
'statusStep' => 'sendFiles',
            
'nextStep' => 'sendFiles',
        ) ) );
    } else {
        die( 
json_encode( array(
            
'stepTitle' => 'Sending files...',
            
'statusStep' => 'sendFiles',
            
'nextStep' => 'sendFiles',
        ) ) );
    }
    
} else {
    die( 
'Invalid step `' htmlentities$thisStep ) . '`.' );
}


//'nextStep' => '-1', // Finished.