-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #242 from t3solution/5.2.0
New release v5.2.0
- Loading branch information
Showing
54 changed files
with
783 additions
and
302 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace T3SBS\T3sbootstrap\Command; | ||
|
||
use Symfony\Component\Console\Command\Command; | ||
|
||
/* | ||
* This file is part of the TYPO3 extension t3sbootstrap. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE file that was distributed with this source code. | ||
*/ | ||
class CommandBase extends Command | ||
{ | ||
|
||
/** | ||
* remove dirs | ||
*/ | ||
public function rmDir(string $path) : int | ||
{ | ||
if (!is_dir ($path)) { | ||
return -1; | ||
} | ||
$dir = @opendir ($path); | ||
if (!$dir) { | ||
return -2; | ||
} | ||
while ($entry = @readdir($dir)) { | ||
if ($entry == '.' || $entry == '..') continue; | ||
if (is_dir ($path.'/'.$entry)) { | ||
$res = self::rmDir ($path.'/'.$entry); | ||
if ($res == -1) { | ||
@closedir ($dir); | ||
return -2; | ||
} else if ($res == -2) { | ||
@closedir ($dir); | ||
return -2; | ||
} else if ($res == -3) { | ||
@closedir ($dir); | ||
return -3; | ||
} else if ($res != 0) { | ||
@closedir ($dir); | ||
return -2; | ||
} | ||
} else if (is_file ($path.'/'.$entry) || is_link ($path.'/'.$entry)) { | ||
$res = @unlink ($path.'/'.$entry); | ||
if (!$res) { | ||
@closedir ($dir); | ||
return -2; | ||
} | ||
} else { | ||
@closedir ($dir); | ||
return -3; | ||
} | ||
} | ||
|
||
@closedir ($dir); | ||
$res = @rmdir ($path); | ||
|
||
if (!$res) { | ||
return -2; | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
|
||
|
||
} |
Oops, something went wrong.