0

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.

0

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

7 Comments

I dont want to load it twice, but as I mentioned in my question whenever I remove one o them it show me error for missing plugin on local system too. However on live server it shows application is trying to load file from Webmaster plugin.
Well @RNKushwaha, your questions wording didn't really help to make it understandable. Same with your comment, it sounds as if the error message would say Webmaster, not webmaster. As I said, casing is important, so please make sure you are properly using Webmaster everywhere, and remove the surplus load() call.
Thanks @ndm for your answer and apologies for my bad english. However cake tell me to add this line CakePlugin::load('webmaster'); instead of CakePlugin::load('Webmaster'); and I used Webmaster everywhere not `webmaster. See here
No need to apologize @RNKushwaha, I just wanted to point out that it's not that easy to understand what you are saying. Anyhow, 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 in your code. The error on your linked site clearly stems from the load('webmaster') call, please remove it! And if you then still receive a missing plugin error, then please update your question with the exact stacktrace (including the context > click on the links).
As you said the casing was a problem, actually I was using webmaster instead of Webmaster in UsersController. Please add this line in your answer and I'll mark it as accepted answer. Thanks
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.