| @@ -193,17 +193,27 @@ | ||
| 193 | 193 | <option value="no"<?php echo (!$automatic_updates)?' selected="selected"':''; ?>>cron job or manual updates</option> |
| 194 | 194 | </select> |
| 195 | 195 | <div id="cron-job-explanation" class="setting-description"> |
| 196 | 196 | <p><?php |
| 197 | - $path = `which curl`; $opts = '--silent %s'; | |
| 197 | + // Do we have shell_exec() available from here, or is it disabled for security reasons? | |
| 198 | + // If it's available, use it to execute `which` to try to get a realistic path to curl, | |
| 199 | + // or to wget. If everything fails or shell_exec() isn't available, then just make | |
| 200 | + // up something for the sake of example. | |
| 201 | + $shellExecAvailable = (is_callable('shell_exec') && false === stripos(ini_get('disable_functions'), 'shell_exec')); | |
| 202 | + | |
| 203 | + if ($shellExecAvailable) : | |
| 204 | + $path = `which curl`; $opts = '--silent %s'; | |
| 205 | + endif; | |
| 206 | + | |
| 207 | + if ($shellExecAvailable and (is_null($path) or strlen(trim($path))==0)) : | |
| 208 | + $path = `which wget`; $opts = '-q -O - %s'; | |
| 209 | + endif; | |
| 210 | + | |
| 198 | 211 | if (is_null($path) or strlen(trim($path))==0) : |
| 199 | - $path = `which wget`; $opts = '-q -O - %s'; | |
| 200 | - if (is_null($path) or strlen(trim($path))==0) : | |
| 201 | - $path = '/usr/bin/curl'; $opts = '--silent %s'; | |
| 202 | - endif; | |
| 212 | + $path = '/usr/bin/curl'; $opts = '--silent %s'; | |
| 203 | 213 | endif; |
| 214 | + | |
| 204 | 215 | $path = preg_replace('/\n+$/', '', $path); |
| 205 | - $crontab = `crontab -l`; | |
| 206 | 216 | |
| 207 | 217 | $cmdline = $path . ' ' . sprintf($opts, get_bloginfo('url').'?update_feedwordpress=1'); |
| 208 | 218 | |
| 209 | 219 | ?>If you want to use a cron job, |