From: Adam Roses Wight Date: Tue, 23 Apr 2013 19:18:47 +0000 (-0700) Subject: Annotate generated files with the source filename X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=d586487623fa0aed8c796c106983c7f635dcac67;p=civicrm-core.git Annotate generated files with the source filename Also renamed some schema files which did not match their classnames-- there might be others. CRM-11583 --- diff --git a/xml/GenCode.php b/xml/GenCode.php index 2306149725..2e897839a8 100644 --- a/xml/GenCode.php +++ b/xml/GenCode.php @@ -223,7 +223,7 @@ Alternatively you can get a version of CiviCRM that matches your PHP version function generateCreateSql($database, $tables, $fileName = 'civicrm.mysql') { echo "Generating sql file\n"; - $this->smarty->clear_all_assign(); + $this->reset_smarty_assignments(); $this->smarty->assign_by_ref('database', $database); $this->smarty->assign_by_ref('tables', $tables); $dropOrder = array_reverse(array_keys($tables)); @@ -241,12 +241,12 @@ Alternatively you can get a version of CiviCRM that matches your PHP version function generateNavigation() { echo "Generating navigation file\n"; - $this->smarty->clear_all_assign(); + $this->reset_smarty_assignments(); file_put_contents($this->sqlCodePath . "civicrm_navigation.mysql", $this->smarty->fetch('civicrm_navigation.tpl')); } function generateLocalDataSql($db_version, $locales) { - $this->smarty->clear_all_assign(); + $this->reset_smarty_assignments(); global $tsLocale; $oldTsLocale = $tsLocale; @@ -277,7 +277,7 @@ Alternatively you can get a version of CiviCRM that matches your PHP version } function generateSample() { - $this->smarty->clear_all_assign(); + $this->reset_smarty_assignments(); $sample = $this->smarty->fetch('civicrm_sample.tpl'); $sample .= $this->smarty->fetch('civicrm_acl.tpl'); file_put_contents($this->sqlCodePath . 'civicrm_sample.mysql', $sample); @@ -296,11 +296,10 @@ Alternatively you can get a version of CiviCRM that matches your PHP version } function generateDAOs($tables) { - $this->smarty->clear_all_assign(); foreach (array_keys($tables) as $name) { $this->smarty->clear_all_cache(); echo "Generating $name as " . $tables[$name]['fileName'] . "\n"; - $this->smarty->clear_all_assign(); + $this->reset_smarty_assignments(); $this->smarty->assign_by_ref('table', $tables[$name]); $php = $this->smarty->fetch('dao.tpl'); @@ -347,8 +346,7 @@ Alternatively you can get a version of CiviCRM that matches your PHP version } } - $this->smarty->clear_all_cache(); - $this->smarty->clear_all_assign(); + $this->reset_smarty_assignments(); $this->smarty->assign_by_ref('columns', $columns); $this->smarty->assign_by_ref('indices', $indices); @@ -518,8 +516,10 @@ Alternatively you can get a version of CiviCRM that matches your PHP version function getTable($tableXML, &$database, &$tables) { $name = trim((string ) $tableXML->name); $klass = trim((string ) $tableXML->class); - $base = $this->value('base', $tableXML) . '/DAO/'; - $pre = str_replace('/', '_', $base); + $base = $this->value('base', $tableXML); + $sourceFile = "xml/schema/{$base}/{$klass}.xml"; + $daoPath = "{$base}/DAO/"; + $pre = str_replace('/', '_', $daoPath); $this->classNames[$name] = $pre . $klass; $localizable = FALSE; @@ -532,7 +532,8 @@ Alternatively you can get a version of CiviCRM that matches your PHP version $table = array( 'name' => $name, - 'base' => $base, + 'base' => $daoPath, + 'sourceFile' => $sourceFile, 'fileName' => $klass . '.php', 'objectName' => $klass, 'labelName' => substr($name, 8), @@ -917,4 +918,13 @@ Alternatively you can get a version of CiviCRM that matches your PHP version } return 'CRM_Utils_Type::HUGE'; } + + /** + * Clear the smarty cache and assign default values + */ + function reset_smarty_assignments() { + $this->smarty->clear_all_assign(); + $this->smarty->clear_all_cache(); + $this->smarty->assign('generated', "DO NOT EDIT. Generated by " . basename(__FILE__)); + } } diff --git a/xml/schema/Core/MessageTemplate.xml b/xml/schema/Core/MessageTemplates.xml similarity index 100% rename from xml/schema/Core/MessageTemplate.xml rename to xml/schema/Core/MessageTemplates.xml diff --git a/xml/schema/Core/files.xml b/xml/schema/Core/files.xml index e1a4ca139a..51cdfff680 100644 --- a/xml/schema/Core/files.xml +++ b/xml/schema/Core/files.xml @@ -27,7 +27,7 @@ - + diff --git a/xml/schema/Financial/Receipt.xml b/xml/schema/Financial/OfficialReceipt.xml similarity index 100% rename from xml/schema/Financial/Receipt.xml rename to xml/schema/Financial/OfficialReceipt.xml diff --git a/xml/schema/Financial/files.xml b/xml/schema/Financial/files.xml index 50c460b174..fb32d7c449 100644 --- a/xml/schema/Financial/files.xml +++ b/xml/schema/Financial/files.xml @@ -7,7 +7,7 @@ - + diff --git a/xml/schema/Standalone/OpenID/Nonces.xml b/xml/schema/Standalone/OpenID/Nonce.xml similarity index 100% rename from xml/schema/Standalone/OpenID/Nonces.xml rename to xml/schema/Standalone/OpenID/Nonce.xml diff --git a/xml/schema/Standalone/OpenID/files.xml b/xml/schema/Standalone/OpenID/files.xml index 641ad8b2f2..a1ae573cdf 100644 --- a/xml/schema/Standalone/OpenID/files.xml +++ b/xml/schema/Standalone/OpenID/files.xml @@ -2,6 +2,6 @@ - + diff --git a/xml/templates/civicrm_acl.tpl b/xml/templates/civicrm_acl.tpl index 8d5e8e54a4..92a24280ac 100644 --- a/xml/templates/civicrm_acl.tpl +++ b/xml/templates/civicrm_acl.tpl @@ -21,6 +21,10 @@ -- | GNU Affero General Public License or the licensing of CiviCRM, | -- | see the CiviCRM license FAQ at http://civicrm.org/licensing | -- +--------------------------------------------------------------------+ +-- +-- Generated from {$smarty.template} +-- {$generated} +-- -- sample acl entries -- Create ACL to edit and view contacts in all groups diff --git a/xml/templates/civicrm_country.tpl b/xml/templates/civicrm_country.tpl index 093aa72614..5b8168ce7c 100644 --- a/xml/templates/civicrm_country.tpl +++ b/xml/templates/civicrm_country.tpl @@ -21,6 +21,10 @@ -- | GNU Affero General Public License or the licensing of CiviCRM, | -- | see the CiviCRM license FAQ at http://civicrm.org/licensing | -- +--------------------------------------------------------------------+ +-- +-- Generated from {$smarty.template} +-- {$generated} +-- /*!40101 SET NAMES utf8 */; /******************************************************* diff --git a/xml/templates/civicrm_currency.tpl b/xml/templates/civicrm_currency.tpl index 7448a98ceb..83f6d5664d 100644 --- a/xml/templates/civicrm_currency.tpl +++ b/xml/templates/civicrm_currency.tpl @@ -21,6 +21,10 @@ -- | GNU Affero General Public License or the licensing of CiviCRM, | -- | see the CiviCRM license FAQ at http://civicrm.org/licensing | -- +--------------------------------------------------------------------+ +-- +-- Generated from {$smarty.template} +-- {$generated} +-- -- currencies INSERT INTO civicrm_currency (id, name, symbol, numeric_code, full_name) VALUES ( 1, "AUD", "$", "036", "Australian Dollar"), diff --git a/xml/templates/civicrm_data.tpl b/xml/templates/civicrm_data.tpl index 67e278053b..c60f4d0266 100644 --- a/xml/templates/civicrm_data.tpl +++ b/xml/templates/civicrm_data.tpl @@ -21,6 +21,10 @@ -- | GNU Affero General Public License or the licensing of CiviCRM, | -- | see the CiviCRM license FAQ at http://civicrm.org/licensing | -- +--------------------------------------------------------------------+ +-- +-- Generated from {$smarty.template} +-- {$generated} +-- -- This file provides template to civicrm_data.mysql. Inserts all base data needed for a new CiviCRM DB SET @domainName := 'Default Domain Name'; diff --git a/xml/templates/civicrm_msg_template.tpl b/xml/templates/civicrm_msg_template.tpl index 1048a80a98..7cd13133a5 100644 --- a/xml/templates/civicrm_msg_template.tpl +++ b/xml/templates/civicrm_msg_template.tpl @@ -21,6 +21,10 @@ -- | GNU Affero General Public License or the licensing of CiviCRM, | -- | see the CiviCRM license FAQ at http://civicrm.org/licensing | -- +--------------------------------------------------------------------+ +-- +-- Generated from {$smarty.template} +-- {$generated} +-- {* not sure how to define the below in Smarty, so doing it in PHP instead *} {php} $ogNames = array( diff --git a/xml/templates/civicrm_navigation.tpl b/xml/templates/civicrm_navigation.tpl index 9c6067cc94..48fe22ac41 100644 --- a/xml/templates/civicrm_navigation.tpl +++ b/xml/templates/civicrm_navigation.tpl @@ -22,6 +22,9 @@ -- | see the CiviCRM license FAQ at http://civicrm.org/licensing | -- +--------------------------------------------------------------------+ -- Navigation Menu, Preferences and Mail Settings +-- +-- Generated from {$smarty.template} +-- {$generated} SELECT @domainID := id FROM civicrm_domain where name = 'Default Domain Name'; diff --git a/xml/templates/civicrm_sample.tpl b/xml/templates/civicrm_sample.tpl index 18ff0ef6d3..0ec2868fc3 100644 --- a/xml/templates/civicrm_sample.tpl +++ b/xml/templates/civicrm_sample.tpl @@ -21,6 +21,10 @@ -- | GNU Affero General Public License or the licensing of CiviCRM, | -- | see the CiviCRM license FAQ at http://civicrm.org/licensing | -- +--------------------------------------------------------------------+ +-- +-- Generated from {$smarty.template} +-- {$generated} +-- SELECT @domainID := id FROM civicrm_domain where name = 'Default Domain Name'; diff --git a/xml/templates/civicrm_state_province.tpl b/xml/templates/civicrm_state_province.tpl index 20b67ff12d..c00c8dc6c0 100644 --- a/xml/templates/civicrm_state_province.tpl +++ b/xml/templates/civicrm_state_province.tpl @@ -21,6 +21,10 @@ -- | GNU Affero General Public License or the licensing of CiviCRM, | -- | see the CiviCRM license FAQ at http://civicrm.org/licensing | -- +--------------------------------------------------------------------+ +-- +-- Generated from {$smarty.template} +-- {$generated} +-- /*!40101 SET NAMES utf8 */; INSERT INTO civicrm_state_province (id, country_id, abbreviation, name) VALUES diff --git a/xml/templates/dao.tpl b/xml/templates/dao.tpl index e6ec545d8d..029f0d7620 100644 --- a/xml/templates/dao.tpl +++ b/xml/templates/dao.tpl @@ -30,8 +30,9 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2013 - * $Id$ * + * Generated from {$table.sourceFile} + * {$generated} */ require_once 'CRM/Core/DAO.php'; diff --git a/xml/templates/drop.tpl b/xml/templates/drop.tpl index 940d27acc2..40609070be 100644 --- a/xml/templates/drop.tpl +++ b/xml/templates/drop.tpl @@ -21,6 +21,10 @@ -- | GNU Affero General Public License or the licensing of CiviCRM, | -- | see the CiviCRM license FAQ at http://civicrm.org/licensing | -- +--------------------------------------------------------------------+ +-- +-- Generated from {$smarty.template} +-- {$generated} +-- -- /******************************************************* -- * -- * Clean up the exisiting tables diff --git a/xml/templates/joomla.tpl b/xml/templates/joomla.tpl index 2add0409b1..6868f62e8e 100644 --- a/xml/templates/joomla.tpl +++ b/xml/templates/joomla.tpl @@ -1,4 +1,8 @@ + CiviCRM {$creationDate} diff --git a/xml/templates/languages.tpl b/xml/templates/languages.tpl index 55c29c7b16..4ba6aef2b8 100644 --- a/xml/templates/languages.tpl +++ b/xml/templates/languages.tpl @@ -1,3 +1,7 @@ +-- +-- Generated from {$smarty.template} +-- {$generated} +-- -- CRM-6138 -- language list from http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes -- most common languages, according to http://en.wikipedia.org/wiki/List_of_languages_by_number_of_native_speakers enabled diff --git a/xml/templates/schema.tpl b/xml/templates/schema.tpl index 198947d14b..da2cd4cf73 100644 --- a/xml/templates/schema.tpl +++ b/xml/templates/schema.tpl @@ -21,6 +21,10 @@ -- | GNU Affero General Public License or the licensing of CiviCRM, | -- | see the CiviCRM license FAQ at http://civicrm.org/licensing | -- +--------------------------------------------------------------------+ +-- +-- Generated from {$smarty.template} +-- {$generated} +-- {$database.comments} {include file="drop.tpl"} diff --git a/xml/templates/schema_structure.tpl b/xml/templates/schema_structure.tpl index 20071fffb8..67d77c0c26 100644 --- a/xml/templates/schema_structure.tpl +++ b/xml/templates/schema_structure.tpl @@ -30,8 +30,9 @@ * * @package CRM * @copyright CiviCRM LLC (c) 2004-2013 - * $Id$ * + * Generated from {$smarty.template} + * {$generated} */ class CRM_Core_I18n_SchemaStructure {ldelim}