ckimrie / Site-Manager

Module that allows you to remotely manage ExpressionEngine sites and synchronise data
69 stars 6 forks source link

Issue found if moving third party add-on folder #1

Closed ajgaunt closed 11 years ago

ajgaunt commented 11 years ago

I found an issue when using Site Manager where the third_party add-ons folder was moved from its original location.

For some reason the requirejs extension would not load and this is a requirement for Site Manager to work.

My set up is to have the system folder above the web root and I had moved the third party folder from its original location of system > expressionengine > third_party to this location to aid in upgrades of ExpressionEngine as that folder would not need to be copied back in.

In my focuslab config.master file I use the new config item for third_party_path to move it's location - available as of ExpressionEngine 2.4.0.

$env_config['third_party_path']    = $base_path . '/../third_party/';

My fix is listed below, but wondering if there is a better way to utilize the config to know exactly where the third party folder is.

In the ext.requirejs.php file I adjusted the filepath when setting up the hook.

original code

    $EXT->hooks['post_controller'][] = array(
        'class'    => 'Requirejs_ext',
        'function' => 'load_js',
        'filename' => 'ext.requirejs.php',
        'filepath' => "third_party/requirejs/",
        'params'   => array()
    );

adjusted code

    $EXT->hooks['post_controller'][] = array(
        'class'    => 'Requirejs_ext',
        'function' => 'load_js',
        'filename' => 'ext.requirejs.php',
        'filepath' => "/third_party/requirejs/",
        'params'   => array()
    );

Now Site Manager runs perfectly with the third_party folder above the web root

ckimrie commented 11 years ago

I'll modify it to use the PATH_THEMES constant, and this should mean it should work regardless of where the third_party folder is located

ckimrie commented 11 years ago

Just been digging into this and the fix I was planning on implementing is not needed. I have been testing at my end with system folder above web root and all appears to be working fine.

Can you add:

 var_dump(APPPATH);

to just before

$EXT->hooks['post_controller'][] = array(

..and tell me what the debug output is? At my end this is looking like a trailing slash issue, so just need to verify what your results are.

ajgaunt commented 11 years ago

Hey Chris,

The output is below;

string(71) "/Applications/MAMP/htdocs/site.local/server/system/expressionengine/"

This is absolutely correct and as expected. However, the issue is not that the system folder is above the root. The problem is stemming from moving the third party folder out of the system > expressionengine folder and putting it at the same level above root as the system folder.

My current structure looks like

   config     
      config.env.php
      config.local.php
      config.master.php
      config.prod.php
      config.stage.php
   public_html
      admin.php
      index.php
      images
      themes
      ...
   system
      codeigniter
      expressionengine
         config
         ...
   third_party
      require_js
      site_manager_client
      site_manager_server
      ...

Hope this helps

Andy

ckimrie commented 11 years ago

Ok, going to have a go replicating your exact setup.

Thanks for taking the time to debug for me.

On 21 Oct 2012, at 16:19, ajgaunt notifications@github.com wrote:

Hey Chris,

The output is below;

string(71) "/Applications/MAMP/htdocs/site.local/server/system/expressionengine/" This is absolutely correct and as expected. However, the issue is not that the system folder is above the root. The problem is stemming from moving the third party folder out of the system > expressionengine folder and putting it at the same level above root as the system folder.

My current structure looks like

config
config.env.php config.local.php config.master.php config.prod.php config.stage.php public_html admin.php index.php images themes ... system codeigniter expressionengine config ... third_party require_js site_manager_client site_manager_server ... Hope this helps

Andy

— Reply to this email directly or view it on GitHub.

ajgaunt commented 11 years ago

My pleasure Chris,

Here for you anytime.

On Oct 21, 2012, at 12:20 PM, Christopher Imrie notifications@github.com wrote:

Ok, going to have a go replicating your exact setup.

Thanks for taking the time to debug for me.

On 21 Oct 2012, at 16:19, ajgaunt notifications@github.com wrote:

Hey Chris,

The output is below;

string(71) "/Applications/MAMP/htdocs/site.local/server/system/expressionengine/" This is absolutely correct and as expected. However, the issue is not that the system folder is above the root. The problem is stemming from moving the third party folder out of the system > expressionengine folder and putting it at the same level above root as the system folder.

My current structure looks like

config config.env.php config.local.php config.master.php config.prod.php config.stage.php public_html admin.php index.php images themes ... system codeigniter expressionengine config ... third_party require_js site_manager_client site_manager_server ... Hope this helps

Andy

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub.

ckimrie commented 11 years ago

Ok, apologies for the confusion at my end. Finally nailed the issue. I've updated the RequireJS-for-EE extension to fix this issue. The extension now reads the EE config to correctly load RJS from the third_party location, wherever it has been moved.

You should be able to simply download and replace the extension.

ajgaunt commented 11 years ago

Fantastic :)

Glad I could help you locate the issue (and I think you'll agree, having that third_party outside the system folder will make updates to sites better)

On Oct 22, 2012, at 4:07 PM, Christopher Imrie notifications@github.com wrote:

Ok, apologies for the confusion at my end. Finally nailed the issue. I've updated the RequireJS-for-EE extension to fix this issue. The extension now reads the EE config to correctly load RJS from the third_party location, wherever it has been moved.

You should be able to simply download and replace the extension.

— Reply to this email directly or view it on GitHub.

ckimrie commented 11 years ago

Agreed, it makes sense to read from the local config as much as possible. We dont use FocusLabs master config setup, so hence this slipped through. Thanks.