本文整理汇总了PHP中PackageManager::checkForUpdates方法的典型用法代码示例。如果您正苦于以下问题:PHP PackageManager::checkForUpdates方法的具体用法?PHP PackageManager::checkForUpdates怎么用?PHP PackageManager::checkForUpdates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PackageManager
的用法示例。
在下文中一共展示了PackageManager::checkForUpdates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkForUpdates
/**
* Check the SugarDepot for updates for the given type as passed in via POST
* @param type the type to check for
* @return array return an array of releases for each given installed object if an update is found
*/
function checkForUpdates()
{
$json = getJSONobj();
$type = '';
if (isset($_REQUEST['type'])) {
$type = nl2br($_REQUEST['type']);
}
$pm = new PackageManager();
$updates = $pm->checkForUpdates();
$nodes = array();
$release_map = array();
if (!empty($updates)) {
foreach ($updates as $update) {
$update = PackageManager::fromNameValueList($update);
$nodes[] = array('label' => $update['name'], 'description' => $update['description'], 'version' => $update['version'], 'build_number' => $update['build_number'], 'id' => $update['id'], 'type' => $update['type']);
$release_map[$update['id']] = array('package_id' => $update['package_id'], 'category_id' => $update['category_id'], 'type' => $update['type']);
}
}
//patches
$filter = array(array('name' => 'type', 'value' => "'patch'"));
$releases = $pm->getReleases('', '', $filter);
if (!empty($releases['packages'])) {
foreach ($releases['packages'] as $update) {
$update = PackageManager::fromNameValueList($update);
$nodes[] = array('label' => $update['name'], 'description' => $update['description'], 'version' => $update['version'], 'build_number' => $update['build_number'], 'id' => $update['id'], 'type' => $update['type']);
$release_map[$update['id']] = array('package_id' => $update['package_id'], 'category_id' => $update['category_id'], 'type' => $update['type']);
}
}
$_SESSION['ML_PATCHES'] = $release_map;
echo 'result = ' . $json->encode(array('updates' => $nodes));
}