From 74acfacde01918f46a088632a9b69bc0a81ab64f Mon Sep 17 00:00:00 2001 From: Jakub Onderka Date: Mon, 19 Apr 2021 13:18:51 +0200 Subject: [PATCH] Revert "chg: [internal] Install CakePHP by Composer" This reverts commit 74eccfe9 --- .gitmodules | 4 +++ app/Console/cake.php | 43 +++++++++++---------------------- app/Lib/Tools/SecurityAudit.php | 2 +- app/Lib/cakephp | 1 + app/composer.json | 1 - app/webroot/index.php | 10 -------- 6 files changed, 20 insertions(+), 41 deletions(-) create mode 160000 app/Lib/cakephp diff --git a/.gitmodules b/.gitmodules index 8abe35ca0..41ced489e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,7 @@ +[submodule "app/Lib/cakephp"] + path = app/Lib/cakephp + url = https://github.com/cakephp/cakephp.git + branch = 2.x [submodule "PyMISP"] path = PyMISP url = https://github.com/MISP/PyMISP.git diff --git a/app/Console/cake.php b/app/Console/cake.php index ba8c1df3c..a98d1b421 100644 --- a/app/Console/cake.php +++ b/app/Console/cake.php @@ -3,45 +3,30 @@ /** * Command-line code generation utility to automate programmer chores. * - * CakePHP(tm) : Rapid Development Framework (https://cakephp.org) - * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) + * PHP 5 + * + * CakePHP(tm) : Rapid Development Framework (http://cakephp.org) + * Copyright 2005-2012, Cake Software Foundation, Inc. * * Licensed under The MIT License - * For full copyright and license information, please see the LICENSE.txt * Redistributions of files must retain the above copyright notice. * - * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org) - * @link https://cakephp.org CakePHP(tm) Project + * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org) + * @link http://cakephp.org CakePHP(tm) Project * @package app.Console * @since CakePHP(tm) v 2.0 - * @license https://opensource.org/licenses/mit-license.php MIT License + * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ - -if (!defined('DS')) { - define('DS', DIRECTORY_SEPARATOR); -} - -$dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php'; - +$ds = DIRECTORY_SEPARATOR; +$dispatcher = dirname(__DIR__) . $ds . 'Lib' . $ds . 'cakephp' . $ds . 'lib' . $ds . 'Cake' . $ds . 'Console' . $ds . 'ShellDispatcher.php'; if (function_exists('ini_set')) { - $root = dirname(dirname(dirname(__FILE__))); - $appDir = basename(dirname(dirname(__FILE__))); - $install = $root . DS . 'lib'; - $composerInstall = $root . DS . $appDir . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib'; - - // the following lines differ from its sibling - // /lib/Cake/Console/Templates/skel/Console/cake.php - if (file_exists($composerInstall . DS . $dispatcher)) { - $install = $composerInstall; - } - - ini_set('include_path', $install . PATH_SEPARATOR . ini_get('include_path')); - unset($root, $appDir, $install, $composerInstall); + $root = dirname(dirname(dirname(__FILE__))); + ini_set('include_path', $root . $ds . 'lib' . PATH_SEPARATOR . ini_get('include_path')); } -if (!include $dispatcher) { - trigger_error('Could not locate CakePHP core files.', E_USER_ERROR); +if (!include ($dispatcher)) { + trigger_error('Could not locate CakePHP core files.', E_USER_ERROR); } -unset($dispatcher); +unset($paths, $path, $dispatcher, $root, $ds); return ShellDispatcher::run($argv); diff --git a/app/Lib/Tools/SecurityAudit.php b/app/Lib/Tools/SecurityAudit.php index b775442a9..6a32a32c5 100644 --- a/app/Lib/Tools/SecurityAudit.php +++ b/app/Lib/Tools/SecurityAudit.php @@ -476,7 +476,7 @@ class SecurityAudit */ private function getCakeVersion() { - $filePath = CAKE_CORE_INCLUDE_PATH . '/Cake/VERSION.txt'; + $filePath = APP . 'Lib/cakephp/lib/Cake/VERSION.txt'; $version = file_get_contents($filePath); if (!$version) { throw new RuntimeException("Could not open CakePHP version file '$filePath'."); diff --git a/app/Lib/cakephp b/app/Lib/cakephp new file mode 160000 index 000000000..cf14e6546 --- /dev/null +++ b/app/Lib/cakephp @@ -0,0 +1 @@ +Subproject commit cf14e6546ec44e3369e3531add11fdb946656280 diff --git a/app/composer.json b/app/composer.json index 27544c43b..4d9daad79 100644 --- a/app/composer.json +++ b/app/composer.json @@ -9,7 +9,6 @@ "ext-dom": "*", "ext-simplexml": "*", "ext-pcre": "*", - "cakephp/cakephp": "2.10.24", "kamisama/cake-resque": "4.1.2", "pear/crypt_gpg": "1.6.3", "monolog/monolog": "1.24.0" diff --git a/app/webroot/index.php b/app/webroot/index.php index 4f924524f..da9846b6c 100644 --- a/app/webroot/index.php +++ b/app/webroot/index.php @@ -58,16 +58,6 @@ if (!defined('APP_DIR')) { */ define('CAKE_CORE_INCLUDE_PATH', ROOT . DS . APP_DIR . DS .'Lib' . DS . 'cakephp' . DS . 'lib'); -/** - * This auto-detects CakePHP as a composer installed library. - * You may remove this if you are not planning to use composer (not recommended, though). - */ -$vendorPath = ROOT . DS . APP_DIR . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib'; -$dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php'; -if (!defined('CAKE_CORE_INCLUDE_PATH') && file_exists($vendorPath . DS . $dispatcher)) { - define('CAKE_CORE_INCLUDE_PATH', $vendorPath); -} - /** * Editing below this line should NOT be necessary. * Change at your own risk.