| @@ 116-148 (lines=33) @@ | ||
| 113 | $scanner = new \OC\Files\Utils\Scanner($user, $connection, \OC::$server->getLogger()); |
|
| 114 | # check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception |
|
| 115 | # printout and count |
|
| 116 | if ($verbose) { |
|
| 117 | $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) { |
|
| 118 | $output->writeln("\tFile <info>$path</info>"); |
|
| 119 | $this->filesCounter += 1; |
|
| 120 | if ($this->hasBeenInterrupted()) { |
|
| 121 | throw new InterruptedException(); |
|
| 122 | } |
|
| 123 | }); |
|
| 124 | $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) { |
|
| 125 | $output->writeln("\tFolder <info>$path</info>"); |
|
| 126 | $this->foldersCounter += 1; |
|
| 127 | if ($this->hasBeenInterrupted()) { |
|
| 128 | throw new InterruptedException(); |
|
| 129 | } |
|
| 130 | }); |
|
| 131 | $scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function (StorageNotAvailableException $e) use ($output) { |
|
| 132 | $output->writeln("Error while scanning, storage not available (" . $e->getMessage() . ")"); |
|
| 133 | }); |
|
| 134 | # count only |
|
| 135 | } else { |
|
| 136 | $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function () use ($output) { |
|
| 137 | $this->filesCounter += 1; |
|
| 138 | if ($this->hasBeenInterrupted()) { |
|
| 139 | throw new InterruptedException(); |
|
| 140 | } |
|
| 141 | }); |
|
| 142 | $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function () use ($output) { |
|
| 143 | $this->foldersCounter += 1; |
|
| 144 | if ($this->hasBeenInterrupted()) { |
|
| 145 | throw new InterruptedException(); |
|
| 146 | } |
|
| 147 | }); |
|
| 148 | } |
|
| 149 | $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) { |
|
| 150 | $this->checkScanWarning($path, $output); |
|
| 151 | }); |
|
| @@ 83-115 (lines=33) @@ | ||
| 80 | $scanner = new \OC\Files\Utils\Scanner(null, $connection, \OC::$server->getLogger()); |
|
| 81 | # check on each file/folder if there was a user interrupt (ctrl-c) and throw an exception |
|
| 82 | # printout and count |
|
| 83 | if ($verbose) { |
|
| 84 | $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) { |
|
| 85 | $output->writeln("\tFile <info>$path</info>"); |
|
| 86 | $this->filesCounter += 1; |
|
| 87 | if ($this->hasBeenInterrupted()) { |
|
| 88 | throw new InterruptedException(); |
|
| 89 | } |
|
| 90 | }); |
|
| 91 | $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) { |
|
| 92 | $output->writeln("\tFolder <info>$path</info>"); |
|
| 93 | $this->foldersCounter += 1; |
|
| 94 | if ($this->hasBeenInterrupted()) { |
|
| 95 | throw new InterruptedException(); |
|
| 96 | } |
|
| 97 | }); |
|
| 98 | $scanner->listen('\OC\Files\Utils\Scanner', 'StorageNotAvailable', function (StorageNotAvailableException $e) use ($output) { |
|
| 99 | $output->writeln("Error while scanning, storage not available (" . $e->getMessage() . ")"); |
|
| 100 | }); |
|
| 101 | # count only |
|
| 102 | } else { |
|
| 103 | $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function () use ($output) { |
|
| 104 | $this->filesCounter += 1; |
|
| 105 | if ($this->hasBeenInterrupted()) { |
|
| 106 | throw new InterruptedException(); |
|
| 107 | } |
|
| 108 | }); |
|
| 109 | $scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function () use ($output) { |
|
| 110 | $this->foldersCounter += 1; |
|
| 111 | if ($this->hasBeenInterrupted()) { |
|
| 112 | throw new InterruptedException(); |
|
| 113 | } |
|
| 114 | }); |
|
| 115 | } |
|
| 116 | $scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function($path) use ($output) { |
|
| 117 | $this->checkScanWarning($path, $output); |
|
| 118 | }); |
|