Changeset 1531 in ExiteCMS for modules/common/download_statistics/php-files/modules/download_statistics/batch/migrate_download_statistics.php
- Timestamp:
- 07/08/08 18:12:41 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/common/download_statistics/php-files/modules/download_statistics/batch/migrate_download_statistics.php
r1492 r1531 97 97 $data = mysql_fetch_assoc($result); 98 98 } 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 100 101 display("Creating the new download logfiles:"); 101 102 $result = mysql_query("SELECT * FROM ".$db_prefix.$table." ORDER BY ds_timestamp"); … … 153 154 } 154 155 156 display("Update counters of the items in the download section"); 157 $result = mysql_query("SELECT * FROM ".$db_prefix."downloads WHERE download_external = 1") 158 display("-> updating ".dbrows($result)." download records!"); 159 $data = mysql_fetch_assoc($result); 160 while ($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 155 173 display(" "); 156 174 display("Migration finished!");
Note: See TracChangeset
for help on using the changeset viewer.
