Application Folder outside of /fuel

edited December 2011 in Feature Requests
Is there a reason why my application can't be outside of the /fuel folder? My reason for this is that I would be able to keep FuelCMS out of my git repo and just symlink it in so I can update all my sites in one pull.

Is there one location I can change the paths or do all the files assume the app folder is inside /fuel?

Comments

  • edited 7:54AM
    Unfortunately, to do that requires the changing of a few paths including:
    1. APPPATH in the index.php bootstrap
    2. The application/config/constants.php
    3. The fuel/modules/fuel/config/fuel_constants.php

    And a few other areas I believe. Also, the application folder does have some files in it that fuel may need to update on a pull (e.g. application/libraries/Form_builder.php).
  • edited 7:54AM
    Could all the libraries and 3rd party stuff live in the /fuel/codeigniter folder? Meaning, when they are included, does fuel search the app directory first and fallback to the ci folders?

    Shouldn't all the client specific code be as separated as possible from the system? Stuff like form builder, I'm almost never going to extend, and if I do, I'd just make a copy from system and place the modified version in my app.

    Since Fuel is basically the app on codeigniter and my app is on top of fuel, it's a little confusing to mix fuel and my app and not mix fuel and CI, separating my app.
  • edited 7:54AM
    I agree. The next version actually addresses this issue using packages to limit the number of files needed in the application folder including Form_builder.
  • edited 7:54AM
    Is this not being tracked on GitHub or just in planning stages?

    Don't mean to sound pushy, just trying to plan out my next project that would benefit here.

    Thanks again for such amazing support!
  • edited 7:54AM
    The next version is not currently on GitHub and being developed using an internal GIT repo until it is more stable. We don't have a release date set yet but are actively working on it and are hoping to have a release in the next few months.
  • edited 7:54AM
    So I'm working on this problem. I have my paths updated. I'm getting an error about CI_Controller not being instantiated, but it's actually dying at line 157 in CodeIgniter.php, during the $RTR->_set_routing() call.

    From there, it eventually dies at line 334 $this->_set_request($this->uri->segments);

    $this exists as an instance of MY_Router, but _set_request is NULL.

    Any ideas why this method wouldn't exist? It's like MY_Router isn't inheriting the base class.
  • edited 7:54AM
    Hmm... not sure. What's the error message?
  • edited January 2012
    wow.. that took way too long.. haha

    Ok, figured it out. The problem was in /app/third_party/MX/Modules.php. You are setting a path relative to the app directory, which, when you move the app out of fuel, breaks. I changed

    APPPATH.'../modules/' => '../../modules/',
    to

    MODULES_PATH => FUELMODULES_FROM_APPCONTROLLERS,

    FUELMODULES_FROM_APPCONTROLLERS is defined as '../../www/fuel/modules/'
    This var is accessed in /fuel/core/CodeIgniter.php on line 221 and thinks it's in the controller directory. I'm going back to root and then up into the system and modules folder. My site structure looks like:

    /application
    /www/fuel
    I was going to write up a post on how to do this, but is it worth it to just update github with a version where the application folder is out of the system directory? I've never really understood why Ci mixes the system and app folder in the first place. Maybe there's a reason I'm missing?
  • edited 7:54AM
    It might be nice to see a write up on how you did it just so I can see if we can add anything in the main repo to make it easier for people trying to do the same thing.
  • edited January 2012
    Here's a writeup. I have a bunch of things I end up doing to a Fuel install straight away that I'd love to share but if you are launching a major revision, it'll probably nullify them. Can't wait to see what you have going here, would love to contribute where I can.

    You can see this on Github here https://github.com/tw12lve/FUEL-CMS/commit/2a263a7fe5ec1c3d674cf009c3101dae798eb3a3

    Step by step guide:
    ---
    1. Move /fuel/application folder to your project root, will look like

    /application
    /assets
    /cache
    /fuel
    /index.php
    2. In /index.php change

    line 21 to

    define('INDEX_ROOT', str_replace('\\', '/', realpath(dirname(__FILE__))). '/');
    define('INSTALL_ROOT', INDEX_ROOT.'fuel/');
    line 111 to:
    $application_folder = INDEX_ROOT.'application';
    3. In /application/config/constants.php

    line 39 to:
    include_once(INSTALL_ROOT.'modules/fuel/config/fuel_constants.php');
    4. In /fuel/modules/fuel/config/fuel_constants.php

    line 4-8 to:
    define('MODULES_FOLDER', 'modules');
    define('FUEL_FOLDER', 'fuel');
    define('MODULES_PATH', INSTALL_ROOT.'modules/');
    define('FUEL_PATH', INSTALL_ROOT. MODULES_FOLDER.'/'.FUEL_FOLDER.'/');
    define('FUELMODULES_FROM_APPCONTROLLERS', '../../fuel/modules/');
    define('WEB_ROOT', str_replace('\\', '/', realpath(dirname(SELF)).DIRECTORY_SEPARATOR)); // replace \ with / for windows
    You are adding a relative path from your application/controllers folder to the fuel/modules folder. So if your app is below your web root like
    /www/index.php
    /www/fuelcms
    /app
    It would look like define('FUELMODULES_FROM_APPCONTROLLERS', '../../www/fuelcms/modules/');

    5. In /application/third_party/MX/Modules.php

    line 4-6 to:

    Modules::$locations = array(
    MODULES_PATH => FUELMODULES_FROM_APPCONTROLLERS,
    );
  • edited 7:54AM
    Nice... I'll add that constant in steps 4 and 5 to eliminate at least one step.
  • edited March 2012
    @tw12lve: thanks for the guide - although I've followed the steps but all I get is still a

    Fatal error: require() [function.require]: Failed opening required '/Applications/MAMP/htdocs/booksteady/fuel/application/third_party/MX/Modules.php' (include_path='.:/Applications/MAMP/bin/php5.3/lib/php:/Applications/MAMP/htdocs/Zend/ZendGdata/library') in /Applications/MAMP/htdocs/booksteady/fuel/application/third_party/MX/Router.php on line 4
    Not sure why...
    Anyway, admin, it'd be enough for me to rename the 'application' folder to the name of my project, it can still be inside of fuel, i don't mind. But why isn't it enough to change the $application_folder variable of the index.php to what i need? I get the same error as above....
  • edited 7:54AM
    Hmm... it should be. Could something else on your end be happening? I just tested renaming the fuel/application folder and changing the $application_folder in index.php and it seems to work OK.
Sign In or Register to comment.