Changeset 2377524
- Timestamp:
- 09/08/2020 11:21:41 PM (5 years ago)
- Location:
- nomore404-404-redirection-and-firewall
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
nomore404-404-redirection-and-firewall/tags/1.15/includes/nomore404-activation.php
r2376893 r2377524 29 29 $obj_settings = new NoMore404_Settings(); // this creates default options via constructor or creates missing options 30 30 } 31 32 function nomore404_update_db_check() { 33 $obj_settings = new NoMore404_Settings(); 34 //NoMore404_Model_Static_Class::good_error_log('settings:', $obj_settings); 35 if(NOMORE404DBVERSION != $obj_settings->options['dbversion']) nomore404_activation(); 36 } 37 38 add_action( 'plugins_loaded', 'nomore404_update_db_check' ); 31 39 32 40 function nomore404_create_tables($prefix) { … … 79 87 //NoMore404_Model_Static_Class::good_error_log('Table 1 update 2 result:', $result); 80 88 } 81 if( $obj_settings->options['dbversion'] < '1.13'){ // alter table here if before v 1.1389 if(False == NoMore404_Model_Static_Class::check_table_column_exists($table_name1, 'uploaded')){ 82 90 $update_query1 = "ALTER TABLE $table_name1 83 91 ADD uploaded TINYINT(1) NOT NULL DEFAULT '0'"; … … 128 136 $result = $wpdb->query($update_query2); 129 137 } 130 if( $obj_settings->options['dbversion'] < '1.13'){ // alter table here if before v 1.13138 if(False == NoMore404_Model_Static_Class::check_table_column_exists($table_name2, 'uploaded')){ 131 139 $update_query2 = "ALTER TABLE $table_name2 132 140 ADD uploaded TINYINT(1) NOT NULL DEFAULT '0'"; … … 164 172 $result = $wpdb->query($update_query3); 165 173 } 166 if( $obj_settings->options['dbversion'] < '1.13'){ // alter table here if before v 1.13174 if(False == NoMore404_Model_Static_Class::check_table_column_exists($table_name3, 'uploaded')){ 167 175 $update_query3 = "ALTER TABLE $table_name3 168 176 ADD uploaded TINYINT(1) NOT NULL DEFAULT '0'"; -
nomore404-404-redirection-and-firewall/tags/1.15/includes/nomore404-model.php
r2376893 r2377524 32 32 } 33 33 34 /** 35 * Returns true if a database table column exists. Otherwise returns false. 36 * 37 * @param string $table_name Name of table we will check for column existence. 38 * @param string $column_name Name of column we are checking for. 39 * 40 * @return boolean True if column exists. Else returns false. 41 */ 42 public static function check_table_column_exists($table_name, $column_name) { 43 44 global $wpdb; 45 46 $column = $wpdb->get_results($wpdb->prepare( 47 "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ", DB_NAME, $table_name, $column_name 48 )); 49 50 if (!empty($column)) { 51 return true; 52 } 53 54 return false; 55 } 56 34 57 public static function delete_col(&$array, $key) 35 58 { … … 155 178 $output = $wpdb->insert_id; 156 179 } catch (Exception $ex) { 157 //self::good_error_log('Caught URICaller insert error:',$ex->getMessage());158 180 return False; // if insert did not work - return false 159 181 } … … 168 190 array('uri_id' => $uri_id, 'caller_id' => $caller_id)); 169 191 } catch (Exception $ex) { 170 //self::good_error_log('Caught URICaller update error:',$ex->getMessage());171 192 return False; // if insert did not work - return false 172 193 } … … 199 220 $output = $wpdb->insert_id; 200 221 } catch (Exception $ex) { 201 //self::good_error_log('Caught Caller insert error:',$ex->getMessage());202 222 return False; // if insert did not work - return false 203 223 } … … 212 232 $output = $wpdb->update(self::$caller_table_name, $caller_data, array('caller_id' => $caller_id)); 213 233 } catch (Exception $ex) { 214 //self::good_error_log('Caught Caller update error:',$ex->getMessage());215 234 return False; // if update did not work - return false 216 235 } … … 236 255 ); 237 256 } catch (Exception $ex) { 238 //self::good_error_log('Caught Caller delete error:',$ex->getMessage());239 257 return False; // if update did not work - return false 240 258 } … … 245 263 public static function countCallers($search = '', $filteruriid = ''){ 246 264 global $wpdb; 247 248 //self::good_error_log('Counting callers by URIid:', $filteruriid);249 265 250 266 if('' == $filteruriid ){ // if not filtered then normal sort and search applies … … 279 295 280 296 } 281 //self::good_error_log('Running query:', $cleanedsql);282 297 $num = (int) $wpdb->get_var($cleanedsql); 283 //self::good_error_log('Number of records:', $num);284 298 return $num; 285 299 } … … 311 325 // prepare list of fields 312 326 $listOfFieldsToGet = 'c.caller_id, c.caller_ip, c.comment, c.hostname, c.date_created, c.date_last_used, 313 c.counter, c.suspicious, c.malicious, c.whitelist, c.uploaded ';327 c.counter, c.suspicious, c.malicious, c.whitelist, c.uploaded, c.caller_ip_str'; 314 328 315 329 // form query … … 334 348 } 335 349 $output = $wpdb->get_results($cleanedsql, ARRAY_A); 336 //NoMore404_Model_Static_Class::good_error_log('SQL in model class:', $cleanedsql);337 //NoMore404_Model_Static_Class::good_error_log('Callers in model class:', $output);338 350 return $output; 339 351 } … … 357 369 ); 358 370 } catch (Exception $ex) { 359 //self::good_error_log('Caught URI delete error:',$ex->getMessage());360 371 return False; // if update did not work - return false 361 372 } … … 396 407 } 397 408 } 398 //self::var_error_log('Number of URIs:', $num);399 409 $num = (int) $wpdb->get_var($cleanedsql); 400 410 return $num; … … 476 486 $output = $wpdb->insert_id; 477 487 } catch (Exception $ex) { 478 //self::good_error_log('Caught insert error:',$ex->getMessage());479 488 return False; // if insert did not work - return false 480 489 } … … 489 498 $output = $wpdb->update(self::$uri_table_name, $uri_data, array('uri_id' => $uri_id)); 490 499 } catch (Exception $ex) { 491 //self::good_error_log('Caught update error:',$ex->getMessage());492 500 return $output; // if insert did not work - return false 493 501 } -
nomore404-404-redirection-and-firewall/tags/1.15/nomore404.php
r2376893 r2377524 32 32 defined('ABSPATH') or exit; 33 33 34 define("NOMORE404VERSION", "1.1 4");35 define("NOMORE404DBVERSION", "1.1 4");34 define("NOMORE404VERSION", "1.15"); 35 define("NOMORE404DBVERSION", "1.15"); 36 36 37 37 // plugin activation and uninstallation -
nomore404-404-redirection-and-firewall/tags/1.15/readme.txt
r2376893 r2377524 6 6 Tested up to: 5.5 7 7 Requires PHP: 5.3 8 Stable tag: 1.1 48 Stable tag: 1.15 9 9 License: GPLv2 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 30 30 31 31 == Changelog == 32 1.15 Bug fix of plugin update process and new bug in Callers list, callers list 33 was empty when filtered by URI 32 34 1.14 Manual upload of data to the backend system for analysis is done 33 35 1.13 Fixed activation and db upgrade errors. -
nomore404-404-redirection-and-firewall/trunk/includes/nomore404-activation.php
r2376893 r2377524 29 29 $obj_settings = new NoMore404_Settings(); // this creates default options via constructor or creates missing options 30 30 } 31 32 function nomore404_update_db_check() { 33 $obj_settings = new NoMore404_Settings(); 34 //NoMore404_Model_Static_Class::good_error_log('settings:', $obj_settings); 35 if(NOMORE404DBVERSION != $obj_settings->options['dbversion']) nomore404_activation(); 36 } 37 38 add_action( 'plugins_loaded', 'nomore404_update_db_check' ); 31 39 32 40 function nomore404_create_tables($prefix) { … … 79 87 //NoMore404_Model_Static_Class::good_error_log('Table 1 update 2 result:', $result); 80 88 } 81 if( $obj_settings->options['dbversion'] < '1.13'){ // alter table here if before v 1.1389 if(False == NoMore404_Model_Static_Class::check_table_column_exists($table_name1, 'uploaded')){ 82 90 $update_query1 = "ALTER TABLE $table_name1 83 91 ADD uploaded TINYINT(1) NOT NULL DEFAULT '0'"; … … 128 136 $result = $wpdb->query($update_query2); 129 137 } 130 if( $obj_settings->options['dbversion'] < '1.13'){ // alter table here if before v 1.13138 if(False == NoMore404_Model_Static_Class::check_table_column_exists($table_name2, 'uploaded')){ 131 139 $update_query2 = "ALTER TABLE $table_name2 132 140 ADD uploaded TINYINT(1) NOT NULL DEFAULT '0'"; … … 164 172 $result = $wpdb->query($update_query3); 165 173 } 166 if( $obj_settings->options['dbversion'] < '1.13'){ // alter table here if before v 1.13174 if(False == NoMore404_Model_Static_Class::check_table_column_exists($table_name3, 'uploaded')){ 167 175 $update_query3 = "ALTER TABLE $table_name3 168 176 ADD uploaded TINYINT(1) NOT NULL DEFAULT '0'"; -
nomore404-404-redirection-and-firewall/trunk/includes/nomore404-model.php
r2376893 r2377524 32 32 } 33 33 34 /** 35 * Returns true if a database table column exists. Otherwise returns false. 36 * 37 * @param string $table_name Name of table we will check for column existence. 38 * @param string $column_name Name of column we are checking for. 39 * 40 * @return boolean True if column exists. Else returns false. 41 */ 42 public static function check_table_column_exists($table_name, $column_name) { 43 44 global $wpdb; 45 46 $column = $wpdb->get_results($wpdb->prepare( 47 "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %s AND TABLE_NAME = %s AND COLUMN_NAME = %s ", DB_NAME, $table_name, $column_name 48 )); 49 50 if (!empty($column)) { 51 return true; 52 } 53 54 return false; 55 } 56 34 57 public static function delete_col(&$array, $key) 35 58 { … … 155 178 $output = $wpdb->insert_id; 156 179 } catch (Exception $ex) { 157 //self::good_error_log('Caught URICaller insert error:',$ex->getMessage());158 180 return False; // if insert did not work - return false 159 181 } … … 168 190 array('uri_id' => $uri_id, 'caller_id' => $caller_id)); 169 191 } catch (Exception $ex) { 170 //self::good_error_log('Caught URICaller update error:',$ex->getMessage());171 192 return False; // if insert did not work - return false 172 193 } … … 199 220 $output = $wpdb->insert_id; 200 221 } catch (Exception $ex) { 201 //self::good_error_log('Caught Caller insert error:',$ex->getMessage());202 222 return False; // if insert did not work - return false 203 223 } … … 212 232 $output = $wpdb->update(self::$caller_table_name, $caller_data, array('caller_id' => $caller_id)); 213 233 } catch (Exception $ex) { 214 //self::good_error_log('Caught Caller update error:',$ex->getMessage());215 234 return False; // if update did not work - return false 216 235 } … … 236 255 ); 237 256 } catch (Exception $ex) { 238 //self::good_error_log('Caught Caller delete error:',$ex->getMessage());239 257 return False; // if update did not work - return false 240 258 } … … 245 263 public static function countCallers($search = '', $filteruriid = ''){ 246 264 global $wpdb; 247 248 //self::good_error_log('Counting callers by URIid:', $filteruriid);249 265 250 266 if('' == $filteruriid ){ // if not filtered then normal sort and search applies … … 279 295 280 296 } 281 //self::good_error_log('Running query:', $cleanedsql);282 297 $num = (int) $wpdb->get_var($cleanedsql); 283 //self::good_error_log('Number of records:', $num);284 298 return $num; 285 299 } … … 311 325 // prepare list of fields 312 326 $listOfFieldsToGet = 'c.caller_id, c.caller_ip, c.comment, c.hostname, c.date_created, c.date_last_used, 313 c.counter, c.suspicious, c.malicious, c.whitelist, c.uploaded ';327 c.counter, c.suspicious, c.malicious, c.whitelist, c.uploaded, c.caller_ip_str'; 314 328 315 329 // form query … … 334 348 } 335 349 $output = $wpdb->get_results($cleanedsql, ARRAY_A); 336 //NoMore404_Model_Static_Class::good_error_log('SQL in model class:', $cleanedsql);337 //NoMore404_Model_Static_Class::good_error_log('Callers in model class:', $output);338 350 return $output; 339 351 } … … 357 369 ); 358 370 } catch (Exception $ex) { 359 //self::good_error_log('Caught URI delete error:',$ex->getMessage());360 371 return False; // if update did not work - return false 361 372 } … … 396 407 } 397 408 } 398 //self::var_error_log('Number of URIs:', $num);399 409 $num = (int) $wpdb->get_var($cleanedsql); 400 410 return $num; … … 476 486 $output = $wpdb->insert_id; 477 487 } catch (Exception $ex) { 478 //self::good_error_log('Caught insert error:',$ex->getMessage());479 488 return False; // if insert did not work - return false 480 489 } … … 489 498 $output = $wpdb->update(self::$uri_table_name, $uri_data, array('uri_id' => $uri_id)); 490 499 } catch (Exception $ex) { 491 //self::good_error_log('Caught update error:',$ex->getMessage());492 500 return $output; // if insert did not work - return false 493 501 } -
nomore404-404-redirection-and-firewall/trunk/nomore404.php
r2376893 r2377524 32 32 defined('ABSPATH') or exit; 33 33 34 define("NOMORE404VERSION", "1.1 4");35 define("NOMORE404DBVERSION", "1.1 4");34 define("NOMORE404VERSION", "1.15"); 35 define("NOMORE404DBVERSION", "1.15"); 36 36 37 37 // plugin activation and uninstallation -
nomore404-404-redirection-and-firewall/trunk/readme.txt
r2376938 r2377524 6 6 Tested up to: 5.5 7 7 Requires PHP: 5.3 8 Stable tag: 1.1 38 Stable tag: 1.15 9 9 License: GPLv2 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 30 30 31 31 == Changelog == 32 1.15 Bug fix of plugin update process and new bug in Callers list, callers list 33 was empty when filtered by URI 32 34 1.14 Manual upload of data to the backend system for analysis is done 33 35 1.13 Fixed activation and db upgrade errors.
Note: See TracChangeset
for help on using the changeset viewer.