当前位置: 首页>>代码示例>>PHP>>正文


PHP Vtiger_Package::getModuleNameFromZip方法代码示例

本文整理汇总了PHP中Vtiger_Package::getModuleNameFromZip方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Package::getModuleNameFromZip方法的具体用法?PHP Vtiger_Package::getModuleNameFromZip怎么用?PHP Vtiger_Package::getModuleNameFromZip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vtiger_Package的用法示例。


在下文中一共展示了Vtiger_Package::getModuleNameFromZip方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPackage

	/**
	 * Function to get package of this instance
	 * @return <Vtiger_Package> package object
	 */
	public function getPackage() {
		$packageModel = new Vtiger_Package();
		$moduleName = $packageModel->getModuleNameFromZip(self::getUploadDirectory(). '/' .$this->getFileName());
		if ($moduleName) {
			return $packageModel;
		}
		return false;
	}
开发者ID:Wasage,项目名称:werpa,代码行数:12,代码来源:Extension.php

示例2: importUserModuleStep2

 public function importUserModuleStep2(Vtiger_Request $request)
 {
     $viewer = $this->getViewer($request);
     $uploadDir = Settings_ModuleManager_Module_Model::getUploadDirectory();
     $qualifiedModuleName = $request->getModule(false);
     $uploadFile = 'usermodule_' . time() . '.zip';
     $uploadFileName = "{$uploadDir}/{$uploadFile}";
     $error = '';
     checkFileAccess($uploadDir);
     if (!move_uploaded_file($_FILES['moduleZip']['tmp_name'], $uploadFileName)) {
         $error = 'LBL_ERROR_MOVE_UPLOADED_FILE';
     } else {
         $package = new Vtiger_Package();
         $importModuleName = $package->getModuleNameFromZip($uploadFileName);
         $importModuleDepVtVersion = $package->getDependentVtigerVersion();
         if ($importModuleName == null) {
             $error = $package->_errorText;
             checkFileAccessForDeletion($uploadFileName);
             unlink($uploadFileName);
         } else {
             // We need these information to push for Update if module is detected to be present.
             $moduleLicence = vtlib_purify($package->getLicense());
             $viewer->assign('MODULEIMPORT_FILE', $uploadFile);
             $viewer->assign('MODULEIMPORT_TYPE', $package->type());
             $viewer->assign('MODULEIMPORT_NAME', $importModuleName);
             $viewer->assign('MODULEIMPORT_PACKAGE', $package);
             $viewer->assign('MODULEIMPORT_DEP_VTVERSION', $importModuleDepVtVersion);
             $viewer->assign('MODULEIMPORT_LICENSE', $moduleLicence);
             $viewer->assign('MODULEIMPORT_PARAMETERS', $package->getParameters());
             if (!$package->isLanguageType() && !$package->isUpdateType() && !$package->isModuleBundle()) {
                 $moduleInstance = Vtiger_Module::getInstance($importModuleName);
                 $moduleimport_exists = $moduleInstance ? "true" : "false";
                 $moduleimport_dir_name = "modules/{$importModuleName}";
                 $moduleimport_dir_exists = is_dir($moduleimport_dir_name) ? "true" : "false";
                 $viewer->assign('MODULEIMPORT_EXISTS', $moduleimport_exists);
                 $viewer->assign('MODULEIMPORT_DIR', $moduleimport_dir_name);
                 $viewer->assign('MODULEIMPORT_DIR_EXISTS', $moduleimport_dir_exists);
             }
         }
     }
     $viewer->assign('MODULEIMPORT_ERROR', $error);
     $viewer->view('ImportUserModuleStep2.tpl', $qualifiedModuleName);
 }
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:43,代码来源:ModuleImport.php

示例3: installOptionalModules

function installOptionalModules($selected_modules)
{
    global $log;
    require_once 'vtlib/Vtiger/Package.php';
    require_once 'vtlib/Vtiger/Module.php';
    $selected_modules = split(":", $selected_modules);
    if ($handle = opendir('packages/5.1.0/optional')) {
        while (false !== ($file = readdir($handle))) {
            $filename_arr = explode(".", $file);
            $packagename = $filename_arr[0];
            if (!empty($packagename)) {
                $packagepath = "packages/5.1.0/optional/{$file}";
                $package = new Vtiger_Package();
                $module = $package->getModuleNameFromZip($packagepath);
                if ($module != null) {
                    $moduleInstance = Vtiger_Module::getInstance($module);
                    if (in_array($packagename, $selected_modules)) {
                        if ($moduleInstance) {
                            initUpdateVtlibModule($module, $packagepath);
                        } else {
                            installVtlibModule($packagename, $packagepath);
                        }
                    } elseif ($moduleInstance) {
                        initUpdateVtlibModule($module, $packagepath);
                        vtlib_toggleModuleAccess((string) $module, false);
                    }
                }
            }
        }
        closedir($handle);
    }
}
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:32,代码来源:utils.php

