| 150 | | // Unzip package to working directory |
| 151 | | $result = unzip_file($package, $working_dir); //TODO optimizations, Copy when Move/Rename would suffice? |
| | 150 | $extension = pathinfo($package, PATHINFO_EXTENSION); |
| | 151 | |
| | 152 | // Make uploading a PHP file instead of a zip archive possible |
| | 153 | if ( 'php' == $extension ) { |
| | 154 | // Create a new folder |
| | 155 | mkdir($working_dir); |
| | 156 | |
| | 157 | // Copy the PHP file into the new foler |
| | 158 | $result = rename($package, $working_dir . '/' . basename($package)); |
| | 159 | } else { |
| | 160 | // Unzip package to working directory |
| | 161 | $result = unzip_file($package, $working_dir); //TODO optimizations, Copy when Move/Rename would suffice? |
| | 162 | |
| | 163 | // Once extracted, delete the package if required. |
| | 164 | if ( $delete_package ) |
| | 165 | unlink($package); |
| | 166 | } |