Compare commits

...

27 Commits
2.3.0 ... 2

Author SHA1 Message Date
Maxime Rainville a60fc4cf24
Merge pull request #146 from creative-commoners/pulls/2/dispatch-ci
MNT Use gha-dispatch-ci
2023-03-23 14:15:32 +13:00
Steve Boyd d2fbce5319 MNT Use gha-dispatch-ci 2023-03-21 14:32:24 +13:00
Steve Boyd beb0f84f2d Merge branch '2.3' into 2 2022-08-03 14:33:11 +12:00
Guy Sartorelli 6d5c35116a
Merge pull request #132 from creative-commoners/pulls/2.3/standardise-modules
MNT Standardise modules
2022-08-03 10:09:54 +12:00
Steve Boyd 41fd4718a2 MNT Standardise modules 2022-08-02 17:55:18 +12:00
Steve Boyd 448828c20a Merge branch '2.3' into 2 2022-07-26 16:45:04 +12:00
Guy Sartorelli faf9d033ff
Merge pull request #130 from creative-commoners/pulls/2.3/module-standards
MNT Use GitHub Actions CI
2022-07-15 12:45:58 +12:00
Steve Boyd d7b4ccb202 MNT Use GitHub Actions CI 2022-07-15 12:23:59 +12:00
Guy Sartorelli c9bce8fe57 Merge branch '2.3' into 2 2022-06-14 11:31:28 +12:00
Sabina Talipova 4bbabf2421
Merge pull request #128 from creative-commoners/pulls/2.3/phpunit9
Approved
2022-06-07 08:00:53 +12:00
Steve Boyd 22e3951244 MNT Test using PHPUnit9 2022-06-02 12:21:46 +12:00
Steve Boyd 321d0d853b Merge branch '2.3' into 2 2022-04-22 09:32:30 +12:00
Guy Sartorelli 84e13ffde3
Merge pull request #127 from creative-commoners/pulls/2.3/chars
FIX Ignore invalid byte character
2022-04-21 18:40:22 +12:00
Steve Boyd 17e9f5388c FIX Ignore invalid byte character 2022-04-21 14:14:28 +12:00
Steve Boyd 222f20529c
Update build status badge 2021-01-21 16:37:01 +13:00
Steve Boyd c46272e751 Merge branch '2.3' into 2 2021-01-18 13:59:53 +13:00
Steve Boyd afec73997a
Merge pull request #121 from creative-commoners/pulls/2.3/travis-matrix
MNT Rearrange travis matrix
2021-01-18 13:58:22 +13:00
Steve Boyd d3c8e2915e MNT Rearrange travis matrix 2021-01-18 11:37:36 +13:00
Steve Boyd a709a741b0 Merge branch '2.3' into 2 2021-01-02 20:09:58 +13:00
Maxime Rainville dd4df9800b
Merge pull request #119 from creative-commoners/pulls/2.3/travis-shared
MNT Travis shared config, use sminnee/phpunit
2020-12-21 15:03:34 +13:00
Steve Boyd 082742ad23 MNT Travis shared config, use sminnee/phpunit 2020-12-02 15:41:59 +13:00
Robbie Averill a7c3450d43 Merge branch 'pulls/docs-known-issue' into 2
# Conflicts:
 #	README.md
 #
2019-11-27 17:33:06 -08:00
Robbie Averill 0be39423a3 Merge branch '2.3' into 2 2019-11-27 17:28:00 -08:00
Robbie Averill 3d50b3f9ec Merge branch '2.2' into 2.3 2019-11-27 17:27:36 -08:00
Ingo Schommer 66376db094 DOCS Known issue about collations
Moving from https://docs.silverstripe.org/en/4/getting_started/server_requirements/
since it's too much noise there.

Also removing the maintainer contact, that's an outdated concept.
2019-09-03 15:22:14 +12:00
Sam Minnée f2ec228c72
Merge pull request #99 from sminnee/fix-9097
FIX: Don’t drop first row on repeated iteration
2019-07-03 14:27:21 +12:00
Sam Minnee 75f4a35f71 FIX: Don’t drop first row on repeated iteration
Fixes https://github.com/silverstripe/silverstripe-framework/issues/9097

Related: https://github.com/silverstripe/silverstripe-framework/issues/9098

