2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM Community Edition is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
38 /*********************************************************************************
40 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
41 * All Rights Reserved.
42 * Contributor(s): ______________________________________..
43 ********************************************************************************/
46 define ( 'MB_PACKAGE_PATH', 'custom/modulebuilder/packages' ) ;
47 define('MB_PACKAGE_BUILD', 'custom' . DIRECTORY_SEPARATOR . 'modulebuilder' . DIRECTORY_SEPARATOR . 'builds');
48 require_once ('modules/ModuleBuilder/MB/MBPackage.php') ;
52 var $packages = array ( ) ;
54 function getPackageList ()
56 static $list = array ( ) ;
57 if (! empty ( $list ) || ! file_exists ( MB_PACKAGE_PATH ))
59 $d = dir ( MB_PACKAGE_PATH ) ;
60 while ( $e = $d->read () )
62 if (file_exists ( MB_PACKAGE_PATH . '/' . $e . '/manifest.php' ))
67 sort ( $list ) ; // order important as generate_nodes_array in Tree.php later loops over this by foreach to generate the package list
76 function getPackage ($name)
78 if (empty ( $this->packages [ $name ] ))
79 $this->packages [ $name ] = new MBPackage ( $name ) ;
81 return $this->packages [ $name ] ;
84 function getPackageKey ($name)
86 $manifestPath = MB_PACKAGE_PATH . '/' . $name . '/manifest.php' ;
87 if (file_exists ( $manifestPath ))
89 require( $manifestPath ) ;
91 return $manifest['key'];
96 function &getPackageModule ($package , $module)
98 $this->getPackage ( $package ) ;
99 $this->packages [ $package ]->getModule ( $module ) ;
100 return $this->packages [ $package ]->modules [ $module ] ;
105 $packages = array_keys ( $this->packages ) ;
106 foreach ( $packages as $package )
108 $this->packages [ $package ]->save () ;
114 $packages = array_keys ( $this->packages ) ;
115 foreach ( $packages as $package )
117 if (count ( $packages ) == 1)
119 $this->packages [ $package ]->build ( true ) ;
122 $this->packages [ $package ]->build ( false ) ;
127 function getPackages ()
129 if (empty ( $this->packages ))
131 $list = $this->getPackageList () ;
132 foreach ( $list as $package )
134 if (! empty ( $this->packages [ $package ] ))
136 $this->packages [ $package ] = new MBPackage ( $package ) ;
143 $this->getPackages () ;
145 foreach ( array_keys ( $this->packages ) as $name )
147 $nodes [] = $this->packages [ $name ]->getNodes () ;