I'd store the commands in an associative array in your app_controller
and set another global variable that sets whether you are on a linux
or windows system. Then add a function to app controlloer to choose
the correct command and execute. Then when you need to port it to a
different OS just toggle the global variable:
class AppController extends Controller{
var commandList = array(
"command 1" =>array("Linux"=>"the linux command", "Windows"=>"the
windows command"),
"command 2" =>array("Linux"=>"the linux command", "Windows"=>"the
windows command"),
"command 3" =>array("Linux"=>"the linux command", "Windows"=>"the
windows command"),
);
var operatingSystem = "Windows";
function executeCommand($commandName=null){
if($commandName!=null)
exec($this->commandList[$commandName][$this->operatingSystem]);
}
}
On May 9, 2:54 pm, "Novice Programmer" <[EMAIL PROTECTED]>
wrote:
> Hello,
>
> I used to run php CLI thro exec function passing it the required php file. I
> know want to port this code to Cake PHP semantics but the problem i am
> facing is that Cake has got seprate ways to execute on linux and on windows.
> on *nix it must be ./cake(as m on a shared host) console applicaiton and on
> windows it should be cake.bat. I am developing on windows system and
> deploying on linux system. How do i work around this problem?
>
> --
> Thanks & Regards,
> Novice (http://ishuonweb.wordpress.com/).
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---