Co-authored-by: Guy Marriott <guy@scopey.co.nz>
2019-07-03 13:55:17 +12:00
11 changed files with 107 additions and 102 deletions

25
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
ci:
name: CI
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
with:
# set phpunit to false to prevent automatic generation of mysql phpunit jobs
phpunit: false
extra_jobs: |
- php: 7.4
db: pgsql
phpunit: true
composer_args: --prefer-lowest
- php: 8.0
db: pgsql
phpunit: true
- php: 8.1
db: pgsql
phpunit: true

16
.github/workflows/dispatch-ci.yml vendored Normal file
View File

@ -0,0 +1,16 @@
name: Dispatch CI
on:
# At 12:20 PM UTC, only on Thursday and Friday
schedule:
- cron: '20 12 * * 4,5'
jobs:
dispatch-ci:
name: Dispatch CI
# Only run cron on the silverstripe account
if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule')
runs-on: ubuntu-latest
steps:
- name: Dispatch CI
uses: silverstripe/gha-dispatch-ci@v1

17
.github/workflows/keepalive.yml vendored Normal file
View File

@ -0,0 +1,17 @@
name: Keepalive
on:
workflow_dispatch:
# The 4th of every month at 10:50am UTC
schedule:
- cron: '50 10 4 * *'
jobs:
keepalive:
name: Keepalive
# Only run cron on the silverstripe account
if: (github.event_name == 'schedule' && github.repository_owner == 'silverstripe') || (github.event_name != 'schedule')
runs-on: ubuntu-latest
steps:
- name: Keepalive
uses: silverstripe/gha-keepalive@v1

View File

