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