I am curious if it is just me or if anyone has the same problem. I setup Cake with a simple ACL just like the cookbook example locally with WAMP and on a hosted server. The database is exactly the same, I am using Dreamweaver with Upload on save so the files are exactly the same locally and remotely. When I run the initDB() or buildAcl() locally it works fine, but run it on the server and I get SQL Error: 1104: The SELECT would examine more than MAX_JOIN_SIZE rows; check your WHERE and use SET SQL_BIG_SELECTS=1 or SET SQL_MAX_JOIN_SIZE=# if
the SELECT is okay [CORE/cake/libs/model/datasources/dbo_source.php, line 514] I had to do the following below to get it to work on the server. Wondering why that is? Why would it work locally but not on the live server unless I have to patch it up? http://realm3.com/articles/setting_up_users_groups_withacl_and_auth_in_cake_ 1.2.php "Patch Your db_acl.php file! It took me hours, no, days, to get all of the above working. It doesn't help that this version of CakePHP actually has a bug that you will need to patch in <https://trac.cakephp.org/ticket/2976> db_acl.php. Geoff was kind enough to provide a patch to fix this issue, and hopefully it will be included in the next version of CakePHP 1.2.x. Go to line 312 and clear out the whole AclNode::node function and replace it with the following: <?php /** * Retrieves the Aro/Aco node for this model * * @param mixed $ref * @return array */ function node($ref = null) { $db =& ConnectionManager::getDataSource($this->useDbConfig); $type = $this->name; $prefix = $this->tablePrefix; if (! <http://www.php.net/empty> empty($this->useTable)) { $table = $this->useTable; } else { $table = Inflector::pluralize(Inflector::underscore($type)); } if ( <http://www.php.net/empty> empty($ref)) { return null; } elseif ( <http://www.php.net/is_string> is_string($ref)) { $path = <http://www.php.net/explode> explode('/', $ref); $start = $path[ <http://www.php.net/count> count($path) - 1]; <http://www.php.net/unset> unset($path[ <http://www.php.net/count> count($path) - 1]); $path = <http://www.php.net/array_reverse> array_reverse( $path ); $query = "SELECT {$type}.* From {$prefix}{$table} AS {$type} "; $query .= "INNER JOIN {$prefix}{$table} {$db->alias} {$type}0 "; //$query .= "LEFT JOIN {$prefix}{$table} AS {$type}0 "; $query .= "ON {$type}0.alias = " . $db->value($start) . " "; foreach ($path as $i => $alias) { $j = $i - 1; $k = $i + 1; //$query .= "LEFT JOIN {$prefix}{$table} AS {$type}{$k} "; //$query .= "ON {$type}{$k}.lft > {$type}{$i}.lft && {$type}{$k}.rght < {$type}{$i}.rght "; $query .= "INNER JOIN {$prefix}{$table} {$db->alias} {$type}{$k} "; $query .= "ON {$type}{$i}.parent_id = {$type}{$k}.id "; $query .= "AND {$type}{$k}.alias = " . $db->value($alias) . " "; } $result = $this->query("{$query} WHERE {$type}.lft <= {$type}0.lft AND {$type}.rght >= {$type}0.rght ORDER BY {$type}.lft DESC", $this->cacheQueries); } elseif ( <http://www.php.net/is_object> is_object($ref) && <http://www.php.net/is_a> is_a($ref, 'Model')) { $ref = <http://www.php.net/array> array('model' => $ref->name, 'foreign_key' => $ref->id); } elseif ( <http://www.php.net/is_array> is_array($ref) && !( <http://www.php.net/isset> isset($ref['model']) && <http://www.php.net/isset> isset($ref['foreign_key']))) { $name = <http://www.php.net/key> key($ref); if (!ClassRegistry::isKeySet($name)) { if (!loadModel($name)) { <http://www.php.net/trigger_error> trigger_error("Model class '$name' not found in AclNode::node() when trying to bind {$this->name} object", E_USER_WARNING); return null; } $model =& new $name(); } else { $model =& ClassRegistry::getObject($name); } $tmpRef = null; if ( <http://www.php.net/method_exists> method_exists($model, 'bindNode')) { $tmpRef = $model->bindNode($ref); } if ( <http://www.php.net/empty> empty($tmpRef)) { $ref = <http://www.php.net/array> array('model' => $name, 'foreign_key' => $ref[$name][$model->primaryKey]); } else { if ( <http://www.php.net/is_string> is_string($tmpRef)) { return $this->node($tmpRef); } $ref = $tmpRef; } } if ( <http://www.php.net/is_array> is_array($ref)) { foreach ($ref as $key => $val) { if ( <http://www.php.net/strpos> strpos($key, $type) !== 0) { <http://www.php.net/unset> unset($ref[$key]); $ref["{$type}0.{$key}"] = $val; } } $query = "SELECT {$type}.* From {$prefix}{$table} AS {$type} "; $query .= "LEFT JOIN {$prefix}{$table} AS {$type}0 "; $query .= "ON {$type}.lft <= {$type}0.lft AND {$type}.rght >= {$type}0.rght "; $result = $this->query("{$query} " . $db->conditions($ref) ." ORDER BY {$type}.lft DESC", $this->cacheQueries); if (!$result) { <http://www.php.net/trigger_error> trigger_error("AclNode::node() - Couldn't find {$type} node identified by \"" . <http://www.php.net/print_r> print_r($ref, true) . "\"", E_USER_WARNING); } } return $result; } ?> Dave --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
