Background Information
I have a web app that allows end users to connect to ssh-enabled devices and manipulate them. Right now, i only support one version of firmware.
The logic is something like this:
user clicks on a button to run some command on device.
web application looks up the class name containing the correct ssh interface for the device, using the device's model name. (because the number of hardware models is so small, i have a list that's hardcoded in my web app)
web app creates a new ssh object using the class loaded in step 2.
ssh command is run and session closed.
command results displayed on web page.
This all works fine. Now the end user wants me to be able to support multiple versions of firmware. But the catch is, they don't want to have to document the firmware version anywhere becuase the amount of overhead this will create in maintaining the system database. In other words, I can't look up the firmware version based on the device.
The good news is that it sounds like at most, I'll have to support two different versions of firmware per device.
One option is to name the the classes like this:
deviceX.1.php
deviceX.2.php
deviceY.1.php
deviceY.2.php
where "X" and "Y" represent the model names, and 1 and 2 represent the firmware versions.
When a user runs a command, I will first try it with one of the class files, if it fails, i can try with the second. I think always try the newer version of firmware first... so let's say in the above example, I would load deviceX.2.php before deviceX.1.php.
This will work, but it's not very efficient. But I can't think of another way around this.
Any suggestions?