CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • How to generate the sql from the template ?
Pages: [1]

Author Topic: How to generate the sql from the template ?  (Read 682 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
How to generate the sql from the template ?
August 14, 2010, 03:32:38 pm
Hi,

The upgrade procedure crashed on an sql nearly at the end of the procedure, restarted from the backup and did it again.

Checked in the CRM/Upgrade/Incremental, there are a handful of lines to finish the upgrade, plus 4 templates messages to add.

I would like to generate the sql (but not run it), ie. render the templates, so I can then manually run the lines I missed. Is there a way of doing that ?

I was thinking about extending drush for do it, but have no idea where to start. Would it be complicated? Do you have an easier hack to get the sql out of the template ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: How to generate the sql from the template ?
August 14, 2010, 05:00:29 pm

the template to a large extent is simple sql :) So for the short term u can render it manually

Should not be too hard to write a shell script that renders a specific template for a specific settings file.

however note that the upgrade is a combination of sql + php, so the template does not necessarily hold all the pieces of the upgrade

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: How to generate the sql from the template ?
August 14, 2010, 06:08:33 pm
Right now, quick and dirty, modified

Code: [Select]
Index: CRM/Utils/File.php
===================================================================
--- CRM/Utils/File.php (revision 29232)
+++ CRM/Utils/File.php (working copy)
@@ -235,7 +235,10 @@
 
         $string = preg_replace("/^#[^\n]*$/m", "\n", $string );
         $string = preg_replace("/^(--[^-]).*/m", "\n", $string );
-       
+       
+//XAV
+echo "\n$string\n";
+return;

Index: CRM/Upgrade/Form.php
===================================================================
--- CRM/Upgrade/Form.php (revision 29232)
+++ CRM/Upgrade/Form.php (working copy)
@@ -204,6 +204,8 @@
     }
 
     function runQuery( $query ) {
+echo "\n$query;\n";
+return;
         return CRM_Core_DAO::executeQuery( $query,
                                            CRM_Core_DAO::$_nullArray );
     }


So it echos statements online, and can see what's going on.

Thanks for the missing php updates, keeping an eye on that too.

X+

-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Upgrading CiviCRM (Moderator: Deepak Srivastava) »
  • How to generate the sql from the template ?

This forum was archived on 2017-11-26.