我怎么知道用哪个CakePHP版本做项目?

时间:2022-03-11 07:11:53

Is it posible to know the version of CakePHP used to generate a project with only the app code available?

是否有可能知道CakePHP的版本,用于生成一个只有可用应用程序代码的项目?


My problem:

我的问题:

I downloaded a project made with CakePHP, and I really can't tell wich Cake version to use. The files say, e.g. @version $Revision: 8004 $, but this is different in some files. Should I assume that the highest revision (8004) is the correct one to use?

我下载了一个用CakePHP做的项目,我真的不能告诉别人用什么蛋糕版本。这些文件说,例如@version $修订:8004 $,但是在某些文件中这是不同的。我应该假设最高的修订(8004)是正确的吗?

It seems to be from around 2008, so I guess it's a 1.x version.

好像是2008年左右,所以我猜是1。x版本。

PD: Here is the code to the project.

这是项目的代码。

13 个解决方案

#1


66  

I have found that the version, as of CakePHP 2.3.0, is held within a static file under the root Cake lib.

我发现CakePHP 2.3.0的版本保存在根饼库下的一个静态文件中。

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

#2


20  

Edit core.php, add to top:

编辑的核心。php,增加:

echo Configure::version();

#3


7  

For cakephp 3.x find \vendor\cakephp\cakephp\VERSION.txt

cakephp 3。x找到\供应商\ cakephp \ cakephp \ VERSION.txt

我怎么知道用哪个CakePHP版本做项目?

////////////////////////////////////////////////////////////////////////////////////////////////////
// +--------------------------------------------------------------------------------------------+ //
// 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

#4


4  

we can check through following path

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

Path=root/lib/cake/VERSION.txt

=根路径/ lib /蛋糕/ VERSION.txt

Open version.txt

打开version.txt

last line show the version of cakephp

最后一行显示了cakephp的版本

#5


4  

Simple way : Just search for VERSION.txt file. Open It to check the version.

简单的方法:搜索版本。txt文件。打开它检查版本。

Path for version.txt

路径version.txt

For cakephp 1.* : cake/VERSION.txt

cakephp 1。*:蛋糕/ VERSION.txt

For cakephp 2.* : lib/Cake/ VERSION.txt

cakephp 2。*:lib /蛋糕/ VERSION.txt

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

cakephp 3。*:供应商/ cakephp / cakephp / VERSION.txt

#6


3  

I'm certain this is for CakePHP 1.2.x branch, and not the CakePHP 1.3.x branch.

我确定这是针对CakePHP 1.2的。x分支,而不是CakePHP 1.3。x分支。

You can download a 1.2.x branch from here.

您可以下载1.2。从这里x分支。

The reason I think it's 1.2 is that all the comment headers are Copyright 2005-2008, and only the 1.2.x branch uses that date range. Everything in the 1.3.x branch is Copyright 2005-2010 or newer.

我认为它是1.2的原因是所有的评论标题都是2005-2008版权,只有1.2。x分支使用这个日期范围。一切都在1.3。x分支是版权2005-2010或更新。

#7


1  

It's like not possible (without going through all the version changes, checking file/folder structures, comments...etc).

这似乎是不可能的(不需要检查所有的版本更改、检查文件/文件夹结构、评论等等)。

AND, it's for good reason IMO.

我觉得这是有原因的。

