* @param $sqlCodePath
* @param $phpCodePath
* @param $tplCodePath
- * @param $smartyPluginDirs
+ * @param $IGNORE
* @param $argCms
* @param $argVersion
* @param $schemaPath
* @param $digestPath
*/
- public function __construct($CoreDAOCodePath, $sqlCodePath, $phpCodePath, $tplCodePath, $smartyPluginDirs, $argCms, $argVersion, $schemaPath, $digestPath) {
+ public function __construct($CoreDAOCodePath, $sqlCodePath, $phpCodePath, $tplCodePath, $IGNORE, $argCms, $argVersion, $schemaPath, $digestPath) {
$this->CoreDAOCodePath = $CoreDAOCodePath;
$this->sqlCodePath = $sqlCodePath;
$this->phpCodePath = $phpCodePath;
// default cms is 'drupal', if not specified
$this->cms = isset($argCms) ? strtolower($argCms) : 'drupal';
- CRM_Core_CodeGen_Util_Smarty::singleton()->setPluginDirs($smartyPluginDirs);
-
$versionFile = $this->phpCodePath . "/xml/version.xml";
$versionXML = CRM_Core_CodeGen_Util_Xml::parse($versionFile);
$this->db_version = $versionXML->version_no;
return self::$singleton;
}
- private $smartyPluginDirs = array();
-
private $compileDir;
public function __destruct() {
}
}
- /**
- * Set plugin directories.
- *
- * @param array $pluginDirs
- */
- public function setPluginDirs($pluginDirs) {
- $this->smartyPluginDirs = $pluginDirs;
- }
-
/**
* Get templates_c directory.
*
* @return \Smarty
*/
public function createSmarty() {
+ $base = dirname(dirname(dirname(dirname(__DIR__))));
+
require_once 'Smarty/Smarty.class.php';
$smarty = new Smarty();
- $smarty->template_dir = './templates';
- $smarty->plugins_dir = $this->smartyPluginDirs;
+ $smarty->template_dir = "$base/xml/templates";
+ $smarty->plugins_dir = array("$base/packages/Smarty/plugins", "$base/CRM/Core/Smarty/plugins");
$smarty->compile_dir = $this->getCompileDir();
$smarty->clear_all_cache();
}
}
+ public function fetch($infile) {
+ return $this->smarty->fetch($infile);
+ }
+
/**
* @param $key
* @param $value
$tasks = $this->findTasks('CRM_Core_CodeGen_DAO');
$names = array();
foreach ($tasks as $task) {
+ /** @var CRM_Core_CodeGen_DAO $task */
$names[] = $task->name;
$this->assertFalse($task->needsUpdate(), "Expect DAO for {$task->name} is up-to-date");
}
$path . '/sql/', // $sqlCodePath
$path . '/', // $phpCodePath
$path . '/templates/', // $tplCodePath
- array(
- // smarty plugin dirs
- $path . '/packages/Smarty/plugins',
- $path . '/CRM/Core/Smarty/plugins',
- ),
+ NULL, // IGNORE,
CIVICRM_UF, // cms
NULL, // db version
$path . '/xml/schema/Schema.xml', // schema file
'../sql/', // $sqlCodePath
'../', // $phpCodePath
'../templates/', // $tplCodePath
- array('../packages/Smarty/plugins', '../CRM/Core/Smarty/plugins'), // smarty plugin dirs
+ NULL, // IGNORE
@$argv[3], // cms
empty($argv[2]) ? NULL : $argv[2], // db version
empty($argv[1]) ? 'schema/Schema.xml' : $argv[1], // schema file