{ $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($directory), \RecursiveIteratorIterator::CHILD_FIRST); /** @var \SplFileInfo $path */ foreach ($iterator as $path) { if ($path->isDir()) { rmdir($path->getPathname()); } else { unlink($path->getPathname()); } } rmdir($directory); } } $installer = new Installer(); try { $installer->log('phpDocumentor installer for manual installations'); if ($argv[1] == 'dev') { $installer->log('> Downloading development application from Github'); $installer->downloadDevelopmentPhpDocumentorArchive(); } else { $installer->log('> Downloading application from Github'); $installer->downloadLatestPhpDocumentorArchive(); } $installer->log('> Extracting application'); $installer->extractPhpDocumentorToCurrentDirectory(); $installer->log('> Preparing dependencies'); $composer_location = ''; if (!$installer->testForComposer()) { // composer is not installed, install it to a temporary directory $composer_location = sys_get_temp_dir(); $installer->log();
global $installer; $error = error_get_last(); if ($error['type'] == 1) { header('HTTP/1.1 500 Internal Server Error'); $errorMsg = htmlspecialchars_decode(strip_tags($error['message'])); echo $errorMsg; if (isset($installer)) { $installer->log('Fatal error: %s on line %s in file %s', $errorMsg, $error['line'], $error['file']); } exit; } } /* * Bootstrap the installer */ require_once 'Lang.php'; require_once 'InstallerException.php'; require_once 'InstallerRewrite.php'; require_once 'Installer.php'; try { $installer = new Installer(); $installer->cleanLog(); $installer->log('Host: %s', php_uname()); $installer->log('PHP version: %s', PHP_VERSION); $installer->log('Server software: %s', isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'Unknown'); $installer->log('Operating system: %s', PHP_OS); $installer->log('Memory limit: %s', ini_get('memory_limit')); $installer->log('Max execution time: %s', ini_get('max_execution_time')); } catch (Exception $ex) { $fatalError = $ex->getMessage(); }