Fix composer app issues with cake.php

This commit is contained in:
euromark 2014-06-24 17:49:18 +02:00
parent 044065df6f
commit 05709908a7
2 changed files with 22 additions and 6 deletions

View file

@ -25,11 +25,18 @@ $dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php';
if (function_exists('ini_set')) { if (function_exists('ini_set')) {
$root = dirname(dirname(dirname(__FILE__))); $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 line differs from its sibling // the following lines differ from its sibling
// /lib/Cake/Console/Templates/skel/Console/cake.php // /lib/Cake/Console/Templates/skel/Console/cake.php
ini_set('include_path', $root . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path')); if (file_exists($composerInstall . DS . $dispatcher)) {
unset($root); $install = $composerInstall;
}
ini_set('include_path', $install . PATH_SEPARATOR . ini_get('include_path'));
unset($root, $appDir, $install, $composerInstall);
} }
if (!include $dispatcher) { if (!include $dispatcher) {

View file

@ -24,11 +24,20 @@ $dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php';
if (function_exists('ini_set')) { if (function_exists('ini_set')) {
$root = dirname(dirname(dirname(__FILE__))); $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 line differs from its sibling // the following lines differ from its sibling
// /app/Console/cake.php // /app/Console/cake.php
ini_set('include_path', $root . PATH_SEPARATOR . __CAKE_PATH__ . PATH_SEPARATOR . ini_get('include_path')); if (file_exists($composerInstall . DS . $dispatcher)) {
unset($root); $install = $composerInstall;
} elseif (!file_exists($install . DS . $dispatcher)) {
$install = $root . PATH_SEPARATOR . __CAKE_PATH__;
}
ini_set('include_path', $install . PATH_SEPARATOR . ini_get('include_path'));
unset($root, $appDir, $install, $composerInstall);
} }
if (!include $dispatcher) { if (!include $dispatcher) {