Skip to content

Commit

Permalink
Changed: The maybe_truncate() method was not intended to be used ou…
Browse files Browse the repository at this point in the history
…tside of the class, so it is not a public method anymore.
  • Loading branch information
BenceSzalai committed Nov 29, 2020
1 parent 661e73d commit ac788f7
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/WordPressHandler/WordPressHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,21 @@ public function uninitialize()
$this->wpdb->query($sql);
}
}
/**
* Deletes the oldest records from the log table to ensure there are no more
* rows than the defined limit.
*
* Use {@see set_max_table_rows()} to configure the limit!
*
* @return boolean True if rows were deleted, false otherwise.
*/
public function maybe_truncate() {
if ( $this->max_table_rows <= 0 ) {
return false;
}
$table_name = $this->get_table_name();
/**
* Deletes the oldest records from the log table to ensure there are no more
* rows than the defined limit.
*
* Use {@see set_max_table_rows()} to configure the limit!
*
* @return boolean True if rows were deleted, false otherwise.
*/
protected function maybe_truncate() {
if ( $this->max_table_rows <= 0 ) {
return false;
}
$table_name = $this->get_table_name();
$sql = "SELECT count(*) FROM {$table_name};";
$count = $this->wpdb->get_var($sql);

Expand Down

0 comments on commit ac788f7

Please sign in to comment.