Changeset 21100
- Timestamp:
- Mar 2, 2013, 6:28:58 PM (11 years ago)
- Location:
- extensions/Prune_History
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/Prune_History/admin/PH_admin.php
r14854 r21100 35 35 { 36 36 37 $newconf_PH[ 0] = $version;38 $newconf_PH[ 1] = $_POST['PH_AutoPrune'];39 $newconf_PH[ 2] = $_POST['PH_Range_Value'];40 $newconf_PH[ 3] = $_POST['PH_Range'];37 $newconf_PH['PHVersion'] = $version; 38 $newconf_PH['AUTOPRUNE'] = (isset($_POST['PH_AutoPrune']) ? $_POST['PH_AutoPrune'] : 'false'); 39 $newconf_PH['RANGEVALUE'] = (isset($_POST['PH_Range_Value']) ? $_POST['PH_Range_Value'] : '0'); 40 $newconf_PH['RANGE'] = (isset($_POST['PH_Range']) ? $_POST['PH_Range'] : '0'); 41 41 42 42 $conf['PruneHistory'] = serialize($newconf_PH); … … 162 162 'PH_VERSION' => $version, 163 163 'PH_DUMP_DOWNLOAD' => $dump_download, 164 'PH_AUTOPRUNE_TRUE' => $conf_PH[ 1]=='true' ? 'checked="checked"' : '' ,165 'PH_AUTOPRUNE_FALSE' => $conf_PH[ 1]=='false' ? 'checked="checked"' : '' ,166 'PH_RANGE_VALUE' => $conf_PH[ 2],167 'PH_RANGE_SELECTED' => $conf_PH[ 3],164 'PH_AUTOPRUNE_TRUE' => $conf_PH['AUTOPRUNE']=='true' ? 'checked="checked"' : '' , 165 'PH_AUTOPRUNE_FALSE' => $conf_PH['AUTOPRUNE']=='false' ? 'checked="checked"' : '' , 166 'PH_RANGE_VALUE' => $conf_PH['RANGEVALUE'], 167 'PH_RANGE_SELECTED' => $conf_PH['RANGE'], 168 168 'range_list' => $range_list, 169 169 'month_list' => $month_list, -
extensions/Prune_History/changelog.txt
r20375 r21100 28 28 29 29 2012-10-05 - 1.0.8 - Bug fixed : Possible MySql error when using "0" value in auto-prune function. 30 31 2013-02-28 - 1.1.0 - Compliance with Piwigo 2.5 32 - Code refactory : Change config variables to assoc array and $_POST vars control before writing conf in database - Thx to flop25 for his advices ;-) 33 - Bug fixed : Unable to restore a backup file -
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, -
extensions/Prune_History/main.inc.php
r18489 r21100 31 31 32 32 /* Prune automation on user login */ 33 if (isset($conf_PH[ 1]) and $conf_PH[1] == 'true')33 if (isset($conf_PH['AUTOPRUNE']) and $conf_PH['AUTOPRUNE'] == 'true') 34 34 { 35 35 add_event_handler('login_success', 'history_autoprune' ); -
extensions/Prune_History/maintain.inc.php
r14854 r21100 24 24 // Default global parameters for Prune History conf 25 25 // ------------------------------------------------- 26 $defaultPH[0] = $version; // Prune History version 27 $defaultPH[1] = 'false'; // Enable automated prune 28 $defaultPH[2] = '0'; // Range 29 $defaultPH[3] = '0'; // Value (Year, month, day) 30 26 $defaultPH = array( 27 'PHVersion' => $version, // Prune History version 28 'AUTOPRUNE' => 'false', // Enable automated prune 29 'RANGEVALUE' => '0', // Range 30 'RANGE' => '0' // Value (Year, month, day) 31 ); 31 32 // Create Prune History conf if not already exists 32 33 // ------------------------------------------------ … … 57 58 PH_Obsolete_Files(); 58 59 60 include_once (PH_PATH.'include/upgradedb.inc.php'); 61 62 /* Check database upgrade */ 63 /* ********************** */ 64 $conf_PH = unserialize($conf['PruneHistory']); 65 66 if (isset($conf_PH[0])) 67 { 68 if (version_compare($conf_PH['PHVersion'], '1.1.0') < 0) 69 { 70 /* upgrade from 1.0 to 1.1 */ 71 /* *********************** */ 72 upgrade_100_110(); 73 } 74 } 75 59 76 /* Update plugin version number in #_config table */ 60 77 /* and check consistency of #_plugins table */
Note: See TracChangeset
for help on using the changeset viewer.