Jump to content

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/268228-svn-merge/
Share on other sites

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 :).

Link to comment
https://forums.phpfreaks.com/topic/268228-svn-merge/#findComment-1376795
Share on other sites

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.

 

 

Link to comment
https://forums.phpfreaks.com/topic/268228-svn-merge/#findComment-1376796
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/268228-svn-merge/#findComment-1376798
Share on other sites

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?

 

Link to comment
https://forums.phpfreaks.com/topic/268228-svn-merge/#findComment-1376807
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/268228-svn-merge/#findComment-1376934
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.