如何从 [MySQL] Plesk 数据库中获取所有域的到期日期?
How to get the expiration dates of all domains from a [MySQL] Plesk database?
我曾经有一个简洁的小报告,运行 在我的日常用品的仪表板上,它会报告我所有托管的 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 数据库以获得所有域到期日期的列表?
-谢谢
更新
好的,通过启用和拖尾 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 table 中的 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');
使用类似于:
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
您可以在 psa 数据库的限制 table 中找到域订阅 ID 的到期日期。
已解决:
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;
我曾经有一个简洁的小报告,运行 在我的日常用品的仪表板上,它会报告我所有托管的 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 数据库以获得所有域到期日期的列表?
-谢谢
更新
好的,通过启用和拖尾 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 table 中的 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');
使用类似于:
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
您可以在 psa 数据库的限制 table 中找到域订阅 ID 的到期日期。
已解决:
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;