Don't save highlithing errors to cache

Summary:
If I have Pygments enabled in config but `pygmentize` doesn't work then unhighlighted source is stored to cache.
If I later make `pygmentize` work then the unhighlighted source is still loaded from the cache.

Test Plan:
Break `pygmentize`.
View a diff with JS files.
Fix `pygmenize`.
View the diff again.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, gatos99, Koolvin

Differential Revision: https://secure.phabricator.com/D2227
This commit is contained in:
vrana
2012-04-12 23:52:50 -07:00
parent 1f1c7a34b7
commit 74cdad29d0
3 changed files with 26 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
<?php
/*
* Copyright 2011 Facebook, Inc.
* Copyright 2012 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,12 +39,12 @@ final class PhabricatorSyntaxHighlighter {
public static function highlightWithFilename($filename, $source) {
$engine = self::newEngine();
$language = $engine->getLanguageFromFilename($filename);
return $engine->getHighlightFuture($language, $source)->resolve();
return $engine->highlightSource($language, $source);
}
public static function highlightWithLanguage($language, $source) {
$engine = self::newEngine();
return $engine->getHighlightFuture($language, $source)->resolve();
return $engine->highlightSource($language, $source);
}