@ -1,15 +0,0 @@
inherit: true
build:
nodes:
analysis:
tests:
override: [php-scrutinizer-run]
checks:
php:
code_rating: true
duplication: true
filter:
paths: [code/*, tests/*]

View File

@ -1,53 +0,0 @@
language: php
dist: xenial
services:
- postgresql
-
cache:
directories:
- $HOME/.composer/cache/files
php:
- 7.1
env:
global:
- DB="PGSQL"
matrix:
fast_finish: true
include:
- php: 7.1
env:
- PHPUNIT_TEST=framework
- php: 7.2
env:
- PHPUNIT_TEST=framework
- php: 7.3
env:
- PHPUNIT_TEST=framework
- php: 7.1
env:
- PHPUNIT_TEST=postgresql
- PHPCS_TEST=1
before_script:
# Init PHP
- phpenv rehash
- phpenv config-rm xdebug.ini
- export PATH=~/.composer/vendor/bin:$PATH
- echo 'memory_limit = 2048M' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
# Install composer dependencies
- composer validate
- composer require --no-update silverstripe/recipe-cms:4.3.x-dev
- composer install --prefer-source --no-interaction --no-progress --no-suggest --optimize-autoloader --verbose --profile
- if [[ $PHPCS_TEST ]]; then composer global require squizlabs/php_codesniffer:^3 --prefer-dist --no-interaction --no-progress --no-suggest -o; fi
script:
- if [[ $PHPUNIT_TEST == postgresql ]]; then vendor/bin/phpunit ./tests; fi
- if [[ $PHPUNIT_TEST == framework ]]; then vendor/bin/phpunit ./vendor/silverstripe/framework/tests/php; fi
- if [[ $PHPCS_TEST ]]; then composer run-script lint; fi

View File

@ -1,15 +1,11 @@
# PostgreSQL Module Module # PostgreSQL Module Module
[![Build Status](https://travis-ci.org/silverstripe/silverstripe-postgresql.png?branch=master)](https://travis-ci.org/silverstripe/silverstripe-postgresql) [![CI](https://github.com/silverstripe/silverstripe-postgresql/actions/workflows/ci.yml/badge.svg)](https://github.com/silverstripe/silverstripe-postgresql/actions/workflows/ci.yml)
[![SilverStripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/) [![Silverstripe supported module](https://img.shields.io/badge/silverstripe-supported-0071C4.svg)](https://www.silverstripe.org/software/addons/silverstripe-commercially-supported-module-list/)
## Maintainer Contact
* Sam Minnee (Nickname: sminnee) <sam@silverstripe.com>
## Requirements ## Requirements
* SilverStripe 4.0 * Silverstripe 4.0
* PostgreSQL >=9.2 * PostgreSQL >=9.2
* Note: PostgreSQL 10 has not been tested * Note: PostgreSQL 10 has not been tested
@ -47,6 +43,12 @@ See [docs/en](docs/en/README.md) for more information about configuring the modu
All column and table names must be double-quoted. PostgreSQL automatically All column and table names must be double-quoted. PostgreSQL automatically
lower-cases columns, and your queries will fail if you don't. lower-cases columns, and your queries will fail if you don't.
Collations have known issues when installed on Alpine, MacOS X and BSD derivatives
(see [PostgreSQL FAQ](https://wiki.postgresql.org/wiki/FAQ#Why_do_my_strings_sort_incorrectly.3F)).
We do not support such installations, although they still may work correctly for you.
As a workaround for PostgreSQL 10+ you could manually switch to ICU collations (e.g. und-x-icu).
There are no known workarounds for PostgreSQL <10.
Ts_vector columns are not automatically detected by the built-in search Ts_vector columns are not automatically detected by the built-in search
filters. That means if you're doing a search through the CMS on a ModelAdmin filters. That means if you're doing a search through the CMS on a ModelAdmin
object, it will use LIKE queries which are very slow. If you're writing your object, it will use LIKE queries which are very slow. If you're writing your

View File

@ -58,8 +58,10 @@ class PostgreSQLQuery extends Query
public function seek($row) public function seek($row)
{ {
pg_result_seek($this->handle, $row); // Specifying the zero-th record here will reset the pointer
return $this->nextRecord(); $result = pg_fetch_array($this->handle, $row, PGSQL_NUM);
return $this->parseResult($result);
} }
public function numRecords() public function numRecords()
@ -73,26 +75,35 @@ class PostgreSQLQuery extends Query
// Correct non-string types // Correct non-string types
if ($row) { if ($row) {
$record = []; return $this->parseResult($row);
foreach ($row as $i => $v) {
$k = $this->columnNames[$i];
$record[$k] = $v;
$type = pg_field_type($this->handle, $i);
if (isset(self::$typeMapping[$type])) {
if ($type === 'bool' && $record[$k] === 't') {
$record[$k] = 1;
// Note that boolean 'f' will be converted to 0 by this
} else {
settype($record[$k], self::$typeMapping[$type]);
}
}
}
return $record;
} }
return false; return false;
} }
/**
* @param array $row
* @return array
*/
protected function parseResult(array $row)
{
$record = [];
foreach ($row as $i => $v) {
$k = $this->columnNames[$i];
$record[$k] = $v;
$type = pg_field_type($this->handle, $i);
if (isset(self::$typeMapping[$type])) {
if ($type === 'bool' && $record[$k] === 't') {
$record[$k] = 1;
// Note that boolean 'f' will be converted to 0 by this
} else {
settype($record[$k], self::$typeMapping[$type]);
}
}
}
return $record;
}
} }

View File

@ -858,7 +858,9 @@ class PostgreSQLSchemaManager extends DBSchemaManager
$argList = array(); $argList = array();
$nextArg = ""; $nextArg = "";
foreach ($bytes as $byte) { foreach ($bytes as $byte) {
if ($byte == "00") { if ($byte == '\x') {
continue;
} elseif ($byte == "00") {
$argList[] = $nextArg; $argList[] = $nextArg;
$nextArg = ""; $nextArg = "";
} else { } else {

View File

@ -19,12 +19,8 @@
"silverstripe/vendor-plugin": "^1.0" "silverstripe/vendor-plugin": "^1.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^5.7" "phpunit/phpunit": "^9.5",
}, "squizlabs/php_codesniffer": "^3"
"extra": {
"branch-alias": {
"2.x-dev": "2.4.x-dev"
}
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View File

@ -2,6 +2,9 @@
<ruleset name="SilverStripe"> <ruleset name="SilverStripe">
<description>CodeSniffer ruleset for SilverStripe coding conventions.</description> <description>CodeSniffer ruleset for SilverStripe coding conventions.</description>
<file>code</file>
<file>tests</file>
<!-- base rules are PSR-2 --> <!-- base rules are PSR-2 -->
<rule ref="PSR2" > <rule ref="PSR2" >
<!-- Current exclusions --> <!-- Current exclusions -->

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true"> <phpunit bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true">
<testsuite name="Default"> <testsuite name="Default">