| @@ 250-266 (lines=17) @@ | ||
| 247 | $current = PATH_ROOT . DS . $directory . DS . $iterator->getSubPathName(); |
|
| 248 | ||
| 249 | // remove empty directories |
|
| 250 | if (is_dir($current)) { |
|
| 251 | if (sizeof(scandir($current)) == 2) { |
|
| 252 | rmdir($current); |
|
| 253 | $this->installer->getIo()->write( |
|
| 254 | " - Removed directory `{$iterator->getSubPathName()}`", |
|
| 255 | true, |
|
| 256 | IOInterface::VERBOSE |
|
| 257 | ); |
|
| 258 | } else { |
|
| 259 | $this->installer->getIo()->write( |
|
| 260 | " - <comment>Skip directory `{$iterator->getSubPathName()}`</comment>", |
|
| 261 | true, |
|
| 262 | IOInterface::VERBOSE |
|
| 263 | ); |
|
| 264 | } |
|
| 265 | continue; |
|
| 266 | } |
|
| 267 | ||
| 268 | // skip already removed files |
|
| 269 | if (!is_file($current)) { |
|
| @@ 273-288 (lines=16) @@ | ||
| 270 | continue; |
|
| 271 | } |
|
| 272 | ||
| 273 | if (md5_file($item) == md5_file($current)) { |
|
| 274 | // remove file |
|
| 275 | unlink($current); |
|
| 276 | $this->installer->getIo()->write( |
|
| 277 | " - Removed file `{$iterator->getSubPathName()}`", |
|
| 278 | true, |
|
| 279 | IOInterface::VERBOSE |
|
| 280 | ); |
|
| 281 | } else { |
|
| 282 | // or skip changed files |
|
| 283 | $this->installer->getIo()->write( |
|
| 284 | " - <comment>File `{$iterator->getSubPathName()}` has changed</comment>", |
|
| 285 | true, |
|
| 286 | IOInterface::VERBOSE |
|
| 287 | ); |
|
| 288 | } |
|
| 289 | } |
|
| 290 | ||
| 291 | return false; |
|