本文整理汇总了PHP中Vtiger_Language::getModuleNameFromZip方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Language::getModuleNameFromZip方法的具体用法?PHP Vtiger_Language::getModuleNameFromZip怎么用?PHP Vtiger_Language::getModuleNameFromZip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Language
的用法示例。
在下文中一共展示了Vtiger_Language::getModuleNameFromZip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstallableModulesFromPackages
public static function getInstallableModulesFromPackages()
{
global $optionalModuleStrings;
require_once 'vtlib/Vtiger/Package.php';
require_once 'vtlib/Vtiger/Module.php';
require_once 'vtlib/Vtiger/Version.php';
$packageDir = 'packages/vtiger/optional/';
$handle = opendir($packageDir);
$optionalModules = array();
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 = "{$packageDir}/{$file}";
$package = new Vtiger_Package();
$moduleName = $package->getModuleNameFromZip($packagepath);
if ($package->isModuleBundle()) {
$bundleOptionalModule = array();
$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();
$subModule->getModuleNameFromZip($packagepath);
$bundleOptionalModule = self::getOptionalModuleDetails($subModule, $bundleOptionalModule);
}
$moduleDetails = array();
$moduleDetails['description'] = $optionalModuleStrings[$moduleName . '_description'];
$moduleDetails['selected'] = true;
$moduleDetails['enabled'] = true;
$migrationAction = 'install';
if (count($bundleOptionalModule['update']) > 0) {
$moduleDetails['enabled'] = false;
$migrationAction = 'update';
}
$optionalModules[$migrationAction]['module'][$moduleName] = $moduleDetails;
} else {
if ($package->isLanguageType()) {
$package = new Vtiger_Language();
$package->getModuleNameFromZip($packagepath);
}
$optionalModules = self::getOptionalModuleDetails($package, $optionalModules);
}
}
}
if (is_array($optionalModules['install']['language']) && is_array($optionalModules['install']['module'])) {
$optionalModules['install'] = array_merge($optionalModules['install']['module'], $optionalModules['install']['language']);
} elseif (is_array($optionalModules['install']['language']) && !is_array($optionalModules['install']['module'])) {
$optionalModules['install'] = $optionalModules['install']['language'];
} else {
$optionalModules['install'] = $optionalModules['install']['module'];
}
if (is_array($optionalModules['update']['language']) && is_array($optionalModules['update']['module'])) {
$optionalModules['update'] = array_merge($optionalModules['update']['module'], $optionalModules['update']['language']);
} elseif (is_array($optionalModules['update']['language']) && !is_array($optionalModules['update']['module'])) {
$optionalModules['update'] = $optionalModules['update']['language'];
} else {
$optionalModules['update'] = $optionalModules['update']['module'];
}
return $optionalModules;
}
示例2: installVtlibModule
function installVtlibModule($packagename, $packagepath, $customized = false)
{
global $log, $Vtiger_Utils_Log, $_installOrUpdateVtlibModule;
if (!file_exists($packagepath)) {
return;
}
if (isset($_installOrUpdateVtlibModule[$packagename . $packagepath])) {
return;
}
$_installOrUpdateVtlibModule[$packagename . $packagepath] = 'install';
require_once 'vtlib/Vtiger/Package.php';
require_once 'vtlib/Vtiger/Module.php';
$Vtiger_Utils_Log = defined('INSTALLATION_MODE_DEBUG') ? INSTALLATION_MODE_DEBUG : true;
$package = new Vtiger_Package();
if ($package->isLanguageType($packagepath)) {
$package = new Vtiger_Language();
$package->import($packagepath, true);
return;
}
$module = $package->getModuleNameFromZip($packagepath);
// Customization
if ($package->isLanguageType()) {
require_once 'vtlib/Vtiger/Language.php';
$languagePack = new Vtiger_Language();
@$languagePack->import($packagepath, true);
return;
}
// END
$module_exists = false;
$module_dir_exists = false;
if ($module == null) {
$log->fatal("{$packagename} Module zipfile is not valid!");
} else {
if (Vtiger_Module::getInstance($module)) {
$log->fatal("{$module} already exists!");
$module_exists = true;
}
}
if ($module_exists == false) {
$log->debug("{$module} - Installation starts here");
$package->import($packagepath, true);
$moduleInstance = Vtiger_Module::getInstance($module);
if (empty($moduleInstance)) {
$log->fatal("{$module} module installation failed!");
}
}
}
示例3: installVtlibModule
function installVtlibModule($packagename, $packagepath, $customized = false)
{
global $log;
require_once 'vtlib/Vtiger/Package.php';
require_once 'vtlib/Vtiger/Module.php';
$Vtiger_Utils_Log = true;
$package = new Vtiger_Package();
if ($package->isLanguageType($packagepath)) {
$package = new Vtiger_Language();
$package->import($packagepath, true);
return;
}
$module = $package->getModuleNameFromZip($packagepath);
$module_exists = false;
$module_dir_exists = false;
if ($module == null) {
$log->fatal("{$packagename} Module zipfile is not valid!");
} else {
if (Vtiger_Module::getInstance($module)) {
$log->fatal("{$module} already exists!");
$module_exists = true;
}
}
if ($module_exists == false) {
$log->debug("{$module} - Installation starts here");
$package->import($packagepath, true);
$moduleInstance = Vtiger_Module::getInstance($module);
if (empty($moduleInstance)) {
$log->fatal("{$module} module installation failed!");
}
}
}