MDL-74567 repository_flickr: replace user-agent value for API calls.

Flickr doesn't like user agent that looks like a bot. Effectively the
same reasoning/fix as b8ee31a0.
This commit is contained in:
Paul Holden
2022-04-28 14:45:37 +01:00
parent e36fb751e5
commit a60a6d41a3
+6
View File
@@ -78,7 +78,13 @@ class phpFlickr {
//Find the PHP version and store it for future reference
$this->php_version = explode("-", phpversion());
$this->php_version = explode(".", $this->php_version[0]);
// Initialize curl helper, set custom user agent as Flickr blocks our "MoodleBot" agent string.
$this->curl = new curl(array('cache'=>true, 'module_cache'=>'repository'));
$version = moodle_major_version();
$this->curl->setopt([
'CURLOPT_USERAGENT' => "MoodleSite/$version (+{$CFG->wwwroot})"
]);
}
function request ($command, $args = array())