rklockner Posted September 10, 2012 Share Posted September 10, 2012 First off, I know this is a PHP forum, but I have had great results from this site, so... I've been working on a project that is now in use by 4 separate companies, and will be adding more soon. Right now I am using SVN to control the versions, but one of the companies has asked for some custom code to be written that would not apply to any other customers. I obviously don't want to merge these changes with the others. Is there a way to have SVN ignore lines x through z of a file? I'm hoping for something like, /************ SVN PLEASE IGNORE ME . . . . . . . TO ME ******/ If that doesn't exist, does anyone else have any other solutions? Thanks! Quote Link to comment Share on other sites More sharing options...
shlumph Posted September 10, 2012 Share Posted September 10, 2012 I would create a separate branch for the special code. And keep it up to date with the main branch. Quote Link to comment Share on other sites More sharing options...
rklockner Posted September 10, 2012 Author Share Posted September 10, 2012 So far that is the best solution I can come up with, but what if it gets to the point where I have 100 companies and each has a slight variation. Then it becomes very difficult to manage. If that is the only option, then I suppose it is what I will do, albeit unhappily . Quote Link to comment Share on other sites More sharing options...
shlumph Posted September 10, 2012 Share Posted September 10, 2012 Yes, you're right it would be difficult to manage. I'm not sure of the nature of the code, so this might not be a valid option. But, maybe you could just make it a feature in your main code base. Then the feature can be toggled on/off in a config file or something. That way, if another company wants the feature, they/you can simply toggle it on. Quote Link to comment Share on other sites More sharing options...
requinix Posted September 10, 2012 Share Posted September 10, 2012 Then that customization should be a feature of the software. Flags that can be turned on or off as configuration settings, if the feature is generic enough, or otherwise extensions/modules/plugins that can be maintained separately. If you haven't realized yet, you're not just making a piece of software you sell to companies: you're developing a platform (in some sense of the word). The platform should be the same for everybody - it's the customizations that make it more relevant to a particular customer. Quote Link to comment Share on other sites More sharing options...
rklockner Posted September 10, 2012 Author Share Posted September 10, 2012 Here is my theory. It isn't all worked out, but it will give an idea. Each company has a file that contains all custom code (we'll call it customizations.php). In this file, it will be a large case statement that will have the custom code. Each company has a companyId (in config). Like... BEGIN CONFIG: $customerId = 10000; END CONFIG BEGIN test.php: ...some code before... $customCode = 'test.php-'.$customerId.'-1'; include("customizations.php"); ...some code after... END test.php BEGIN customizations.php: switch($customCode) { case 'test.php-10000-1': echo 'Run this code!'; break; default: //Do Nothing break; } END customizations.php The idea is that I want to try and add in some additional checks to see if the custom code is being run from (1) the intended page, (2) the intended company, and (3) a unique identifier in case multiple lines need to be run. Thoughts? Quote Link to comment Share on other sites More sharing options...
Christian F. Posted September 11, 2012 Share Posted September 11, 2012 I'm not sure I'd do it like this, as it seems awfully brittle and monolithic to me. The first thought that plopped into my head, when reading your description of the issue, was using a plugin system. Containing each extra feature inside a file/class of its own, and then linking it to the customers that need it. Then using a table in the database, or something like that, to control which modules to load for which customer. In any case, it is a very bad idea to mix configuration and features in one file/location. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.