本文整理汇总了PHP中Vtiger_Package类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Package类的具体用法?PHP Vtiger_Package怎么用?PHP Vtiger_Package使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_Package类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Vtiger_Package
<?php
require_once 'vtlib/Vtiger/Package.php';
require_once 'vtlib/Vtiger/Module.php';
$package = new Vtiger_Package();
$package->export(Vtiger_Module::getInstance('Deliverynote'), 'test/vtlib', 'Deliverynote.zip', true);
示例2: url
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title><?php
echo $title;
?>
</title>
<style type="text/css">@import url("themes/softed/style.css");br { display: block; margin: 2px; }</style>
</head><body class=small style="font-size: 12px; margin: 2px; padding: 2px;">
<?php
}
set_time_limit(0);
ini_set('memory_limit', '1024M');
if (empty($_REQUEST['modulename'])) {
echo '<br><br><b>Necessary Parameter {modulename} not present</b><br>';
} else {
$modulename = vtlib_purify($_REQUEST['modulename']);
$module = Vtiger_Module::getInstance($modulename);
if ($module) {
$pkg = new Vtiger_Package();
$pkg->export($module, 'build', $modulename . '.zip', $dl);
if ($dl) {
die;
}
echo "<b>Package should be exported to the build directory of your install.</b><br>";
} else {
echo "<b>Failed to find " . $modulename . " module.</b><br>";
}
}
?>
</body>
</html>
示例3: applyChange
function applyChange()
{
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset cbupdate_example already applied!');
} else {
// do your magic here
$this->ExecuteQuery('select 1 from vtiger_cbupdater');
$this->ExecuteQuery('select 1 from vtiger_cbupder');
$package = new Vtiger_Package();
ob_start();
$rdo = $package->importManifest('build/French/manifest.xml');
$out = ob_get_contents();
ob_end_clean();
$this->sendMsg($out);
if ($rdo) {
$this->sendMsg('french installed!');
} else {
$this->sendMsg('NO french!');
}
$this->sendMsg('Changeset cbupdate_example applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例4: updateUserModuleStep3
public function updateUserModuleStep3(Vtiger_Request $request)
{
$importModuleName = $request->get('module_import_name');
$uploadFile = $request->get('module_import_file');
$uploadDir = Settings_ModuleManager_Extension_Model::getUploadDirectory();
$uploadFileName = "{$uploadDir}/{$uploadFile}";
checkFileAccess($uploadFileName);
$importType = $request->get('module_import_type');
if (strtolower($importType) == 'language') {
$package = new Vtiger_Language();
} else {
if (strtolower($importType) == 'layout') {
$package = new Vtiger_Layout();
} else {
$package = new Vtiger_Package();
}
}
if (strtolower($importType) == 'language' || strtolower($importType) == 'layout') {
$package->import($uploadFileName);
} else {
$package->update(Vtiger_Module::getInstance($importModuleName), $uploadFileName);
}
checkFileAccessForDeletion($uploadFileName);
unlink($uploadFileName);
$result = array('success' => true, 'importModuleName' => $importModuleName);
$response = new Vtiger_Response();
$response->setResult($result);
$response->emit();
}
示例5: 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;
}
示例6: applyChange
function applyChange()
{
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
$module = 'Mobile';
if ($this->isModuleInstalled($module)) {
//Update module
$package = new Vtiger_Package();
$moduleInstance = Vtiger_Module::getInstance($module);
$package->loadManifestFromFile('modules/' . $module . '/manifest.xml');
$rdo = $package->update_Module($moduleInstance);
$this->sendMsg('Module updated: ' . $module);
} else {
$this->installManifestModule($module);
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例7: importUserModuleStep2
public function importUserModuleStep2(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$uploadDir = Settings_ModuleManager_Extension_Model::getUploadDirectory();
$qualifiedModuleName = $request->getModule(false);
$uploadFile = 'usermodule_' . time() . '.zip';
$uploadFileName = "{$uploadDir}/{$uploadFile}";
checkFileAccess($uploadDir);
if (!move_uploaded_file($_FILES['moduleZip']['tmp_name'], $uploadFileName)) {
$viewer->assign('MODULEIMPORT_FAILED', true);
} else {
$package = new Vtiger_Package();
$importModuleName = $package->getModuleNameFromZip($uploadFileName);
$importModuleDepVtVersion = $package->getDependentVtigerVersion();
if ($importModuleName == null) {
$viewer->assign('MODULEIMPORT_FAILED', true);
$viewer->assign("MODULEIMPORT_FILE_INVALID", true);
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_DEP_VTVERSION", $importModuleDepVtVersion);
$viewer->assign("MODULEIMPORT_LICENSE", $moduleLicence);
if (!$package->isLanguageType() && !$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->view('ImportUserModuleStep2.tpl', $qualifiedModuleName);
}
示例8: mkdir
$smarty->assign("APP", $app_strings);
$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();
示例9: vtlib_purify
include_once 'vtlib/Vtiger/Module.php';
global $current_user, $adb;
$dl = vtlib_purify($_REQUEST['download']);
$dl = !empty($dl);
if (!$dl) {
header('Content-Type: text/html; charset=UTF8');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title><?php
echo $title;
?>
</title>
<style type="text/css">@import url("themes/softed/style.css");br { display: block; margin: 2px; }</style>
</head><body class=small style="font-size: 12px; margin: 2px; padding: 2px;">
<?php
}
set_time_limit(0);
ini_set('memory_limit', '1024M');
if (empty($_REQUEST['modulename'])) {
echo '<br><br><b>Necessary Parameter {modulename} not present</b><br>';
} else {
$modulename = vtlib_purify($_REQUEST['modulename']);
Vtiger_Package::packageFromFilesystem($modulename, false, $dl);
if ($dl) {
die;
}
echo "<b>Package should be exported to the packages/optional directory of your install.</b><br>";
}
?>
</body>
</html>
示例10: installCurrentVersion
public function installCurrentVersion()
{
$this->connect();
$updateURL = $this->getUpdateUrl();
$filename = sys_get_temp_dir() . "/autoupdater." . md5($updateURL) . ".zip";
global $root_directory;
if (!is_writeable(sys_get_temp_dir()) && is_writeable($root_directory . "/test/")) {
$filename = $root_directory . "/test/autoupdater.zip";
}
if (!is_writeable(sys_get_temp_dir()) && !is_writeable($root_directory . "/test/")) {
echo "<strong style='color:red;'>ERROR</strong> - You need to make the <b>test</b> directory inside vtiger root writable for webserver user!";
return;
}
$data = $this->_client->call("downloadVersion", array(base64_encode($updateURL), sha1(base64_encode($updateURL) . "ASD,.2#*")));
if (!empty($_REQUEST["stefanDebug"])) {
/* ONLY DEBUG*/
echo "<pre>";
var_dump($this->_client->debug_str);
}
$data = base64_decode($data);
file_put_contents($filename, $data);
$package = new \Vtiger_Package();
$package->update(\Vtiger_Module::getInstance($this->_extension), $filename);
}
示例11: putMsg
$taskManager->saveTask($task);
$task = $taskManager->createTask('VTEntityMethodTask', $helpDeskWorkflow->id);
$task->active = true;
$task->summary = 'Notify Related Customer on Ticket Change, which is not done from Portal';
$task->methodName = "NotifyParentOnTicketChange";
$taskManager->saveTask($task);
putMsg('Workflow "' . $helpDeskWorkflow->description . '" created!');
$delmods = array('EmailTemplates', 'Google');
foreach ($delmods as $module) {
$mod = Vtiger_Module::getInstance($module);
if ($mod) {
$mod->deleteRelatedLists();
$mod->deleteLinks();
$mod->deinitWebservice();
$mod->delete();
echo "<b>Module {$module} EXTERMINATED!</b><br>";
}
}
$delmods = array('ar_ae', 'sv_se', 'tr_tr', 'pl_pl', 'ro_ro', 'ru_ru');
require_once 'vtlib/Vtiger/Language.php';
foreach ($delmods as $prefix) {
$languagePack = new Vtiger_Language();
@$languagePack->deregister($prefix);
}
$insmods = array('CronTasks', 'ConfigEditor', 'PBXManager', 'cbupdater');
foreach ($insmods as $module) {
$package = new Vtiger_Package();
$rdo = $package->importManifest("modules/{$module}/manifest.xml");
}
$mod = Vtiger_Module::getInstance('ModTracker');
$mod->addLink('HEADERSCRIPT', 'ModTrackerCommon_JS', 'modules/ModTracker/ModTrackerCommon.js');
示例12: vtlib_purify
<?php
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
********************************************************************************/
$module_export = vtlib_purify($_REQUEST['module_export']);
require_once "vtlib/Vtiger/Package.php";
require_once "vtlib/Vtiger/Module.php";
$package = new Vtiger_Package();
$module = Vtiger_Module::getInstance($module_export);
if ($module) {
if (isset($_REQUEST['manifestfs'])) {
Vtiger_Package::packageFromFilesystem($module_export, false, true);
} else {
$package->export($module, '', "{$module_export}.zip", true);
}
} else {
global $adb, $vtiger_current_version;
$lngrs = $adb->pquery('select * from vtiger_language where prefix=?', array($module_export));
if ($lngrs and $adb->num_rows($lngrs) == 1) {
// we have a language file
$lnginfo = $adb->fetch_array($lngrs);
$lngxml = 'include/language/' . $lnginfo['prefix'] . '.manifest.xml';
if (!file_exists($lngxml)) {
$mnf = fopen($lngxml, 'w');
fwrite($mnf, "<?xml version='1.0'?>\n");
示例13: Vtiger_Package
<?php
@error_reporting(0);
@ini_set('display_errors', 'off');
@set_time_limit(0);
@ini_set('memory_limit', '1024M');
if (count($argv) == 3) {
$module = $argv[1];
$type = $argv[2];
require_once 'vtlib/Vtiger/Module.php';
require_once 'vtlib/Vtiger/Package.php';
global $current_user, $adb;
$Vtiger_Utils_Log = false;
// Turn off debugging level
$current_user = Users::getActiveAdminUser();
$package = new Vtiger_Package();
$tabrs = $adb->pquery('select count(*) from vtiger_tab where name=?', array($module));
if ($tabrs and $adb->query_result($tabrs, 0, 0) == 1) {
// it exists already so we are updating
if (strtolower($type) == 'language') {
// just copy files and activate
vtlib_toggleModuleAccess($module, true);
} else {
$moduleInstance = Vtiger_Module::getInstance($module);
$package->loadManifestFromFile('modules/' . $module . '/manifest.xml');
$rdo = $package->update_Module($moduleInstance);
}
echo "Module updated: {$module} \n";
} else {
if (strtolower($type) == 'language') {
$rdo = $package->importManifest('include/language/' . $module . '.manifest.xml');
示例14: Vtiger_Package
/*+********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
*********************************************************************************/
//5.1.0 RC to 5.1.0 database changes
//we have to use the current object (stored in PatchApply.php) to execute the queries
$adb = $_SESSION['adodb_current_object'];
$conn = $_SESSION['adodb_current_object'];
$migrationlog->debug("\n\nDB Changes from 5.1.0 RC to 5.1.0 -------- Starts \n\n");
require_once 'vtlib/Vtiger/Package.php';
require_once 'vtlib/Vtiger/Module.php';
$package = new Vtiger_Package();
ExecuteQuery("DELETE vtiger_cvcolumnlist FROM vtiger_cvcolumnlist INNER JOIN vtiger_customview WHERE vtiger_cvcolumnlist.columnname LIKE '%vtiger_notes:filename%' AND vtiger_customview.cvid = vtiger_cvcolumnlist.cvid AND vtiger_customview.entitytype='HelpDesk'");
ExecuteQuery("DELETE vtiger_cvcolumnlist FROM vtiger_cvcolumnlist INNER JOIN vtiger_customview WHERE (vtiger_cvcolumnlist.columnname LIKE '%parent_id%' OR vtiger_cvcolumnlist.columnname LIKE '%vtiger_contactdetails%') AND vtiger_customview.cvid = vtiger_cvcolumnlist.cvid AND vtiger_customview.entitytype='Documents'");
ExecuteQuery("DELETE vtiger_cvadvfilter FROM vtiger_cvadvfilter INNER JOIN vtiger_customview WHERE vtiger_cvadvfilter.columnname LIKE '%vtiger_notes:filename%' AND vtiger_customview.cvid = vtiger_cvadvfilter.cvid AND vtiger_customview.entitytype='HelpDesk'");
ExecuteQuery("DELETE vtiger_cvadvfilter FROM vtiger_cvadvfilter INNER JOIN vtiger_customview WHERE (vtiger_cvadvfilter.columnname LIKE '%parent_id%' OR vtiger_cvadvfilter.columnname LIKE '%vtiger_contactdetails%') AND vtiger_customview.cvid = vtiger_cvadvfilter.cvid AND vtiger_customview.entitytype='Documents'");
// Update PBXManager module files
$moduleInstance = Vtiger_Module::getInstance('PBXManager');
$package->initUpdate($moduleInstance, 'packages/5.1.0/mandatory/PBXManager.zip', true);
// Update ServiceContracts module files
$moduleInstance = Vtiger_Module::getInstance('ServiceContracts');
$package->initUpdate($moduleInstance, 'packages/5.1.0/mandatory/ServiceContracts.zip', true);
// Update Services module files
$moduleInstance = Vtiger_Module::getInstance('Services');
$package->initUpdate($moduleInstance, 'packages/5.1.0/mandatory/Services.zip', true);
// Install/Update Optional modules
require_once 'include/utils/installVtlibSelectedModules.php';
示例15: 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;
}
}