/** * Sets up logging to a file * * On each successive call, this will close the current log file handle * if already open. * If logging to FirePHP is enabled, it will then return true. * Otherwise, the log file will be opened using the current parameter * values * @param string $file The file name * @param string $mode The access mode (as with {@see fopen()}) * @return boolean True * @todo The result of calling fopen should be verified and be * reflected in the return value */ static function setup($file, $mode = 'a') { if (self::$log_firephp) { return true; } //no need to setup ressources, we're using firephp $suffix = ''; /*$nr = 0; while (file_exists($file.$suffix)) { $suffix = '.'.++$nr; }*/ if ($file == 'php://output') { self::$dbg_fh = fopen($file, $mode); if (self::$dbg_fh) { return true; } else { return false; } } elseif (class_exists('\\Cx\\Lib\\FileSystem\\File')) { try { self::$dbg_fh = new \Cx\Lib\FileSystem\File(ASCMS_DOCUMENT_ROOT . '/update/' . $file . $suffix); self::$dbg_fh->touch(); if (self::$dbg_fh->makeWritable()) { return true; } else { return false; } } catch (\Cx\Lib\FileSystem\FileSystemException $e) { return false; } } else { self::$dbg_fh = fopen(ASCMS_DOCUMENT_ROOT . '/update/' . $file . $suffix, $mode); if (self::$dbg_fh) { return true; } else { return false; } } }