MODXInstaller::quit('Missing file: ' . $source); } elseif (filesize($source) < 64) { MODXInstaller::quit('File: ' . $source . ' is empty -- download failed'); } $tempDir = realPath(dirname(__FILE__)) . '/temp'; MODXInstaller::mmkdir($tempDir); clearstatcache(); $destination = $tempDir; if (!file_exists($tempDir)) { MODXInstaller::quit('Unable to create directory: ' . $tempDir); } if (!is_readable($tempDir)) { MODXInstaller::quit('Unable to read from /temp directory'); } set_time_limit(0); $success = MODXInstaller::unZip(MODX_CORE_PATH, $source, $destination, $forcePclZip); if ($success !== true) { MODXInstaller::quit($success); } $directories = MODXInstaller::getDirectories(); $directories = MODXInstaller::normalize($directories); $sourceDir = $tempDir . '/' . MODXInstaller::getModxDir($tempDir); $sourceDir = MODXInstaller::normalize($sourceDir); MODXInstaller::copyFiles($sourceDir, $directories); unlink($source); if (!is_dir(MODX_BASE_PATH . 'setup')) { MODXInstaller::quit('File Copy Failed'); } MODXInstaller::removeFolder($tempDir, true); /* Clear cache files but not cache folder */ $path = MODX_CORE_PATH . 'cache';
public function testunZipPclZip() { $tempDir = realPath(dirname(__FILE__)) . '/temp'; MODXInstaller::removeFolder($tempDir, true); $corePath = MODX_CORE_PATH; fwrite(STDOUT, "\n Core Path: " . $corePath); $source = dirname(__FILE__) . "/modx.zip"; $forcePclZip = true; clearstatcache(); $destination = $tempDir; $success = MODXInstaller::unZip($corePath, $source, $destination, $forcePclZip); $this->assertTrue($success); $this->assertTrue(is_dir($tempDir)); $this->assertTrue(is_dir($tempDir . '/modx-2.4.1-pl/' . 'connectors')); $this->assertTrue(is_dir($tempDir . '/modx-2.4.1-pl/' . 'connectors/security')); $this->assertTrue(is_dir($tempDir . '/modx-2.4.1-pl/' . 'core')); $this->assertTrue(is_dir($tempDir . '/modx-2.4.1-pl/' . 'core/error')); $this->assertTrue(is_dir($tempDir . '/modx-2.4.1-pl/' . 'manager')); $this->assertTrue(is_dir($tempDir . '/modx-2.4.1-pl/' . 'manager/controllers')); $this->assertTrue(is_dir($tempDir . '/modx-2.4.1-pl/' . 'setup')); $this->assertTrue(is_dir($tempDir . '/modx-2.4.1-pl/' . 'setup/controllers')); }