root/vtigercrm/branches/4.2/extractSchema.php

Revision 3914, 2.9 kB (checked in by mfedyk, 5 years ago)

add file to extract adodb XML schema from database, from mikecrowe

Line 
1 <?php
2 /*********************************************************************************
3  * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
4  * ("License"); You may not use this file except in compliance with the
5  * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
6  * Software distributed under the License is distributed on an  "AS IS"  basis,
7  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
8  * the specific language governing rights and limitations under the License.
9  * The Original Code is: SugarCRM Open Source
10  * The Initial Developer of the Original Code is SugarCRM, Inc.
11  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
12  * All Rights Reserved.
13  * Contributor(s): ______________________________________.
14  ********************************************************************************/
15 /*********************************************************************************
16  * $Header: /advent/projects/wesat/vtiger_crm/sugarcrm/install/5createTables.php,v 1.58 2005/04/19 16:57:08 ray Exp $
17  * Description:  Executes a step in the installation process.
18  ********************************************************************************/
19
20 set_time_limit(600);
21
22 require_once('include/database/PearDatabase.php');
23 require_once('include/logging.php');
24 require_once('modules/Leads/Lead.php');
25 require_once('modules/Settings/FileStorage.php');
26 //require_once('modules/imports/Headers.php');
27 require_once('modules/Contacts/Contact.php');
28 require_once('modules/Accounts/Account.php');
29 require_once('modules/Potentials/Opportunity.php');
30 require_once('modules/Activities/Activity.php');
31 require_once('modules/Notes/Note.php');
32 require_once('modules/Emails/Email.php');
33 require_once('modules/Users/User.php');
34 require_once('modules/Import/SugarFile.php');
35 require_once('modules/Import/ImportMap.php');
36 require_once('modules/Import/UsersLastImport.php');
37 require_once('modules/Users/TabMenu.php');
38 require_once('modules/Users/LoginHistory.php');
39 require_once('modules/Settings/FileStorage.php');
40 require_once('data/Tracker.php');
41 require_once('include/utils.php');
42 require_once('modules/Users/Security.php');
43
44 // load the config_override.php file to provide default user settings
45 if (is_file("config_override.php")) {
46     require_once("config_override.php");
47 }
48 require_once('config.php');
49
50 $conn = ADONewConnection($dbconfig['db_type']);
51 $conn->Connect(
52     $dbconfig['db_hostname'],
53     $dbconfig['db_username'],
54     $dbconfig['db_password'],
55     $dbconfig['db_name']);
56
57
58 $schema = new adoSchema( $conn );
59 $schema->XMLS_DEBUG = true;
60
61 //Get schema without data
62 $xmlresult = $schema->ExtractSchema(false);
63 header("content-type: text/plain");
64 #echo "abcd";
65
66 if (!$schemaFile = fopen("schema/DatabaseSchema.xml", w)) {
67     echo "Cannot open file ($filename)";
68     exit;
69 }
70
71 if (fwrite($schemaFile, $xmlresult) === FALSE) {
72     echo "Cannot write to file ($schemaFile)";
73     exit;
74 }
75
76 echo $xmlresult;
77
Note: See TracBrowser for help on using the browser.