# |
Mar 16th 2018, 16:18 |
joopm |
i have a cakeproject on a linux server,i would like to ask that what is the best chmod for a user directory to enable file upload |
# |
Mar 16th 2018, 16:17 |
joopm |
hello all |
# |
Mar 16th 2018, 16:13 |
flavius |
``` ->contain(['Replies' => function ($q) { return $q ->where(['Replies.client_id' => $this->Selection->client['id']]) ->order(['Replies.created_time' => 'ASC']); }]); ``` |
# |
Mar 16th 2018, 16:12 |
flavius |
`->contain(['Posts' => ['fields' => ['fd']]])` |
# |
Mar 16th 2018, 16:12 |
flavius |
depends on the complexity, i use both |
# |
Mar 16th 2018, 16:07 |
saeideng |
``` ->select() ->contain() ``` ? |
# |
Mar 16th 2018, 15:59 |
neon1024 |
Do you guys n gals prefer using a callback with `->select()` inside your contains or you do use array `fields => []` ? |
# |
Mar 16th 2018, 15:54 |
neon1024 |
Just be careful that you don’t clear your entire cache too frequently, as it will cost you to rebuild it each time |
# |
Mar 16th 2018, 15:53 |
neon1024 |
https://book.cakephp.org/3.0/en/core-libraries/events.html |
# |
Mar 16th 2018, 15:53 |
neon1024 |
Then the final piece of the puzzle is just listening to the correct events |
# |
Mar 16th 2018, 15:53 |
neon1024 |
Book has a page on clearing cache also |
# |
Mar 16th 2018, 15:53 |
neon1024 |
https://book.cakephp.org/3.0/en/core-libraries/caching.html#clearing-cached-data |
# |
Mar 16th 2018, 15:52 |
neon1024 |
Sure, try the source code. https://github.com/cakephp/cakephp/blob/master/src/Shell/CacheShell.php#L67-L91 |
# |
Mar 16th 2018, 15:48 |
awi |
Is there somewhere a little blog or something where I can read how to regenerate cache by Events? |
# |
Mar 16th 2018, 15:47 |
awi |
hi. |
# |
Mar 16th 2018, 15:33 |
patsuckow |
Got it, but not 100% ... it's a pity that there is no example ... Well, thanks for that! :) |
# |
Mar 16th 2018, 15:33 |
generitter |
.. resets all selected field. |
# |
Mar 16th 2018, 15:33 |
generitter |
Only if you pass the second argument true. But that resets everything. |
# |
Mar 16th 2018, 15:32 |
neon1024 |
If I specify a `->select()` in a custom finder, will that overwrite the queries selected fields? |
# |
Mar 16th 2018, 15:30 |
dereuromark |
otherwise it is a redirect (get) which needs a query string as payload or at least as payload identifier |
# |
Mar 16th 2018, 15:30 |
dereuromark |
well, sending from action directly is not sth that just "works". you need to use a form here |
# |
Mar 16th 2018, 15:30 |
dereuromark |
about what? |
# |
Mar 16th 2018, 15:29 |
patsuckow |
dereuromark, is there any minimum example or reference to an example? Just in the documentation something as I can not find |
# |
Mar 16th 2018, 15:28 |
dereuromark |
feel free to make a PR to adjust the current code |
# |
Mar 16th 2018, 15:27 |
bez |
it is not required, but should use it if you pass it, shouldn't it? |
# |
Mar 16th 2018, 15:25 |
dereuromark |
the internal one doesnt need salt afaik, as it has something built in |
# |
Mar 16th 2018, 15:24 |
bez |
if it did, then it would work ok |
# |
Mar 16th 2018, 15:24 |
bez |
not sure why cake is not using the salt there |
# |
Mar 16th 2018, 15:24 |
patsuckow |
is there any minimum example or reference to an example? Just in the documentation something as I can not find |
# |
Mar 16th 2018, 15:24 |
bez |
i just did, and it works |
# |
Mar 16th 2018, 15:24 |
bez |
if I manually do the hashing with the password and salt (using the php function DefaultPasswordHasher uses) and save it on the database, I alway get the same hash and then I can login |
# |
Mar 16th 2018, 15:23 |
dereuromark |
you need to look into their code |
# |
Mar 16th 2018, 15:23 |
dereuromark |
the internal for default seems to be the password hasher of PHP, so yeah, some internal salt probably |
# |
Mar 16th 2018, 15:23 |
dereuromark |
especially when form validation is relevant |
# |
Mar 16th 2018, 15:23 |
dereuromark |
but the default usually is the same action for obvious usability reasons |
# |
Mar 16th 2018, 15:22 |
dereuromark |
you can always post date from any action to any action |
# |
Mar 16th 2018, 15:22 |
bez |
yah, i don't think cake is using the salt, as the password hash generated each time is very different from each other |
# |
Mar 16th 2018, 15:21 |
patsuckow |
dereuromark, thanks again for the help, what I needed. But all the same, but tell me, in principle, is there a way to send data in one controller from one action to the action of the same POST controller? |
# |
Mar 16th 2018, 15:11 |
generitter |
Good to know. |
# |
Mar 16th 2018, 15:09 |
bez |
in the entity, this is what i did: ``` protected function _setPassword($password) { Security::setSalt('MYSALT'); return (new DefaultPasswordHasher)->hash($password); } ``` but still failing to sign in |
# |
Mar 16th 2018, 15:08 |
bez |
oh, right, it did now |