Check for hash instead of file existence

The previous logic did not necessarily trigger in every case. This logic is more error-resistant, the autoload_classmap.php file has a guaranteed different hash on 9.0.0, 9.0.1 and 9.0.2

Fixes https://github.com/owncloud/updater/issues/342
This commit is contained in:
Lukas Reschke 2016-04-27 15:46:24 +02:00
parent 795f321a19
commit 145810dc20
No known key found for this signature in database
GPG Key ID: 9AB0ADB949B6898C
1 changed files with 4 additions and 3 deletions

View File

@ -70,9 +70,10 @@ class BrokenUpdaterRepair extends BasicEmitter implements \OC\RepairStep {
'sabre/dav/lib/DAV/Version.php',
];
// First check whether the files have been copied the first time already
// if so there is no need to run the move routine.
if(file_exists($thirdPartyDir . '/icewind/streams/src/RetryWrapper.php')) {
// Check the hash for the autoload_classmap.php file, if the hash does match
// the expected value then the third-party folder has already been copied
// properly.
if(hash_file('sha512', $thirdPartyDir . '/composer/autoload_classmap.php') === 'abe09be19b6d427283cbfa7c4156d2c342cd9368d7d0564828a00ae02c435b642e7092cef444f94635f370dbe507eb6b2aa05109b32d8fb5d8a65c3a5a1c658f') {
$this->emit('\OC\Repair', 'info', ['Third-party files seem already to have been copied. No repair necessary.']);
return false;
}