本文整理汇总了PHP中PackageManager类的典型用法代码示例。如果您正苦于以下问题:PHP PackageManager类的具体用法?PHP PackageManager怎么用?PHP PackageManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PackageManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
require_once 'ModuleInstall/PackageManager/PackageManager.php';
$pm = new PackageManager();
$packages = $pm->getinstalledPackages(array('module'));
foreach ($packages as $pack) {
if (strpos($pack['name'], 'SugarCRM Upgrader') !== false) {
$uh = new UpgradeHistory();
$uh->name = $pack['name'];
$history = $uh->checkForExisting($uh);
$this->filesToRemove[] = "custom/Extension/application/Ext/Include/{$history->id_name}.php";
$history->delete();
$this->fileToDelete($this->filesToRemove);
$this->log("Useless files of {$pack['name']} v{$pack['version']} removed");
}
}
foreach ($pm->getPackagesInStaging() as $pack) {
if (strpos($pack['name'], 'SugarCRM Upgrader') !== false) {
$file = UploadStream::getFSPath(hashToFile($pack['file']));
$this->fileToDelete($file);
foreach (array('manifest', 'icon') as $meta) {
$this->fileToDelete(pathinfo($file, PATHINFO_DIRNAME) . '/' . pathinfo($file, PATHINFO_FILENAME) . "-{$meta}.php");
}
}
}
}
示例2: testCheckedArrayKey
public function testCheckedArrayKey()
{
$package = new PackageManager();
$returnJson = $package->getPackagesInStaging('module');
foreach ($returnJson as $module) {
$this->assertArrayHasKey('unFile', $module, 'Key "unFile" is missing in return array');
}
}
示例3: resources_url
<?php
$locale = Lang::getLocale();
PackageManager::add('libraries')->js(null, resources_url('/js/libraries.js'))->js("moment-{$locale}", resources_url("/libs/moment/js/{$locale}.js"), 'libraries');
PackageManager::add('core')->css('global', resources_url('/css/app.css'))->js(null, resources_url('/js/backend.js'), 'libraries');
PackageManager::add('jquery')->js(null, resources_url('/libs/jquery/js/jquery.min.js'));
PackageManager::add('bootstrap')->css(null, resources_url('/libs/bootstrap/css/bootstrap.min.css'))->js(null, resources_url('/libs/bootstrap/js/bootstrap.min.js'), 'jquery');
PackageManager::add('bootstrap-theme')->css(null, resources_url('/libs/bootstrap/css/bootstrap-theme.min.css'), 'bootstrap');
PackageManager::add('underscore')->js(null, resources_url('/libs/underscore/js/underscore-min.js'), 'jquery');
PackageManager::add('backbone')->js(null, resources_url('/libs/backbone/js/backbone-min.js'), 'underscore');
PackageManager::add('jquery-ui')->js(null, resources_url('/libs/jquery-ui/js/jquery-ui.min.js'), 'jquery')->css(null, resources_url('/css/jquery-ui.css'));
PackageManager::add('fontawesome')->css(null, resources_url('/libs/font-awesome/css/font-awesome.min.css'));
PackageManager::add('jquery-tagsinput')->js(null, resources_url('/libs/jquery.tagsinput/js/jquery.tagsinput.js'), ['jquery', 'jquery-ui'])->css(null, resources_url('/libs/jquery.tagsinput//css/jquery.tagsinput.css'));
PackageManager::add('dropzone')->js(null, resources_url('/libs/dropzone/js/dropzone.min.js'), ['jquery', 'libraries'])->css('dropzone-basic', resources_url('/libs/dropzone/css/basic.min.css'))->css(null, resources_url('/libs/dropzone/css/dropzone.min.css'));
PackageManager::add('datepicker')->js(null, resources_url('/libs/datetimepicker/js/jquery.datetimepicker.min.js'), ['jquery', 'libraries'])->css(null, resources_url('/libs/datetimepicker/css/jquery.datetimepicker.css'));
PackageManager::add('bootstrap-multiselect')->js(null, resources_url('/libs/bootstrap-multiselect/js/bootstrap-multiselect.js'), ['jquery', 'libraries'])->css(null, resources_url('/libs/bootstrap-multiselect/css/bootstrap-multiselect.css'));
PackageManager::add('editable')->js(null, resources_url('/libs/x-editable/js/bootstrap-editable.min.js'), ['jquery', 'bootstrap'])->css(null, resources_url('/libs/x-editable/css/bootstrap-editable.css'));
PackageManager::add('nestable')->js(null, resources_url('/libs/nestable/js/jquery.nestable.js'), ['jquery', 'libraries']);
PackageManager::add('steps')->js(null, resources_url('/libs/jquery.steps/js/jquery.steps.min.js'), ['jquery', 'libraries']);
PackageManager::add('noty')->js(null, resources_url('/libs/noty/js/jquery.noty.packaged.min.js'), ['jquery', 'libraries']);
PackageManager::add('select2')->js(null, resources_url('/libs/select2/js/select2.min.js'), ['jquery', 'libraries'])->js("select2-{$locale}", resources_url("/libs/select2/js/i18n/{$locale}.js"), 'select2')->css(null, resources_url('/libs/select2/css/select2.min.css'));
PackageManager::add('sortable')->js(null, resources_url('/libs/Sortable/js/Sortable.min.js'), ['jquery', 'libraries'])->js('sortable-binding', resources_url('/libs/Sortable/js/jquery.binding.js'), ['jquery', 'libraries']);
PackageManager::add('validate')->js(null, resources_url('/libs/jquery-validation/js/jquery.validate.min.js'), ['jquery', 'libraries'])->js("validate-{$locale}", resources_url("/libs/jquery-validation/js/messages_{$locale}.js"), 'validate');
PackageManager::add('moment')->js(null, resources_url('/libs/moment/js/moment.min.js'), ['jquery', 'libraries'])->js("moment-{$locale}", resources_url("/libs/moment/js/{$locale}.js"), 'moment');
PackageManager::add('ckeditor')->js('ckeditor-library', resources_url('/libs/ckeditor/ckeditor.js'), ['jquery', 'libraries'])->js(null, resources_url('/js/wysiwyg/ckeditor.js'), 'ckeditor-library')->js("ckeditor-{$locale}", resources_url("/libs/ckeditor/lang/{$locale}.js"), 'ckeditor-library');
PackageManager::add('ace')->js('ace-library', resources_url('/libs/ace/src-min/ace.js'), ['jquery', 'libraries'])->js(null, resources_url('/js/wysiwyg/ace.js'), 'ace-library');
PackageManager::add('diff')->js(null, resources_url('/libs/jsdiff/js/diff.js'));
PackageManager::add('datatables')->js(null, resources_url('/libs/datatables/js/jquery.dataTables.min.js'), ['jquery', 'libraries'])->js('datatables.bootstrap', resources_url('/libs/datatables/js/datatables.bootstrap.js'), 'datatables')->css(null, resources_url('/libs/datatables/css/datatables.bootstrap.css'));
WYSIWYG::add('ace', 'Ace', null, null, WYSIWYG::code());
WYSIWYG::add('ckeditor', 'CKEditor');
示例4: resources_url
<?php
PackageManager::add('weather')->js(null, resources_url('/libs/weather/js/weather.js'), 'jquery');
PackageManager::add('gridster')->js(null, resources_url('/libs/gridster/js/jquery.gridster.min.js'), 'jquery')->css(null, resources_url('/libs/gridster/css/jquery.gridster.min.css'));
示例5: login
/**
* Login to the depot
*
* @return true if successful, false otherwise
*/
function login($terms_checked = true)
{
if (empty($_SESSION['SugarDepotSessionID'])) {
global $license;
$GLOBALS['log']->debug("Begin SugarDepot Login");
PackageManagerComm::initialize(false);
require 'sugar_version.php';
require 'config.php';
$credentials = PackageManager::getCredentials();
if (empty($license)) {
loadLicense();
}
$info = sugarEncode('2813', serialize(getSystemInfo(true)));
$pm = new PackageManager();
$installed = $pm->buildInstalledReleases();
$installed = base64_encode(serialize($installed));
$params = array('installed_modules' => $installed, 'terms_checked' => $terms_checked, 'system_name' => $credentials['system_name']);
$terms_version = !empty($_SESSION['SugarDepot_TermsVersion']) ? $_SESSION['SugarDepot_TermsVersion'] : '';
if (!empty($terms_version)) {
$params['terms_version'] = $terms_version;
}
$result = $GLOBALS['SugarDepot']->call('depotLogin', array(array('user_name' => $credentials['username'], 'password' => $credentials['password']), 'info' => $info, 'params' => $params));
PackageManagerComm::errorCheck();
if (!is_array($result)) {
$_SESSION['SugarDepotSessionID'] = $result;
}
$GLOBALS['log']->debug("End SugarDepot Login");
return $result;
} else {
return $_SESSION['SugarDepotSessionID'];
}
}
示例6: array
$base_upgrade_dir = $sugar_config['upload_dir'] . "upgrades";
$base_tmp_upgrade_dir = $base_upgrade_dir . "/temp";
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//// HANDLE FILE UPLOAD AND PROCESSING
$errors = array();
$uploadResult = '';
//commitModules();
if (isset($_REQUEST['languagePackAction']) && !empty($_REQUEST['languagePackAction'])) {
switch ($_REQUEST['languagePackAction']) {
case 'upload':
$perform = false;
$tempFile = '';
if (isset($_REQUEST['release_id']) && $_REQUEST['release_id'] != "") {
require_once 'ModuleInstall/PackageManager/PackageManager.php';
$pm = new PackageManager();
$tempFile = $pm->download($_REQUEST['release_id'], getcwd() . '/' . $sugar_config['upload_dir']);
$perform = true;
//$base_filename = urldecode($tempFile);
} else {
$file = new UploadFile('language_pack');
if ($file->confirm_upload()) {
$perform = true;
if (strpos($file->mime_type, 'zip') !== false) {
// only .zip files
if (langPackFinalMove($file)) {
$perform = true;
} else {
$errors[] = $mod_strings['ERR_LANG_UPLOAD_3'];
}
} else {
示例7: getHeader
function getHeader()
{
global $current_language;
$mod_strings = return_module_language($current_language, "Administration");
$header_text = '';
$isAlive = false;
$show_login = false;
if (!function_exists('curl_init') && $show_login) {
$header_text = "<font color='red'><b>" . $mod_strings['ERR_ENABLE_CURL'] . "</b></font>";
$show_login = false;
} else {
$credentials = PackageManager::getCredentials();
if (empty($credentials['username']) || empty($credentials['password'])) {
//$header_text = "<font color='red'><b>".$mod_strings['ERR_CREDENTIALS_MISSING']."</b></font>";
} else {
$result = PackageManagerComm::login();
if (is_array($result) && !empty($result['faultcode']) || $result == false) {
$header_text = "<font color='red'><b>" . $result['faultstring'] . "</b></font>";
} else {
$header_text = PackageManager::getPromotion();
$isAlive = true;
}
}
}
return array('text' => $header_text, 'isAlive' => $isAlive, 'show_login' => $show_login);
}
示例8: action_DeployPackage
function action_DeployPackage()
{
if (defined('TEMPLATE_URL')) {
sugar_cache_reset();
SugarTemplateUtilities::disableCache();
}
$mb = new ModuleBuilder();
$load = $_REQUEST['package'];
$message = $GLOBALS['mod_strings']['LBL_MODULE_DEPLOYED'];
if (!empty($load)) {
$zip = $mb->getPackage($load);
require_once 'ModuleInstall/PackageManager/PackageManager.php';
$pm = new PackageManager();
$info = $mb->packages[$load]->build(false);
mkdir_recursive($GLOBALS['sugar_config']['cache_dir'] . '/upload/upgrades/module/');
rename($info['zip'], $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '.zip');
copy($info['manifest'], $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '-manifest.php');
$_REQUEST['install_file'] = $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '.zip';
$GLOBALS['mi_remove_tables'] = false;
$pm->performUninstall($load);
//#23177 , js cache clear
clearAllJsAndJsLangFilesWithoutOutput();
//#30747, clear the cache in memoy
$cache_key = 'app_list_strings.' . $GLOBALS['current_language'];
sugar_cache_clear($cache_key);
sugar_cache_reset();
//clear end
$pm->performInstall($_REQUEST['install_file']);
}
echo 'complete';
}
示例9: PackageManager
<?php
/*
to view the initer :
echo $this->showIniter();
or better way
uncomment in this file the line : //$content.=$this->showIniter();
*/
$reload = $this->instanceVar->varpost("reload");
$reload = $this->instanceVar->vartotmpsession($reload);
$this->initer['mainsubtitle'] = "Package Manager";
$instancePage = new PackageManager($this->initer);
//sync package in folder and db
if (isset($reload) && $reload != "canceled") {
$instancePage->check_new_package();
}
$content = "";
//$content.=$this->showIniter();
//submiter
$content .= $instancePage->form_submiter();
$form = $instancePage->form_loader();
$this->tpl->remplir_template("form", $form);
$content .= $instancePage->content_loader();
$this->tpl->remplir_template("content", $content);
$data = $instancePage->data_loader();
$this->tpl->remplir_template("data", $data);
示例10: isNoNeeded
/**
* Проверять возможность удаления указанного пакета.
*
* Если существует пакет который зависит от данного то удаление невозможно.
*
* Массив пакетов для удаления. Если удаление невозможно вернет false.
*
* @param $nvr
* @param array $unstatisfied
* @return array of packages | bool false
*/
static function isNoNeeded($nvr, &$unstatisfied)
{
$name = $nvr['name'];
$pseq = PackageManager::getPackageSequence();
$nvr['rel'] = Deps::normalizeRel($nvr['rel']);
if ($nvr['rel'] == '=') {
$nvr['rel'] = '>=';
}
$stayedList = array();
// версии которые останцтся после уддаления
$removedList = array();
// версии которые необходимо удалить
$addToRemovedList = false;
$checkList = array();
// пакеты которые необходимо проверить на совместимость
for ($i = 0, $c = count($pseq); $i < $c; $i++) {
if ($pseq[$i]['name'] != $name) {
if ($addToRemovedList) {
$checkList[] = $pseq[$i];
}
} else {
if (version_compare($pseq[$i]['version'], $nvr['version'], $nvr['rel'])) {
$addToRemovedList = true;
}
if ($addToRemovedList) {
$removedList[] = PackageManager::getInstalledPackage($pseq[$i]['name'], $pseq[$i]['version']);
} else {
$stayedList[] = $pseq[$i];
}
}
}
/*
io::out('Stayed list : '.$name, false);
foreach($stayedList as $a) io::out($a['name'].'='.$a['version']. ' ', false);
io::out();
io::out('removes list : ', false);
foreach($removedList as $a) io::out($a->version. ' ', false);
io::out();
io::out('CheckList : ', false);
foreach($checkList as $a) io::out($a['name'].' '.$a['version'].', ', false);
io::out();
*/
foreach ($checkList as $pnvr) {
$packageDeps = PackageManager::getInstalledPackage($pnvr['name'], $pnvr['version'])->deps['packages'];
foreach ($packageDeps as $p) {
if ($p['name'] == $name) {
$statisfy = false;
$luns = array();
// localUnstatisfied
//io::out($nvr['name'].' '.$nvr['version']);
//print_r($p);
// Все версии пакета будут удалены, а пакет фигурирует в зависимостях
if (count($stayedList) == 0) {
$luns[$p['name'] . ' ' . $p['rel'] . ' ' . $p['version']] = 1;
} else {
foreach ($stayedList as $stayedPackage) {
if (!version_compare($stayedPackage['version'], $p['version'], $p['rel'])) {
$luns[$p['name'] . ' ' . $p['rel'] . ' ' . $p['version']] = 1;
} else {
$statisfy = true;
break;
}
}
}
// если после удаления не останется ниодного пакета удовлетворяющего зависимости,
// то добавляем в массив нудовлетворенных зависимостей $luns
if (!$statisfy) {
$unstatisfied[$pnvr['name'] . '(' . $pnvr['version'] . ')'] = $luns;
}
}
}
}
return count($unstatisfied) ? false : array_reverse($removedList);
}
示例11: action_DeployPackage
function action_DeployPackage()
{
global $current_user;
if (defined('TEMPLATE_URL')) {
sugar_cache_reset();
SugarTemplateUtilities::disableCache();
}
//increment etag for menu so the new module shows up when the AJAX UI reloads
$current_user->incrementETag("mainMenuETag");
$mb = new ModuleBuilder();
$load = $_REQUEST['package'];
$message = $GLOBALS['mod_strings']['LBL_MODULE_DEPLOYED'];
if (!empty($load)) {
$zip = $mb->getPackage($load);
require_once 'ModuleInstall/PackageManager/PackageManager.php';
$pm = new PackageManager();
$info = $mb->packages[$load]->build(false);
$uploadDir = $pm->upload_dir . '/upgrades/module/';
mkdir_recursive($uploadDir);
rename($info['zip'], $uploadDir . $info['name'] . '.zip');
copy($info['manifest'], $uploadDir . $info['name'] . '-manifest.php');
$_REQUEST['install_file'] = $uploadDir . $info['name'] . '.zip';
$GLOBALS['mi_remove_tables'] = false;
$pm->performUninstall($load);
//#23177 , js cache clear
clearAllJsAndJsLangFilesWithoutOutput();
//#30747, clear the cache in memory
$cache_key = 'app_list_strings.' . $GLOBALS['current_language'];
sugar_cache_clear($cache_key);
sugar_cache_reset();
//clear end
$pm->performInstall($_REQUEST['install_file'], true);
//clear the unified_search_module.php file
require_once 'modules/Home/UnifiedSearchAdvanced.php';
UnifiedSearchAdvanced::unlinkUnifiedSearchModulesFile();
//bug 44269 - start
//clear workflow admin modules cache
if (isset($_SESSION['get_workflow_admin_modules_for_user'])) {
unset($_SESSION['get_workflow_admin_modules_for_user']);
}
//clear "is_admin_for_module" cache
$sessionVar = 'MLA_' . $current_user->user_name;
foreach ($mb->packages as $package) {
foreach ($package->modules as $module) {
$_SESSION[$sessionVar][$package->name . '_' . $module->name] = true;
}
}
//recreate acl cache
$actions = ACLAction::getUserActions($current_user->id, true);
//bug 44269 - end
}
echo 'complete';
}
示例12: cmdUnlock
/**
* Снимает блокировку системы.
*
*/
function cmdUnlock()
{
IO::out('Unlocking Package Manager', false);
if (PackageManager::get()->unlock(true)) {
io::done();
}
}
示例13: action_DeployPackage
function action_DeployPackage()
{
$mb = new ModuleBuilder();
$load = $_REQUEST['package'];
$message = $GLOBALS['mod_strings']['LBL_MODULE_DEPLOYED'];
if (!empty($load)) {
$zip = $mb->getPackage($load);
require_once 'ModuleInstall/PackageManager/PackageManager.php';
$pm = new PackageManager();
$info = $mb->packages[$load]->build(false);
mkdir_recursive($GLOBALS['sugar_config']['cache_dir'] . '/upload/upgrades/module/');
rename($info['zip'], $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '.zip');
copy($info['manifest'], $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '-manifest.php');
$_REQUEST['install_file'] = $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '.zip';
$GLOBALS['mi_remove_tables'] = false;
$pm->performUninstall($load);
$pm->performInstall($_REQUEST['install_file']);
}
echo 'complete';
}
示例14: resources_url
<?php
PackageManager::add('cron')->js(null, resources_url('/libs/jquery-cron/js/jquery-cron-min.js'), 'jquery');
示例15: resources_url
<?php
PackageManager::add('page-wysiwyg')->js('page-wysiwyg-libraries', resources_url('/js/page-wysiwyg-libraries.js'), 'jquery')->js(null, resources_url('/js/page-wysiwyg.js'), ['page-wysiwyg-libraries'])->css(null, resources_url('/css/page-wysiwyg.css'));