<pre>
------ Change Logs ------
<?PHP
ini_set 
('max_execution_time'60);

// Include the config
require_once('../include/config.inc.php');


$sql "SELECT package_p, category_title, package_title, changelog_md5 FROM category, package LEFT JOIN package_changelog ON package_p = package_f WHERE category_p = category_f AND package._removed IS NULL";
$results mysql_query($sql) or die(mysql_error());
while(
$row mysql_fetch_assoc($results)){
    
$changelog $GLOBAL['portage_dir'].'/'.$row['category_title'].'/'.$row['package_title'].'/ChangeLog';
    
    if(
is_file($changelog)){
        
$changelog_md5 md5_file($changelog);
    
        if(
$changelog_md5 != $row['changelog_md5']){
            
$changelog_file file_get_contents($changelog);
            
            
$sql "UPDATE package_changelog SET changelog = '".mysqlclean($changelog_file)."', changelog_md5 = '".mysqlclean($changelog_md5)."' WHERE package_f = '".$row['package_p']."'";
            
mysql_query($sql) or die(mysql_error());
            
            if (
mysql_affected_rows() == 0){
                
$sql "INSERT INTO package_changelog (`package_f`, `changelog`, `changelog_md5`) 
                            VALUES ('"
.$row['package_p']."', '".mysqlclean($changelog_file)."', '".mysqlclean($changelog_md5)."')";
                
mysql_query($sql) or die(mysql_error());
            }
            
            echo 
$row['category_title']."/".$row['package_title']." (".$row['changelog_md5'].")\n";
        }
    }
}


?>
</pre>