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-2011 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/modulebuilder/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
72 function getPackage ($name)
74 if (! empty ( $this->packages [ $name ] ))
75 return $this->packages [ $name ] ;
76 $this->packages [ $name ] = new MBPackage ( $name ) ;
79 function getPackageKey ($name)
81 $manifestPath = MB_PACKAGE_PATH . '/' . $name . '/manifest.php' ;
82 if (file_exists ( $manifestPath ))
84 require( $manifestPath ) ;
86 return $manifest['key'];
91 function &getPackageModule ($package , $module)
93 $this->getPackage ( $package ) ;
94 $this->packages [ $package ]->getModule ( $module ) ;
95 return $this->packages [ $package ]->modules [ $module ] ;
100 $packages = array_keys ( $this->packages ) ;
101 foreach ( $packages as $package )
103 $this->packages [ $package ]->save () ;
109 $packages = array_keys ( $this->packages ) ;
110 foreach ( $packages as $package )
112 if (count ( $packages ) == 1)
114 $this->packages [ $package ]->build ( true ) ;
117 $this->packages [ $package ]->build ( false ) ;
122 function getPackages ()
124 if (empty ( $this->packages ))
126 $list = $this->getPackageList () ;
127 foreach ( $list as $package )
129 if (! empty ( $this->packages [ $package ] ))
131 $this->packages [ $package ] = new MBPackage ( $package ) ;
138 $this->getPackages () ;
140 foreach ( array_keys ( $this->packages ) as $name )
142 $nodes [] = $this->packages [ $name ]->getNodes () ;