Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
brae
Feb 2, 2006

omgwtfnoway posted:

I'm trying to use exec() in a php script to add and commit some files to SVN.

I'm doing something like:

code:
$cmd = "cd c:\pathWithSVN";
exec($cmd);
$cmd = "svn add $abaFilename";
exec($cmd);
...

The problem is: neither of these commands are being run. Any ideas? I've never tried executing command line commands from a script before. This is run on a windows machine with apache/php5.

I don't know how it works on windows, but in UNIX I wouldn't expect changing directories this way (via exec) to work. Try chdir:
http://us2.php.net/manual/en/function.chdir.php

Also exec returns the last line of output from the thing you're trying to run. Do you get anything in your example? Do you have safe_mode disabled? If it's enabled, you can only exec in certain directories.

Adbot
ADBOT LOVES YOU

brae
Feb 2, 2006

genericadmin posted:

code

I would suggest this. Your problem is a good application for a class factory. Have a class (the factory) that does the expensive sql and add methods on it to get instances of the chunks of your big class that you've created. Have the chunks take a reference to the factory (so they can get at the stored results of the expensive SQL). You run the queries once and can produce different objects that can get at one copy of the results.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply