protected function __construct($name, $dir, $dirTmp) { set_time_limit(0); if (!is_dir($dir)) { trigger_error(__METHOD__ . " invalid directory '{$dir}'", E_USER_ERROR); } if (substr($dirTmp, -1) != '/') { $dirTmp .= '/'; } if (!is_dir($dirTmp)) { mkdir($dirTmp); } $this->count = 0; $this->name = $name; $this->logFname = $dir . $name . '.log'; $this->dirTmp = $dirTmp; $this->cookiejarFname = $this->dirTmp . "{$name}.cookiejar"; self::$curlCmd = trim(`which curl`); // delete stashed pages if (self::SAVE_PAGES) { $files = glob($this->dirTmp . "{$this->name}-*"); foreach ($files as $file) { @unlink($file); funx::debug("Removed: '{$file}'"); } } }