Skip to content

Commit

Permalink
Fix 'redis-cli LASTSAVE' output parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianfeldmann authored and Sebastian Feldmann committed Dec 6, 2015
1 parent 3f92645 commit 0eb80b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Backup/Source/Redis.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ private function getLastBackupTime(Executable\RedisCli $redis)
$result = $redis->run();
$output = $result->getOutputAsString();
$matches = [];
if (!preg_match('#\(integer\) ([0-9]+)#i', $output, $matches)) {
if (!preg_match('#(\(integer\) )?([0-9]+)#i', $output, $matches)) {
throw new Exception('invalid redis-cli LASTSAVE output');
}
return $matches[1];
return (int) $matches[2];
}

/**
Expand Down

0 comments on commit 0eb80b4

Please sign in to comment.