Commit Graph

130 Commits

Author SHA1 Message Date
Niklas Forsdahl 88c70b3234 Fixed deprecation notices in php 8.2 by using the AllowDynamicProperties
annotation on classes that set dynamic properties
2023-08-25 11:07:48 +03:00
Steve Boyd a16b268ff7 MNT Tidy up double assignment 2023-07-20 18:19:14 +12:00
Steve Boyd 7daa3fdb08 FIX Short-array syntax for Enum 2023-07-20 16:06:01 +12:00
Dylan Wagstaff 8c3ba81052
FIX PHP 8.1 support in MySQLiConnector::query errors (#10570)
* FIX PHP 8.1 support in MySQLiConnector::query errors

The default error reporting mode in PHP 8.1 has changed from using
errors reported on the connection handle to throwing
mysqli_sql_exception. query() makes no allowance for this, and
functions up the call stack expect to catch
Silverstripe\ORM\Connect\DatabaseException instead - resulting in the
MySQLi exception going all the way up to halt the system.

We can use a try, catch, and finally to retain backwards compatibility,
no matter which setting (e.g. PHP version default) someone has enabled.

* Move MySQLConnector test skip call into setUp()

As review feedback; marking the test as skipped in a private function
obfuscated where the call was happening and made it harder to skimread
the tests. Moving this into a setUp function makes it obvious the check
is run before each test case, and skipped if necessary.
2023-07-07 15:56:31 +12:00
Guy Sartorelli c4b8d9a246
FIX Add back missing SSL support for database connections (#10784) 2023-05-22 12:40:59 +12:00
Sabina Talipova 05674adf51 ENH Updated deprecation warning message 2023-03-01 12:39:42 +13:00
Steve Boyd 4e9c74243d API Deprecate code 2023-02-07 11:56:04 +13:00
Steve Boyd 137ebcebec API Stop using deprecated API 2022-11-15 18:20:54 +13:00
Steve Boyd 9c453abf89 API Update deprecations 2022-10-13 14:49:15 +13:00
Steve Boyd cc49036616 ENH Standardise deprecation messages 2022-10-13 14:05:49 +13:00
Viktor Szépe 94d1ac8d99
ENH Various changes via static analysis tooling 2022-08-24 12:14:32 +12:00
Guy Sartorelli 29fae72211 API TableBuilder class reduces inconsistency between temp & prod db 2022-07-07 09:49:19 +12:00
Brandon Iffert ad83b78a10
FIX Handle null values passed to PDO::quote() (#10383) 2022-07-04 13:17:51 +12:00
Steve Boyd 3a0fff25de FIX PDO in PHP 8 2022-06-30 12:34:05 +12:00
Steve Boyd a77ca74a7e FIX Ensure not passing null to mysql methods for PHP 8.1 compatibility 2022-06-29 09:34:30 +12:00
Steve Boyd 337c6e583c ENH Various fixes for PHP 8.1 compatibility 2022-04-27 09:29:40 +12:00
Steve Boyd 511b3bb060 ENH PHP 8.1 compatibility 2022-04-14 13:12:59 +12:00
Ingo Schommer d8499a24d0
NEW NullDatabase (#10016)
* NEW DatabaselessKernel to support operation without DB

This is required for GraphQL code generation in CI (without a working runtime database/webserver environment).
Context: https://github.com/silverstripe/silverstripe-graphql/issues/388

* New --no-database option for sake

* Refactor to abstract class

* Apply feedback peer review

Co-authored-by: Aaron Carlino <unclecheese@leftandmain.com>
Co-authored-by: Maxime Rainville <maxime@silverstripe.com>
2022-02-04 10:07:27 +13:00
Lukas 552cf5944d
MNT Fix various typos with codespell (#10177) 2021-12-13 21:05:33 +13:00
Sergey Shevchenko 9e2d661689 FIX: Make MySQLSchemaManager::shouldUseIntegerWidth() private 2021-12-08 11:19:47 +13:00
Sergey Shevchenko e68e65badc feat: added config value to force certain behaviour & added a note to the docs 2021-12-08 11:18:00 +13:00
Sergey Shevchenko 2c9ba8bc45 fix: conform with linter 2021-12-08 11:18:00 +13:00
Sergey Shevchenko 62725a5db3 fix: added exception for MariaDB 2021-12-08 11:18:00 +13:00
Sergey Shevchenko 04b7ad51b8
Merge branch 'silverstripe:4' into 4 2021-11-01 13:12:59 +13:00
William Desportes c932d7e7fb
Fix the phpdoc blocks 2020-12-21 22:23:23 +01:00
Sergey Shevchenko 51402a9c42
fix: don't use int width for mysql > 8.0.17 #9453 2020-10-29 10:54:52 +13:00
Bernard Hamlin f00f64120d
NEW Allow setting sql_mode via config (#9721) 2020-10-22 15:01:30 +13:00
Robbie Averill 4d54a2110f Update spaces in syntax, single quotes, early returns where possible 2020-10-01 17:36:14 -07:00
Robbie Averill ae1e17edec Update exception assertions in tests and remove deprecated annotations 2020-09-25 10:06:49 -07:00
Robbie Averill 27bd5d12e3 ENH Replace E_USER_ERROR errors with exceptions 2020-09-24 23:51:21 -07:00
Sam Minnée b810b7d5c9
API: Allow for user-created objects to have values passed in the constructor (#8591) 2020-08-20 12:28:31 +12:00
Serge Latyntcev b4669ad1bb FIX 4.6 regression in the TempDatabase reset schema logic 2020-06-22 16:17:14 +12:00
Daniel Hensby 080ce157ce
Fix various typos in comments 2020-05-16 10:34:53 +01:00
Michal Kleiner 21129b1624
Use short array syntax across the framework's codebase 2020-05-16 10:34:45 +01:00
Daniel Hensby 237b2d5f74
Convert array delcarations to short array syntax 2020-04-20 18:58:09 +01:00
Daniel Hensby 03239f9dcc
Merge pull request #9454 from open-sausages/pulls/4/myisam
NEW Allow InnoDB for FULLTEXT indexes
2020-04-14 11:50:45 +01:00
Ingo Schommer a50e15e5ee FIX Avoid VACUUM on test dbs in Postgres
The Postgres implementation was always faulty,
but the database exception was swallowed until
See https://github.com/silverstripe/silverstripe-framework/pull/9456.

Now that the the exception is only swallowed the first time,
the second recurrence will cause failing test execution.

This is a bit of an awkward fix, but the indirection "through" DataObject doesn't allow for anything else without changing public API surface.
The logic goes from TempDatabase to DBSchemaManager, then through the closure into DataObject->requireTable(),
then back into DBSchemaManager->requireTable(). And updateschema() is subclassed in SQLite3, making it difficult to add more arguments.

VACUUM is described as:

> VACUUM reclaims storage occupied by dead tuples. In normal PostgreSQL operation, tuples that are deleted or obsoleted by an update are not physically removed from their table; they remain present until a VACUUM is done. Therefore it's necessary to do VACUUM periodically, especially on frequently-updated tables.

https://www.postgresql.org/docs/9.1/sql-vacuum.html

Since test databases are short-lived, there's no reason to delete dead tuples, they'll be garbage collected when either the transaction is rolled back, or the database is destroyed after the test run.
2020-04-09 14:43:16 +12:00
Ingo Schommer 2c5deceeb4 FIX Filter out all FULLTEXT BOOLEAN chars
The query might still work depending on where these chars are placed,
but it seems weird to only remove *some* of the valid chars here.
See https://dev.mysql.com/doc/refman/5.6/en/fulltext-boolean.html

Note that the query runs both the actual boolean query with chars,
and then a separate relevance search without them.
2020-04-09 10:32:45 +12:00
Ingo Schommer 0215fdd262 DOC Clarify sanitisation in searchEngine() under boolean mode
This came up in https://github.com/silverstripe/silverstripe-cms/issues/1452, and wasn't fully addressed.
Either we allow boolean mode and all the constraints this brings around special character usage,
or we filter out those special characters, which makes boolean mode pointless.
You can't just pass arbitrary user input in a power-user function like this.
See https://dev.mysql.com/doc/refman/5.6/en/fulltext-boolean.html

Context: This used to work for some examples like "foo>*" under MyISAM,
presumably because it had a more lenient parser. InnoDB rightfully complains about this now.
2020-04-09 10:32:45 +12:00
Ingo Schommer c6b698cb02 NEW Allow InnoDB for FULLTEXT indexes
MyISAM used to be the only one to support it, now InnoDB has caught up.
Unless an engine is set specifically in create_table_options,
this will auto-convert existing MyISAM tables to InnoDb.

Fixes #9242
2020-04-09 10:32:45 +12:00
Ingo Schommer 052c5cbc38 BUG Infinite loops in TempDatabase (fixes #8902)
Ugly, but so is the original implementation that this works around (swallowing an exception to trigger functionality)
2020-04-08 13:58:02 +12:00
Michal Kleiner bcbf90a837 NEW Introduce supported database transaction mode check 2019-09-16 14:44:15 +12:00
Serge Latyntcev 29a663c65d Merge branch '4.4' into 4 2019-07-15 09:24:49 +12:00
Guy Marriott ec66d366d2
NEW: Deprecated PDO in favour of native drivers (#9052)
NEW: Deprecated PDO in favour of native drivers
2019-07-08 12:41:13 +12:00
Sam Minnee 404366909e FIX: Fix MysqlStatement::rewind()
Its implementation is more naive than Query’s and leads to unnecessary
seek()ing. This causes issues with the previous commit.
2019-07-03 14:28:31 +12:00
Sam Minnee 96e7914f23 FIX: Fix MySQLQuery::seek() and Query::rewind() to fix repeated iteration
API: Query::seek() and Query::rewind() no longer return a value.

Although breaking an API inside a patch release may seem odd, this in
fact is correcting a long-standing bug in our implementation of 
Iterator::rewind(), so I think it’s appropriate.

https://github.com/silverstripe/silverstripe-framework/issues/9097
2019-07-03 09:20:05 +12:00
Sam Minnee 27ace03273 NEW: Deprecated PDO in favour of native drivers
https://github.com/silverstripe/silverstripe-framework/issues/8598
2019-06-11 16:17:30 +12:00
shoosah 80e4886c3f Add getter and change visibility for whitelist_array property 2019-05-28 14:15:12 +12:00
shoosah d740998463 Improve displayQuery and benchmarkQuery functions and whitelist_array variable 2019-05-28 12:00:05 +12:00
shoosah d684c69f09 Allow displaying partial/full query message for debugging 2019-05-28 12:00:05 +12:00