示例4: installSelectedOptionalModules

 public static function installSelectedOptionalModules($selected_modules, $source_directory = '', $destination_directory = '')
 {
     require_once 'vtlib/Vtiger/Package.php';
     require_once 'vtlib/Vtiger/Module.php';
     require_once 'include/utils/utils.php';
     $selected_modules = explode(":", $selected_modules);
     $languagePacks = array();
     if ($handle = opendir('packages/vtiger/optional')) {
         while (false !== ($file = readdir($handle))) {
             $filename_arr = explode(".", $file);
             if ($filename_arr[count($filename_arr) - 1] != 'zip') {
                 continue;
             }
             $packagename = $filename_arr[0];
             $packagepath = "packages/vtiger/optional/{$file}";
             $package = new Vtiger_Package();
             $module = $package->getModuleNameFromZip($packagepath);
             if (!empty($packagename) && in_array($module, $selected_modules)) {
                 if ($package->isLanguageType($packagepath)) {
                     $languagePacks[$module] = $packagepath;
                     continue;
                 }
                 if ($module != null) {
                     if ($package->isModuleBundle()) {
                         $unzip = new Vtiger_Unzip($packagepath);
                         $unzip->unzipAllEx($package->getTemporaryFilePath());
                         $moduleInfoList = $package->getAvailableModuleInfoFromModuleBundle();
                         foreach ($moduleInfoList as $moduleInfo) {
                             $moduleInfo = (array) $moduleInfo;
                             $packagepath = $package->getTemporaryFilePath($moduleInfo['filepath']);
                             $subModule = new Vtiger_Package();
                             $subModuleName = $subModule->getModuleNameFromZip($packagepath);
                             $moduleInstance = Vtiger_Module::getInstance($subModuleName);
                             if ($moduleInstance) {
                                 updateVtlibModule($subModuleName, $packagepath);
                             } else {
                                 installVtlibModule($subModuleName, $packagepath);
                             }
                         }
                     } else {
                         $moduleInstance = Vtiger_Module::getInstance($module);
                         if ($moduleInstance) {
                             updateVtlibModule($module, $packagepath);
                         } else {
                             installVtlibModule($module, $packagepath);
                         }
                     }
                 }
             }
         }
         closedir($handle);
     }
     foreach ($languagePacks as $module => $packagepath) {
         installVtlibModule($module, $packagepath);
         continue;
     }
 }
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:57,代码来源:utils.php

示例5: mkdir

