Commit Graph

34 Commits

Author SHA1 Message Date
Daniel Hensby
4731d3c671
Merge branch '3.5' into 3.6 2017-11-14 12:00:53 +00:00
Daniel Hensby
32cef975ef
FIX Use self::inst() for Injector/Config nest methods 2017-10-25 17:48:35 +01:00
Sam Minnee
f224849cc6 FIX: Don’t use SplFixedArray in PHP 7.
PHP 7 seems to suffer a segfault when using SplFixedArray. Since LRU is
deprecated anyway, I’m not too fussed about getting to the bottom of
this issue, however, if it turns out that SplFixedArray is corrected in
PHP 7.0.0 stable or a future patch release, we could update this check.
2017-04-05 11:05:28 +10:00
Damian Mooyman
7de5b998e1 Merge 3.4 into 3 2016-08-05 19:12:25 +12:00
Damian Mooyman
cd80d501f9
BUG Fix unset config options returning isset() = true
Fixes #4791
2016-08-02 18:07:55 +12:00
Sam Minnée
366224078b FIX: Allow caching of false config values (Fixes #4755) (#4762)
False values were indistinguishable from cache misses. This patch solves
this by introducing a new multiple-return-value varation on cache->get().
The new method is named differently so as not to break a public API.
2016-07-15 09:22:58 +01:00
jeroendedauw
320c717358 Remove unused local vars 2015-08-03 20:42:43 +02:00
Daniel Hensby
ca8d0f2818 Merge branch '3.1' into 3.2
Conflicts:
	dev/Debug.php
	docs/en/05_Contributing/01_Code.md
	forms/FormField.php
	i18n/i18nTextCollector.php
	model/DataQuery.php
2015-07-20 10:48:01 +01:00
Damian Mooyman
e14f743bf0 Set deprecation level for all changes in 3.x to 4.0 2015-06-19 13:07:41 +12:00
Daniel Hensby
eaec2ad9a8 Safe unnesting of Config and Injector 2015-06-15 00:23:40 +01:00
Simon Welsh
1d135552cf Change the LRU cache to a simple in-memory model
Slight memory increase when there are lots of additions for much better performance in every case.
2015-03-09 02:01:24 +00:00
Damian Mooyman
eb069e605d Remove all redundant whitespace 2014-08-19 09:17:15 +12:00
Damian Mooyman
d8e9af8af8 API New Database abstraction layer. Ticket #7429
Database abstraction broken up into controller, connector, query builder, and schema manager, each independently configurable via YAML / Injector
Creation of new DBQueryGenerator for database specific generation of SQL
Support for parameterised queries, move of code base to use these over escaped conditions
Refactor of SQLQuery into separate query classes for each of INSERT UPDATE DELETE and SELECT
Support for PDO
Installation process upgraded to use new ORM
SS_DatabaseException created to handle database errors, maintaining details of raw sql and parameter details for user code designed interested in that data.
Renamed DB static methods to conform correctly to naming conventions (e.g. DB::getConn -> DB::get_conn)
3.2 upgrade docs
Performance Optimisation and simplification of code to use more concise API
API Ability for database adapters to register extensions to ConfigureFromEnv.php
2014-07-09 18:04:05 +12:00
Damian Mooyman
c26df0b3c6 Revert "BUG Config::merge_array_low_into_high() ignores falsey values" 2014-07-09 09:57:25 +12:00
Sean Harvey
16e546300f BUG Config::merge_array_low_into_high() ignores falsey values
Specific case: LeftAndMain::$session_keepalive_ping = true cannot be
set to false in config.yml for some cases because the value is ignored
when merge_array_low_into_high() is processing the config arrays.
2014-07-08 15:18:26 +12:00
Damian Mooyman
d06d5c113b API Injector supports nesting
BUG Resolve issue with DirectorTest breaking RequestProcessor
Injector::nest and Injector::unnest are introduced to better support sandboxing of testings.
Injector and Config ::nest and ::unnest support chaining
Test cases for both Injector::nest and Config::nest
2014-04-29 08:59:33 +12:00
Hamish Friedlander
5484283a25 FIX changing environment in config.php changes matched yaml rules 2013-07-02 13:21:27 +12:00
Will Rossiter
ddcfcf7bed Update @package, @subpackage labels
Cleanup of framework's use of @package and @subpackage labels and additional of labels for classes missing packages.

Moved all GridField related components to the one name.

Countless spelling fixes, grammar for other comments.

Link ClassName references in file headers.
2013-05-21 22:24:41 +12:00
Ingo Schommer
a415db91d4 FIX Clone Config_LRU incl. objects in array
Caused key confusions when using Config::nest()/unnest()
2013-03-26 12:47:52 +01:00
Ingo Schommer
69ae1f338f FIX Clean cache on Config->remove() 2013-03-24 17:20:36 +01:00
Ingo Schommer
bb52f2a214 FIX Allow FALSE in Config API, call remove() will NULL key on update() 2013-03-24 17:20:36 +01:00
Hamish Friedlander
3543a93623 FIX SplFixedArray causes segfaults in old versions of PHP 2013-03-18 10:22:11 +13:00
Hamish Friedlander
a6f1a200b6 Some micro-optimisations for Config 2013-03-04 09:25:23 +13:00
Hamish Friedlander
024a0b90a9 Add ability to create temporary Config copies 2013-02-28 09:43:33 +13:00
Hamish Friedlander
6b986cb17d Extract statics via code analysis rather than introspection 2013-02-28 09:43:33 +13:00
Hamish Friedlander
c98621977c Cache the merged version of any Config value in an in-mem LRU cache 2013-02-28 09:43:33 +13:00
Sam Minnee
1f7fc1f76a FIX Remove instances of lines longer than 120c
The entire framework repo (with the exception of system-generated files) has been amended to respect the 120c line-length limit.  This is in preparation for the enforcement of this rule with PHP_CodeSniffer.
2012-09-30 17:18:13 +13:00
Ingo Schommer
e2f073f38a Method visibility according to coding conventions 2012-09-20 10:46:59 +02:00
Hamish Friedlander
fa37c448a5 API Reverse config extra statics control flow
Config system used to provide an add_static_source method, which was intended for
use by Extensions to add statics. But extensions for a class arent initialised
until at least one instance of that class is created, so before that the
Config system didnt include values from extensions

This patch reverses the control flow, so that the Config system explictly asks
each Object for its additional config sources via the new method
get_extra_config_sources. This method returns an array that can contain
string names of classes and also raw associative arrays.

The developer visible change is that Extension#add_to_class has been
deprecated. Instead there is a new method, get_extra_config, which has
the same method signature but needs to guarantee that it doesnt
cause side effects. Additionally there is no need to call
parent::get_extra_config - this is handled automatically.
2012-08-23 09:29:13 +12:00
Marcus Nyeholt
ae7fc6f4d2 RECOMMIT This is a recommit of a previously merged, but reverted, commit. The initial commit had problems when running "tests/all flush=all" when dev/build would re-analyse a bunch of stuff; fixes to address this went into https://github.com/silverstripe/sapphire/pull/487, but for some reason the actual base changes didn't, so I'm re-submitting them in a separate pull.
BUGFIX Versioned's constructor doesn't provide suitable defaults. Previously a bug/feature in singleton, where it would pass null,true as params to strong_create, which would then get passed through as params to Versioned's constructor, meant that the code still executed fine (as was set to something that wasn't an array, so the null and true were instead taken as args). The fact that the usage of singleton(Versioned) never really used the classes code, purely for value lookup, meant that this never propagated errors. I've now switched singleton() to use the injector for retrieving values, which means these dud values are no longer passed through

