Skip to content

Instantly share code, notes, and snippets.

@icetee
Created June 19, 2017 21:01
Show Gist options
  • Save icetee/06ae42d0943ee8d6d8190c36f264630d to your computer and use it in GitHub Desktop.
Save icetee/06ae42d0943ee8d6d8190c36f264630d to your computer and use it in GitHub Desktop.
CakePHP reorder acl tree
/**
* This is a maint function to recover/reorder the
* lft/rght columns of the aco and aro models.
*
*/
public function recover_acl_tree( ) {
App::Import('Model', 'Aco' );
App::Import('Model', 'Aro' );
$Aco = new Aco;
$Aro = new Aro;
if ( !$Aco->recover() || !$Aro->recover() ) {
echo 'Error recovering acl tree';
} else {
echo 'Aros and Acos reordered.';
}
exit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment