Merge pull request #4776 from webaccess/master
[civicrm-core.git] / xml / GenCode.php
CommitLineData
6a488035
TO
1<?php
2ini_set('include_path', '.' . PATH_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'packages' . PATH_SEPARATOR . '..');
0d035206 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': $memLimit *= 1024;
9 case 'm': $memLimit *= 1024;
10 case 'k': $memLimit *= 1024;
11}
12
13if ($memLimit >= 0 and $memLimit < 536870912) {
14 ini_set('memory_limit', '512M');
15}
6a488035
TO
16date_default_timezone_set('UTC'); // avoid php warnings if timezone is not set - CRM-10844
17
18define('CIVICRM_UF', 'Drupal');
19
20require_once 'CRM/Core/ClassLoader.php';
21CRM_Core_ClassLoader::singleton()->register();
22
e39816b5
ARW
23# TODO: pull these settings from configuration
24$genCode = new CRM_Core_CodeGen_Main(
2469a0dd
TO
25 '../CRM/Core/DAO/', // $CoreDAOCodePath
26 '../sql/', // $sqlCodePath
27 '../', // $phpCodePath
28 '../templates/', // $tplCodePath
29 array('../packages/Smarty/plugins', '../CRM/Core/Smarty/plugins'), // smarty plugin dirs
30 @$argv[3], // cms
31 empty($argv[2]) ? NULL : $argv[2], // db version
32 empty($argv[1]) ? 'schema/Schema.xml' : $argv[1], // schema file
33 getenv('CIVICRM_GENCODE_DIGEST') ? getenv('CIVICRM_GENCODE_DIGEST') : NULL // path to digest file
6a488035 34);
95b00902 35$genCode->main();