/**
* Clear out any cache files.
+ *
+ * @param bool $removeDir Should folder itself be removed too.
*/
- public function clear() {
- \CRM_Utils_File::cleanDir($this->getCachePath());
+ public function clear($removeDir = TRUE) {
+ \CRM_Utils_File::cleanDir($this->getCachePath(), $removeDir);
}
/**
public static function pageRun() {
// Beg your pardon, sir. Please may I have an HTTP response class instead?
$asset = self::pageRender($_GET);
- if (function_exists('http_response_code')) {
- // PHP 5.4+
- http_response_code($asset['statusCode']);
- }
- else {
- header('X-PHP-Response-Code: ' . $asset['statusCode'], TRUE, $asset['statusCode']);
- }
-
- header('Content-Type: ' . $asset['mimeType']);
- echo $asset['content'];
- \CRM_Utils_System::civiExit();
+ \CRM_Utils_System::sendResponse(new \GuzzleHttp\Psr7\Response($asset['statusCode'], ['Content-Type' => $asset['mimeType']], $asset['content']));
}
/**