protected function tearDown() { if (file_exists($this->resultFile)) { @unLink($this->resultFile); } unset($this->configFile, $this->resultFile, $this->routesFile, $this->config); }
public function clean(\Nano\TestUtils\TestCase $test, $dir, $fullPath = false) { if (false === $fullPath) { $dir = $this->get($test, $dir); } if (!file_exists($dir)) { mkDir($dir, 0755, true); return true; } $i = new \DirectoryIterator($dir); $result = true; foreach ($i as $file) { /** @var \DirectoryIterator $file */ if ($file->isDot()) { continue; } if (self::EMPTY_FILE == $file->getBaseName()) { $result = false; continue; } if ($file->isDir()) { if ($this->clean($test, $file->getPathName(), true)) { rmDir($file->getPathName()); } continue; } unLink($file->getPathName()); } unset($i, $file); return $result; }
/** * @return boolean */ public function clean() { if (null === $this->destination) { return false; } if (file_exists($this->destination . DS . \Nano\Application\Config::CONFIG_FILE_NAME)) { unLink($this->destination . DS . \Nano\Application\Config::CONFIG_FILE_NAME); } if (file_exists($this->destination . DS . \Nano\Application\Config::ROUTES_FILE_NAME)) { unLink($this->destination . DS . \Nano\Application\Config::ROUTES_FILE_NAME); } return true; }
function gif_outputAsJpeg($gif, $lpszFileName, $bgColor = -1) { if (gif_outputAsBmp($gif, "{$lpszFileName}.bmp", $gbColor)) { exec("cjpeg {$lpszFileName}.bmp >{$lpszFileName} 2>/dev/null"); @unLink("{$lpszFileName}.bmp"); if (@file_exists($lpszFileName)) { if (@fileSize($lpszFileName) > 0) { return true; } @unLink($lpszFileName); } } return false; }
function gif_outputAsJpeg($gif, $lpszFileName, $bgColor = -1) { // JPEG output that does not require cjpeg added by James Heinrich <*****@*****.**> - December 10, 2003 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN' && (file_exists('/usr/local/bin/cjpeg') || `which cjpeg`)) { if (gif_outputAsBmp($gif, $lpszFileName . '.bmp', $bgColor)) { exec('cjpeg ' . $lpszFileName . '.bmp >' . $lpszFileName . ' 2>/dev/null'); @unLink($lpszFileName . '.bmp'); if (@file_exists($lpszFileName)) { if (@fileSize($lpszFileName) > 0) { return true; } @unLink($lpszFileName); } } } else { // either Windows, or cjpeg not found in path if ($img = @ImageCreateFromString($gif->getPng($bgColor))) { if (@ImageJPEG($img, $lpszFileName)) { return true; } } } return false; }
/** * Clears log file * * @return void */ public function clear() { if (file_exists($this->getFile())) { unLink($this->getFile()); } }