[ Index ] |
|
Code source de Phorum 5.1.25 |
1 <?php 2 /* 3 This script converts viewcount data from mod_viewcount to Phorum's internal viewcounter. 4 To use it, copy the script to your main Phorum directory (eg: /phorum5), and run it from the command line. 5 "php convertViewCount.php" 6 It should work from a web browser also, although if output buffering is enabled it may not 7 output anything until it is completed. 8 9 If you are enabling Phorum's internal viewcount setting, you should disable mod_viewcount. 10 */ 11 include("include/db/config.php"); 12 mysql_connect($PHORUM["DBCONFIG"]["server"],$PHORUM["DBCONFIG"]["user"],$PHORUM["DBCONFIG"]["password"]); 13 mysql_select_db($PHORUM["DBCONFIG"]["name"]); 14 $query = "SELECT message_id, meta, viewcount FROM $PHORUM[DBCONFIG][table_prefix]_messages ORDER BY message_id DESC"; 15 $result = mysql_query($query); 16 while ($row = mysql_fetch_array($result)){ 17 print("Converting message $row[0]\n"); 18 $meta = unserialize($row["meta"]); 19 if (isset($meta["mod_viewcount"][$row["message_id"]])){ 20 $count = $row["viewcount"] + $meta["mod_viewcount"][$row["message_id"]]; 21 } 22 else{ 23 $count = 0; 24 } 25 $query = "UPDATE $PHORUM[DBCONFIG][table_prefix]_messages SET viewcount = $count WHERE message_id = $row[message_id]"; 26 mysql_query($query); 27 } 28 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Nov 29 12:22:27 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |