Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Updater - keep your GetSimple installation and plugins up to date
#30
I just spent hours figuring out why this would not work on a specific host, still no damn clue why.

But CURLOPT_FILE was not being set whenin an options array.
I had to explicitly add
curl_setopt($ch, CURLOPT_FILE, fopen($destination, "w"));
( should probably be 'wb' also for binary )

It would output the file to the screen and save a 0 length file.

EDIT:
It has to do with the order of setting FILE. I don't know how it applies options when in an array, but apparently it can make a difference depending on config of a host and what options are defaulted internally.
it works when i move FILE to the beginning of the options array in plugins.php

PHP Code:
// no worky
    
$curl_options = array(
        
CURLOPT_URL => $url,
        
CURLOPT_FOLLOWLOCATION => true,
        
CURLOPT_MAXREDIRS => 10,
        
CURLOPT_FILE => fopen($destination"w"),
    );

// worky
    
$curl_options = array(
        
CURLOPT_FILE => fopen($destination"w"),
        
CURLOPT_URL => $url,
        
CURLOPT_FOLLOWLOCATION => true,
        
CURLOPT_MAXREDIRS => 10
    
); 

ok figured that one out
curl_setopt_array returns false immediately if a setting fails to set, preventing any following settings to apply.
In my case, followlocation fails because of open_base_dir restrictions in php, and there is no error catch for this.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply


Messages In This Thread
RE: Updater - keep your GetSimple installation and plugins up to date - by shawn_a - 2014-06-12, 04:08:37



Users browsing this thread: 1 Guest(s)