如何从[MySQL] Plesk数据库中获取所有域的到期日期?

时间:2015-03-08 02:40:10

标签: mysql plesk

我曾经在仪表板上运行这个简洁的小报告,我的日常用品会报告我所有托管的plesk域名的到期日期[Plesk 9]

看起来像这样:

select d.name, l.* from Limits l 
left join domains d on l.id =d.id 
where l.limit_name = "expiration" and d.name != ""
order by value 

非常简单,我可以在月初查看它并使用我用来对其进行排序的代码,并使人类可读日期突出显示当前月份的所有费用。大。

我更新到Plesk 12,现在已经打破,因为它们似乎已经改变了架构,对于我的生活我似乎无法弄明白。

我尝试过这样的事情:

select d.name, l.* from Limits l 
left join clients c on c.pool_id = l.id
left join domains d on c.id = d.cl_id 
where l.limit_name = "expiration" and d.name != ""
order by value ASC;

这似乎也不起作用,只是取结果样本,一些域显示过期为-1,但在Plesk中查看它们显示过期日期。 [与我上次结算相符的到期日期]

有谁知道如何查询[MySQL] psa数据库以获取所有域到期日期的列表?

-Thanks

更新

好的,通过启用&拖尾mysql查询日志我发现这些查询将获得我需要的信息:

select `id`, `name`, `displayName`, `cr_date`, `status`, `webspace_status`, `dns_zone_id`, `htype`, `cl_id`, `vendor_id`, `webspace_id`, `parentDomainId`, `cert_rep_id`, `real_size`, `guid`, `external_id`,
 `adminDescription`, `resellerDescription`, `description`, `overuse` from `domains` where `id`=110;


SELECT `Subscriptions`.* FROM `Subscriptions` AS `Subscriptions` WHERE (`object_type` = 'domain' AND `object_id` = 110);


SELECT `SubscriptionProperties`.* FROM `SubscriptionProperties` AS `SubscriptionProperties` WHERE (`subscription_id` = '70');


SELECT `Limits`.* FROM `Limits` AS `Limits` WHERE (`id` = '77');

最后一点,id 77,来自SubscriptionProperties表中的limitid值,如何将所有这些查询加入到一个中,以便创建报告? 我正在做类似这样的事情,但没有取得任何进展:

select s.* , d.name, l.*
from Subscriptions s left join domains d on s.object_id = d.id
left join SubscriptionProperties sp on sp.subscription_id = s.id
left join Limits l on l.id = (select SubscriptionProperties.value from SubscriptionProperties where subscription_id = s.id and name = 'limistid');

3 个答案:

答案 0 :(得分:1)

解决:

select d.`name`, l.* from SubscriptionProperties sp 
left join Subscriptions s on s.id = sp.subscription_id
left join domains d on d.id = s.object_id
left join Limits l on l.id = sp.value
where sp.`name` = 'limitsId' and l.limit_name = 'expiration'
order by value;

答案 1 :(得分:0)

使用类似:

for i in `mysql -uadmin -p\`cat /etc/psa/.psa.shadow\` psa -Ns -e "select name from domains"`; do /usr/local/psa/bin/domain -i $i; done | grep -B4 -i expir 

答案 2 :(得分:0)

您可以在psa数据库的Limits表中找到域订阅ID的截止日期。