Skip to content

Commit

Permalink
Improved composer autoloaded to only look for autoload.php when vendo…
Browse files Browse the repository at this point in the history
…r folder exist in system
  • Loading branch information
sampoyigi committed May 20, 2016
1 parent 6d4e757 commit 4239818
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion system/tastyigniter/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@
|
| $config['composer_autoload'] = TRUE;
|
| your vendor/ directory is located in the system folder: /system/
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
Expand All @@ -135,7 +137,7 @@
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = '/vendor/autoload.php';
$config['composer_autoload'] = TRUE;

/*
|--------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions system/tastyigniter/core/TastyIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,11 @@
* Should we use a Composer autoloader?
* ------------------------------------------------------
*/
if ($composer_autoload = config_item('composer_autoload')) {
if ($composer_autoload = config_item('composer_autoload') AND file_exists(BASEPATH . 'vendor')) {
if ($composer_autoload === TRUE) {
file_exists(APPPATH . 'vendor/autoload.php')
? require_once(APPPATH . 'vendor/autoload.php')
: log_message('error', '$config[\'composer_autoload\'] is set to TRUE but ' . APPPATH . 'vendor/autoload.php was not found.');
file_exists(BASEPATH . 'vendor/autoload.php')
? require_once(BASEPATH . 'vendor/autoload.php')
: log_message('error', '$config[\'composer_autoload\'] is set to TRUE but ' . BASEPATH . 'vendor/autoload.php was not found.');
} elseif (file_exists($composer_autoload)) {
require_once($composer_autoload);
} else {
Expand Down

0 comments on commit 4239818

Please sign in to comment.