Monday, January 28, 2013

Re: Bake Plugin Issues

FYI, there's a recent commit that fixes this issue: https://github.com/cakephp/cakephp/commit/e8647d77ebd3db79ae051e55eca2907b762df924

On Tuesday, January 29, 2013 6:02:48 AM UTC+7, advantage+ wrote:

Thanks man,

 

You have been a great help and appreciate the time and assistance.

 

Will fix that and hope I can carry on issue free J

 

Dave

 

From: cake...@googlegroups.com [mailto:cake...@googlegroups.com] On Behalf Of euromark
Sent: Monday, January 28, 2013 7:31 PM
To: cake...@googlegroups.com
Subject: Re: Bake Plugin Issues

 

That is another commonly made mistake.

You need to always App::uses() all used classes in your files.

 

So in your plugin app controller file (UserManagerAppController.php) you are missing

 

<?php

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

 

class ...

 

Please fix this for all your controllers/models and other class files.

 

 



Am Montag, 28. Januar 2013 20:43:04 UTC+1 schrieb advantage+:

OK, I fixed that issue.

 

Bake plugin creates the default UserManager folder in Plugins with each app model / controller

 

Bake the model
cake bake model User --plugin UserManager,

or

cake bake controller Users --plugin UserManager

 

Results in errors " PHP Fatal error:  Class 'AppController' not found in K:\wamp\www\starter\2.x\app

\Plugin\UserManager\Controller\UserManagerAppController.php on line 3"

 

K:\wamp\www\starter\2.x\app>cake bake controller User --plugin UserManager

 

 

Welcome to CakePHP v2.2.5 Console

---------------------------------------------------------------

App : app

Path: K:\wamp\www\starter\2.x\app\

---------------------------------------------------------------

 

Baking controller class for Users...

---------------------------------------------------------------

You have more than one set of templates installed.

Please choose the template set you wish to use:

---------------------------------------------------------------

1. admin

2. default

Which bake theme would you like to use? (1/2)

[1] > 1

 

Creating file K:\wamp\www\starter\2.x\app\Plugin\UserManager\Controller\UsersCon

troller.php

Wrote `K:\wamp\www\starter\2.x\app\Plugin\UserManager\Controller\UsersController

.php`

 

You can download PHPUnit from http://phpunit.de

PHP Fatal error:  Class 'AppController' not found in K:\wamp\www\starter\2.x\app

\Plugin\UserManager\Controller\UserManagerAppController.php on line 3

PHP Stack trace:

PHP   1. {main}() K:\wamp\www\libs\2.2.5\Cake\Console\cake.php:0

PHP   2. ShellDispatcher::run() K:\wamp\www\libs\2.2.5\Cake\Console\cake.php:43

PHP   3. ShellDispatcher->dispatch() K:\wamp\www\libs\2.2.5\Cake\Console\ShellDi

spatcher.php:69

PHP   4. Shell->runCommand() K:\wamp\www\libs\2.2.5\Cake\Console\ShellDispatcher

.php:201

PHP   5. Shell->runCommand() K:\wamp\www\libs\2.2.5\Cake\Console\Shell.php:389

PHP   6. ControllerTask->execute() K:\wamp\www\libs\2.2.5\Cake\Console\Shell.php

:392

PHP   7. ControllerTask->bakeTest() K:\wamp\www\libs\2.2.5\Cake\Console\Command\

Task\ControllerTask.php:92

PHP   8. TestTask->bake() K:\wamp\www\libs\2.2.5\Cake\Console\Command\Task\Contr

ollerTask.php:341

PHP   9. TestTask->isLoadableClass() K:\wamp\www\libs\2.2.5\Cake\Console\Command

\Task\TestTask.php:143

PHP  10. class_exists() K:\wamp\www\libs\2.2.5\Cake\Console\Command\Task\TestTas

k.php:267

PHP  11. App::load() K:\wamp\www\libs\2.2.5\Cake\Console\Command\Task\TestTask.p

hp:0

PHP  12. include() K:\wamp\www\libs\2.2.5\Cake\Core\App.php:560

PHP  13. App::load() K:\wamp\www\libs\2.2.5\Cake\Core\App.php:0

PHP  14. include() K:\wamp\www\libs\2.2.5\Cake\Core\App.php:560

 

Fatal error: Class 'AppController' not found in K:\wamp\www\starter\2.x\app\Plug

in\UserManager\Controller\UserManagerAppController.php on line 3

 

Call Stack:

    0.0004     639360   1. {main}() K:\wamp\www\libs\2.2.5\Cake\Console\cake.php

:0

    0.0017     790200   2. ShellDispatcher::run() K:\wamp\www\libs\2.2.5\Cake\Co

nsole\cake.php:43

    0.0358    3622096   3. ShellDispatcher->dispatch() K:\wamp\www\libs\2.2.5\Ca

ke\Console\ShellDispatcher.php:69

    0.0445    4266608   4. Shell->runCommand() K:\wamp\www\libs\2.2.5\Cake\Conso