CHANGE Given that Config::inst is an implementation of the singleton pattern itself, I've removed the extra call to singleton(). A side effect of this is that it gets around a possibly nasty circular reference with the dependency injector (which relies on the config object); in future, this dependency structure should really be structured from the DI directly.

MINOR Change singleton and strong_create to use dependency injector
2012-06-03 20:41:00 +10:00
Sean Harvey
29e04a1049 Revert "BUGFIX Versioned's constructor doesn't provide suitable defaults. Previously a bug/feature in singleton, where it would pass null,true as params to strong_create, which would then get passed through as params to Versioned's constructor, meant that the code still executed fine (as was set to something that wasn't an array, so the null and true were instead taken as args). The fact that the usage of singleton(Versioned) never really used the classes code, purely for value lookup, meant that this never propagated errors. I've now switched singleton() to use the injector for retrieving values, which means these dud values are no longer passed through"
This reverts commit 5eaca340b4.
2012-05-23 09:52:57 +12:00
Marcus Nyeholt
5eaca340b4 BUGFIX Versioned's constructor doesn't provide suitable defaults. Previously a bug/feature in singleton, where it would pass null,true as params to strong_create, which would then get passed through as params to Versioned's constructor, meant that the code still executed fine (as was set to something that wasn't an array, so the null and true were instead taken as args). The fact that the usage of singleton(Versioned) never really used the classes code, purely for value lookup, meant that this never propagated errors. I've now switched singleton() to use the injector for retrieving values, which means these dud values are no longer passed through
CHANGE Given that Config::inst is an implementation of the singleton pattern itself, I've removed the extra call to singleton(). A side effect of this is that it gets around a possibly nasty circular reference with the dependency injector (which relies on the config object); in future, this dependency structure should really be structured from the DI directly.

MINOR Change singleton and strong_create to use dependency injector
2012-05-22 19:09:35 +10:00
Simon Welsh
f8082e4814 MINOR Add newline to end of files without one 2012-04-15 10:50:19 +12:00
Hamish Friedlander
d355cd5baf ENHANCEMENT: Add config layer - the Config access class itself, and the ConfigManfiest builder which parses in the yaml config files 2012-03-09 18:13:56 +13:00