Skip to content

Commit

Permalink
Improved CodeIgniter .gitignore to support an system directory in a d…
Browse files Browse the repository at this point in the history
…ifferent location to the default install. Fixed database.php ignore rule. The application directory can be moved to any location and the ignore will still operate
  • Loading branch information
Ollie Rattue authored and defunkt committed Nov 10, 2010
1 parent b85d557 commit 1aa8f64
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions CodeIgniter.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
config/database.php
system/logs/log-*.php
system/cache/*
systen/cache/!index.html
*/config/database.php
*/system/logs/log-*.php
*/system/cache/*
*/systen/cache/!index.html

4 comments on commit 1aa8f64

@seppo0010
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't config/config.php be ignored too, considering it has the base url, and some settings that may change on each environment?

@ollieza
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey seppo0010, thanks for taking the time to comment.

Personally I don't ignore config.php becasue a lot of the options are impacted by code changes and need to be consistent across all systems e.g. permitted_uri_chars, enable_query_strings, subclass_prefix, charset. So if I changed permitted_uri_char, which I recently did for a Sage Pay integration, I want to be able to commit the change. Sending an email around + manually updating the production system is not reliable.

The only config setting I have needed to change on an instance by instance basis is log_threshold, set to 1 (Error Messages (including PHP errors)) in version control, which is sometimes useful to change when debugging locally.

As for base_url I use $config['base_url'] = "http://${_SERVER['HTTP_HOST']}"; to get around the hard coded url issue.

Some complex setups may have custom base_url rules but this would be the exception.

Personally I ignore constants.php so each system can run their own (e.g. notifications emails, enabling profiler etc) but again this is perhaps not a typical use so I didn't include it in my .gitignore.

Let me know your thoughts.

@seppo0010
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both ways are OK... I'd prefer to ignore the file, but it makes sense also not to do it.

I don't like relying on HTTP_HOST for the base_url, because I don't always work on the "/", sometimes I run CI on a subdirectory.

@ollieza
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey,

"I don't like relying on HTTP_HOST for the base_url, because I don't always work on the "/", sometimes I run CI on a subdirectory."

-> Yeah I often do this. I might have the main website powered by a CMS and then be using a CI installation (e.g. /apps) for the more complex functionality. I need to keep the subdirectory name consistent for all systems because of the way the CMS and CI link and integrate so I simply add this to the base url e.g.

config['base_url'] = "http://${_SERVER['HTTP_HOST']}/apps";

I can't think of a scenario where I would a different sub-directory (apache alias) per system...

Thanks,

Please sign in to comment.