Changeset 21100 for extensions/Prune_History/include
- Timestamp:
- Mar 2, 2013, 6:28:58 PM (12 years ago)
- Location:
- extensions/Prune_History/include
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Prune_History/include/functions.inc.php
r20375 r21100 99 99 $result = pwg_query($query); 100 100 $conf_PH = pwg_db_fetch_assoc($result); 101 101 102 102 $Newconf_PH = unserialize($conf_PH['value']); 103 104 $Newconf_PH[ 0] = $version;103 104 $Newconf_PH['PHVersion'] = $version; 105 105 106 106 $update_conf = serialize($Newconf_PH); … … 228 228 229 229 // Definition of the range to keep 230 if (isset($conf_PH[ 1]) and $conf_PH[1] == 'true' and isset($conf_PH[2]) and $conf_PH[2] <> '0' and isset($conf_PH[3]) and $conf_PH[3] <> '0')231 { 232 if ($conf_PH[ 3] == '1') // Ranged for days233 { 234 $limit = mktime(0, 0, 0, date("m") , date("d")-$conf_PH[ 2], date("Y"));230 if (isset($conf_PH['AUTOPRUNE']) and $conf_PH['AUTOPRUNE'] == 'true' and isset($conf_PH['RANGEVALUE']) and $conf_PH['RANGEVALUE'] <> '0' and isset($conf_PH['RANGE']) and $conf_PH['RANGE'] <> '0') 231 { 232 if ($conf_PH['RANGE'] == '1') // Ranged for days 233 { 234 $limit = mktime(0, 0, 0, date("m") , date("d")-$conf_PH['RANGEVALUE'], date("Y")); 235 235 $limit = date('Y-m-d', $limit); 236 236 } 237 else if ($conf_PH[ 3] == '2') // Ranged for months238 { 239 $limit = mktime(0, 0, 0, date("m")-$conf_PH[ 2] , date("d"), date("Y"));237 else if ($conf_PH['RANGE'] == '2') // Ranged for months 238 { 239 $limit = mktime(0, 0, 0, date("m")-$conf_PH['RANGEVALUE'] , date("d"), date("Y")); 240 240 $limit = date('Y-m-d', $limit); 241 241 } 242 else if ($conf_PH[ 3] == '3') // Ranged for years243 { 244 $limit = mktime(0, 0, 0, date("m") , date("d"), date("Y")-$conf_PH[ 2]);242 else if ($conf_PH['RANGE'] == '3') // Ranged for years 243 { 244 $limit = mktime(0, 0, 0, date("m") , date("d"), date("Y")-$conf_PH['RANGEVALUE']); 245 245 $limit = date('Y-m-d', $limit); 246 246 } … … 307 307 $insertions .= "DROP TABLE IF EXISTS ".$ListTables[$j].";\n\n"; 308 308 309 $array = mysql_fetch_array($res);309 $array = pwg_db_fetch_row($res); 310 310 $array[1] .= ";\n\n"; 311 311 $insertions .= $array[1]; 312 312 313 $req_table = pwg_query('SELECT * FROM '.$ListTables[$j]) or die(mysql_error()); 314 $nb_fields = mysql_num_fields($req_table); 315 while ($line = mysql_fetch_array($req_table)) 313 $req_table = pwg_query('DESCRIBE '.$ListTables[$j].';') or die(my_error()); 314 $nb_fields = pwg_db_num_rows($req_table); 315 $req_table2 = pwg_query('SELECT * FROM '.$ListTables[$j]) or die(my_error()); 316 317 while ($line = pwg_db_fetch_row($req_table2)) 316 318 { 317 319 $insertions .= 'INSERT INTO '.$ListTables[$j].' VALUES ('; … … 375 377 // Restore sql backup file - DROP TABLE queries are executed 376 378 // --------------------------------------------------------- 377 UAM_execute_sqlfile(379 PH_execute_sqlfile( 378 380 $Backup_File, 379 381 DEFAULT_PREFIX_TABLE,
Note: See TracChangeset
for help on using the changeset viewer.