Ignore:
Timestamp:
07/08/08 18:12:41 (4 years ago)
Author:
hverton
Message:

updated the batch tools to support the new "external download" field

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/common/download_statistics/php-files/modules/download_statistics/batch/migrate_download_statistics.php

    r1492 r1531  
    9797            $data = mysql_fetch_assoc($result); 
    9898        } 
    99         // fill the file_ipss table from the old statistics table and create the logfiles 
     99 
     100        // fill the file_ips table from the old statistics table and create the logfiles 
    100101        display("Creating the new download logfiles:");  
    101102        $result = mysql_query("SELECT * FROM ".$db_prefix.$table." ORDER BY ds_timestamp"); 
     
    153154} 
    154155 
     156display("Update counters of the items in the download section"); 
     157$result = mysql_query("SELECT * FROM ".$db_prefix."downloads WHERE download_external = 1") 
     158display("-> updating ".dbrows($result)." download records!"); 
     159$data = mysql_fetch_assoc($result); 
     160while ($data !== false) { 
     161    // get the filename from the URL 
     162    $url = parse_url($data['download_url']); 
     163    // do we have a counter for it? 
     164    $result2 = mysql_query("SELECT * FROM ".$db_prefix."dlstats_files WHERE dlsf_file = '".$url['path']."' LIMIT 1"); 
     165    if ($result2) { 
     166        // update the counter 
     167        $data2 = mysql_fetch_assoc($result2); 
     168        $result2 = mysql_query("UPDATE ".$db_prefix."downloads SET download_counter = '".$data2['dlsf_counter']."' WHERE download_id = '".$data['download_id']."'"); 
     169    } 
     170    $data = mysql_fetch_assoc($result); 
     171} 
     172 
    155173display(" "); 
    156174display("Migration finished!"); 
Note: See TracChangeset for help on using the changeset viewer.