Merge remote-tracking branch 'upstream/4.6' into 4.6-master-2015-10-07-14-23-03
[civicrm-core.git] / xml / GenCode.php
... / ...
CommitLineData
1<?php
2ini_set('include_path', '.' . PATH_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'packages' . PATH_SEPARATOR . '..');
3// make sure the memory_limit is at least 512 MB
4$memLimitString = trim(ini_get('memory_limit'));
5$memLimitUnit = strtolower(substr($memLimitString, -1));
6$memLimit = (int) $memLimitString;
7switch ($memLimitUnit) {
8 case 'g':
9 $memLimit *= 1024;
10 case 'm':
11 $memLimit *= 1024;
12 case 'k':
13 $memLimit *= 1024;
14}
15
16if ($memLimit >= 0 and $memLimit < 536870912) {
17 ini_set('memory_limit', '512M');
18}
19date_default_timezone_set('UTC'); // avoid php warnings if timezone is not set - CRM-10844
20
21define('CIVICRM_UF', 'Drupal');
22define('CIVICRM_UF_BASEURL', '/');
23
24require_once 'CRM/Core/ClassLoader.php';
25CRM_Core_ClassLoader::singleton()->register();
26
27# TODO: pull these settings from configuration
28$genCode = new CRM_Core_CodeGen_Main(
29 '../CRM/Core/DAO/', // $CoreDAOCodePath
30 '../sql/', // $sqlCodePath
31 '../', // $phpCodePath
32 '../templates/', // $tplCodePath
33 array('../packages/Smarty/plugins', '../CRM/Core/Smarty/plugins'), // smarty plugin dirs
34 @$argv[3], // cms
35 empty($argv[2]) ? NULL : $argv[2], // db version
36 empty($argv[1]) ? 'schema/Schema.xml' : $argv[1], // schema file
37 getenv('CIVICRM_GENCODE_DIGEST') ? getenv('CIVICRM_GENCODE_DIGEST') : NULL // path to digest file
38);
39$genCode->main();