Annotate generated files with the source filename
authorAdam Roses Wight <awight@wikimedia.org>
Tue, 23 Apr 2013 19:18:47 +0000 (12:18 -0700)
committerAdam Roses Wight <awight@wikimedia.org>
Tue, 23 Apr 2013 20:51:20 +0000 (13:51 -0700)
Also renamed some schema files which did not match their classnames--
there might be others.

CRM-11583

21 files changed:
xml/GenCode.php
xml/schema/Core/MessageTemplates.xml [moved from xml/schema/Core/MessageTemplate.xml with 100% similarity]
xml/schema/Core/files.xml
xml/schema/Financial/OfficialReceipt.xml [moved from xml/schema/Financial/Receipt.xml with 100% similarity]
xml/schema/Financial/files.xml
xml/schema/Standalone/OpenID/Nonce.xml [moved from xml/schema/Standalone/OpenID/Nonces.xml with 100% similarity]
xml/schema/Standalone/OpenID/files.xml
xml/templates/civicrm_acl.tpl
xml/templates/civicrm_country.tpl
xml/templates/civicrm_currency.tpl
xml/templates/civicrm_data.tpl
xml/templates/civicrm_msg_template.tpl
xml/templates/civicrm_navigation.tpl
xml/templates/civicrm_sample.tpl
xml/templates/civicrm_state_province.tpl
xml/templates/dao.tpl
xml/templates/drop.tpl
xml/templates/joomla.tpl
xml/templates/languages.tpl
xml/templates/schema.tpl
xml/templates/schema_structure.tpl

index 2306149725bdcc9bff382f42e0eae00427b338d2..2e897839a83ba4086d68821937babffe821365ed 100644 (file)
@@ -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__));
+  }
 }
index e1a4ca139a6632e4efc48606172b3c2c129edf7c..51cdfff6805b1ec2b6043ccfad4db966c1616bd5 100644 (file)
@@ -27,7 +27,7 @@
   <xi:include href="Mapping.xml"              parse="xml" />
   <xi:include href="MappingField.xml"         parse="xml" />
   <xi:include href="Menu.xml"                 parse="xml" />
-  <xi:include href="MessageTemplate.xml"      parse="xml" />
+  <xi:include href="MessageTemplates.xml"     parse="xml" />
   <xi:include href="Navigation.xml"           parse="xml" />
   <xi:include href="Note.xml"                 parse="xml" />
   <xi:include href="OptionGroup.xml"          parse="xml" />
index 50c460b174e013a28f4582b4ab487494f12dd32f..fb32d7c449c8bbb72dd12d0acb7b180ef5f83895 100644 (file)
@@ -7,7 +7,7 @@
 <xi:include href="FinancialTrxn.xml"        parse="xml" />
 <xi:include href="PaymentProcessor.xml"     parse="xml" />
 <xi:include href="PaymentProcessorType.xml" parse="xml" />
-<xi:include href="Receipt.xml"              parse="xml" />
+<xi:include href="OfficialReceipt.xml"      parse="xml" />
 <xi:include href="FinancialType.xml"          parse="xml" />
 <xi:include href="EntityFinancialAccount.xml" parse="xml" />
 <xi:include href="FinancialItem.xml"          parse="xml" />
index 641ad8b2f21e0052912d98481619219daf1d4b5c..a1ae573cdf1c8398c3f4383c1cb7112e0e2b13c0 100644 (file)
@@ -2,6 +2,6 @@
 
 <tables xmlns:xi="http://www.w3.org/2001/XInclude">
 
-<xi:include href="Nonces.xml"         parse="xml" />
+<xi:include href="Nonce.xml"          parse="xml" />
 <xi:include href="Associations.xml"   parse="xml" />
 </tables>
index 8d5e8e54a41fcaa7da00ae614c11ed53712ec15f..92a24280ac3f16f33037516f98f387f2f702c741 100644 (file)
 -- | 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
index 093aa726147e9ac634707fbacc9f0943c89b8548..5b8168ce7c1b139417ce8bac63ca5b0dea679567 100644 (file)
 -- | 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 */;
 
 /*******************************************************
index 7448a98ceb9353acf1f52cefee7d4225ce7aea3b..83f6d5664d39c8f21b7691a5df8c6a235262ead1 100644 (file)
 -- | 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"),
index 67e278053bfe4fd3f0f6592e2844902542d608b5..c60f4d0266ead0bc0383a54ab1284c92fc18c516 100644 (file)
 -- | 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';
index 1048a80a98b66eeb5c39a36019875e1f93536c84..7cd13133a58f9c8b38c9ffa57e7f74db9c08a363 100644 (file)
 -- | 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(
index 9c6067cc94fad0d872dab6373955d944a66007ca..48fe22ac41b57fc5731f4f03503064c779787e64 100644 (file)
@@ -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';
 
index 18ff0ef6d389d46f26fe6dba3e3c68d15cb5317b..0ec2868fc31b0bd1f0381420cdcd15a151536797 100644 (file)
 -- | 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';
 
index 20b67ff12dc176c7c95a22b5c8e5708242ba4d3d..c00c8dc6c0ebd395bdaf0ee37b40a3711975bae6 100644 (file)
 -- | 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
index e6ec545d8db6ed25c704f6f18a206e27d566ec0f..029f0d7620750706d39cda65486245c9d6c66222 100644 (file)
@@ -30,8 +30,9 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2013
- * $Id$
  *
+ * Generated from {$table.sourceFile}
+ * {$generated}
  */
 
 require_once 'CRM/Core/DAO.php';
index 940d27acc2f150787d31a3f53daf3adade23c9d5..40609070be1f1ab9002200b5c0ac972f723b50c5 100644 (file)
 -- | 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
index 2add0409b1a7f5661d27244fccd1fb4f65ccb191..6868f62e8e339e9bfea6a3f70a0aac73dda4dfe2 100644 (file)
@@ -1,4 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!--
+    Generated from {$smarty.template}
+    {$generated}
+-->
 <extension method="upgrade" type="component" version="2.5">
   <name>CiviCRM</name>
   <creationDate>{$creationDate}</creationDate>
index 55c29c7b16c951b8b54ed522ba5d1c84d22f6b99..4ba6aef2b8f9f9381b8f73d55c0fb8c7d67061ce 100644 (file)
@@ -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
index 198947d14bb281ebba8a574dee84b26e89be7619..da2cd4cf73a103b243f03f4f0f61ab008195133a 100644 (file)
 -- | 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"}
index 20071fffb8a7cd4613cca01c6061e8b9c9119ed9..67d77c0c26368927d492b0c023ca183d4ebd94d4 100644 (file)
@@ -30,8 +30,9 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2013
- * $Id$
  *
+ * Generated from {$smarty.template}
+ * {$generated}
  */
 class CRM_Core_I18n_SchemaStructure
 {ldelim}