Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Fix: Remove obsolete code in database partitioning functions #11810

Conversation

emabassi-ext
Copy link
Contributor

Description

Queries should be sanitized (if possible) and bound using PDO statement to reduce attack surface and clean legacy code

Where

www/class/centreon-partition/partEngine.class.php

Remove optimizeTablePartitions function

Fixes # MON-14974

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software

Target serie

  • 21.04.x
  • 21.10.x
  • 22.04.x
  • 22.10.x (master)

How this pull request can be tested ?

Get number of current partition for “data_bin”:

ls /var/lib/mysql/centreon_storage/ | egrep data_bin#P#* | wc -l
38
Increase “Forward provisioning” from “Administration > Parameters > Options” menu (+10)

Run script manually

/usr/bin/php /usr/share/centreon/cron/centreon-partitioning.php
Check that partitions have been created using:

ls /var/lib/mysql/centreon_storage/ | egrep data_bin#P#* | wc -l
48
Reduce “Retention duration for performance data in MySQL database” from “Administration > Parameters > Options” menu

Run script manually

/usr/bin/php /usr/share/centreon/cron/centstorage_purge.php
Check that partitions have been deleted

ls /var/lib/mysql/centreon_storage/ | egrep data_bin#P#* | wc -l
35

Checklist

Community contributors & Centreon team

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially new classes, functions or any legacy code modified. (docblock)
  • I have commented my code, especially hard-to-understand areas of the PR.
  • I have rebased my development branch on the base branch (master, maintenance).

@sonarqube-decoration
Copy link

SonarQube Quality Gate

Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@emabassi-ext emabassi-ext merged commit 61cac66 into develop Sep 20, 2022
@emabassi-ext emabassi-ext deleted the MON-14974-remove-obsolete-code-in-database-partitioning-functions branch September 20, 2022 11:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants