| 2 | | /* |
| 3 | | $Rev: 265 $ | $LastChangedBy: brieb $ |
| 4 | | $LastChangedDate: 2007-08-13 21:33:23 -0600 (Mon, 13 Aug 2007) $ |
| 5 | | +-------------------------------------------------------------------------+ |
| 6 | | | Copyright (c) 2004 - 2007, Kreotek LLC | |
| 7 | | | All rights reserved. | |
| 8 | | +-------------------------------------------------------------------------+ |
| 9 | | | | |
| 10 | | | Redistribution and use in source and binary forms, with or without | |
| 11 | | | modification, are permitted provided that the following conditions are | |
| 12 | | | met: | |
| 13 | | | | |
| 14 | | | - Redistributions of source code must retain the above copyright | |
| 15 | | | notice, this list of conditions and the following disclaimer. | |
| 16 | | | | |
| 17 | | | - Redistributions in binary form must reproduce the above copyright | |
| 18 | | | notice, this list of conditions and the following disclaimer in the | |
| 19 | | | documentation and/or other materials provided with the distribution. | |
| 20 | | | | |
| 21 | | | - Neither the name of Kreotek LLC nor the names of its contributore may | |
| 22 | | | be used to endorse or promote products derived from this software | |
| 23 | | | without specific prior written permission. | |
| 24 | | | | |
| 25 | | | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
| 26 | | | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
| 27 | | | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | |
| 28 | | | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
| 29 | | | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 30 | | | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 31 | | | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 32 | | | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 33 | | | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 34 | | | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 35 | | | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 36 | | | | |
| 37 | | +-------------------------------------------------------------------------+ |
| 38 | | */ |
| 39 | | error_reporting(E_ALL); |
| 40 | | define("APP_DEBUG",false); |
| 41 | | define("noStartup",true); |
| 42 | | include("../../../install/install_include.php"); |
| 43 | | include("../../../include/session.php"); |
| | 2 | // The install proceess is typically simple, but if you have some complex |
| | 3 | // installation procedures not covered by the installModuleAjax (located in the |
| | 4 | // main install/installajax.php file) You can override the class. |
| | 5 | // |
| | 6 | // Just make sure your class has an 'install' method, and spits back JSON paired |
| | 7 | // results |
| 62 | | |
| 63 | | // ENTER YOUR MODULE NAME HERE |
| 64 | | $thereturn = "Business Management System Installation\n"; |
| 65 | | $thereturn .= "_______________________________________\n"; |
| 66 | | |
| 67 | | //MAKE SURE THERE IS A createtables.sql FILE |
| 68 | | //which houses all your SQL create statements |
| 69 | | // for any tables you will create. |
| 70 | | $tempreturn = createTables($db,"createtables.sql"); |
| 71 | | |
| 72 | | if($tempreturn === true){ |
| 73 | | |
| 74 | | $thereturn.= "Done Creating Tables \n"; |
| 75 | | |
| 76 | | |
| 77 | | // NEXT, DEFINE AN ARRAY OF TABLE NAMES |
| 78 | | // for any tables that need initial data populated. (including existing tables) |
| 79 | | // for each table, make sure there |
| 80 | | // is a corresponding SQL file |
| 81 | | // with insert statements for all the records needing to be imported |
| 82 | | $tables = array( |
| 83 | | "choices", |
| 84 | | "menu", |
| 85 | | "tabs", |
| 86 | | "modules", |
| 87 | | "relationships", |
| 88 | | "reports", |
| 89 | | "tablecolumns", |
| 90 | | "tabledefs", |
| 91 | | "tablefindoptions", |
| 92 | | "tableoptions", |
| 93 | | "tablesearchablefields", |
| 94 | | "usersearches", |
| 95 | | "settings", |
| 96 | | "shippingmethods", |
| 97 | | "paymentmethods", |
| 98 | | "invoicestatuses", |
| 99 | | ); |
| 100 | | foreach($tables as $table){ |
| 101 | | |
| 102 | | $failure = false; |
| 103 | | $tempreturn = importData($db,$table); |
| 104 | | $thereturn .= $tempreturn; |
| 105 | | if(!strpos($tempreturn,"complete.") === false){ |
| 106 | | $failed = true; |
| 107 | | } |
| 108 | | |
| 109 | | }//end foreach |
| 110 | | |
| 111 | | |
| 112 | | //MAKE SURE TO set the done message for your module. |
| 113 | | if(!$failure){ |
| 114 | | $thereturn .= "________________________\n"; |
| 115 | | $thereturn .= "Done Installing BMS Data\n"; |
| 116 | | } |
| 117 | | } else |
| 118 | | $thereturn = $tempreturn; |
| 119 | | } |
| 120 | | } |
| 121 | | } else |
| 122 | | $thereturn = "Could not access settings.php"; |
| 123 | | |
| 124 | | |
| 125 | | header('Content-Type: text/xml'); |
| 126 | | ?><?php echo '<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>'; ?> |
| 127 | | <response><?php echo $thereturn?></response> |
| | 32 | ?> |