When I start an app, I build it in the latest release. But, even by the time it goes public, I'm usually on a new release of CakePHP, and will continue to update it as they come out. My APP files don't change at all (other than the requested changes per release notes - if any). Only the cakephp/lib directory changes (and unfortunately, you don't have that).

当我启动一个应用程序时,我在最新版本中构建它。但是,即使在它公开的时候,我通常也在使用CakePHP的新版本,并且会在发布时继续更新它。我的应用程序文件没有任何变化(除了每次发布通知所要求的变化——如果有的话)。只有cakephp/lib目录更改(不幸的是,您没有这样的更改)。

If you're lucky, and the previous developer keeps their Cake versions in separate folders instead of overwriting, then you might find the version number in your webroot/index.php in the CAKE_CORE_INCLUDE_PATH line, but in your case, it's not there.

如果幸运的话,前面的开发人员将他们的Cake版本保存在单独的文件夹中,而不是覆盖,那么您可以在webroot/index中找到版本号。CAKE_CORE_INCLUDE_PATH中的php,但是在您的例子中,它并不存在。

If you do have the actual Cake files (I know you don't, but other people might), then you can look in the cake/VERSION.txt file for the version you're using.

如果您有实际的蛋糕文件(我知道您没有,但其他人可能有),那么您可以查看蛋糕/版本。您正在使用的版本的txt文件。

#8


1  

On the wellcome page the version is written, we dont need any command to check the version. If still it a problem, you somehow dont find the wellcome page. you can use

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

echo Configure::version();

#9


0  

Also for Linux console you can check your CakePHP version like this.
Change example.com with your domain name.

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

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

#10


0  

in cake 3.0 from app root directory>>> cat vendor/cakephp/cakephp/VERSION.txt

在cake 3.0中,来自app根目录>>> cat供应商/ cphp akephp/VERSION.txt

#11


0  

For Cakephp3, open command line and go to your Project App directory and type bin/cake,it will show you something like this *

对于Cakephp3,打开命令行,进入你的项目应用目录,输入bin/cake,它会显示如下内容*

Welcome to CakePHP v3.3.5 Console

欢迎来到CakePHP v3.3.5控制台

Which is your current cakephp Version.

这就是当前的cakephp版本。

#12


0  

In Cake 3x, inside your project directory, type bin\cake version (windows) or bin/cake version(osx/linux).

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

#13


-1  

This is the BEST way to get it on run time

这是使它在运行时运行的最佳方式

Configure::version()

3.x docs

3所示。x文档

2.x docs

2。x文档

The other way is to look for VERSION.txt

另一种方法是查找VERSION.txt

2.x lib/Cake/VERSION.txt

2。x lib /蛋糕/ VERSION.txt

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

3所示。x供应商/ cakephp / cakephp / VERSION.txt

#1


66  

I have found that the version, as of CakePHP 2.3.0, is held within a static file under the root Cake lib.

我发现CakePHP 2.3.0的版本保存在根饼库下的一个静态文件中。

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

#2


20  

Edit core.php, add to top:

编辑的核心。php,增加:

echo Configure::version();

#3


7  

For cakephp 3.x find \vendor\cakephp\cakephp\VERSION.txt

cakephp 3。x找到\供应商\ cakephp \ cakephp \ VERSION.txt

我怎么知道用哪个CakePHP版本做项目?

////////////////////////////////////////////////////////////////////////////////////////////////////
// +--------------------------------------------------------------------------------------------+ //
// 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

#4


4  

we can check through following path

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

Path=root/lib/cake/VERSION.txt

=根路径/ lib /蛋糕/ VERSION.txt

Open version.txt

打开version.txt

last line show the version of cakephp

最后一行显示了cakephp的版本

#5


4  

Simple way : Just search for VERSION.txt file. Open It to check the version.

简单的方法:搜索版本。txt文件。打开它检查版本。

Path for version.txt

路径version.txt

For cakephp 1.* : cake/VERSION.txt

cakephp 1。*:蛋糕/ VERSION.txt

For cakephp 2.* : lib/Cake/ VERSION.txt

cakephp 2。*:lib /蛋糕/ VERSION.txt

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

cakephp 3。*:供应商/ cakephp / cakephp / VERSION.txt

#6


3  

I'm certain this is for CakePHP 1.2.x branch, and not the CakePHP 1.3.x branch.

我确定这是针对CakePHP 1.2的。x分支,而不是CakePHP 1.3。x分支。

You can download a 1.2.x branch from here.

您可以下载1.2。从这里x分支。

The reason I think it's 1.2 is that all the comment headers are Copyright 2005-2008, and only the 1.2.x branch uses that date range. Everything in the 1.3.x branch is Copyright 2005-2010 or newer.

我认为它是1.2的原因是所有的评论标题都是2005-2008版权,只有1.2。x分支使用这个日期范围。一切都在1.3。x分支是版权2005-2010或更新。

#7


1  

It's like not possible (without going through all the version changes, checking file/folder structures, comments...etc).

这似乎是不可能的(不需要检查所有的版本更改、检查文件/文件夹结构、评论等等)。

AND, it's for good reason IMO.

我觉得这是有原因的。

When I start an app, I build it in the latest release. But, even by the time it goes public, I'm usually on a new release of CakePHP, and will continue to update it as they come out. My APP files don't change at all (other than the requested changes per release notes - if any). Only the cakephp/lib directory changes (and unfortunately, you don't have that).

当我启动一个应用程序时,我在最新版本中构建它。但是,即使在它公开的时候,我通常也在使用CakePHP的新版本,并且会在发布时继续更新它。我的应用程序文件没有任何变化(除了每次发布通知所要求的变化——如果有的话)。只有cakephp/lib目录更改(不幸的是,您没有这样的更改)。

If you're lucky, and the previous developer keeps their Cake versions in separate folders instead of overwriting, then you might find the version number in your webroot/index.php in the CAKE_CORE_INCLUDE_PATH line, but in your case, it's not there.

如果幸运的话,前面的开发人员将他们的Cake版本保存在单独的文件夹中,而不是覆盖,那么您可以在webroot/index中找到版本号。CAKE_CORE_INCLUDE_PATH中的php,但是在您的例子中,它并不存在。

If you do have the actual Cake files (I know you don't, but other people might), then you can look in the cake/VERSION.txt file for the version you're using.

如果您有实际的蛋糕文件(我知道您没有,但其他人可能有),那么您可以查看蛋糕/版本。您正在使用的版本的txt文件。

#8


1  

On the wellcome page the version is written, we dont need any command to check the version. If still it a problem, you somehow dont find the wellcome page. you can use

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

echo Configure::version();

#9


0  

Also for Linux console you can check your CakePHP version like this.
Change example.com with your domain name.

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

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

#10


0  

in cake 3.0 from app root directory>>> cat vendor/cakephp/cakephp/VERSION.txt

在cake 3.0中,来自app根目录>>> cat供应商/ cphp akephp/VERSION.txt

#11


0  

For Cakephp3, open command line and go to your Project App directory and type bin/cake,it will show you something like this *

对于Cakephp3,打开命令行,进入你的项目应用目录,输入bin/cake,它会显示如下内容*

Welcome to CakePHP v3.3.5 Console

欢迎来到CakePHP v3.3.5控制台

Which is your current cakephp Version.

这就是当前的cakephp版本。

#12


0  

In Cake 3x, inside your project directory, type bin\cake version (windows) or bin/cake version(osx/linux).

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

#13


-1  

This is the BEST way to get it on run time

这是使它在运行时运行的最佳方式

Configure::version()

3.x docs

3所示。x文档

2.x docs

2。x文档

The other way is to look for VERSION.txt

另一种方法是查找VERSION.txt

2.x lib/Cake/VERSION.txt

2。x lib /蛋糕/ VERSION.txt

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

3所示。x供应商/ cakephp / cakephp / VERSION.txt