FORMfields, the premiere web framework
Login
Support Home | Knowledge Base | Documentation | Forums | Contact Us
Info
AdMan :: Miscellaneous

Purging Stats

(2436 views. Last Updated: 2009-08-17 9:21 AM)

Here is a simple way to clear some of the statistical data that is stored in AdMan.

1. Create a file called purgeStats.php:
<?php

    
require_once(dirname(__FILE__) . "/../globals.php");
    
    
verifyMembership(GROUP_ADMIN);
    
    
define("AM_DAYS_TO_KEEP"90);
    
    
$db = &FfDb::s();
    
    
$db->query("
        DELETE FROM " 
AD_MAN_TABLE_PREFIX "ad_requests 
        WHERE ts<NOW() - INTERVAL " 
AM_DAYS_TO_KEEP " DAY
    "
);

    
$db->query("
        DELETE FROM " 
AD_MAN_TABLE_PREFIX "daily_stats
        WHERE ts<NOW() - INTERVAL " 
AM_DAYS_TO_KEEP " DAY
    "
);
    
    
$db->query("
        DELETE FROM " 
AD_MAN_TABLE_PREFIX "page_requests
        WHERE ts<NOW() - INTERVAL " 
AM_DAYS_TO_KEEP " DAY
    "
);
    
    echo 
"Purge Complete";

?>

2. Configure the value of AM_DAYS_TO_KEEP so that it reflects the number of days of stats data that you wish to keep.

3. Upload the file to your AdMan installation to the location /adMan/misc/purgeStats.php

4. Visit the file in a web browser, e.g. http://example.com/adMan/misc/purgeStats.php. Note: You will need to login with you administrator account before the script will execute.
Info
Support | Earn Money
Copyright © 2005-2019 Brain Book Software LLC.
Built with FORMfields, the premiere web framework.