Re: ACL very slow

2012-04-17 Thread Farah
Ok, I'm sorry stork, but I if I just try put in the session all permissions 
of the controller:

$acoes = $this-Acao-find(all, array(conditions = 
array(Controller.alias = $controller)));
foreach ($acoes as $key = $acao) {
if (!$this-Session-check(Auth.Permissions. . 
$controller . . . $acao[Acao][alias])) {
if ($this-SessionAcl-check(array('model' = 
'Usuario', 'foreign_key' = $this-Auth-user('id')), $controller . / . 
$acao[Acao][alias])) {
$this-Session-write(Auth.Permissions. . 
$controller . . . $acao[Acao][alias], true);
}
}
}

It takes (default) 561 queries took 1072 ms, the count of $acoes is 7, I 
don't understand why 561 queries, is too slow?

Thanks =)


On Tuesday, April 17, 2012 8:09:00 AM UTC-3, stork wrote:

  Any one can help me with this ?

 Not me, sorry. This is example, how should NOT look code of CakePHP 
 application, controller should be as slim as possible.


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: ACL very slow

2012-04-17 Thread Farah
I'm not expert in CakePHP, but its very clear that the ACL is slow if my 
tables database acos, aros and aros_acos over thousand rows.

Just a simple $this-Acl-check() runs over 500 queries and its clear that 
its not the acl generate that, it uses the Tree behavior to find the 
specific permission.

1. I'm not using database session.
2. There are many articles on the internet talking about that, and I'm not 
blaming, I'm just trying to figure out how fast my app can be.

The articles

1. http://www.visuallizard.com/blog/2009/10/19/241 
2. http://www.mainelydesign.com/blog/view/speeding-up-cakephp-acl-component
3. 
http://phpknight.com/cakephp-acl-controlled-application-slow-performance-problem/


I'll create a component and helper to make this faster as soon as possible 
and I'll post it here.

Thanks for your attention =)


On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database as 
 the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: ACL very slow

2012-04-17 Thread Farah
Thanks for the reply!

On Tuesday, April 17, 2012 11:16:49 AM UTC-3, stork wrote:

 Also, check out these projects
 http://plugins.cakephp.org/packages?query=acl
 if you do not need wheel with some special shape.


On Tuesday, April 17, 2012 11:16:49 AM UTC-3, stork wrote:

 Also, check out these projects
 http://plugins.cakephp.org/packages?query=acl
 if you do not need wheel with some special shape.


-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: ACL very slow

2012-04-17 Thread Farah
Yes, all fields has index

On Tuesday, April 17, 2012 12:21:36 PM UTC-3, jeremyharris wrote:

 I realized after posting that the post I referenced assumes MySQL, but the 
 idea of indexing is relative nonetheless.

 On Tuesday, April 17, 2012 8:20:05 AM UTC-7, jeremyharris wrote:

 It's quite possible you're just missing indexes[1], which would be a huge 
 performance problem. Also, make sure the engine is innodb.

 1:  
 http://blog.loadsys.com/2008/03/19/cakephp-12-tuning-the-acl-via-mysql/ 

 On Tuesday, April 17, 2012 6:00:05 AM UTC-7, Farah wrote:

 I'm not expert in CakePHP, but its very clear that the ACL is slow if my 
 tables database acos, aros and aros_acos over thousand rows.

 Just a simple $this-Acl-check() runs over 500 queries and its clear 
 that its not the acl generate that, it uses the Tree behavior to find the 
 specific permission.

 1. I'm not using database session.
 2. There are many articles on the internet talking about that, and I'm 
 not blaming, I'm just trying to figure out how fast my app can be.

 The articles

 1. http://www.visuallizard.com/blog/2009/10/19/241 
 2. 
 http://www.mainelydesign.com/blog/view/speeding-up-cakephp-acl-component
 3. 
 http://phpknight.com/cakephp-acl-controlled-application-slow-performance-problem/


 I'll create a component and helper to make this faster as soon as 
 possible and I'll post it here.

 Thanks for your attention =)


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database 
 as the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database 
 as the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database 
 as the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.


 On Tuesday, April 17, 2012 9:13:21 AM UTC-3, stork wrote:

 1. Do you store sessions in database? If yes, is it the same database 
 as the one with application data? If yes, why? And why not use other 
 (memcache) storage for sessions?

 2. Stop blaming core code for slowness, until you'll be able to write 
 short example NOT using your own classes like SessionAcl etc in it, 
 especially not after your example code snippet above. I do have advanced 
 imagination and I'm more then just a bit scared of what and how does your 
 other custom code, used in your last loop over $acoes, where I even don't 
 know what $recursive you used and how many associations are queried along.

 Set up clean CakePHP installation, connect it to the very same database 
 like your ACL uses, and run some test code related to your doubts WITHOUT 
 your own code.



-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others

Re: Password Protecting a Directory

2010-09-08 Thread Farah
See this documentation

http://httpd.apache.org/docs/2.0/howto/auth.html



On 7 set, 23:38, Arak Tai'Roth nielsen.dus...@gmail.com wrote:
 Can anyone help me with this problem please?

 On Sep 6, 11:37 pm, Arak Tai'Roth nielsen.dus...@gmail.com wrote: So, I 
 am aware this question has been asked and answered in a variety
  of different ways in a variety of different places. I have already
  spent way too much time trying to find a solution, so I'm hoping to
  find a solution here by just asking myself.

  I am using CakePHP 1.2.5 in this case if that makes a difference. I'm
  hoping not, because I'm hoping to use whatever solution I get on a few
  different installations, all of which use different versions.

  Anyways, the issue is this. I have setup a directory inside /homePath/
  app/webroot/, the directory is called admin, so the full path looks
  like /homePath/app/webroot/admin. Now getting to this directory works
  great. Until I password protect it using a .htaccess and .htpasswd
  file.

  After I implement the password protection, I get this error, Error:
  The requested address '/failed_auth.html' was not found on this
  server.

  My .htaccess file looks like this:
  AuthType Basic
  AuthUserFile /homePath/app/webroot/admin/.htpasswd
  AuthName Precision Laser Therapy Administrators
  require valid-user

  I am using Dreamhost and have generated this using their panel, so I
  am pretty positive the /homePath/ portion is correct.

  I have already tried the solutions 
  onhttp://groups.google.ca/group/cake-php/browse_thread/thread/9054f372d...,
  andhttp://groups.google.ca/group/cake-php/browse_thread/thread/30ea77cad...

  I couldn't get them to work, that could be because I'm dumb and missed
  something that they didn't explicitly say or they just simply won't
  work in my case. Does someone have a solution for this issue? Assume
  that the only thing I have changed to a static Cake install, is the
  addition of the admin directory in /app/webroot, and the addition of
  the .htaccess and .htpasswd files inside of it. Any help is extremely
  appreciated.

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en