#silverstripe IRC Log

IRC log for 3 January 2015

All timestamps are in UTC.

1: [00:01:50] * muskie9 quit (Quit: Textual IRC Client: www.textualapp.com)
2: [00:26:37] * Azure quit (Quit: My MBP went to sleep.)
3: [00:29:52] * Azure has joined #silverstripe
4: [01:25:32] * jenniferaslan quit (Quit: jenniferaslan has left the room)
5: [02:04:01] * UncleCheese quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
6: [02:17:23] * babak quit (Quit: Connection closed for inactivity)
7: [04:12:28] * cloph has joined #silverstripe
8: [04:13:02] * cloph_away quit (Ping timeout: 265 seconds)
9: [05:32:24] * SomeNickUsedByMe has joined #silverstripe
10: [06:38:36] <SomeNickUsedByMe> is it possible that the template engine changes href tags?
11: [06:39:08] <SomeNickUsedByMe> i have problems with ankors like <a href="#colorbox-items"> it always adds a / before #
12: [06:39:17] <SomeNickUsedByMe> even if i delete the base tag
13: [06:39:55] <Zauberfisch> SomeNickUsedByMe: yes
14: [06:40:01] <Zauberfisch> it does rewrite # links
15: [06:40:10] <Zauberfisch> there is a config setting to disable that though
16: [06:40:21] <SomeNickUsedByMe> Oh that would be wonderful
17: [06:40:28] <SomeNickUsedByMe> colorbox doesn't work correctly
18: [06:40:46] <Zauberfisch> but when I use #anchor links for javascript/ajax navigation, I personaly prefer to just rewrite that paticular link with javascript
19: [06:41:03] <Zauberfisch> var a = $(this);
20: [06:42:12] <Zauberfisch> a.prop('href', a.prop('href').split('#')[1]);
21: [06:42:57] <Zauberfisch> actually, that should be:
22: [06:43:04] <Zauberfisch> a.prop('href', '#' + a.prop('href').split('#')[1]);
23: [06:44:16] <SomeNickUsedByMe> hmm, yes maybe that's the better option
24: [06:57:04] <Zauberfisch> SomeNickUsedByMe: but in case you want to go the config way
25: [06:57:05] <Zauberfisch> http://stackoverflow.com/a/18026703
26: [06:57:20] <Zauberfisch> (use the yml config option, NOT the php Config::inst()->update())
27: [06:59:47] <SomeNickUsedByMe> Zauberfisch, yes i used that, thanks :)
28: [07:07:18] * babak has joined #silverstripe
29: [07:45:00] * UncleCheese has joined #silverstripe
30: [08:23:40] * r_hector has joined #silverstripe
31: [08:37:29] <SomeNickUsedByMe> how can i check if URLSegment is the startpage?
32: [08:37:52] <SomeNickUsedByMe> got it :)
33: [08:37:55] <SomeNickUsedByMe> = home
34: [09:43:13] * UncleCheese quit (Quit: My MacBook Pro has gone to sleep. ZZZzzz…)
35: [10:25:02] <ezero> what is the way to access $SiteConfig.FacebookURL inside _config.php?
36: [10:28:46] <ezero> hmm this is the way to do it in classes
37: [10:28:48] <ezero> SiteConfig::current_site_config()->FacebookURL;
38: [10:28:55] <ezero> but cant get it in _config :(
39: [11:11:55] * r_hector quit (Quit: Leaving.)
40: [11:20:42] * SomeNickUsedByMe quit (Ping timeout: 245 seconds)
41: [11:45:48] <ezero> oh FFS ..
42: [11:45:51] <ezero> SilverStripe framework does not provide a method to set configuration via a web panel.
43: [11:45:56] <ezero> stink
44: [11:45:57] <ezero> http://doc.silverstripe.org/framework/en/topics/configuration
45: [11:47:51] <Zauberfisch> ezero: what are you trying to do?
46: [11:48:20] <ezero> i was trying to set a configuration property
47: [11:48:56] <ezero> i want to provide ability to enable or disable certain routing
48: [11:48:59] <ezero> via CMS
49: [11:49:37] <ezero> im overriding the SilverStripe Security controller route
50: [11:49:45] <ezero> to one of my own
51: [11:50:02] <Zauberfisch> that should be doable
52: [11:50:16] <ezero> in my class
53: [11:50:21] <ezero> i am setting it back to the original one
54: [11:50:22] <Zauberfisch> you can use Config::inst()->update('Foo.Bar', $somevar);
55: [11:50:22] <ezero> Config::inst()->update('Director', 'rules', $rule = array('Security//$Action/$ID/$OtherID' => 'Security'));
56: [11:50:31] <Zauberfisch> yeah, exactly
57: [11:50:35] <ezero> but its not working
58: [11:50:40] <ezero> i think its the order its loading in
59: [11:50:51] <ezero> my routes.yml
60: [11:51:14] <ezero> looks like this
61: [11:51:15] <ezero> ]http://pastie.org/private/4erh4cnnhncdad61rf7qzq
62: [11:52:07] <ezero> and my config.yml looks like http://pastie.org/private/ctj5hppwkfo6abhuiorg
63: [11:53:20] <ezero> and in my Security controller im doing something like this
64: [11:53:21] <ezero> http://pastie.org/private/geuy66c37lebswkcugwga
65: [11:56:08] <ezero> hmm maybe i should load it before not after
66: [12:13:06] <Zauberfisch> ezero: uhm
67: [12:13:22] <Zauberfisch> so you have a set of yml rules, and you want to overwrite / disable them, right?
68: [12:13:32] <Zauberfisch> thats not possible
69: [12:13:40] <Zauberfisch> update performs a merge
70: [12:13:46] <Zauberfisch> at least I think it does
71: [12:13:53] <ezero> yes Zauberfisch
72: [12:13:55] <Zauberfisch> so overwriting a list / array does not work
73: [12:14:01] <Zauberfisch> only properties
74: [12:14:03] <ezero> thats what i figured Zauberfisch
75: [12:16:24] <ezero> hmm wonder if i dont do it using yml file
76: [12:16:32] <ezero> instead do it in _config.php
77: [12:18:48] <Zauberfisch> ezero: but if you do it reverse it might work
78: [12:18:52] <Zauberfisch> so not configure it in yml
79: [12:19:01] <Zauberfisch> and if you need that route, add it in php
80: [12:19:18] <ezero> yeah i was thinking of doing that
81: [12:19:24] <ezero> SiteConfig::current_site_config()->Enabled
82: [12:19:27] <ezero> but cant access that! :(
83: [12:21:41] <Zauberfisch> oh
84: [12:21:43] <Zauberfisch> hmm
85: [12:21:53] <Zauberfisch> ah, yes, database is probably not ready at this time
86: [12:22:03] <Zauberfisch> no idea
87: [12:22:34] <Zauberfisch> another thing you could try is create your own controller
88: [12:22:49] <Zauberfisch> and this controller either returns a MemberLogin form or your SSOLoginForm
89: [12:22:57] <ezero> nope
90: [12:22:59] <ezero> cant even get Config::inst()->get('SiteConfig', 'Title')
91: [12:23:22] <ezero> yeah i think thats better idea Zauberfisch
92: [12:25:43] <Zauberfisch> Config::inst()->get('SiteConfig', 'Title')
93: [12:25:45] <Zauberfisch> will not work
94: [12:26:02] <Zauberfisch> because Title is a DB field, not a yml config value
95: [12:26:16] <ezero> i see
96: [12:26:21] <Zauberfisch> Config::inst()->get() only get stuff from the yml file and things that have been added with ->update()
97: [12:26:32] <Zauberfisch> basically its a key value store
98: [12:26:45] <Zauberfisch> the fact that we have a classname is only convention
99: [12:27:10] <Zauberfisch> you could also do Config::inst()->update('Ezero', 'yay'); and thats valid
100: [12:27:15] <Zauberfisch> doesn't have to be a class name
101: [12:27:25] <Zauberfisch> or at least I think it doesn't have to be
102: [12:27:38] <ezero> i see, ill try and work in reverse see if that works
103: [12:27:46] <ezero> ill just have to introduce another property
104: [12:30:18] <ezero> something like this Zauberfisch
105: [12:30:18] <ezero> http://pastie.org/private/jxlbkg38xgt56cky6pr6a
106: [12:30:41] <Zauberfisch> that would work
107: [12:30:52] <Zauberfisch> but you are aware that you can't change that through the CMS, right?
108: [12:31:42] <ezero> yea
109: [12:32:18] <ezero> yeah stuff it, ill remove it from CMS
110: [12:32:41] <ezero> if they wnana enable it they will just do it using config
111: [13:11:12] * MrGuits has joined #silverstripe
112: [13:14:23] * Guits quit (Ping timeout: 240 seconds)
113: [13:16:37] * Azure quit (Quit: My MBP went to sleep.)
114: [13:45:16] * Martin__ has joined #silverstripe
115: [13:47:07] * Kingy[a] is now known as Kingy
116: [13:49:04] * MrGuits quit (Ping timeout: 250 seconds)
117: [13:56:00] * Kingy is now known as Kingy[a]
118: [14:22:05] * cloph quit (Remote host closed the connection)
119: [14:22:19] * guzzlefry quit (Ping timeout: 255 seconds)
120: [15:22:47] <ezero> // public function populateDefaults()
121: [15:22:48] <ezero> :( isn't working as expected
122: [15:22:54] <ezero> in my DataExtension
123: [15:27:55] * guzzlefry has joined #silverstripe
124: [17:37:07] * Azure has joined #silverstripe
125: [17:38:54] * Azure quit (Excess Flood)
126: [17:39:39] * Azure has joined #silverstripe
127: [18:06:02] * travis-ci has joined #silverstripe
128: [18:06:02] <travis-ci> silverstripe/silverstripe-framework#3806 (31 - a75766e : Will Rossiter): The build has errored.
129: [18:06:02] <travis-ci> Change view : https://github.com/silverstripe/silverstripe-framework/compare/31
130: [18:06:02] <travis-ci> Build details : http://travis-ci.org/silverstripe/silverstripe-framework/builds/45788373
131: [18:06:02] * travis-ci has left #silverstripe
132: [18:08:10] * travis-ci has joined #silverstripe
133: [18:08:10] <travis-ci> silverstripe/silverstripe-framework#3807 (31 - a75766e : Will Rossiter): The build has errored.
134: [18:08:10] <travis-ci> Change view : https://github.com/silverstripe/silverstripe-framework/compare/31
135: [18:08:10] <travis-ci> Build details : http://travis-ci.org/silverstripe/silverstripe-framework/builds/45788417
136: [18:08:10] * travis-ci has left #silverstripe
137: [18:10:05] * travis-ci has joined #silverstripe
138: [18:10:05] <travis-ci> dhensby/silverstripe-framework#43 (master - 8b0bcd9 : Loz Calver): The build has errored.
139: [18:10:05] <travis-ci> Change view : https://github.com/dhensby/silverstripe-framework/compare/f17d594141f6...8b0bcd93e8bc
140: [18:10:05] <travis-ci> Build details : http://travis-ci.org/dhensby/silverstripe-framework/builds/45788294
141: [18:10:05] * travis-ci has left #silverstripe
142: [18:24:12] * travis-ci has joined #silverstripe
143: [18:24:12] <travis-ci> dhensby/silverstripe-framework#44 (master - a75766e : Will Rossiter): The build has errored.
144: [18:24:12] <travis-ci> Change view : https://github.com/dhensby/silverstripe-framework/compare/8b0bcd93e8bc...a75766ee4971
145: [18:24:12] <travis-ci> Build details : http://travis-ci.org/dhensby/silverstripe-framework/builds/45788461
146: [18:24:12] * travis-ci has left #silverstripe
147: [18:33:02] * travis-ci has joined #silverstripe
148: [18:33:02] <travis-ci> dhensby/silverstripe-framework#45 (3.1 - 8b0bcd9 : Loz Calver): The build passed.
149: [18:33:02] <travis-ci> Change view : https://github.com/dhensby/silverstripe-framework/compare/644f38f2d6cd...8b0bcd93e8bc
150: [18:33:02] <travis-ci> Build details : http://travis-ci.org/dhensby/silverstripe-framework/builds/45788480
151: [18:33:02] * travis-ci has left #silverstripe
152: [19:06:24] * Azure quit (Read error: Connection reset by peer)
153: [19:08:03] * Azure has joined #silverstripe
154: [19:34:47] * Azure quit (Quit: My MBP went to sleep.)
155: [20:20:33] * gelignite has joined #silverstripe
156: [21:59:32] * ello has joined #silverstripe
157: [22:03:34] * ello quit (Ping timeout: 246 seconds)
158: [22:10:24] * Azure has joined #silverstripe
159: [22:41:30] * Azure quit (Quit: My MBP went to sleep.)
160: [22:54:09] * Azure has joined #silverstripe
161: [22:58:44] * Azure quit (Quit: Blue Sky Fish)
162: [23:04:51] <Zauberfisch> ezero: what did you expect?
163: [23:04:56] <ezero> :(
164: [23:04:59] * Azure has joined #silverstripe
165: [23:05:10] <ezero> in the form fields i expected it to populate the default value
166: [23:05:16] <ezero> like for example
167: [23:05:34] <ezero> $fields->addFieldToTab("Root.SingleSignOn", new TextField("Blah", "blah", "blah"));
168: [23:05:36] <ezero> when i do that
169: [23:05:37] <ezero> it works!
170: [23:05:51] <ezero> but when i do it on a field that is in $db
171: [23:05:55] <ezero> it doesn't :(
172: [23:06:42] <Zauberfisch> populateDefaults is called right after creation of an object and allows you to set database fields like those defined in $db
173: [23:06:57] <ezero> thats what i expected :(
174: [23:07:04] <ezero> but i dont think its getting called
175: [23:07:07] <ezero> unless im doing it wrong
176: [23:07:11] <Zauberfisch> it is often confused with default values for getCMSFields, which it is not doing. it really only gets called once, on creation of a new object
177: [23:07:21] <Zauberfisch> and ot does not populdate the form, it populates the database
178: [23:07:23] <ezero> here is my class
179: [23:07:23] <ezero> http://sspaste.com/paste/show/54a87619e00f6
180: [23:07:42] <ezero> oh i see
181: [23:07:46] <ezero> on creation of a new object..
182: [23:07:54] <ezero> oh crap
183: [23:07:55] <ezero> lol
184: [23:07:59] <ezero> so maybe it is done in the database
185: [23:08:20] <Zauberfisch> ezero: you are doing it in a DataExtension
186: [23:08:30] <ezero> i
187: [23:08:32] <Zauberfisch> in DataExtensions $this is always the dataextension itself, not the actual object
188: [23:08:39] <Zauberfisch> you have to do $this->owner->Something
189: [23:08:45] <Zauberfisch> instead of $this->Something
190: [23:08:54] <ezero> ah yes
191: [23:08:58] <ezero> i did experiment with $this->owner
192: [23:09:07] <ezero> even that wasn't getting set! hopefully if i do
193: [23:09:13] <ezero> $this->owner->extend()
194: [23:09:16] <ezero> it might work
195: [23:09:21] <Zauberfisch> wait a second
196: [23:09:23] <Zauberfisch> let me check
197: [23:10:21] <Zauberfisch> just looked it up
198: [23:10:28] <Zauberfisch> it should work with $this->onwer
199: [23:10:35] <Zauberfisch> change the code, and then create a new dataobject
200: [23:10:38] <ezero> yes it should :D
201: [23:11:02] <Zauberfisch> then check in the DB directly (mysql-client, phpmyadmin, ...) to see if the values have been populated
202: [23:11:50] <ezero> lol
203: [23:11:58] <ezero> its having execution tiimeout
204: [23:13:05] <ezero> Zauberfisch, will it be in SiteConfig table?
205: [23:13:25] <ezero> I dont see my custom config table
206: [23:14:43] <Zauberfisch> have you attached that extension to SiteConfig?
207: [23:14:56] <Zauberfisch> and have you run a dev/build?flush=1 after adding it?
208: [23:15:09] <ezero> yup just did /dev/build and flush
209: [23:15:16] <ezero> yes i've attached it using yml file
210: [23:15:27] <Zauberfisch> and yes, if you added that extension to SiteConfig, the DB fields should be added to that the SiteConfig table
211: [23:15:46] <ezero> like so
212: [23:15:46] <ezero> http://sspaste.com/paste/show/54a8781201b7e
213: [23:16:08] <ezero> ah yes
214: [23:16:10] <ezero> i see the fields
215: [23:16:15] <ezero> but no default value being populated
216: [23:17:06] <ezero> still NULL
217: [23:17:33] <ezero> when i add
218: [23:17:33] <ezero> $this->owner->extend('updateCMSFields', $fields);
219: [23:17:38] <ezero> its having execution timeout
220: [23:17:48] <Zauberfisch> yes, because you create an endless loop
221: [23:17:56] <Zauberfisch> $this->owner->extend('updateCMSFields', $fields);
222: [23:18:18] <Zauberfisch> is pretty much the same as $this->updateCMSFields($fields)
223: [23:18:40] <ezero> so why am i calling it recursively?
224: [23:18:54] <Zauberfisch> i don't know why you would do such a thing
225: [23:19:18] <ezero> i was having a read of
226: [23:19:18] <ezero> https://www.cwp.govt.nz/guides/core-technical-documentation/framework/en/reference/dataextension
227: [23:19:26] <ezero> and thats where i got the idea of it
228: [23:19:29] <ezero> but i dont think it applies here
229: [23:19:47] * UncleCheese has joined #silverstripe
230: [23:20:15] <ezero> hmm im checking with phpmyadmin
231: [23:20:20] <ezero> its not popu lating defaults
232: [23:20:58] <Zauberfisch> $this->extend() is a method designed to call a method on all attached extensions
233: [23:21:11] <Zauberfisch> so you would normaly use that in the actual class. so in SiteConfig
234: [23:21:25] <Zauberfisch> or in DataObject, or in Page
235: [23:21:31] <ezero> yea
236: [23:21:36] <Zauberfisch> to allow an extension to use that method on it
237: [23:21:38] <ezero> this is a DataExtension
238: [23:21:57] <ezero> surely i can use populateDefaults() tho
239: [23:22:32] <Zauberfisch> and in fact, it is in DataObject: https://github.com/silverstripe/silverstripe-framework/blob/7b89c17349013b9239e73cf74d43c988899b4f6d/model/DataObject.php#L2058
240: [23:23:02] <Zauberfisch> yes, populate defaults also should work, because its called here: https://github.com/silverstripe/silverstripe-framework/blob/7b89c17349013b9239e73cf74d43c988899b4f6d/model/DataObject.php#L1091
241: [23:23:03] * Azure quit (Quit: Blue Sky Fish)
242: [23:23:25] <Zauberfisch> (also note that populateDefaults has very little to do with the CMSFields)
243: [23:23:36] <Zauberfisch> so to be sure that it is working, you should always check the database directly
244: [23:23:57] <ezero> thats what im doing
245: [23:24:02] <ezero> im going todo another test
246: [23:24:11] <ezero> to prove that I have not mickey moused around
247: [23:24:19] <ezero> i have a hunch that it is one-time only
248: [23:24:37] <ezero> adding another db field
249: [23:24:39] <ezero> called blah
250: [23:24:40] <ezero> 'blah' => 'Varchar'
251: [23:24:45] <ezero> then also adding
252: [23:24:45] <ezero> $this->blah = "blah";
253: [23:24:53] <Zauberfisch> well, yes. its one time only on creation
254: [23:24:53] <ezero> then running /dev/build
255: [23:25:01] <ezero> because i think i might have created the fields
256: [23:25:04] <ezero> and then later on introduced code
257: [23:25:15] <ezero> for populateDefaults aftewards
258: [23:25:15] <Zauberfisch> so if you are not creating a new record of that object, populateDefaults is not going to be called
259: [23:25:36] <Zauberfisch> ah, I should have thought of that. SiteConfig is usually not an object that is created newly
260: [23:25:56] <Zauberfisch> if you delete your database, and then run a dev/build, the defaults will be set
261: [23:26:03] <ezero> nope
262: [23:26:06] <ezero> still didnt work!
263: [23:26:06] <ezero> :(
264: [23:26:11] <ezero> blah is still NULL in db
265: [23:26:18] <Zauberfisch> have you created a new record?
266: [23:26:24] <Zauberfisch> it only works on creating a new record
267: [23:26:28] <ezero> oh really
268: [23:26:29] <ezero> dam it
269: [23:26:36] <ezero> but you always get SiteConfig
270: [23:26:36] <ezero> lol
271: [23:26:42] <ezero> with your fresh silverstripe install
272: [23:27:15] <ezero> i guess ican delete that row from DB
273: [23:27:41] <ezero> Added default site config
274: [23:27:48] <ezero> in /dev/build
275: [23:28:24] <ezero> weird
276: [23:28:26] <ezero> its still NULL
277: [23:28:28] <ezero> all of them
278: [23:28:38] <ezero> even from new record
279: [23:28:40] * Azure has joined #silverstripe
280: [23:29:11] <madmatt> populateDefaults is only used when loading it into the CMS, IIRC? (e.g. when clicking 'New Page')
281: [23:29:38] <ezero> i see, so this is not a page
282: [23:29:42] <ezero> so it will not ever work :(
283: [23:30:19] <ezero> but
284: [23:30:23] <ezero> SiteConfig.php does it
285: [23:30:25] <madmatt> So you're creating a Varchar, and want it set to a particular value when you build the db for the first time?
286: [23:30:26] <ezero> $this->Title = _t('SiteConfig.SITENAMEDEFAULT', "Your Site Name");
287: [23:30:37] <ezero> yes madmatt
288: [23:32:06] <ezero> for Booleans it was easy!
289: [23:32:12] <ezero> $db 'requestedAuthnContext' => "Boolean(1)",
290: [23:34:44] <madmatt> ezero: Yeah, looks like it's not curently supported
291: [23:34:54] <madmatt> You could create a sub-class of Varchar to support it
292: [23:35:07] <ezero> thats going way too far for the objective of module lol
293: [23:35:15] <ezero> ill leave it out :)
294: [23:35:32] <ezero> im surprised that SiteConfig.php manages todo it
295: [23:35:40] <ezero> although that extends DataObject
296: [23:35:49] <ezero> maybe i should have gone down that path.
297: [23:36:18] <ezero> but seems sensible to have configuration stuff under SiteConfig umbrella
298: [23:36:23] <ezero> just seems right
299: [23:37:56] * Liquide quit ()
300: [23:39:00] <ezero> hmm there is another way..
301: [23:39:14] <ezero> i create LiteralFields that will shadow the db fields
302: [23:39:22] <ezero> and onBeforeWrite() i just map them
303: [23:42:34] <madmatt> Have you looked at DataObject::requireDefaultRecords()
304: [23:42:50] <madmatt> That's what creates a SiteConfig object (the "Adding default SiteConfig" thing during a dev/build)
305: [23:43:11] <madmatt> It gets extended on Extensions, perhaps you can see if the value is set, and if not, set it to your default value?
306: [23:43:22] <madmatt> (Sorry if you've already tried this, I haven't read all the scrollback :))
307: [23:43:45] <ezero> no i have not tried that
308: [23:43:57] <ezero> although i did eye it whilst in the api
309: [23:44:31] <ezero> but the thing is
310: [23:44:38] <ezero> SIteConfig object will always exist
311: [23:44:51] <ezero> its like what comes with SilverStripe default instal
312: [23:45:03] <ezero> hmmm yeah i see your point
313: [23:45:04] <ezero> let me try
314: [23:45:51] <madmatt> one sec, I've found some code in an existing project that might help you
315: [23:45:59] <madmatt> If it does what I think it does (no comments, as usual :p)
316: [23:47:03] <ezero> :D
317: [23:48:48] <madmatt> http://sspaste.com/paste/show/54a87f96f113c
318: [23:50:23] <madmatt> I think that's all of it :)
319: [23:58:08] <ezero> why did u add
320: [23:58:11] <ezero> private static defaults
321: [23:58:15] <ezero> when you were going to do that
322: [23:58:22] <ezero> i guess you saw that, it didnt work?
323: [23:59:04] <ezero> oh i see
324: [23:59:08] <ezero> your getting it from $defaults
325: [23:59:08] <ezero> $config->$item = $defaults[$item];

These logs were automatically created by ss-log on irc.freenode.net.