Reputation: 2365
Is it possible to know the version of CakePHP used to generate a project with only the app code available?
My problem:
I downloaded a project made with CakePHP, and I really can't tell which 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?
It seems to be from around 2008, so I guess it's a 1.x version.
PD: Here is the code to the project.
Upvotes: 51
Views: 80916
Reputation: 34914
Any PHP Framework using composer
having version details in composer.json
file
Example
{
"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"
},
Upvotes: 0
Reputation: 1662
Simple way : Just search for VERSION.txt file. Open It to check the version.
Path for version.txt
For cakephp 1.* : cake/VERSION.txt
For cakephp 2.* : lib/Cake/ VERSION.txt
For cakephp 3. & 4.* : vendor/cakephp/cakephp/ VERSION.txt
Upvotes: 22
Reputation: 29
In Cake 3x, inside your project directory, type bin\cake version
(windows) or bin/cake version
(osx/linux).
Upvotes: 2
Reputation: 119
This is the BEST way to get it on run time
Configure::version()
The other way is to look for VERSION.txt
2.x lib/Cake/VERSION.txt
3.x vendor/cakephp/cakephp/VERSION.txt
Upvotes: 3
Reputation: 1913
For cakephp 3.x find \vendor\cakephp\cakephp\VERSION.txt
////////////////////////////////////////////////////////////////////////////////////////////////////
// +--------------------------------------------------------------------------------------------+ //
// 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
Upvotes: 19
Reputation: 2073
For Cakephp3, open command line and go to your Project App directory and type bin/cake
,it will show you something like this *
Welcome to CakePHP v3.3.5 Console
Which is your current cakephp Version.
Upvotes: 0
Reputation: 11
in cake 3.0 from app root directory>>> cat vendor/cakephp/cakephp/VERSION.txt
Upvotes: 0
Reputation: 439
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
echo Configure::version();
Upvotes: 2
Reputation: 1536
we can check through following path
Path=root/lib/cake/VERSION.txt
Open version.txt
last line show the version of cakephp
Upvotes: 4
Reputation: 33986
Also for Linux console you can check your CakePHP version like this.
Change example.com with your domain name.
# grep ^[^\/] /var/www/vhosts/example.com/httpdocs/lib/Cake/VERSION.txt
Upvotes: 0
Reputation: 896
I have found that the version, as of CakePHP 2.3.0, is held within a static file under the root 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
Upvotes: 88
Reputation: 29121
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).
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.
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.
Upvotes: 1
Reputation: 54741
I'm certain this is for CakePHP 1.2.x branch, and not the CakePHP 1.3.x branch.
You can download a 1.2.x branch from here.
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.
Upvotes: 4