Good day,
Some year ago, I built a web site with CakePHP. I also set permission with ACO and ARO.
The big problem, I have, its so long time, that I do not rember a lot of things.
Today, I have to make a very simple update to my ResearchController file.Some thimgs so simple like changing the order of listing data (DESC to ASC)
if(is_numeric($catid)){
$d['researches'] = $this->Research->find('all',array(
'limit'=>100,
'order'=>'Research.order ASC',
'conditions' => array(
'Research.researchescat_id'=>$catid,
'Research.status'=> true
)
));
}
Then I upload that file to my server.
The mistake I did, I uploaded it as root. I ssh the server and I observer that all files are own to another user than root. Then I deleted the file, configure FileZilla with the right user and I re-upload it. Now all files have the same owner.
Since, a message is shown
[ Warning (2)](javascript:void(0);): Invalid argument supplied for foreach() [ APP/Controller/Component/CtrlComponent.php , line 31 ]
[ Warning (2)](javascript:void(0);): array_diff() [PHP: array_diff - Manual]: Argument #1 is not an array [ APP/Controller/Component/CtrlComponent.php , line 49 ]
[ Warning (2)](javascript:void(0);): Invalid argument supplied for foreach() [ APP/Controller/AppController.php , line 78 ]
Note, the web site is running since serveral years and I never get a such message.
I really do not understand why the fact to upload a file, give me the above troubles.
Note: Before uploading (for the first time) I make a backup of my original file. I renamed it ResearchControllerBCK.php.
Because of my issue, I renamed back ResearchControllerBCK.php to ResearchController.php, but the problem is the same.
So i ahev not idea, how to solve my problem.
By the way, from my permission page
www.website.ch/admin/acl_manager/acl/permissions
I have tow special links
- update ACOs
- update AROs
As it’s long time and I do not rember how it’s work, I am afraid about to click on thos link, but I did on ACOs link. I do not know if it’s the reason of my issue, but it should not.
Do you have an idea how I should start to investigate?
The content of AppController is
<?php
//
//File: application/Controller/Component/CtrlComponent.php
// Component rewritten, original from : http://cakebaker.42dh.com/2006/07/21/how-to-list-all-controllers/
//
class CtrlComponent extends Component {
/**
* Return an array of user Controllers and their methods.
* The function will exclude ApplicationController methods
* @return array
*/
public function get() {
$aCtrlClasses = App::objects('controller');
foreach ($aCtrlClasses as $controller) {
if ($controller != 'AppController') {
// Load the controller
App::import('Controller', str_replace('Controller', '', $controller));
// Load its methods / actions
$aMethods = get_class_methods($controller);
foreach ($aMethods as $idx => $method) {
if ($method{0} == '_') {
unset($aMethods[$idx]);
}
}
// Load the ApplicationController (if there is one)
App::import('Controller', 'AppController');
$parentActions = get_class_methods('AppController');
$contro = strstr($controller,'Controller',-1);
// List here all the actions you want to remove from the default selection
$exclude = array('categoriesList','admin_show','menuList','adminpagesList','tag','admin_delTag','show','feed','signin','activate','login','logout','changepassword','forgottenpassword','tagsList','category');
$controllers[$contro] = array_diff($aMethods, $parentActions, $exclude);
}
}
return $controllers;
}
}
Many thank for your help