本文整理汇总了PHP中Scalr_Model::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Scalr_Model::delete方法的具体用法?PHP Scalr_Model::delete怎么用?PHP Scalr_Model::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scalr_Model
的用法示例。
在下文中一共展示了Scalr_Model::delete方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
/**
* {@inheritdoc}
* @see Scalr_Model::delete()
*/
public function delete($id = null)
{
if ($this->db->GetOne('SELECT COUNT(*) FROM apache_vhosts WHERE ssl_cert_id = ?', array($this->id)) > 0) {
throw new Scalr_Exception_Core(sprintf('Certificate "%s" is used by apache virtual host(s)', $this->name));
}
parent::delete();
}
示例2: delete
public function delete()
{
parent::delete();
//TODO: Use models
$this->db->Execute("DELETE FROM account_audit WHERE account_id=?", array($this->id));
$this->db->Execute("DELETE FROM account_users WHERE account_id=?", array($this->id));
$this->db->Execute("DELETE FROM account_teams WHERE account_id=?", array($this->id));
$this->db->Execute("DELETE FROM account_limits WHERE account_id=?", array($this->id));
$this->db->Execute("DELETE FROM client_environments WHERE client_id=?", array($this->id));
$this->db->Execute("DELETE FROM servers WHERE client_id=?", array($this->id));
$this->db->Execute("DELETE FROM ec2_ebs WHERE client_id=?", array($this->id));
$this->db->Execute("DELETE FROM apache_vhosts WHERE client_id=?", array($this->id));
$this->db->Execute("DELETE FROM scheduler WHERE account_id=?", array($this->id));
$farms = $this->db->GetAll("SELECT id FROM farms WHERE clientid='{$this->id}'");
foreach ($farms as $farm) {
$this->db->Execute("DELETE FROM farms WHERE id=?", array($farm["id"]));
$this->db->Execute("DELETE FROM farm_roles WHERE farmid=?", array($farm["id"]));
$this->db->Execute("DELETE FROM farm_role_options WHERE farmid=?", array($farm["id"]));
$this->db->Execute("DELETE FROM farm_role_scripts WHERE farmid=?", array($farm["id"]));
$this->db->Execute("DELETE FROM farm_event_observers WHERE farmid=?", array($farm["id"]));
$this->db->Execute("DELETE FROM elastic_ips WHERE farmid=?", array($farm["id"]));
}
$roles = $this->db->GetAll("SELECT id FROM roles WHERE client_id='{$this->id}'");
foreach ($roles as $role) {
$this->db->Execute("DELETE FROM roles WHERE id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_behaviors WHERE role_id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_images WHERE role_id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_parameters WHERE role_id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_properties WHERE role_id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_security_rules WHERE role_id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_software WHERE role_id = ?", array($role['id']));
}
}
示例3: delete
public function delete()
{
parent::delete();
foreach ($this->getGroups() as $group) {
$this->db->Execute('DELETE FROM `account_group_permissions` WHERE group_id = ?', array($group['id']));
}
$this->db->Execute('DELETE FROM `account_groups` WHERE team_id = ?', array($this->id));
$this->db->Execute('DELETE FROM `account_team_users` WHERE team_id = ?', array($this->id));
$this->db->Execute('DELETE FROM `account_team_envs` WHERE team_id = ?', array($this->id));
}
示例4: delete
public function delete()
{
parent::delete();
$this->db->Execute("DELETE FROM service_config_preset_data WHERE preset_id = ?", array($this->id));
$this->db->Execute("DELETE FROM farm_role_service_config_presets WHERE preset_id = ?", array($this->id));
}
示例5: delete
/**
* {@inheritdoc}
* @see Scalr_Model::delete()
*/
public function delete($id = null)
{
if ($this->type == Scalr_Account_User::TYPE_ACCOUNT_OWNER) {
throw new Exception('You cannot remove Account Owner');
}
parent::delete();
$this->db->Execute('DELETE FROM `account_team_users` WHERE user_id = ?', array($this->id));
$this->db->Execute('DELETE FROM `account_user_settings` WHERE user_id = ?', array($this->id));
}
示例6: delete
/**
* {@inheritdoc}
* @see Scalr_Model::delete()
*/
public function delete($id = null)
{
if ($this->db->GetOne("SELECT COUNT(*) FROM farms WHERE env_id = ?", array($this->id))) {
throw new Exception("Cannot remove environment. You need to remove all your farms first.");
}
if ($this->db->GetOne("SELECT COUNT(*) FROM client_environments WHERE client_id = ?", array($this->clientId)) < 2) {
throw new Exception('At least one environment should be in account. You cannot remove the last one.');
}
parent::delete();
try {
$this->db->Execute("DELETE FROM client_environment_properties WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM apache_vhosts WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM autosnap_settings WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM bundle_tasks WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM dm_applications WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM dm_deployment_tasks WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM dm_sources WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM dns_zones WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM ec2_ebs WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM elastic_ips WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM farms WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM roles WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM servers WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM ssh_keys WHERE env_id=?", array($this->id));
$this->db->Execute('DELETE FROM `account_team_envs` WHERE env_id = ?', array($this->id));
$this->db->Execute('DELETE FROM `global_variables` WHERE env_id = ?', array($this->id));
} catch (Exception $e) {
throw new Exception(sprintf(_("Cannot delete record. Error: %s"), $e->getMessage()), $e->getCode());
}
}
示例7: delete
public function delete()
{
parent::delete();
$this->clearPermissions();
$this->db->Execute('DELETE FROM `account_user_groups` WHERE group_id = ?', array($this->id));
}
示例8: delete
/**
* {@inheritdoc}
* @see Scalr_Model::delete()
*/
public function delete($id = null)
{
$servers = \DBServer::listByFilter(['clientId' => $this->id]);
foreach ($servers as $server) {
/* @var $server \DBServer */
$server->Remove();
}
try {
$this->db->StartTrans();
//TODO: Use models
$this->db->Execute("\n DELETE account_team_users FROM account_team_users, account_teams\n WHERE account_teams.account_id = ?\n AND account_team_users.team_id = account_teams.id\n ", array($this->id));
$this->db->Execute("DELETE FROM account_users WHERE account_id=?", array($this->id));
$this->db->Execute("DELETE FROM account_teams WHERE account_id=?", array($this->id));
$this->db->Execute("DELETE FROM account_limits WHERE account_id=?", array($this->id));
/* @var $environment Environment */
foreach (Environment::findByAccountId($this->id) as $environment) {
$environment->delete(true);
}
CloudCredentials::deleteByAccountId($this->id);
$this->db->Execute("\n DELETE account_team_user_acls FROM account_team_user_acls, acl_account_roles\n WHERE acl_account_roles.account_id = ?\n AND account_team_user_acls.account_role_id = acl_account_roles.account_role_id\n ", array($this->id));
$this->db->Execute("DELETE FROM acl_account_roles WHERE account_id=?", array($this->id));
$this->db->Execute("DELETE FROM ec2_ebs WHERE client_id=?", array($this->id));
$this->db->Execute("DELETE FROM apache_vhosts WHERE client_id=?", array($this->id));
$this->db->Execute("DELETE FROM scheduler WHERE account_id=?", array($this->id));
foreach ($this->db->Execute("SELECT id FROM farms WHERE clientid=?", [$this->id]) as $farm) {
$this->db->Execute("DELETE FROM farms WHERE id=?", array($farm["id"]));
$this->db->Execute("DELETE FROM farm_roles WHERE farmid=?", array($farm["id"]));
$this->db->Execute("DELETE FROM elastic_ips WHERE farmid=?", array($farm["id"]));
}
$roles = $this->db->GetAll("SELECT id FROM roles WHERE client_id = '{$this->id}'");
foreach ($roles as $role) {
$this->db->Execute("DELETE FROM roles WHERE id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_behaviors WHERE role_id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_images WHERE role_id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_properties WHERE role_id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_security_rules WHERE role_id = ?", array($role['id']));
}
//Removing cost centres and projects which are set up from this account
$this->db->Execute("\n DELETE project_properties FROM project_properties, projects\n WHERE projects.project_id = project_properties.project_id\n AND projects.account_id = ?\n ", [$this->id]);
$this->db->Execute("DELETE FROM projects WHERE account_id = ?", [$this->id]);
$this->db->Execute("\n DELETE cc_properties FROM cc_properties, ccs\n WHERE ccs.cc_id = cc_properties.cc_id\n AND ccs.account_id = ?\n ", [$this->id]);
$this->db->Execute("DELETE FROM ccs WHERE account_id = ?", [$this->id]);
parent::delete();
ReportEntity::deleteByAccountId($this->id);
NotificationEntity::deleteByAccountId($this->id);
$this->db->CompleteTrans();
} catch (\Exception $e) {
$this->db->RollbackTrans();
throw $e;
}
}
示例9: delete
/**
* {@inheritdoc}
* @see Scalr_Model::delete()
*/
public function delete($id = null)
{
try {
$this->db->StartTrans();
//TODO: Use models
$this->db->Execute("\n DELETE account_team_users FROM account_team_users, account_teams\n WHERE account_teams.account_id = ?\n AND account_team_users.team_id = account_teams.id\n ", array($this->id));
$this->db->Execute("DELETE FROM account_users WHERE account_id=?", array($this->id));
$this->db->Execute("DELETE FROM account_teams WHERE account_id=?", array($this->id));
$this->db->Execute("DELETE FROM account_limits WHERE account_id=?", array($this->id));
$this->db->Execute("DELETE FROM client_environments WHERE client_id=?", array($this->id));
$this->db->Execute("\n DELETE account_team_user_acls FROM account_team_user_acls, acl_account_roles\n WHERE acl_account_roles.account_id = ?\n AND account_team_user_acls.account_role_id = acl_account_roles.account_role_id\n ", array($this->id));
$this->db->Execute("DELETE FROM acl_account_roles WHERE account_id=?", array($this->id));
$this->db->Execute("DELETE FROM servers WHERE client_id=?", array($this->id));
$this->db->Execute("DELETE FROM ec2_ebs WHERE client_id=?", array($this->id));
$this->db->Execute("DELETE FROM apache_vhosts WHERE client_id=?", array($this->id));
$this->db->Execute("DELETE FROM scheduler WHERE account_id=?", array($this->id));
$farms = $this->db->GetAll("SELECT id FROM farms WHERE clientid='{$this->id}'");
foreach ($farms as $farm) {
$this->db->Execute("DELETE FROM farms WHERE id=?", array($farm["id"]));
$this->db->Execute("DELETE FROM farm_roles WHERE farmid=?", array($farm["id"]));
$this->db->Execute("DELETE FROM farm_role_options WHERE farmid=?", array($farm["id"]));
$this->db->Execute("DELETE FROM farm_event_observers WHERE farmid=?", array($farm["id"]));
$this->db->Execute("DELETE FROM elastic_ips WHERE farmid=?", array($farm["id"]));
}
$roles = $this->db->GetAll("SELECT id FROM roles WHERE client_id='{$this->id}'");
foreach ($roles as $role) {
$this->db->Execute("DELETE FROM roles WHERE id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_behaviors WHERE role_id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_images WHERE role_id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_parameters WHERE role_id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_properties WHERE role_id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_security_rules WHERE role_id = ?", array($role['id']));
$this->db->Execute("DELETE FROM role_software WHERE role_id = ?", array($role['id']));
}
//Removing cost centres and projects which are set up from this account
$this->db->Execute("\n DELETE project_properties FROM project_properties, projects\n WHERE projects.project_id = project_properties.project_id\n AND projects.account_id = ?\n ", [$this->id]);
$this->db->Execute("DELETE FROM projects WHERE account_id = ?", [$this->id]);
$this->db->Execute("\n DELETE cc_properties FROM cc_properties, ccs\n WHERE ccs.cc_id = cc_properties.cc_id\n AND ccs.account_id = ?\n ", [$this->id]);
$this->db->Execute("DELETE FROM ccs WHERE account_id = ?", [$this->id]);
parent::delete();
$this->db->CompleteTrans();
} catch (\Exception $e) {
$this->db->RollbackTrans();
throw $e;
}
}
示例10: delete
/**
* {@inheritdoc}
* @see Scalr_Model::delete()
*/
public function delete($id = null)
{
parent::delete();
$this->db->Execute('DELETE FROM `account_team_users` WHERE team_id = ?', array($this->id));
$this->db->Execute('DELETE FROM `account_team_envs` WHERE team_id = ?', array($this->id));
}
示例11: delete
/**
* {@inheritdoc}
* @see Scalr_Model::delete()
*/
public function delete($id = null)
{
// TODO: rewrite shortcuts
// Check template usage
$rolesCount = $this->db->GetOne("SELECT COUNT(*) FROM farm_role_scripts WHERE scriptid=? AND event_name NOT LIKE 'CustomEvent-%'", array($this->id));
if ($rolesCount > 0) {
throw new Scalr_Exception_Core(sprintf('Script "%s" being used and can\'t be deleted', $this->name));
}
parent::delete();
$id = !is_null($id) ? $id : $this->id;
$this->db->Execute("DELETE FROM farm_role_scripts WHERE scriptid=?", array($id));
$this->db->Execute("DELETE FROM script_revisions WHERE scriptid=?", array($id));
}
示例12: delete
/**
* {@inheritdoc}
* @see Scalr_Model::delete()
*/
public function delete($id = null)
{
if ($this->db->GetOne("SELECT COUNT(*) FROM farms WHERE env_id = ?", array($this->id))) {
throw new Exception("Cannot remove environment. You need to remove all your farms first.");
}
if ($this->db->GetOne("SELECT COUNT(*) FROM client_environments WHERE client_id = ?", array($this->clientId)) < 2) {
throw new Exception('At least one environment should be in account. You cannot remove the last one.');
}
parent::delete();
try {
$this->db->Execute("DELETE FROM client_environment_properties WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM apache_vhosts WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM autosnap_settings WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM bundle_tasks WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM dns_zones WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM ec2_ebs WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM elastic_ips WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM farms WHERE env_id=?", array($this->id));
$this->db->Execute("DELETE FROM roles WHERE env_id=?", array($this->id));
$servers = \DBServer::listByFilter(['envId' => $this->id]);
foreach ($servers as $server) {
/* @var $server \DBServer */
$server->Remove();
}
Entity\EnvironmentCloudCredentials::deleteByEnvId($this->id);
Entity\CloudCredentials::deleteByEnvId($this->id);
$this->db->Execute("DELETE FROM `account_team_envs` WHERE env_id = ?", array($this->id));
} catch (Exception $e) {
throw new Exception(sprintf(_("Cannot delete record. Error: %s"), $e->getMessage()), $e->getCode());
}
}