Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This patch has a lot of @todos and has never been actually run. I did php -l on it only.
Comment | File | Size | Author |
---|---|---|---|
#23 | 1649238-23.patch | 35.91 KB | damiankloip |
#21 | 1649238-21.patch | 35.53 KB | damiankloip |
#17 | 1649238-16-exportablebase.patch | 16.88 KB | damiankloip |
#16 | ctools.config.16.patch | 21.45 KB | sun |
#16 | interdiff.txt | 18.2 KB | sun |
Comments
Comment #1
merlinofchaos CreditAttribution: merlinofchaos commentedFor the record there's at least one major bug in the patch. :)
Comment #2
damiankloip CreditAttribution: damiankloip commentedJust looking at the patch, a few ideas to kick around:
Was this the bug you spotted?
Comment #3
damiankloip CreditAttribution: damiankloip commented... and, so that I hopefully don't forget; on both Config and Database Controllers we are setting the type in the constructor, but this is already being set in the ControllerBase constructor.
Comment #4
merlinofchaos CreditAttribution: merlinofchaos commentedI have to catch a plane soon so this is not a full response but I wanted to address:
sun wanted to be able to leverage the config object, so actually storing it on the exportable and making it accessible is the best way. Almost everyone else involved thinks that the DatabaseController will actually go away and not return, though I still am hoping to keep the system abstract enough to make it possible anyway, but some people are saying that even the possibility of it existing is bad. We'll have to see. Anyhow, we should do our best to accommodate that one for now.
Your other abstraction ideas seem pretty reasonable. Anything moved to the Base should then be part of the interface.
Comment #5
damiankloip CreditAttribution: damiankloip commentedOk, I kind of guessed we need to keep the config object. That makes sense. I think what I was think was still storing the config object in $this->data but when instead of passing just the config object to unpack, it makes more sense to me to do this in the exportable constructor:
$this->unpack($data->get())
Then unpack can always be an array and we keep the config object too. Wouldn't it be more efficient to just get everything at one rather than call get() for each schema field too? Sorry if I'm exercising CMI ignorance :)
I can look at putting the abstractions in separate patches? Would be good to break things up a bit.
Comment #6
damiankloip CreditAttribution: damiankloip commented.
Comment #7
merlinofchaos CreditAttribution: merlinofchaos commentedHmm. $data->get() might work. We need to retain the granularity so that each schema entry has its own get() call, but that probably isn't actually affected by that I don't *think*. So that is worth trying out.
Comment #8
merlinofchaos CreditAttribution: merlinofchaos commentedUpdated patch after those methods moved.
Comment #9
damiankloip CreditAttribution: damiankloip commentedIs it just me, or does it seem crazy that you can't get the actual config name from the object you have loaded?
Comment #10
damiankloip CreditAttribution: damiankloip commentedThis will only set the field on the config object if the value is not NULL. Is this what we want? If we have NULL values from the schema fields, don't we still want those stored on the config object? currently isset() will not be true for nulls, sorry if this is the intended.
I know it would be ideal to have pack/unpack to be mirrors of each other but it seems like it would be a good idea to just pass an array (using ->get()on the config object) and use the existing unpack method. I think what I am trying to get at is; won't it be faster to just get all the config values once, rather than calling get() on each value? Stuff will be loaded alot more than it will be saved. So in the Exportable constructor we would do $this->unpack($data->get()) instead of just $this->unpack($data).
(I know I already mentioned this but thought it might be good to get it written in the issue).
Comment #11
damiankloip CreditAttribution: damiankloip commentedAlso, the pack method is setting the values on the config object. and not just returning an array. Is this the route we are taking now? Pack isn't just to extract the values anymore. I thought this would be something done more when saving is done rather than packing? (Not saying this is wrong at all, just clarifying :) )
We probably need to give setStatus a bit of attention too, I guess this will just be handled with the $disabled reserved key on the exportable being set on the config object?
Comment #12
merlinofchaos CreditAttribution: merlinofchaos commentedThe config object replaces the array and because it's an object, it has to be maintained throughout its lifetime. So it's a bit more complex than just using an array.
That said, there is value to making sure that config object exists and is usable at a low level.
Comment #13
sunOn the more simple things - this patch seems to predate the config rearchitecture patch (which introduced ->getName() and ->setName(), which is one of the @todos in that patch), and also the addition of ->isNew() (eliminating !empty() checks on ->get()).
I'm also not sure whether the additional caching mechanism in $this->cache is needed. We have a general issue for checking/improving the config system performance with #1605124: Configuration system performance, which is currently postponed on the idea of introducing a cache backend/plugin that supports LRU logic; i.e., statically caching only a limited amount of config objects, which are re-requested within a single request. In general though, we slightly postponed this topic in order to focus on the bare architecture first - at this point, I wouldn't recommend to implement a custom caching behavior here.
Lastly, I'd love if we could get these changes here aligned with #1668820: Concept, base class, and interface for Configurables (e.g., node types, image styles, vocabularies, views, etc) as much as possible, in order to at least ensure a common/shared direction. Ideally, we'd combine the two approaches entirely, of course, although I believe that this won't be really possible until the config system supports all of the additional feature-set for handling enabled/disabled/overridden configuration. That said, I might be mistaken with that.
Comment #14
damiankloip CreditAttribution: damiankloip commentedHere is a slightly updated patch, based on the patch from #8.
Main changes of note:
I haven't used the getName/setName() methods yet anywhere, It would be good to discuss the naming of views with the prefix and what is stored as the id etc...
I was also thinking (as were other people) that the config system would handle caching. So when this can be removed we should do it.
It would be good to fall in line with the Configurable Thingies stuff, In my mind this should wait a bit though, It would be good to get some momentum moving this stuff to using the config system. This could be changed later if needed? At the moment Our implementation is quite different. I definitely like the idea though :)
Comment #15
damiankloip CreditAttribution: damiankloip commentedComment #16
sunTrying to move this forward...
Attached patch makes ExportableCrudTest work - both for DatabaseExportableController and ConfigExportableController, although both only get to line 134, at which the test tries to call ->get() on a Exportable object that is supposed to live in the database, but for some reason does not. Since both controllers are failing on the same line, I stopped there.
However, the most important part of this patch is rather this comment I left in the code of unpack():
HTH
Comment #17
damiankloip CreditAttribution: damiankloip commentedI think it was correct before, but $info['schema'] would be an array of the fields that the exportable packs/unpacks etc... so no call to drupal_get_schema. Atleast that's how I saw it working for config.
We don't want to do this on the config implementation do we? So this was intentionally left out. Wont the config system manage the rest for us? or are you suggesting reading the files directly?
It's really not up to me, but I would personally like to see the implementation stay abstracted enough so we can keep the database controller too. I also mentioned some stuff in #10 of this post about the pack/unpack data, that might be applicable. Not sure if we can.
I was playing with the idea of going back to an ExportableBase class and extend this as we need. Here is a patch I created yesterday, It's just a rough idea. So please don't take it overly serious :)
Comment #18
damiankloip CreditAttribution: damiankloip commented@sun, also I think if we do keep both controllers, refactoring the tests to have a base we should definitely do.
edit: also, with the get/set methods, you think move to storing everything in $data. Does this still store the config object too? (sorry don't have time to look properly).
Comment #19
merlinofchaos CreditAttribution: merlinofchaos commentedI think we need a discussion about whether or not it's worthwhile to keep the DatabaseController or not, and what that means. Keeping it will limit our design decisions, even if we keep it only in theory. i.e: In my view, if we 'keep' DatabaseController it will always live outside of core.
The pros: Flexibility and the ability for some things that exist in today's world to port forward more sanely. The biggest issue I have is that if it turns out CMI simply isn't suitable for something in today's world, it has a transition point. Without this, that thing might not be portable to D8 ever. The downside to this line of thinking is that I don't actually know of anything, for sure.
However, CMI is going to enhance performance problems that export.inc already has. This shows up in Page Manager in particular once you cross a threshold of a couple hundred pages. Because you can't fetch a list of pages that is paged (i.e, only fetch 25 or so at a time) you have an increasing memory problem whenever you have to fetch all of the page manager pages. This is something that can be avoided with Database stuff.
That said, we can also fix this problem with database synchronization, where the database is basically considered a cache. However, this is a hard problem to solve completely.
Comment #20
merlinofchaos CreditAttribution: merlinofchaos commentedI think the best path forward for now:
Let's do our best to keep DatabaseController a possibility until such time as keeping that possible impacts the design too negatively. One thought I had is to have a base interface and a Config specific interface; the base interface makes no assumptions about what the data will be, and the Config specific interface assumes a $config object. THat would allow Database to then do the same thing, out in contrib.
The primary reason I want to keep this is to hedge our best. export.inc is used in a lot of places and I would like the upgrade path to be possible.
That said, what I really want to do is encourage everything to move to Config and use database synchronization. To that end, we need to ensure that db sync is solid. See http://drupal.org/node/1670370#comment-6221342 for the current work on that.
Comment #21
damiankloip CreditAttribution: damiankloip commentedHere is a new version, I have spent quite alot of time on this today, so now the majority of the tests are working - we have config and database test classes. I have added some default test config exportables and exportable info to accommodate these.
This still uses the ExportableBase class as I think this may be the best way forward on this.
I'm sure there is still work to do, and some stuff here may need tidying (certainly reviewing).
Comment #23
damiankloip CreditAttribution: damiankloip commentedThis patch removes some files too.
Comment #24
damiankloip CreditAttribution: damiankloip commentedComment #25
effulgentsia CreditAttribution: effulgentsia commentedWhat do you folks think of #1668820-53: Concept, base class, and interface for Configurables (e.g., node types, image styles, vocabularies, views, etc) and the comments that follow? I think that issue has taken a direction (and quite possibly some code) very in line with this one, but maybe there's something I'm missing? I think the main thing being proposed there that hasn't been part of the scope of this issue is to make Exportables/Configurables/WhateverOtherNameWeComeUpWith literally be entities with entity storage controllers rather than entity-like things with entity-like storage controllers. Is there any reason why that would present a problem for Views / CTools or is otherwise a bad idea?
Comment #26
moshe weitzman CreditAttribution: moshe weitzman commented#1668820: Concept, base class, and interface for Configurables (e.g., node types, image styles, vocabularies, views, etc) was committed. hopefully we are unblocked here?
Comment #27
tim.plunkettThis is a duplicate of #1760188: Improve Wizard method default_display_options which was committed! Yay.