CpPostgreSQL.pm 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package Troglodyne::CpPostgreSQL;
  2. use strict;
  3. use warnings;
  4. our %REPO_RPM_URLS = (
  5. '8' => 'https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm',
  6. '7' => 'https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm',
  7. '6' => 'https://download.postgresql.org/pub/repos/yum/reporpms/EL-6-x86_64/pgdg-redhat-repo-latest.noarch.rpm',
  8. );
  9. # Repository entries will look like "pgdg$VERSION" -- ex. pgdg95
  10. our $REPO_PREFIX = 'pgdg';
  11. our $PKG_PREFIX = 'postgresql';
  12. our $MINIMUM_SUPPORTED_VERSION = '9.5';
  13. # Times are in seconds since epoch, as that allows easier localization.
  14. our %SUPPORTED_VERSIONS_MAP = (
  15. '9.5' => {
  16. 'release' => 1452146400,
  17. 'EOL' => 1613023200,
  18. 'features' => [ 'INSERTS with constraint conflicts can be turned into UPDATEs or ignored', 'Row-level security control', 'Adds Block Range Indexes' ],
  19. },
  20. '9.6' => {
  21. 'release' => 1475125200,
  22. 'EOL' => 1636610400,
  23. 'features' => [ 'Synchronous replication now allows multiple standby servers', 'Full-text search can now search for phrases', 'Substantial performance improvements' ],
  24. },
  25. '10' => {
  26. 'release' => 1507179600,
  27. 'EOL' => 1668060000,
  28. 'features' => [ 'Logical replication using publish/subscribe', 'Significant general performance improvements', 'Stronger password authentication', 'Improved monitoring and control' ],
  29. },
  30. # Note -- The below can't actually be installed due to needing lvm-toolset-7-clang
  31. #'11' => {
  32. # 'release' => 1539838800,
  33. # 'EOL' => 1699509600,
  34. # 'features' => [ 'Improvements to partitioning and parallelism', 'SQL stored procedures that support embedded transactions', 'Many other useful performance improvements' ]
  35. # },
  36. #'12' => {
  37. # 'release' => 1570078800,
  38. # 'EOL' => 1731564000,
  39. # 'features' => [ 'General performance improvements', 'Stored generated columns', 'Support for the SQL/JSON path language', 'New authentication features' ]
  40. #},
  41. );
  42. # The BS that cPanel will be installing with /scripts/installpostgres
  43. our %CP_UNSUPPORTED_VERSIONS_MAP = (
  44. '9.2' => { 'release' => 1347253200, 'EOL' => 1510207200 }, # Cent 7
  45. '8.4' => { 'release' => 1246424400, 'EOL' => 1406178000 }, # Cent 6
  46. );
  47. # The cPanel version is a joke. You have to further massage data.
  48. sub get_version {
  49. require Cpanel::PostgresUtils;
  50. my @cur_ver = ( Cpanel::PostgresUtils::get_version() );
  51. if(!$cur_ver[0]) {
  52. # Chop off the bullshit error message -- "Failed to determine postgresql version: "
  53. # If we start at the end, that's 40 chars
  54. my $str = substr( $cur_ver[1], 40 );
  55. @cur_ver = $cur_ver[1] =~ m/(\d+)\.(\d+)$/;
  56. }
  57. return @cur_ver;
  58. }
  59. 1;