Missing Plugin error in Cakephp

2.6k Views Asked by At

I am developing a site in cakephp2.5. I have two plugin Webmaster and debugKit. When I write

CakePlugin::load('Webmaster', array('bootstrap' => false, 'routes' => false));
CakePlugin::load('webmaster');
CakePlugin::load( 'DebugKit');

The site works correctly on local system but not on live server. However if I remove one of the above Webmaster it shows error on local system and also on live

Error: The application is trying to load a file from the webmaster plugin
Error: Make sure your plugin webmaster is in the app\Plugin directory and was loaded

I also tried but no luck. Struggling from 2 days. Also seen these links link1 link2

Here is my WebmasterAppController

<?php

App::uses('AppController', 'Controller');

class WebmasterAppController extends AppController{
  public $theme= "beyond";
  //public $layout=NULL;
  public function beforeFilter(){
    //$this->Auth->allow('login');
    $this->Auth->loginAction= array('controller'=>'users', 'action'=>'login');
    $this->Auth->loginRedirect= array('controller'=>'users', 'action'=>'index');
    $this->Auth->loginError= 'Invalid Email/Password!';
    $this->Auth->authError= 'You are not authorised to access!';
    $this->Auth->logoutRedirect= array('controller'=>'users', 'action'=>'login');
    AuthComponent::$sessionKey = 'Auth.Webmaster'; 
    //we don't need to load debug kit
    $this->Components->unload('DebugKit.Toolbar');
    
    parent::beforeFilter();
}

}

And here is AppController

class AppController extends Controller{

public $cakeDescription = "CakePhp | ";
public $theme = "alpus";
public $ext = 'html';

public $helpers = array('NiceForms', 'coolFun');
public $components = array(
    'DebugKit.Toolbar',
    'Common',
    'Session',
    'Auth' => array(
        'loginRedirect' => array(
            'controller' => 'pages',
            'action' => 'dashboard'
        ),
        'logoutRedirect' => array(
            'controller' => 'users',
            'action'     => 'login',
            
        ),
        'authenticate' => array(
            'Form' => array(
                'passwordHasher' => 'Blowfish',
                'fields' => array('username' => 'email')
            )
        ),
        'sessionKey' => 'Admin'
    )
);


public function beforeFilter(){
    if (isset($this->params['prefix']) && $this->params['prefix'] == 'admin') {
        $this->theme = 'smart';
        $this->Auth->loginAction = array('controller' => 'users', 'action' => 'admin_login', 'plugin' => false);
    } 
    $this->Auth->allow('register');
}

}

Edit 1:
For cakephp 3.0 we can use

public function beforeFilter(Event $event) {

$this->Auth->sessionKey ='Auth.User';

}

in AppController.php to set different sessionKey for frontend and backend.

1

There are 1 best solutions below

7
On BEST ANSWER

Why do you have multiple load calls for the same plugin anways? There should be only one per plugin!

That being said, mind your casing, the second CakePlugin::load() call uses webmaster instead of Webmaster. Plugin names should start with an uppercased letter, just like the corresponding directory name.

Your local filesystem is most probably case insensitive, so it can find the plugin directory even though the casing doesn't match.

Update It looks like I intially got you wrong, if CakePHP would tell you to load the plugin webmaster without you already having added a CakePlugin::load('webmaster') call, then you must have used the lowercased webmaster somewhere else in your code.