le\ShellDispatcher.php:201

    0.1029    7494648   5. Shell->runCommand() K:\wamp\www\libs\2.2.5\Cake\Conso

le\Shell.php:389

    0.1049    7510672   6. ControllerTask->execute() K:\wamp\www\libs\2.2.5\Cake

\Console\Shell.php:392

   1.9906    8071632   7. ControllerTask->bakeTest() K:\wamp\www\libs\2.2.5\Cak

e\Console\Command\Task\ControllerTask.php:92

    1.9911    8076256   8. TestTask->bake() K:\wamp\www\libs\2.2.5\Cake\Console\

Command\Task\ControllerTask.php:341

    1.9912    8076504   9. TestTask->isLoadableClass() K:\wamp\www\libs\2.2.5\Ca

ke\Console\Command\Task\TestTask.php:143

    1.9912    8077120  10. class_exists() K:\wamp\www\libs\2.2.5\Cake\Console\Co

mmand\Task\TestTask.php:267

    1.9912    8077440  11. App::load() K:\wamp\www\libs\2.2.5\Cake\Console\Comma

nd\Task\TestTask.php:0

    1.9936    8086536  12. include('K:\wamp\www\starter\2.x\app\Plugin\UserManag

er\Controller\UsersController.php') K:\wamp\www\libs\2.2.5\Cake\Core\App.php:560

 

    1.9936    8087000  13. App::load() K:\wamp\www\libs\2.2.5\Cake\Core\App.php:

0

    1.9989    8092408  14. include('K:\wamp\www\starter\2.x\app\Plugin\UserManag

er\Controller\UserManagerAppController.php') K:\wamp\www\libs\2.2.5\Cake\Core\Ap

p.php:560

 

Fatal Error Error: Class 'AppController' not found in [K:\wamp\www\starter\2.x\a

pp\Plugin\UserManager\Controller\UserManagerAppController.php, line 3]

 

 

 

K:\wamp\www\starter\2.x\app>

 

From: cake...@googlegroups.com [mailto:cake...@googlegroups.com] On Behalf Of euromark
Sent: Monday, January 28, 2013 6:33 AM
To: cake...@googlegroups.com
Subject: Re: Bake Plugin Issues

 

line 155, your ssl method, there you try to access an array key SERVER_PORT without checking if it actually exists in the array.



Am Montag, 28. Januar 2013 10:15:28 UTC+1 schrieb advantage+:

Thanks I will check the AppController out,

 

But I do not reference $_SERVER anywhere in the site, but I will do some exploring with your pointer.

 

Thanks,

Dave

 

From: cake...@googlegroups.com [mailto:cake...@googlegroups.com] On Behalf Of euromark
Sent: Monday, January 28, 2013 4:51 AM
To: cake...@googlegroups.com
Subject: Re: Bake Plugin Issues

 

Looks like this is your own faulty code (in AppController) that triggers it

Fix that first.

 

PS: You cannot just use $_SERVER like that without any checking. Especially if you also invoke the AppController via CLI (while baking for example) as

some vars will not be set as you know it from a web-based request. use isset() or better the cake method env() here.

 

 


Am Montag, 28. Januar 2013 08:51:30 UTC+1 schrieb advantage+:

On my Windows desktop I can bake models / views controllers / basic stuff no problem.

 

When I run cake bake plugin Users I get a crazy assortment of errors. Any ideas anyone?
 
K:\wamp\www\starter\2.x\app>cake bake plugin Users
 
<pre class="cake-error"><a href="javascript:void(0);" onclick="document.getEleme
ntById('cakeErr51062ce5c94b0-trace').style.display = (document.getElementById('c
akeErr51062ce5c94b0-trace').style.display == 'none' ? '' : 'none');"><b>Notice</
b> (8)</a>: Undefined index: SERVER_PORT [<b>APP\Controller\AppController.php</b
>, line <b>155</b>]<div id="cakeErr51062ce5c94b0-trace" class="cake-stack-trace"
 style="display: none;"><a href="javascript:void(0);" onclick="document.getEleme
ntById('cakeErr51062ce5c94b0-code').style.display = (document.getElementById('ca
keErr51062ce5c94b0-code').style.display == 'none' ? '' : 'none')">Code</a> <a hr
ef="javascript:void(0);" onclick="document.getElementById('cakeErr51062ce5c94b0-
context').style.display = (document.getElementById('cakeErr51062ce5c94b0-context
').style.display == 'none' ? '' : 'none')">Context</a><pre id="cakeErr51062ce5c9
4b0-code" class="cake-code-dump" style="display: none;"><code><span style="color
: #000000"><span style="color: #0000BB">&nbsp;&nbsp;&nbsp;&nbsp;</span><span sty
le="color: #007700">************************************************************
/</span></span></code>
<code><span style="color: #000000"><span style="color: #0000BB">&nbsp;&nbsp;&nbs
p;&nbsp;</span><span style="color: #007700">private&nbsp;function&nbsp;</span><s
pan style="color: #0000BB">notSSL</span><span style="color: #007700">()&nbsp;{</
span></span></code>
<span class="code-highlight"><code><span style="color: #000000"><span style="col
or: #0000BB">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style=
"color: #007700">if(&nbsp;</span><span style="color: #0000BB">$_SERVER</span><sp
an style="color: #007700">[</span><span style="color: #DD0000">'SERVER_PORT'</sp
an><span style="color: #007700">]&nbsp;!=&nbsp;</span><span style="color: #DD000
0">'80'&nbsp;</span><span style="color: #007700">)&nbsp;{</span></span></code></
span></pre><pre class="stack-trace">AppController::notSSL() - APP\Controller\App
Controller.php, line 155
AppController::beforeFilter() - APP\Controller\AppController.php, line 89
call_user_func - [internal], line ??
CakeEventManager::dispatch() - CORE\Cake\Event\CakeEventManager.php, line 246
Controller::startupProcess() - CORE\Cake\Controller\Controller.php, line 669
ExceptionRenderer::_getController() - CORE\Cake\Error\ExceptionRenderer.php, lin
e 153
ExceptionRenderer::__construct() - CORE\Cake\Error\ExceptionRenderer.php, line 9
3
ErrorHandler::handleException() - CORE\Cake\Error\ErrorHandler.php, line 125
[main] - [internal], line ??</pre></div></pre><pre class="cake-error"><a href="j
avascript:void(0);" onclick="document.getElementById('cakeErr51062ce5cf80f-trace
').style.display = (document.getElementById('cakeErr51062ce5cf80f-trace').style.
display == 'none' ? '' : 'none');"><b>Notice</b> (8)</a>: Undefined index: SERVE
R_NAME [<b>APP\Controller\AppController.php</b>, line <b>156</b>]<div id="cakeEr
r51062ce5cf80f-trace" class="cake-stack-trace" style="display: none;"><a href="j
avascript:void(0);" onclick="document.getElementById('cakeErr51062ce5cf80f-code'
).style.display = (document.getElementById('cakeErr51062ce5cf80f-code').style.di
splay == 'none' ? '' : 'none')">Code</a> <a href="javascript:void(0);" onclick="
document.getElementById('cakeErr51062ce5cf80f-context').style.display = (documen
t.getElementById('cakeErr51062ce5cf80f-context').style.display == 'none' ? '' :
'none')">Context</a><pre id="cakeErr51062ce5cf80f-code" class="cake-code-dump" s
tyle="display: none;"><code><span style="color: #000000"><span style="color: #00
00BB">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">private&nbsp;f
unction&nbsp;</span><span style="color: #0000BB">notSSL</span><span style="color
: #007700">()&nbsp;{</span></span></code>
<code><span style="color: #000000"><span style="color: #0000BB">&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if(&nbsp;</s
pan><span style="color: #0000BB">$_SERVER</span><span style="color: #007700">[</
span><span style="color: #DD0000">'SERVER_PORT'</span><span style="color: #00770
0">]&nbsp;!=&nbsp;</span><span style="color: #DD0000">'80'&nbsp;</span><span sty
le="color: #007700">)&nbsp;{</span></span></code>
<span class="code-highlight"><code><span style="color: #000000"><span style="col
or: #0000BB">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;$this</span><span style="color: #007700">-&gt;</span><span style="color: #0
000BB">redirect</span><span style="color: #007700">(&nbsp;</span><span style="co
lor: #DD0000">'http://www.'&nbsp;</span><span style="color: #007700">.&nbsp;</sp
an><span style="color: #0000BB">$_SERVER</span><span style="color: #007700">[</s
pan><span style="color: #DD0000">'SERVER_NAME'</span><span style="color: #007700
">]&nbsp;.&nbsp;</span><span style="color: #0000BB">$this</span><span style="col
or: #007700">-&gt;</span><span style="color: #0000BB">here&nbsp;</span><span sty
le="color: #007700">);</span></span></code></span></pre><pre class="stack-trace"
>AppController::notSSL() - APP\Controller\AppController.php, line 156
AppController::beforeFilter() - APP\Controller\AppController.php, line 89
call_user_func - [internal], line ??
CakeEventManager::dispatch() - CORE\Cake\Event\CakeEventManager.php, line 246
Controller::startupProcess() - CORE\Cake\Controller\Controller.php, line 669
ExceptionRenderer::_getController() - CORE\Cake\Error\ExceptionRenderer.php, lin
e 153
ExceptionRenderer::__construct() - CORE\Cake\Error\ExceptionRenderer.php, line 9
3
ErrorHandler::handleException() - CORE\Cake\Error\ErrorHandler.php, line 125
[main] - [internal], line ??</pre></div></pre>
 

 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake...@googlegroups.com.
To unsubscribe from this group, send email to cake-php+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake...@googlegroups.com.
To unsubscribe from this group, send email to cake-php+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: