Jump to content

hooks did not work,show that No Hook Functions Defined for AfterCronJob


Recommended Posts

im useing hooks to add some code after cronjob

 

heres my hooks file ,i have try to use it in whmcs 7 ,and its running well 

 

but since 17th this month, i found its stop work

 

when i turn on the hooks debug mod, and got 

 

21/10/2020 20:57
Cron Job: Hooks Debug: No Hook Functions Defined for AfterCronJob
 
-
 
21/10/2020 20:57
Cron Job: Hooks Debug: Called Hook Point AfterCronJob
 
-
 
21/10/2020 20:55
Cron Job: Hooks Debug: No Hook Functions Defined for AfterCronJob
 
-
 
21/10/2020 20:55
Cron Job: Hooks Debug: Called Hook Point AfterCronJob
 
-
 
21/10/2020 20:50
Cron Job: Hooks Debug: No Hook Functions Defined for AfterCronJob
 
-
 
21/10/2020 20:50
Cron Job: Hooks Debug: Called Hook Point AfterCronJob
 
-
 
21/10/2020 20:48
Cron Job: Hooks Debug: No Hook Functions Defined for AfterCronJob

 

Does anyone have any comments or experience on this?

 

thank u guys

 

whmcs 8.0.3

php 7.4.11

 

<?php
use WHMCS\Database\Capsule;
add_hook('AfterCronJob'1function(){
    try {
        $query = \WHMCS\Database\Capsule::table('tblproducts')->where('servertype''V2RaySocks')->get();
        $query2 = \WHMCS\Database\Capsule::table('tblhosting')->where('domainstatus''Active')->get();
        $query3 = \WHMCS\Database\Capsule::table('tblservers')->where('type''V2RaySocks')->get();
        $products = V2RaySocks_QueryToArray($query);
        $clients = V2RaySocks_QueryToArray($query2);
        $servers = V2RaySocks_QueryToArray($query3);
        $pids = V2RaySocks_prase_pid($products);
        $pro = V2RaySocks_get_client_products_with_pids($clients,$pids,array('Active','Suspended'));
        $pro = V2RaySocks_update_network($pro,$servers,V2RaySocks_prase_product_DB($products),$products);
    }catch (Exception $e){
    }
});
 
add_hook('AfterCronJob'1function() {
    try {
        $query = \WHMCS\Database\Capsule::table('tblproducts')->where('servertype''V2RaySocks')->get();
        $query2 = \WHMCS\Database\Capsule::table('tblhosting')->where('domainstatus''Active')->get();
        $query3 = \WHMCS\Database\Capsule::table('tblservers')->where('type''V2RaySocks')->get();
        $products = V2RaySocks_QueryToArray($query);
        $clients = V2RaySocks_QueryToArray($query2);
        $servers = V2RaySocks_QueryToArray($query3);
        $pids = V2RaySocks_prase_pid($products);
        $pro = V2RaySocks_get_client_products_with_pids($clients,$pids,array('Active','Suspended'));
        $rproducts = V2RaySocks_RebuildProductArray($products);
        $pro = V2RaySocks_CalcBandReset($pro,$rproducts,$servers);
    }catch (Exception $e){
    }
});
 
function V2RaySocks_QueryToArray($query){
    $products = array();
    foreach ($query as $product) {
        $producta = array();
        foreach($product as $k => $produc){
            $producta[$k] = $produc;
        }
        $products[] = $producta;
    }
    return $products;
}
 
......
 
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated