gpt4 book ai didi

cakephp - 通过 shell 脚本将我的蛋糕核心从 1.3 升级到 2.1 时,还需要对我的核心路径做什么?

转载 作者:行者123 更新时间:2023-12-02 14:58:49 25 4
gpt4 key购买 nike

我已从 1.3 升级到 2.1.1,现在似乎出现路径错误。关于运行升级 shell 后需要进行哪些更改,是否有一个好的指南可供引用?

我尝试更新核心的路径以在“lib/Cake”中查找,

define('CAKE', CORE_PATH . DS.'lib'.DS. 'Cake' . DS);

但随后我开始收到包含错误。

Fatal error: Class 'Configure' not found in C:\inetpub\wwwroot\phpDev\lib\Cake\bootstrap.php on line 143 <<

通过 App::uses() 添加到 bootstrap.php 内部的核心组件失败(尽管上面 6 行需要 App.php)。

require CAKE . 'basics.php';
require CAKE . 'Core' . DS . 'App.php'; // App::uses() should work
require CAKE . 'Error' . DS . 'exceptions.php';


spl_autoload_register(array('App', 'load'));

App::uses('ErrorHandler', 'Error');
App::uses('Configure', 'Core'); //configure is included
App::uses('CakePlugin', 'Core');
App::uses('Cache', 'Cache');
App::uses('Object', 'Core');
App::$bootstrapping = true;

Configure::bootstrap(isset($boot) ? $boot : true); //this fails (line 143)

我想我错过了一些东西,因为一旦我弄清了核心路径,bootstrap、Configure.php、App.php 和 core.php 引用应该是全部或全部修复。任何见解将不胜感激。

*** 更新 ****

在做了更多研究以查看其他人是否遇到过之后,我希望这是一个缓存问题。清除了持久缓存文件但未清除缓存...

在多次迭代要求 App::uses() 无法提供的文件后,我的 lib/Cake/bootstrap.php 代码如下所示

require CAKE . 'basics.php';
require CAKE . 'Core' . DS . 'App.php';
require CAKE . 'Core' . DS . 'Object.php';
require CAKE . 'Error' . DS . 'exceptions.php';
require CAKE . 'Error' . DS . 'ErrorHandler.php';
require CAKE . 'Error' . DS . 'ErrorHandler.php';
require CAKE . 'Core' . DS . 'Configure.php';
require CAKE . 'Core' . DS . 'CakePlugin.php';
require CAKE . 'Cache' . DS . 'Cache.php';
require CAKE . 'Routing' . DS . 'Dispatcher.php';
require CAKE . 'Utility' . DS . 'Debugger.php';
require CAKE . 'Utility' . DS . 'Set.php';
require CAKE . 'Utility' . DS . 'String.php';

spl_autoload_register(array('App', 'load'));

/*App::uses('ErrorHandler', 'Error');
App::uses('Configure', 'Core');
App::uses('CakePlugin', 'Core');
App::uses('Cache', 'Cache');
App::uses('Object', 'Core');*/

Warning (4096): Argument 1 passed to Dispatcher::dispatch() must be an instance of CakeRequest, none given, called in C:\inetpub\wwwroot\phpDev\app\webroot\index.php on line 84 and defined [CORE\lib\Cake\Routing\Dispatcher.php, line 69]

Warning (4096): Argument 2 passed to Dispatcher::dispatch() must be an instance of CakeResponse, none given, called in C:\inetpub\wwwroot\phpDev\app\webroot\index.php on line 84 and defined [CORE\lib\Cake\Routing\Dispatcher.php, line 69]

Notice (8): Undefined variable: request [CORE\lib\Cake\Routing\Dispatcher.php, line 70]

Notice (8): Trying to get property of non-object [CORE\lib\Cake\Routing\Dispatcher.php, line 70]

Notice (8): Undefined variable: response [CORE\lib\Cake\Routing\Dispatcher.php, line 70]

Warning (4096): Argument 2 passed to Dispatcher::asset() must be an instance of CakeResponse, null given, called in C:\inetpub\wwwroot\phpDev\lib\Cake\Routing\Dispatcher.php on line 70 and defined [CORE\lib\Cake\Routing\Dispatcher.php, line 236]

Notice (8): Undefined variable: request [CORE\lib\Cake\Routing\Dispatcher.php, line 70]

Fatal error: Call to a member function here() on a non-object in C:\inetpub\wwwroot\phpDev\lib\Cake\Routing\Dispatcher.php on line 70

所以我什至没有得到蛋糕请求对象? App::uses() 被破坏也没有任何意义,因为我看到它实际包含在哪里,并且该方法的代码就在那里。

我想我忽略了一些事情。我对核心不是很熟悉,因为到目前为止我只是一个即插即用的开发人员。 1.3 运行得非常顺利,但我想在添加更多开发之前进行升级。我感谢所有建议。

最佳答案

(在问题编辑中回答。转换为社区 wiki 答案。请参阅 Question with no answers, but issue solved in the comments (or extended in chat) )

OP 写道:

The upgrade shell did not replace index.php in the app/webroot folder... I knew that the upgrade shell didn't come close to converting the code over to 2.0, but replacing that file was in line with what it actually did. I was surprised to find my old index file, and replacing it was what I needed to get the new framework operational (to the point where cake was at least generating it's own errors!) Thanks for the suggestions and comments.

As a side note, the upgrade shell was successful in renaming the files to match the new naming conventions, but didn't upgrade much of anything else outside of the framework folder.

关于cakephp - 通过 shell 脚本将我的蛋糕核心从 1.3 升级到 2.1 时,还需要对我的核心路径做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10014616/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com