Line 57... |
Line 57... |
57 |
'data_sent' => 0,
|
57 |
'data_sent' => 0,
|
58 |
'data_received' => 0,
|
58 |
'data_received' => 0,
|
59 |
'disk_used' => '',
|
59 |
'disk_used' => '',
|
60 |
'notes' => '',
|
60 |
'notes' => '',
|
61 |
);
|
61 |
);
|
- |
|
62 |
|
- |
|
63 |
function cleanNumber( $number ) {
|
- |
|
64 |
return preg_replace("/[^0-9.]/", "", $number );
|
- |
|
65 |
}
|
62 |
|
66 |
|
63 |
|
67 |
|
64 |
$matches = array();
|
68 |
$matches = array();
|
65 |
|
69 |
|
66 |
$line;
|
70 |
$line;
|
Line 118... |
Line 122... |
118 |
$data['transferred_count'] -= $data['files_deleted'] + $data['skipped'];
|
122 |
$data['transferred_count'] -= $data['files_deleted'] + $data['skipped'];
|
119 |
|
123 |
|
120 |
// we should have a stats summary at the end
|
124 |
// we should have a stats summary at the end
|
121 |
while (( $line = fgets( $log, $maxLineLength )) !== false ) {
|
125 |
while (( $line = fgets( $log, $maxLineLength )) !== false ) {
|
122 |
$data['notes'] .= $line; // everything here goes into notes
|
126 |
$data['notes'] .= $line; // everything here goes into notes
|
123 |
if ( preg_match( '/Number of files:\s+(\d+)/', $line, $matches ) ) {
|
127 |
if ( preg_match( '/Number of files:\s+([0-9,]+)/', $line, $matches ) ) {
|
124 |
$data['files_count'] = $matches[1];
|
128 |
$data['files_count'] = cleanNumber($matches[1]);
|
125 |
} elseif ( preg_match( '/Number of files transferred:\s+(\d+)/', $line, $matches ) ) {
|
129 |
} elseif ( preg_match( '/Number of files transferred:\s+([0-9,]+)/', $line, $matches ) ) {
|
126 |
$data['transferred_count'] = $matches[1];
|
130 |
$data['transferred_count'] = cleanNumber($matches[1]);
|
127 |
} elseif ( preg_match( '/Total file size:\s+(\d+) bytes/', $line, $matches ) ) {
|
131 |
} elseif ( preg_match( '/Total file size:\s+([0-9,]+) bytes/', $line, $matches ) ) {
|
128 |
$data['files_size'] = $matches[1];
|
132 |
$data['files_size'] = cleanNumber($matches[1]);
|
129 |
} elseif ( preg_match( '/Total transferred file size:\s+(\d+) bytes/', $line, $matches ) ) {
|
133 |
} elseif ( preg_match( '/Total transferred file size:\s+([0-9,]+) bytes/', $line, $matches ) ) {
|
130 |
$data['transferred_size'] = $matches[1];
|
134 |
$data['transferred_size'] = cleanNumber($matches[1]);
|
131 |
} elseif ( preg_match( '/Total bytes sent:\s+(\d+)/', $line, $matches ) ) {
|
135 |
} elseif ( preg_match( '/Total bytes sent:\s+([0-9,]+)/', $line, $matches ) ) {
|
132 |
$data['data_sent'] = $matches[1];
|
136 |
$data['data_sent'] = cleanNumber($matches[1]);
|
133 |
} elseif ( preg_match( '/Total bytes received:\s+(\d+)/', $line, $matches ) ) {
|
137 |
} elseif ( preg_match( '/Total bytes received:\s+([0-9,]+)/', $line, $matches ) ) {
|
134 |
$data['data_received'] = $matches[1];
|
138 |
$data['data_received'] = cleanNumber($matches[1]);
|
135 |
} elseif ( preg_match( '/Backup Version\s+v?([\d.]+)/', $line, $matches ) ) {
|
139 |
} elseif ( preg_match( '/Backup Version\s+v?([\d.]+)/', $line, $matches ) ) {
|
136 |
// this is the end of the rsync stats summary, and the
|
140 |
// this is the end of the rsync stats summary, and the
|
137 |
// beginning of the rsbackup summary
|
141 |
// beginning of the rsbackup summary
|
138 |
$data['version'] = $matches[1];
|
142 |
$data['version'] = $matches[1];
|
139 |
break;
|
143 |
break;
|
140 |
}
|
144 |
}
|
141 |
}
|
145 |
}
|