2 /*********************************************************************************
3 * SugarCRM Community Edition is a customer relationship management program developed by
4 * SugarCRM, Inc. Copyright (C) 2004-2012 SugarCRM Inc.
6 * This program is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU Affero General Public License version 3 as published by the
8 * Free Software Foundation with the addition of the following permission added
9 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
10 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
11 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
18 * You should have received a copy of the GNU Affero General Public License along with
19 * this program; if not, see http://www.gnu.org/licenses or write to the Free
20 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
24 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
26 * The interactive user interfaces in modified source and object code versions
27 * of this program must display Appropriate Legal Notices, as required under
28 * Section 5 of the GNU Affero General Public License version 3.
30 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
31 * these Appropriate Legal Notices must retain the display of the "Powered by
32 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
33 * technical reasons, the Appropriate Legal Notices must display the words
34 * "Powered by SugarCRM".
35 ********************************************************************************/
37 require_once('modules/ModuleBuilder/MB/MBModule.php');
41 var $is_uninstallable = true;
42 var $description = '';
43 var $has_images = true;
44 var $modules = array();
45 var $date_modified = '';
49 function MBPackage($name){
54 function loadModules($force=false){
55 if(!file_exists(MB_PACKAGE_PATH . '/' . $this->name .'/modules'))return;
56 $d = dir(MB_PACKAGE_PATH . '/' . $this->name .'/modules');
57 while($e = $d->read()){
58 if(substr($e, 0, 1) != '.' && is_dir(MB_PACKAGE_PATH . '/'. $this->name. '/modules/' . $e)){
59 $this->getModule($e, $force);
65 * Loads the translated module titles from the selected language into.
66 * Will override currently loaded string to reflect undeployed label changes.
69 * @param $languge String language identifyer
71 function loadModuleTitles($languge = '')
75 $language = $GLOBALS['current_language'];
77 global $app_list_strings;
78 $packLangFilePath = $this->getPackageDir() . "/language/application/" . $language . ".lang.php";
79 if (file_exists($packLangFilePath))
82 require($packLangFilePath);
91 function getModule($name, $force=true){
92 if(!$force && !empty($this->modules[$name]))
93 return $this->modules[$name];
95 $path = $this->getPackageDir();
96 $this->modules[$name] = new MBModule($name, $path, $this->name, $this->key);
98 return $this->modules[$name];
102 * Returns an MBModule by the given full name (package key + module name)
103 * if it exists in this package
105 * @param string $name
108 public function getModuleByFullName($name){
109 foreach($this->modules as $mname => $module) {
110 if ($this->key . "_" . $mname == $name)
115 function deleteModule($name){
116 $this->modules[$name]->delete();
117 unset($this->modules[$name]);
120 function getManifest($version_specific = false, $for_export = false){
121 //If we are exporting the package, we must ensure a different install key
122 $pre = $for_export ? MB_EXPORTPREPEND : "";
123 $date = TimeDate::getInstance()->nowDb();
125 $this->description = to_html($this->description);
126 $is_uninstallable = ($this->is_uninstallable ? true : false);
127 if($GLOBALS['sugar_flavor'] == 'CE') {
128 $flavors = array('CE','PRO','ENT');
130 $flavors = array($GLOBALS['sugar_flavor']);
132 $version = (!empty($version_specific))?$GLOBALS['sugar_version']:'';
134 // Build an array and use var_export to build this file
136 array('acceptable_sugar_versions' => array($version)),
137 array('acceptable_sugar_flavors' => $flavors),
138 'readme' => $this->readme,
140 'author' => $this->author,
141 'description' => $this->description,
143 'is_uninstallable' => $is_uninstallable,
144 'name' => $pre.$this->name,
145 'published_date' => $date,
148 'remove_tables' => 'prompt',
153 $header = file_get_contents('modules/ModuleBuilder/MB/header.php');
155 return $header."\n// THIS CONTENT IS GENERATED BY MBPackage.php\n".'$manifest = '.var_export_helper($manifest).";\n\n";
160 'acceptable_sugar_versions' =>
164 'acceptable_sugar_flavors' =>
168 'readme'=>'$this->readme',
170 'author' => '$this->author',
171 'description' => '$this->description',
173 'is_uninstallable' => $is_uninstallable,
174 'name' => '$pre$this->name',
175 'published_date' => '$date',
177 'version' => '$time',
178 'remove_tables' => 'prompt',
184 function buildInstall($path){
185 $installdefs = array ('id' => $this->name,
187 'layoutdefs'=>array(),
188 'relationships'=>array(),
190 if($this->has_images){
191 $installdefs['image_dir'] = '<basepath>/icons';
193 foreach(array_keys($this->modules) as $module){
194 $this->modules[$module]->build($path);
195 $this->modules[$module]->addInstallDefs($installdefs);
197 $this->path = $this->getPackageDir();
198 if(file_exists($this->path . '/language')){
199 $d= dir($this->path . '/language');
200 while($e = $d->read()){
201 $lang_path = $this->path .'/language/' . $e;
202 if(substr($e, 0, 1) != '.' && is_dir($lang_path)){
203 $f = dir($lang_path);
204 while($g = $f->read()){
205 if(substr($g, 0, 1) != '.' && is_file($lang_path.'/'. $g)){
206 $lang = substr($g, 0, strpos($g, '.'));
207 $installdefs['language'][] = array(
208 'from'=> '<basepath>/SugarModules/language/'.$e . '/'. $g,
217 copy_recursive( $this->path . '/language/', $path . '/language/');
218 $icon_path = $path . '/../icons/default/images/';
219 mkdir_recursive($icon_path);
220 copy_recursive($this->path . '/icons/', $icon_path);
222 return "\n".'$installdefs = ' . var_export_helper($installdefs). ';';
226 function getPackageDir(){
227 return MB_PACKAGE_PATH . '/' . $this->name;
230 function getBuildDir(){
231 return MB_PACKAGE_BUILD . '/' . $this->name;
234 function getZipDir(){
235 return $this->getPackageDir() . '/zips';
240 $path = $this->getPackageDir();
241 if(file_exists($path .'/manifest.php')){
242 require($path . '/manifest.php');
243 if(!empty($manifest)){
244 $this->date_modified = $manifest['published_date'];
245 $this->is_uninstallable = $manifest['is_uninstallable'];
246 $this->author = $manifest['author'];
247 $this->key = $manifest['key'];
248 $this->description = $manifest['description'];
249 if(!empty($manifest['readme']))
250 $this->readme = $manifest['readme'];
253 $this->loadModules(true);
257 $path = $this->getPackageDir();
258 if(mkdir_recursive($path)){
259 //Save all the modules when we save a package
260 $this->updateModulesMetaData(true);
261 sugar_file_put_contents_atomic($path .'/manifest.php', $this->getManifest());
265 function build($export=true, $clean = false){
266 $this->loadModules();
267 require_once('include/utils/zip_utils.php');
268 $package_path = $this->getPackageDir();
269 $path = $this->getBuildDir() . '/SugarModules';
270 if($clean && file_exists($path))rmdir_recursive($path);
271 if(mkdir_recursive($path)){
273 $manifest = $this->getManifest().$this->buildInstall($path);
274 $fp = sugar_fopen($this->getBuildDir() .'/manifest.php', 'w');
275 fwrite($fp, $manifest);
279 if(file_exists('modules/ModuleBuilder/MB/LICENSE.txt')){
280 copy('modules/ModuleBuilder/MB/LICENSE.txt', $this->getBuildDir() . '/LICENSE.txt');
281 }else if(file_exists('LICENSE.txt')){
282 copy('LICENSE.txt', $this->getBuildDir() . '/LICENSE.txt');
284 $package_dir = $this->getPackageDir();
285 $date = date('Y_m_d_His');
286 $zipDir = $this->getZipDir();
287 if(!file_exists($zipDir))mkdir_recursive($zipDir);
289 chdir($this->getBuildDir());
290 zip_dir('.',$cwd . '/'. $zipDir. '/'. $this->name. $date. '.zip');
293 header('Location:' . $zipDir. '/'. $this->name. $date. '.zip');
296 'zip'=>$zipDir. '/'. $this->name. $date. '.zip',
297 'manifest'=>$this->getBuildDir(). '/manifest.php',
298 'name'=>$this->name. $date,
304 $this->loadModules();
305 $node = array('name'=>$this->name, 'action'=>'module=ModuleBuilder&action=package&package=' . $this->name, 'children'=>array());
306 foreach(array_keys($this->modules) as $module){
307 $node['children'][] = $this->modules[$module]->getNodes();
312 function populateFromPost(){
313 $this->description = trim($_REQUEST['description']);
314 $this->author = trim($_REQUEST['author']);
315 $this->key = trim($_REQUEST['key']);
316 $this->readme = trim($_REQUEST['readme']);
319 function rename($new_name){
320 $old= $this->getPackageDir();
321 $this->name = $new_name;
322 $new = $this->getPackageDir();
323 if(file_exists($new)){
326 if(rename($old, $new)){
333 function updateModulesMetaData($save=false){
334 foreach(array_keys($this->modules) as $module){
335 $old_name = $this->modules[$module]->key_name;
336 $this->modules[$module]->key_name = $this->key . '_' . $this->modules[$module]->name;
337 $this->modules[$module]->renameMetaData($this->modules[$module]->getModuleDir(), $old_name);
338 $this->modules[$module]->renameLanguageFiles($this->modules[$module]->getModuleDir());
339 if($save)$this->modules[$module]->save();
344 function copy($new_name){
345 $old= $this->getPackageDir();
348 $this->name = $new_name;
349 $new= $this->getPackageDir();
350 while(file_exists($new)){
352 $this->name = $new_name . $count;
353 $new= $this->getPackageDir();
356 $new = $this->getPackageDir();
357 if(copy_recursive($old, $new)){
358 $this->updateModulesMetaData();
366 return rmdir_recursive($this->getPackageDir());
370 //creation of the installdefs[] array for the manifest when exporting customizations
371 function customBuildInstall($modules, $path, $extensions = array()){
372 $columns=$this->getColumnsName();
373 $installdefs = array ('id' => $this->name);
374 $include_path="$path/SugarModules/include/language";
375 if(file_exists($include_path) && is_dir($include_path)){
376 $dd= dir($include_path);
377 while($gg = $dd->read()){
378 if(substr($gg, 0, 1) != '.' && is_file($include_path . '/' . $gg)){
379 $lang = substr($gg, 0, strpos($gg, '.'));
380 $installdefs['language'][] = array(
381 'from'=> '<basepath>/SugarModules/include/language/'. $gg,
382 'to_module'=> 'application',
389 foreach($modules as $value){
390 $custom_module = $this->getCustomModules($value);
391 foreach($custom_module as $va){
392 if ($va == 'language'){
393 $this->getLanguageManifestForModule($value, $installdefs);
394 $this->getCustomFieldsManifestForModule($value, $installdefs);
396 if($va == 'metadata'){
397 $this->getCustomMetadataManifestForModule($value, $installdefs);
401 if (is_dir("$path/Extension"))
403 $this->getExtensionsManifestForPackage($path, $installdefs);
405 return "\n".'$installdefs = ' . var_export_helper($installdefs). ';';
408 private function getLanguageManifestForModule($module, &$installdefs)
410 $lang_path = 'custom/modules/' . $module . '/language';
411 foreach(scandir($lang_path) as $langFile)
413 if(substr($langFile, 0, 1) != '.' && is_file($lang_path . '/' . $langFile)){
414 $lang = substr($langFile, 0, strpos($langFile, '.'));
415 $installdefs['language'][] = array(
416 'from'=> '<basepath>/SugarModules/modules/' . $module . '/language/'. $langFile,
417 'to_module'=> $module,
424 private function getCustomFieldsManifestForModule($module, &$installdefs)
426 $db = DBManagerFactory::getInstance();
427 $result=$db->query("SELECT * FROM fields_meta_data where custom_module='$module'");
428 while($row = $db->fetchByAssoc($result)){
430 foreach($row as $col=>$res){
432 case 'custom_module':
433 $installdefs['custom_fields'][$name]['module'] = $res;
436 $installdefs['custom_fields'][$name]['require_option'] = $res;
439 $installdefs['custom_fields'][$name]['label'] = $res;
442 $installdefs['custom_fields'][$name]['require_option'] = $res;
445 $installdefs['custom_fields'][$name]['mass_update'] = $res;
448 $installdefs['custom_fields'][$name]['comments'] = $res;
451 $installdefs['custom_fields'][$name]['help'] = $res;
454 $installdefs['custom_fields'][$name]['max_size'] = $res;
457 $installdefs['custom_fields'][$name][$col] = $res;
463 private function getCustomMetadataManifestForModule($module, &$installdefs)
465 $meta_path = 'custom/modules/' . $module . '/metadata';
466 foreach(scandir($meta_path) as $meta_file)
468 if(substr($meta_file, 0, 1) != '.' && is_file($meta_path . '/' . $meta_file)){
469 if($meta_file == 'listviewdefs.php'){
470 $installdefs['copy'][] = array(
471 'from'=> '<basepath>/SugarModules/modules/'. $module . '/metadata/'. $meta_file,
472 'to'=> 'custom/modules/'. $module . '/metadata/' . $meta_file,
476 $installdefs['copy'][] = array(
477 'from'=> '<basepath>/SugarModules/modules/'. $module . '/metadata/'. $meta_file,
478 'to'=> 'custom/modules/'. $module . '/metadata/' . $meta_file,
480 $installdefs['copy'][] = array(
481 'from'=> '<basepath>/SugarModules/modules/'. $module . '/metadata/'. $meta_file,
482 'to'=> 'custom/working/modules/'. $module . '/metadata/' . $meta_file,
489 private function getExtensionsManifestForPackage($path, &$installdefs)
491 $extPath = "$path/Extension/modules";
492 foreach(scandir($extPath) as $moduleDir)
494 if(substr($moduleDir, 0, 1) != '.' && is_dir("$extPath/$moduleDir/Ext")){
495 foreach(scandir("$extPath/$moduleDir/Ext") as $type)
497 if(substr($type, 0, 1) != '.' && is_dir("$extPath/$moduleDir/Ext/$type")){
498 foreach(scandir("$extPath/$moduleDir/Ext/$type") as $file)
500 if(substr($file, 0, 1) != '.' && strtolower(substr($file, -4)) == ".php")
502 $installdefs['copy'][] = array(
503 'from'=> "<basepath>/Extension/modules/$moduleDir/Ext/$type/$file",
504 'to'=> "custom/Extension/modules/$moduleDir/Ext/$type/$file",
515 //return an array which contain the name of fields_meta_data table's columns
516 function getColumnsName(){
518 $meta = new FieldsMetaData();
520 foreach($meta->getFieldDefinitions() as $key=>$value) {
527 //creation of the custom fields ZIP file (use getmanifest() and customBuildInstall() )
528 function exportCustom($modules, $export=true, $clean = true){
529 $path=$this->getBuildDir();
530 if($clean && file_exists($path))rmdir_recursive($path);
531 //Copy the custom files to the build dir
532 foreach($modules as $mod){
533 $extensions = $this->getExtensionsList($mod);
534 $pathmod="$path/SugarModules/modules/$mod";
535 if(mkdir_recursive($pathmod)){
536 if(file_exists("custom/modules/$mod")){
537 copy_recursive("custom/modules/$mod", "$pathmod");
538 //Don't include cached extension files
539 if (is_dir("$pathmod/Ext"))
540 rmdir_recursive("$pathmod/Ext");
542 //Convert modstring files to extension compatible arrays
543 $this->convertLangFilesToExtensions("$pathmod/language");
545 $pathext="$path/Extension/modules/$mod/Ext";
546 if (!empty($extensions) && mkdir_recursive($pathext))
548 foreach($extensions as $type => $files)
550 sugar_mkdir("$pathext/$type");
551 foreach($files as $file => $filePath)
553 copy ($filePath, "$pathext/$type/$file");
559 $this->copyCustomDropdownValuesForModules($modules,$path);
560 if(file_exists($path)){
561 $manifest = $this->getManifest(true).$this->customBuildInstall($modules,$path);
562 sugar_file_put_contents($path .'/manifest.php', $manifest);;
564 if(file_exists('modules/ModuleBuilder/MB/LICENSE.txt')){
565 copy('modules/ModuleBuilder/MB/LICENSE.txt', $path . '/LICENSE.txt');
567 else if(file_exists('LICENSE.txt')){
568 copy('LICENSE.txt', $path . '/LICENSE.txt');
570 require_once('include/utils/zip_utils.php');
571 $date = date('Y_m_d_His');
572 $zipDir = $this->getZipDir();
573 if(!file_exists($zipDir))mkdir_recursive($zipDir);
575 chdir($this->getBuildDir());
576 zip_dir('.',$cwd . '/'. $zipDir. '/'. $this->name. $date. '.zip');
578 if($clean && file_exists($this->getBuildDir()))rmdir_recursive($this->getBuildDir());
580 header('Location:' . $zipDir. '/'. $this->name. $date. '.zip');
582 return $zipDir. '/'. $this->name. $date. '.zip';
585 private function convertLangFilesToExtensions($langDir)
587 if (is_dir($langDir))
589 foreach(scandir($langDir) as $langFile)
591 $mod_strings = array();
592 if (strcasecmp(substr($langFile, -4), ".php") != 0)
594 include("$langDir/$langFile");
595 $out = "<?php \n // created: " . date('Y-m-d H:i:s') . "\n";
596 foreach($mod_strings as $lbl_key => $lbl_val )
598 $out .= override_value_to_string("mod_strings", $lbl_key, $lbl_val) . "\n";
601 sugar_file_put_contents("$langDir/$langFile", $out);
605 private function copyCustomDropdownValuesForModules($modules, $path)
607 if(file_exists("custom/include/language")){
608 if(mkdir_recursive("$path/SugarModules/include")){
609 global $app_list_strings;
610 $backStrings = $app_list_strings;
611 foreach(scandir("custom/include/language") as $langFile)
613 $app_list_strings = array();
614 if (strcasecmp(substr($langFile, -4), ".php") != 0)
616 include("custom/include/language/$langFile");
618 $lang = substr($langFile, 0, -9);
619 $options = $this->getCustomDropDownStringsForModules($modules, $app_list_strings);
620 foreach($options as $name => $arr) {
621 $out .= override_value_to_string('app_list_strings', $name, $arr);
623 mkdir_recursive("$path/SugarModules/include/language/");
624 sugar_file_put_contents("$path/SugarModules/include/language/$lang.$this->name.php", $out);
626 $app_list_strings = $backStrings;
631 function getCustomDropDownStringsForModules($modules, $list_strings) {
632 global $beanList, $beanFiles;
634 foreach($modules as $module)
636 if (!empty($beanList[$module]))
638 require_once($beanFiles[$beanList[$module]]);
639 $bean = new $beanList[$module]();
640 foreach($bean->field_defs as $field => $def)
642 if (isset($def['options']) && isset($list_strings[$def['options']]))
644 $options[$def['options']] = $list_strings[$def['options']];
654 //if $module=false : return an array with custom module and there customizations.
655 //if $module=!false : return an array with the directories of custom/module/$module.
656 function getCustomModules($module=false){
658 $path='custom/modules/';
659 $extPath = 'custom/Extension/modules/';
660 if(!file_exists($path) || !is_dir($path)){
661 return array($mod_strings['LBL_EC_NOCUSTOM'] => "");
664 if ($module != false ){
665 $path=$path . $module . '/';
667 $scanlisting = scandir($path);
668 $dirlisting = array();
669 foreach ($scanlisting as $value){
670 if(is_dir($path . $value) == true && $value != '.' && $value != '..') {
671 $dirlisting[] = $value;
674 if(empty($dirlisting)){
675 return array($mod_strings['LBL_EC_NOCUSTOM'] => "");
677 if ($module == false ){
678 foreach ($dirlisting as $value){
679 if(!file_exists('modules/' . $value . '/metadata/studio.php'))
681 $custommodules[$value]=$this->getCustomModules($value);
682 foreach ($custommodules[$value] as $va){
685 $return[$value][$va] = $mod_strings['LBL_EC_CUSTOMFIELD'];
688 $return[$value][$va] = $mod_strings['LBL_EC_CUSTOMLAYOUT'];
692 $return[$value][$va] = $mod_strings['LBL_EC_CUSTOMFIELD'];
695 $return[$value . " " . $mod_strings['LBL_EC_EMPTYCUSTOM']] = "";
698 $return[$value][$va] = $mod_strings['LBL_UNDEFINED'];
710 private function getExtensionsList($module, $excludeRelationships = true)
712 require_once 'modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php' ;
713 $extPath = 'custom/Extension/modules/';
714 $modExtPath = $extPath . $module . '/Ext';
715 $rels = new DeployedRelationships($module);
716 $relList = $rels->getRelationshipList ();
719 if (is_dir($modExtPath))
721 $extFolders = scandir($modExtPath);
722 foreach($extFolders as $extFolder)
724 if (!is_dir("$modExtPath/$extFolder") || substr($extFolder, 0, 1) == ".")
727 foreach( scandir("$modExtPath/$extFolder") as $extFile)
730 if (substr($extFile, 0, 1) == "." || strtolower(substr($extFile, -4)) != ".php")
732 //Exclude relattionship extension files
733 if ($excludeRelationships && (
734 (substr($extFile, 0, 6) == "custom" && isset($relList[substr($extFile, 6, strlen($extFile) - 10)])) ||
735 (substr($extFile, 6, 6) == "custom" && isset($relList[substr($extFile, 12, strlen($extFile) - 16)]))
740 if (!isset($ret[$extFolder]))
741 $ret[$extFolder] = array();
743 $ret[$extFolder][$extFile ] = "$modExtPath/$extFolder/$extFile";
751 * Returns a set of field defs for fields that will exist when this package is deployed
752 * based on the relationships in all of its modules.
754 * @param $moduleName (module must be from whithin this package)
755 * @return array Field defs
757 function getRelationshipsForModule($moduleName) {
759 if (isset($this->modules[$moduleName])) {
760 $keyName = $this->modules[$moduleName]->key_name;
761 foreach($this->modules as $mName => $module) {
762 $rels = $module->getRelationships();
763 $relList = $rels->getRelationshipList();
764 foreach($relList as $rName ) {
765 $rel = $rels->get ( $rName ) ;
766 if ($rel->lhs_module == $keyName || $rel->rhs_module == $keyName) {
777 function exportProjectInstall($package, $for_export){
778 $pre = $for_export ? MB_EXPORTPREPEND : "";
779 $installdefs = array ('id' => $pre . $this->name);
780 $installdefs['copy'][] = array(
781 'from'=> '<basepath>/' . $this->name,
782 'to'=> 'custom/modulebuilder/packages/'. $this->name,
784 return "\n".'$installdefs = ' . var_export_helper($installdefs). ';';
790 function exportProject($package, $export=true, $clean = true){
791 $tmppath="custom/modulebuilder/projectTMP/";
792 if(file_exists($this->getPackageDir())){
793 if(mkdir_recursive($tmppath)){
794 copy_recursive($this->getPackageDir(), $tmppath ."/". $this->name);
795 $manifest = $this->getManifest(true, $export).$this->exportProjectInstall($package, $export);
796 $fp = sugar_fopen($tmppath .'/manifest.php', 'w');
797 fwrite($fp, $manifest);
799 if(file_exists('modules/ModuleBuilder/MB/LICENSE.txt')){
800 copy('modules/ModuleBuilder/MB/LICENSE.txt', $tmppath . '/LICENSE.txt');
802 else if(file_exists('LICENSE.txt')){
803 copy('LICENSE.txt', $tmppath . '/LICENSE.txt');
805 $readme_contents = $this->readme;
806 $readmefp = sugar_fopen($tmppath.'/README.txt','w');
807 fwrite($readmefp, $readme_contents);
811 require_once('include/utils/zip_utils.php');
812 $date = date('Y_m_d_His');
813 $zipDir = "custom/modulebuilder/packages/ExportProjectZips";
814 if(!file_exists($zipDir))mkdir_recursive($zipDir);
817 zip_dir('.',$cwd . '/'. $zipDir. '/project_'. $this->name. $date. '.zip');
819 if($clean && file_exists($tmppath))rmdir_recursive($tmppath);
821 header('Location:' . $zipDir. '/project_'. $this->name. $date. '.zip');
823 return $zipDir. '/project_'. $this->name. $date. '.zip';