Rename method to abortIfInterrupted

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Daniel Kesselberg 2018-10-08 13:05:00 +02:00
parent 752f637207
commit 311de17730
No known key found for this signature in database
GPG Key ID: 36E3664E099D0614
3 changed files with 10 additions and 10 deletions

View File

@ -129,12 +129,12 @@ class Scan extends Base {
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) { $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) {
$output->writeln("\tFile <info>$path</info>"); $output->writeln("\tFile <info>$path</info>");
$this->filesCounter += 1; $this->filesCounter += 1;
$this->hasBeenInterrupted(); $this->abortIfInterrupted();
}); });
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) { $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) {
$output->writeln("\tFolder <info>$path</info>"); $output->writeln("\tFolder <info>$path</info>");
$this->foldersCounter += 1; $this->foldersCounter += 1;
$this->hasBeenInterrupted(); $this->abortIfInterrupted();
}); });
$scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function (StorageNotAvailableException $e) use ($output) { $scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function (StorageNotAvailableException $e) use ($output) {
$output->writeln('Error while scanning, storage not available (' . $e->getMessage() . ')'); $output->writeln('Error while scanning, storage not available (' . $e->getMessage() . ')');
@ -143,11 +143,11 @@ class Scan extends Base {
} else { } else {
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function () use ($output) { $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function () use ($output) {
$this->filesCounter += 1; $this->filesCounter += 1;
$this->hasBeenInterrupted(); $this->abortIfInterrupted();
}); });
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function () use ($output) { $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function () use ($output) {
$this->foldersCounter += 1; $this->foldersCounter += 1;
$this->hasBeenInterrupted(); $this->abortIfInterrupted();
}); });
} }
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) { $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) {
@ -244,7 +244,7 @@ class Scan extends Base {
} }
try { try {
$this->hasBeenInterrupted(); $this->abortIfInterrupted();
} catch(InterruptedException $e) { } catch(InterruptedException $e) {
break; break;
} }

View File

@ -102,12 +102,12 @@ class ScanAppData extends Base {
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) { $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) {
$output->writeln("\tFile <info>$path</info>"); $output->writeln("\tFile <info>$path</info>");
$this->filesCounter += 1; $this->filesCounter += 1;
$this->hasBeenInterrupted(); $this->abortIfInterrupted();
}); });
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) { $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) {
$output->writeln("\tFolder <info>$path</info>"); $output->writeln("\tFolder <info>$path</info>");
$this->foldersCounter += 1; $this->foldersCounter += 1;
$this->hasBeenInterrupted(); $this->abortIfInterrupted();
}); });
$scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function (StorageNotAvailableException $e) use ($output) { $scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function (StorageNotAvailableException $e) use ($output) {
$output->writeln('Error while scanning, storage not available (' . $e->getMessage() . ')'); $output->writeln('Error while scanning, storage not available (' . $e->getMessage() . ')');
@ -116,11 +116,11 @@ class ScanAppData extends Base {
} else { } else {
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function () use ($output) { $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function () use ($output) {
$this->filesCounter += 1; $this->filesCounter += 1;
$this->hasBeenInterrupted(); $this->abortIfInterrupted();
}); });
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function () use ($output) { $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function () use ($output) {
$this->foldersCounter += 1; $this->foldersCounter += 1;
$this->hasBeenInterrupted(); $this->abortIfInterrupted();
}); });
} }
$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) { $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) {

View File

@ -133,7 +133,7 @@ class Base extends Command implements CompletionAwareInterface {
* *
* @throws InterruptedException * @throws InterruptedException
*/ */
protected function hasBeenInterrupted() { protected function abortIfInterrupted() {
if ($this->php_pcntl_signal === false) { if ($this->php_pcntl_signal === false) {
return; return;
} }