From 63a05f4f1f4c88e48dbafdfdee8b364bea48f044 Mon Sep 17 00:00:00 2001 From: Huong Nguyen Date: Fri, 28 May 2021 08:52:05 +0700 Subject: [PATCH 1/2] MDL-71741 portfolio: Use the correct configurations --- lib/portfoliolib.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/portfoliolib.php b/lib/portfoliolib.php index cc00cc5b8a2..97c1b56bd2c 100644 --- a/lib/portfoliolib.php +++ b/lib/portfoliolib.php @@ -1028,15 +1028,15 @@ function portfolio_filesize_info() { function portfolio_expected_time_db($recordcount) { global $CFG; - if (empty($CFG->portfolio_moderate_dbsize_threshold)) { - set_config('portfolio_moderate_dbsize_threshold', 10); + if (empty($CFG->portfolio_moderate_db_threshold)) { + set_config('portfolio_moderate_db_threshold', 20); } - if (empty($CFG->portfolio_high_dbsize_threshold)) { - set_config('portfolio_high_dbsize_threshold', 50); + if (empty($CFG->portfolio_high_db_threshold)) { + set_config('portfolio_high_db_threshold', 50); } - if ($recordcount < $CFG->portfolio_moderate_dbsize_threshold) { + if ($recordcount < $CFG->portfolio_moderate_db_threshold) { return PORTFOLIO_TIME_LOW; - } else if ($recordcount < $CFG->portfolio_high_dbsize_threshold) { + } else if ($recordcount < $CFG->portfolio_high_db_threshold) { return PORTFOLIO_TIME_MODERATE; } return PORTFOLIO_TIME_HIGH; From da14398a88b90928ea983e581c42412b33f47e1e Mon Sep 17 00:00:00 2001 From: Huong Nguyen Date: Fri, 28 May 2021 08:55:43 +0700 Subject: [PATCH 2/2] MDL-71741 portfolio: Reset header information between requests The reset process also removes the CURLFile option in the HTTP object, which will avoid the serialisation issue on PHP7.4 and upward --- lib/flickrclient.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/flickrclient.php b/lib/flickrclient.php index de57c328b83..ffe11588519 100644 --- a/lib/flickrclient.php +++ b/lib/flickrclient.php @@ -235,6 +235,9 @@ class flickr_client extends oauth_helper { $response = $this->http->post(self::UPLOAD_ROOT, $params); + // Reset http header and options to prepare for the next request. + $this->reset_state(); + if ($response) { $xml = simplexml_load_string($response); @@ -254,4 +257,14 @@ class flickr_client extends oauth_helper { throw new moodle_exception('flickr_upload_error', 'core_error', '', null, $response); } } + + /** + * Resets curl state. + * + * @return void + */ + public function reset_state(): void { + $this->http->cleanopt(); + $this->http->resetHeader(); + } }