Skip to content

Commit

Permalink
Improve extraxt zip
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW committed Aug 7, 2012
1 parent b96cf80 commit cac67f7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion RecipeShell.php
Expand Up @@ -342,8 +342,15 @@ private function __zip($key){
$this->out(__d('cake_console', '<error>Invalid zip archive.</error>'));
return;
}
$zip->extractTo($installDir . $name);
$zip->extractTo(TMP . $name);
$zip->close();
if (count(glob(TMP . $name, GLOB_ONLYDIR)) === 1) {
$cmd = 'mv ' . TMP . $name . DS . '* ' . $installDir . $name;
unlink(TMP . $nam);
} else {
$cmd = 'mv ' . TMP . $name . ' ' . $installDir . $name;
}
exec($cmd);
unlink($installDir . $fileName);
break;
case RECIPE_TYPE_PLAIN:
Expand Down Expand Up @@ -371,6 +378,7 @@ private function __zip($key){
$zip->close();
if (count(glob(TMP . $name, GLOB_ONLYDIR)) === 1) {
$cmd = 'mv ' . TMP . $name . DS . '* ' . $installDir . $name;
unlink(TMP . $nam);
} else {
$cmd = 'mv ' . TMP . $name . ' ' . $installDir . $name;
}
Expand Down

0 comments on commit cac67f7

Please sign in to comment.