You are here

function Smarty::_is_compiled in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/lib/smarty/Smarty.class.php \Smarty::_is_compiled()

test if resource needs compiling

Parameters

string $resource_name:

string $compile_path:

Return value

boolean

2 calls to Smarty::_is_compiled()
Smarty::fetch in includes/moodle/lib/smarty/Smarty.class.php
executes & returns or displays the template results
Smarty::_smarty_include in includes/moodle/lib/smarty/Smarty.class.php

File

includes/moodle/lib/smarty/Smarty.class.php, line 1372

Class

Smarty
@package Smarty

Code

function _is_compiled($resource_name, $compile_path) {
  if (!$this->force_compile && file_exists($compile_path)) {
    if (!$this->compile_check) {

      // no need to check compiled file
      return true;
    }
    else {

      // get file source and timestamp
      $_params = array(
        'resource_name' => $resource_name,
        'get_source' => false,
      );
      if (!$this
        ->_fetch_resource_info($_params)) {
        return false;
      }
      if ($_params['resource_timestamp'] <= filemtime($compile_path)) {

        // template not expired, no recompile
        return true;
      }
      else {

        // compile template
        return false;
      }
    }
  }
  else {

    // compiled template does not exist, or forced compile
    return false;
  }
}