summaryrefslogtreecommitdiffstats
path: root/application/models
diff options
context:
space:
mode:
Diffstat (limited to 'application/models')
-rw-r--r--application/models/mfile.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/application/models/mfile.php b/application/models/mfile.php
index e298850a5..10daba3af 100644
--- a/application/models/mfile.php
+++ b/application/models/mfile.php
@@ -199,6 +199,27 @@ class Mfile extends CI_Model {
return true;
}
+ public function get_lexers() {
+ $this->load->library("MemcacheLibrary");
+ if (! $lexers = $this->memcachelibrary->get('lexers')) {
+ $lexers = array();
+ $last_desc = "";
+ exec("python ".escapeshellarg(FCPATH."scripts/get_lexer_list.py"), $output);
+
+ foreach ($output as $line) {
+ list($name, $desc) = explode("|", $line);
+ if ($desc == $last_desc) {
+ continue;
+ }
+ $last_desc = $desc;
+ $lexers[$name] = $desc;
+ }
+ $this->memcachelibrary->set('lexers', $lexers, 1800);
+ }
+
+ return $lexers;
+ }
+
function should_highlight($type)
{
if ($this->mime2lexer($type)) return true;