$smarty->assign("THEME", $theme);
$smarty->assign("IMAGE_PATH", "themes/{$theme}/images/");
global $modulemanager_uploaddir;
// Defined in modules/Settings/ModuleManager.php
if ($module_import_step == 'Step2') {
    if (!is_dir($modulemanager_uploaddir)) {
        mkdir($modulemanager_uploaddir);
    }
    $uploadfile = "usermodule_" . time() . ".zip";
    $uploadfilename = "{$modulemanager_uploaddir}/{$uploadfile}";
    checkFileAccess($modulemanager_uploaddir);
    if (!move_uploaded_file($_FILES['module_zipfile']['tmp_name'], $uploadfilename)) {
        $smarty->assign("MODULEIMPORT_FAILED", "true");
    } else {
        $package = new Vtiger_Package();
        $moduleimport_name = $package->getModuleNameFromZip($uploadfilename);
        if ($moduleimport_name == null) {
            $smarty->assign("MODULEIMPORT_FAILED", "true");
            $smarty->assign("MODULEIMPORT_FILE_INVALID", "true");
        } else {
            if (!$package->isLanguageType()) {
                $moduleInstance = Vtiger_Module::getInstance($moduleimport_name);
                $moduleimport_exists = $moduleInstance ? "true" : "false";
                $moduleimport_dir_name = "modules/{$moduleimport_name}";
                $moduleimport_dir_exists = is_dir($moduleimport_dir_name) ? "true" : "false";
                $smarty->assign("MODULEIMPORT_EXISTS", $moduleimport_exists);
                $smarty->assign("MODULEIMPORT_DIR", $moduleimport_dir_name);
                $smarty->assign("MODULEIMPORT_DIR_EXISTS", $moduleimport_dir_exists);
            }
            $moduleimport_dep_vtversion = $package->getDependentVtigerVersion();
            $moduleimport_license = $package->getLicense();
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:31,代码来源:Import.php

示例6: strpos

     $entryName = $za->getNameIndex($i);
     $firstSlash = strpos($entryName, '/');
     if ($entryName === 'manifest.xml' || $entryName === './manifest.xml' || $firstSlash === false) {
         $za->unchangeAll();
         break;
     }
     $newEntryName = substr($entryName, $firstSlash + 1);
     if ($newEntryName !== false) {
         $za->renameIndex($i, $newEntryName);
     } else {
         $za->deleteIndex($i);
     }
 }
 $za->close();
 $package = new Vtiger_Package();
 $moduleupdate_name = $package->getModuleNameFromZip($uploadfilename);
 if ($moduleupdate_name == null) {
     $smarty->assign("MODULEUPDATE_FAILED", "true");
     $smarty->assign("MODULEUPDATE_FILE_INVALID", "true");
 } else {
     if (!$package->isLanguageType() && $moduleupdate_name != $target_modulename) {
         $smarty->assign("MODULEUPDATE_FAILED", "true");
         $smarty->assign("MODULEUPDATE_NAME_MISMATCH", "true");
     } else {
         if ($package->isLanguageType() && trim($package->xpath_value('prefix')) != $target_modulename) {
             $smarty->assign("MODULEUPDATE_FAILED", "true");
             $smarty->assign("MODULEUPDATE_NAME_MISMATCH", "true");
         } else {
             $moduleupdate_dep_vtversion = $package->getDependentVtigerVersion();
             $moduleupdate_license = $package->getLicense();
             $moduleupdate_version = $package->getVersion();
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:31,代码来源:Update.php

示例7: handle

	public function handle() {
		if ($this->interactive) {
			echo "------------------------------------ >>> UPDATE MODULE <<< ---\n";
			do {
				$path = $this->prompt("Enter package path: ", self::PROMPT_PATH);
				if (file_exists($path)) {
					break;
				}
				echo "ERROR: " . $path . " - file not found, try another.\n";
			} while (true);
		} else {
			$path = array_shift($this->arguments);
		}
		
		if (file_exists($path)) {
			$package = new Vtiger_Package();
			$module  = $package->getModuleNameFromZip($path);
			
			$moduleInstance = Vtiger_Module::getInstance($module);
			if (!$moduleInstance) {
				echo "ERROR: Module $module not found!\n";
			} else {
				echo "Updating ...";
				$package->update($moduleInstance, $path);
				echo "DONE.\n";
			}			
			
		} else {
			throw new Exception("Package file $path not found.");
		}
		
		echo "----------------------------------\n\n";
	}
开发者ID:Wasage,项目名称:werpa,代码行数:33,代码来源:console.php

示例8: installModules

 /**
  * Function installs all the available modules
  */
 public static function installModules()
 {
     require_once 'vtlib/Vtiger/Package.php';
     require_once 'vtlib/Vtiger/Module.php';
     require_once 'include/utils/utils.php';
     $moduleFolders = array('packages/vtiger/mandatory', 'packages/vtiger/optional');
     foreach ($moduleFolders as $moduleFolder) {
         if ($handle = opendir($moduleFolder)) {
             while (false !== ($file = readdir($handle))) {
                 $packageNameParts = explode(".", $file);
                 if ($packageNameParts[count($packageNameParts) - 1] != 'zip') {
                     continue;
                 }
                 array_pop($packageNameParts);
                 $packageName = implode("", $packageNameParts);
                 if (!empty($packageName)) {
                     $packagepath = "{$moduleFolder}/{$file}";
                     $package = new Vtiger_Package();
                     $module = $package->getModuleNameFromZip($packagepath);
                     if ($module != null) {
                         $moduleInstance = Vtiger_Module::getInstance($module);
                         if ($moduleInstance) {
                             updateVtlibModule($module, $packagepath);
                         } else {
                             installVtlibModule($module, $packagepath);
                         }
                     }
                 }
             }
             closedir($handle);
         }
     }
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:36,代码来源:Utils.php


注:本文中的Vtiger_Package::getModuleNameFromZip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。