本文整理汇总了PHP中image::get_ids_by_storage方法的典型用法代码示例。如果您正苦于以下问题:PHP image::get_ids_by_storage方法的具体用法?PHP image::get_ids_by_storage怎么用?PHP image::get_ids_by_storage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::get_ids_by_storage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$found_hc = false;
$found_hc_id = -1;
foreach ($hc_id_list as $list) {
foreach ($list as $hc_id) {
$storage->get_instance_by_id($hc_id);
if ($storage->resource_id == 0) {
$found_hc = true;
$found_hc_id = $storage->id;
break;
}
}
}
if ($found_hc) {
// remove all AMI Images, then the storage
$image = new image();
$hc_image_list = $image->get_ids_by_storage($found_hc_id);
foreach ($hc_image_list as $list) {
foreach ($list as $hc_image_id) {
$image->remove($hc_image_id);
$event->log("init", $_SERVER['REQUEST_TIME'], 5, "hybrid-cloud-ation", "Removed AMI Image Object " . $hc_image_id . ".", "", "", 0, 0, 0);
}
}
$storage->remove($found_hc_id);
}
// remove cloud products
if (file_exists($cloud_usergroup_class)) {
require_once $cloud_usergroup_class;
$cloud_project = new cloudusergroup();
$cloud_project->get_instance_by_name('Admin');
if (file_exists($cloud_selector_class)) {
if (file_exists($cloud_product_hook)) {
示例2: remove
function remove()
{
$response = $this->get_response();
$storages = $response->html->request()->get($this->identifier_name);
$form = $response->form;
$storage = new storage();
if ($storages !== '') {
$submit = $form->get_elements('submit');
$submit->handler = 'onclick="wait();"';
$form->add($submit, 'submit');
$submit = $form->get_elements('cancel');
$submit->handler = 'onclick="cancel();"';
$form->add($submit, 'cancel');
$i = 0;
foreach ($storages as $id) {
$storage = $storage->get_instance_by_id($id);
$d['param_f' . $i]['label'] = $storage->name;
$d['param_f' . $i]['object']['type'] = 'htmlobject_input';
$d['param_f' . $i]['object']['attrib']['type'] = 'checkbox';
$d['param_f' . $i]['object']['attrib']['name'] = $this->identifier_name . '[' . $i . ']';
$d['param_f' . $i]['object']['attrib']['value'] = $id;
$d['param_f' . $i]['object']['attrib']['checked'] = true;
$i++;
}
$form->add($d);
if (!$form->get_errors() && $response->submit()) {
$errors = array();
$message = array();
foreach ($storages as $key => $id) {
$storage = $storage->get_instance_by_id($id);
$storage_name = $storage->name;
$image_is_used_by_storage = "";
$remove_error = 0;
$image_remove_check = new image();
$image_remove_id_list = $image_remove_check->get_ids_by_storage($id);
foreach ($image_remove_id_list as $image_list) {
$image_id = $image_list['image_id'];
$image_is_used_by_storage .= $image_id . " ";
$remove_error = 1;
}
if ($remove_error == 1) {
$message[] = sprintf($this->lang['msg_not_removing_active'], $id, $image_is_used_by_storage);
continue;
}
$storage->remove($id);
$form->remove($this->identifier_name . '[' . $key . ']');
$message[] = sprintf($this->lang['msg_removed'], $storage_name);
}
if (count($errors) === 0) {
$response->msg = join('<br>', $message);
} else {
$msg = array_merge($errors, $message);
$response->error = join('<br>', $msg);
}
}
} else {
$response->msg = '';
}
return $response;
}