本文整理汇总了PHP中image::remove_by_name方法的典型用法代码示例。如果您正苦于以下问题:PHP image::remove_by_name方法的具体用法?PHP image::remove_by_name怎么用?PHP image::remove_by_name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类image
的用法示例。
在下文中一共展示了image::remove_by_name方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: kernel
require_once "{$plugin_start_appliance_hook}";
$appliance_function = "openqrm_" . "{$plugin_name}" . "_appliance";
$appliance_function = str_replace("-", "_", $appliance_function);
// stop
$appliance_function("stop", $appliance_fields);
// remove
$appliance_function("remove", $appliance_fields);
}
}
// remove appliance
$appliance->remove($appliance_id);
}
}
// remove kernel
$kernel = new kernel();
$kernel->remove_by_name("resource{$local_server_id}");
// remove image
$image = new image();
$image->remove_by_name("resource{$local_server_id}");
// remove storage serveer
$storage = new storage();
$storage->remove_by_name("resource{$local_server_id}");
break;
default:
$event->log("{$local_server_command}", $_SERVER['REQUEST_TIME'], 3, "local-server-action", "No such local-server command ({$local_server_command})", "", "", 0, 0, 0);
break;
}
?>
</body>
示例2: image
$image = new image();
if (!strlen($image_fields["image_isshared"])) {
$image_fields["image_isshared"] = "0";
}
// unquote
$image_deployment_parameter = $image_fields["image_deployment_parameter"];
$image_fields["image_deployment_parameter"] = stripslashes($image_deployment_parameter);
$image->update($image_id, $image_fields);
break;
case 'remove':
$image = new image();
$image->remove($image_id);
break;
case 'remove_by_name':
$image = new image();
$image->remove_by_name($image_name);
break;
case 'add_deployment_type':
$deployment = new deployment();
$deployment_fields["deployment_id"] = (int) str_replace(".", "", str_pad(microtime(true), 15, "0"));
$deployment->add($deployment_fields);
break;
case 'remove_deployment_type':
$deployment = new deployment();
$deployment->remove_by_type($deployment_name);
break;
default:
$event->log("{$image_command}", $_SERVER['REQUEST_TIME'], 3, "image-action", "No such image command ({$image_command})", "", "", 0, 0, 0);
break;
}
?>
示例3: remove
function remove()
{
$response = $this->get_response();
$lvols = $response->html->request()->get($this->identifier_name);
$form = $response->form;
if ($lvols !== '') {
$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 ($lvols as $ex) {
$d['param_f' . $i]['label'] = $ex;
$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'] = $ex;
$d['param_f' . $i]['object']['attrib']['checked'] = true;
$i++;
}
$form->add($d);
if (!$form->get_errors() && $response->submit()) {
$name = $this->openqrm->admin()->name;
$pass = $this->openqrm->admin()->password;
$storage = new storage();
$resource = new resource();
$deployment = new deployment();
$storage->get_instance_by_id($this->response->html->request()->get('storage_id'));
$resource->get_instance_by_id($storage->resource_id);
$deployment->get_instance_by_id($storage->type);
$errors = array();
$message = array();
foreach ($lvols as $key => $lvol) {
// check if an appliance is still using the volume as an image
$image = new image();
$image->get_instance_by_name($lvol);
// check if it is still in use
$appliance = new appliance();
$appliances_using_resource = $appliance->get_ids_per_image($image->id);
if (count($appliances_using_resource) > 0) {
$appliances_using_resource_str = implode(",", $appliances_using_resource[0]);
$errors[] = sprintf($this->lang['msg_vm_image_still_in_use'], $lvol, $image->id, $appliances_using_resource_str);
} else {
$command = $this->openqrm->get('basedir') . '/plugins/kvm/bin/openqrm-kvm remove';
$command .= ' -n ' . $lvol;
$command .= ' -v ' . $this->volgroup;
$command .= ' -t ' . $deployment->type;
$command .= ' -u ' . $name . ' -p ' . $pass;
$command .= ' --openqrm-ui-user ' . $this->user->name;
$command .= ' --openqrm-cmd-mode background';
$file = $this->openqrm->get('basedir') . '/plugins/kvm/web/storage/' . $resource->id . '.' . $this->volgroup . '.lv.stat';
if ($this->file->exists($file)) {
$this->file->remove($file);
}
$resource->send_command($resource->ip, $command);
while (!$this->file->exists($file)) {
usleep(10000);
// sleep 10ms to unload the CPU
clearstatcache();
}
$form->remove($this->identifier_name . '[' . $key . ']');
$message[] = sprintf($this->lang['msg_removed'], $lvol);
// remove the image of the volume
$image->remove_by_name($lvol);
}
}
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;
}
示例4: remove
function remove()
{
$response = $this->get_response();
$volume_names = $response->html->request()->get($this->identifier_name);
$form = $response->form;
if ($volume_names !== '') {
$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 ($volume_names as $ex) {
$d['param_f' . $i]['label'] = $ex;
$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'] = $ex;
$d['param_f' . $i]['object']['attrib']['checked'] = true;
$i++;
}
$form->add($d);
if (!$form->get_errors() && $response->submit()) {
$storage_id = $this->response->html->request()->get('storage_id');
$storage = new storage();
$resource = new resource();
$errors = array();
$message = array();
foreach ($volume_names as $key => $volume_name) {
// check if an appliance is still using the volume as an image
$image = new image();
$image->get_instance_by_name($volume_name);
// check if it is still in use
$appliance = new appliance();
$appliances_using_resource = $appliance->get_ids_per_image($image->id);
if (count($appliances_using_resource) > 0) {
$appliances_using_resource_str = implode(",", $appliances_using_resource[0]);
$errors[] = sprintf($this->lang['msg_image_still_in_use'], $volume_name, $image->id, $appliances_using_resource_str);
} else {
// remove volume
$linuxcoe_volume = new linuxcoe_volume();
$linuxcoe_volume->remove_by_name($volume_name);
// remove the image of the volume
$image->remove_by_name($volume_name);
$form->remove($this->identifier_name . '[' . $key . ']');
$message[] = sprintf($this->lang['msg_removed'], $volume_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;
}