如何判断哪个CakePHP版本是用哪个项目制作的?

时间:2013-06-01 17:56:04

标签: php cakephp

知道用于生成只有应用代码的项目的CakePHP版本是否可行?


我的问题:

我下载了一个用CakePHP制作的项目,我真的说不出要使用的Cake版本。文件说,例如@version $Revision: 8004 $,但在某些文件中有所不同。我应该假设最高版本(8004)是正确使用的吗?

它似乎是从2008年左右开始的,所以我猜它是一个1.x版本。

PD:Here是项目的代码。

14 个答案:

答案 0 :(得分:71)

我发现从CakePHP 2.3.0开始,该版本保存在根Cake lib下的静态文件中。

bash #: cat $CAKE_ROOT/lib/Cake/VERSION.txt

////////////////////////////////////////////////////////////////////////////////////////////////////
// +--------------------------------------------------------------------------------------------+ //
// CakePHP Version
//
// Holds a static string representing the current version of CakePHP
//
// CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
// Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
//
// Licensed under The MIT License
// Redistributions of files must retain the above copyright notice.
//
// @copyright     Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
// @link          http://cakephp.org
// @package       cake.libs
// @since         CakePHP(tm) v 0.2.9
// @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
// +--------------------------------------------------------------------------------------------+ //
////////////////////////////////////////////////////////////////////////////////////////////////////
2.3.0

答案 1 :(得分:22)

编辑core.php,添加到顶部:

echo Configure::version();

答案 2 :(得分:12)

对于cakephp 3.x发现 \厂商\ cakephp的\ cakephp的\ VERSION.txt

enter image description here

////////////////////////////////////////////////////////////////////////////////////////////////////
// +--------------------------------------------------------------------------------------------+ //
// CakePHP Version
//
// Holds a static string representing the current version of CakePHP
//
// CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
// Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
//
// Licensed under The MIT License
// Redistributions of files must retain the above copyright notice.
//
// @copyright     Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
// @link          http://cakephp.org
// @since         CakePHP(tm) v 0.2.9
// @license       http://www.opensource.org/licenses/mit-license.php MIT License
// +--------------------------------------------------------------------------------------------+ //
////////////////////////////////////////////////////////////////////////////////////////////////////
3.3.2

答案 3 :(得分:9)

简单方法:只需搜索 VERSION.txt 文件即可。打开它以检查版本。

version.txt的路径

cakephp 1。* :cake / VERSION.txt

对于 cakephp 2。* :lib / Cake / VERSION.txt

cakephp 3。* :vendor / cakephp / cakephp / VERSION.txt

答案 4 :(得分:4)

我们可以通过以下路径查看

路径=根/ LIB /饼/ VERSION.txt

打开version.txt

最后一行显示了cakephp的版本

答案 5 :(得分:3)

我确定这是CakePHP 1.2.x分支,而不是CakePHP 1.3.x分支。

你可以download a 1.2.x branch from here

我认为1.2的原因是所有注释标题都是Copyright 2005-2008,只有1.2.x分支使用该日期范围。 1.3.x分支中的所有内容都是Copyright 2005-2010或更新。

答案 6 :(得分:2)

这是最佳在运行时获取

的方法
Configure::version()

this blog post

3.x docs

另一种方法是寻找VERSION.txt

2.x lib / Cake / VERSION.txt

3.x vendor / cakephp / cakephp / VERSION.txt

答案 7 :(得分:1)

这是不可能的(不经过所有版本更改,检查文件/文件夹结构,注释等)。

并且,这是有充分理由的IMO。

当我启动应用程序时,我会在最新版本中构建它。但是,即使在它上市的时候,我通常会在CakePHP的新版本上发布,并且会在它们发布时继续更新它。我的APP文件根本没有变化(除了每个发行说明所请求的更改 - 如果有的话)。只有cakephp / lib目录发生了变化(不幸的是,你没有这个变化)。

如果您很幸运,并且之前的开发人员将他们的Cake版本保存在单独的文件夹中而不是覆盖,那么您可能会在webroot/index.php行的CAKE_CORE_INCLUDE_PATH中找到版本号,但在您的情况,它不存在。

如果您确实拥有实际的Cake文件(我知道您没有,但其他人可能),那么您可以在cake/VERSION.txt文件中查找您正在使用的版本。

答案 8 :(得分:1)

在wellcome页面上编写了版本,我们不需要任何命令来检查版本。 如果仍然是一个问题,你不知何故找不到惠康页面。你可以用

echo Configure::version();

答案 9 :(得分:1)

在Cake 3x中,在项目目录中,键入bin\cake version(windows)或bin/cake version(osx / linux)。

答案 10 :(得分:0)

同样对于Linux控制台,您可以像这样检查CakePHP版本 使用您的域名更改example.com。

# grep ^[^\/] /var/www/vhosts/example.com/httpdocs/lib/Cake/VERSION.txt

答案 11 :(得分:0)

来自应用程序根目录的cake 3.0中的

>>> cat vendor / cakephp / cakephp / VERSION.txt

答案 12 :(得分:0)

对于Cakephp3,打开命令行并转到Project App目录并输入bin/cake,它会显示这样的内容*

  

欢迎使用CakePHP v3.3.5控制台

您的当前 cakephp版本。

答案 13 :(得分:0)

使用composercomposer.json文件中具有版本详细信息的任何PHP框架

enter image description here

示例

{
    "name": "cakephp/app",
    "description": "CakePHP skeleton app",
    "homepage": "http://cakephp.org",
    "type": "project",
    "license": "MIT",
    "require": {
        "php": ">=5.4.16",
        "cakephp/cakephp": "3.6.11",//<<< Cakephp Version
        "mobiledetect/mobiledetectlib": "2.8.33",
        "cakephp/migrations": "1.8.1",
        "cakephp/plugin-installer": "*",
        "donatj/simplecalendar": "^0.6.1",
        "davidyell/proffer": "0.6.3"
    },
相关问题