MDL-77342 repository: Added class properties that are not declared.

In PHP 8.2 and later, setting a value to an undeclared class property is
deprecated and emits a deprecation notice.
So we need to add missing class properties that still need to be declared.
This commit is contained in:
Meirza 2023-02-09 09:16:13 +07:00
parent 794f107e88
commit 59c6b2dccd
15 changed files with 108 additions and 2 deletions

View File

@ -151,7 +151,7 @@ class repository_flickr extends repository {
* @return bool
*/
public function global_search() {
if (empty($this->token)) {
if (empty($this->accesstoken)) {
return false;
} else {
return true;

View File

@ -38,9 +38,34 @@ require_once(__DIR__ . '/image.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class repository_flickr_public extends repository {
/** @var phpFlickr Flickr class. */
private $flickr;
/** @var string Flick photos. */
public $photos;
/** @var string API key. */
protected $api_key;
/** @var string email address account. */
protected $flickr_account;
/** @var string watermarks usage status. */
protected $usewatermarks;
/** @var string session account. */
protected $sess_account;
/** @var string session tag. */
protected $sess_tag;
/** @var string session text. */
protected $sess_text;
/** @var string Flickr user identifier. */
protected $nsid;
/**
* Stores sizes of images to prevent multiple API call
*/

View File

@ -531,6 +531,10 @@ abstract class repository implements cacheable_object {
public $instance;
/** @var string Type of repository (webdav, google_docs, dropbox, ...). Read from $this->get_typename(). */
protected $typename;
/** @var string instance name. */
public $name;
/** @var bool true if the super construct is called, otherwise false. */
public $super_called;
/**
* Constructor
@ -2886,6 +2890,10 @@ final class repository_instance_form extends moodleform {
protected $instance;
/** @var string repository plugin type */
protected $plugin;
/** @var string repository type ID */
protected $typeid;
/** @var string repository context ID */
protected $contextid;
/**
* Added defaults to moodle form
@ -3008,6 +3016,8 @@ final class repository_type_form extends moodleform {
protected $plugin;
/** @var string action */
protected $action;
/** @var string plugin name */
protected $pluginname;
/**
* Definition of the moodleform

View File

@ -34,6 +34,18 @@ require_once($CFG->dirroot . '/repository/lib.php');
*/
class repository_merlot extends repository {
/** @var string merlot keyword. */
protected $keyword;
/** @var string merlot author. */
protected $author;
/** @var string merlot license key. */
protected $licensekey;
/** @var string API URL. */
protected $api;
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
parent::__construct($repositoryid, $context, $options);
$this->keyword = optional_param('merlot_keyword', '', PARAM_RAW);

View File

@ -46,6 +46,9 @@ class access_controlled_link_manager_test extends \advanced_testcase {
/** @var null|\core\oauth2\issuer which belongs to the repository_nextcloud object. */
public $issuer = null;
/** @var string system account username. */
public $systemaccountusername;
/**
* SetUp to create an repository instance.
*/

View File

@ -703,7 +703,7 @@ JSON;
array('success' => 201)));
$this->repo->expects($this->once())->method('delete_share_dataowner_sysaccount')->willReturn(
array('statuscode' => array('success' => 100)));
$filereturn = array();
$filereturn = new \stdClass();
$filereturn->link = 'some/fullpath' . 'some/target/path';
$filereturn->name = 'mysource';
$filereturn->usesystem = true;

View File

@ -44,6 +44,9 @@ class repository_recent extends repository {
/** @var int only retrieve files within the time limit */
protected $timelimit;
/** @var int recent files number configuration. */
protected $number;
/**
* Initialize recent plugin
* @param int $repositoryid

View File

@ -2020,6 +2020,13 @@ final class S3Request
*/
public $response;
/**
* Filename or resource to write to.
*
* @var string
* @access public
*/
public $file;
/**
* Constructor

View File

@ -41,6 +41,15 @@ if (!defined('CURL_SSLVERSION_TLSv1')) {
*/
class repository_s3 extends repository {
/** @var string access key. */
protected $access_key;
/** @var string secret key. */
protected $secret_key;
/** @var string endpoint URL. */
protected $endpoint;
/** @var S3 S3 class. */
protected $s;
/**
* Constructor
* @param int $repositoryid

View File

@ -13,3 +13,4 @@ upstream. Remove the local changes if so)
MDL-67031 php74 compliance. Change curly to square braces.
MDL-73523 php80 compliance. Deprecated openssl_free_key() use (https://github.com/tpyo/amazon-s3-php-class/issues/178)
MDL-77342 PHP 8.2 compliance. Add property $file in class S3Request.

View File

@ -41,6 +41,8 @@ class repository_url extends repository {
var $processedfiles = array();
/** @var int Recursion counter. */
var $recursioncounter = 0;
/** @var string file URL. */
public $file_url;
/**
* @param int $repositoryid

View File

@ -35,6 +35,19 @@ require_once($CFG->libdir.'/webdavlib.php');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class repository_webdav extends repository {
/** @var string webdav type. */
protected $webdav_type;
/** @var mixed webdav port. */
protected $webdav_port;
/** @var string webdav host. */
protected $webdav_host;
/** @var webdav_client webdav client. */
protected $dav;
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
parent::__construct($repositoryid, $context, $options);
// set up webdav client

View File

@ -38,6 +38,9 @@ require_once(__DIR__ . '/wikimedia.php');
class repository_wikimedia extends repository {
/** @var string keyword search. */
protected $keyword;
/**
* Returns maximum width for images
*

View File

@ -32,6 +32,18 @@ class wikimedia {
private $_conn = null;
private $_param = array();
/** @var string API URL. */
protected $api;
/** @var string user ID. */
protected $userid;
/** @var string username. */
protected $username;
/** @var string token key. */
protected $token;
public function __construct($url = '') {
if (empty($url)) {
$this->api = 'https://commons.wikimedia.org/w/api.php';

View File

@ -55,6 +55,12 @@ class repository_youtube extends repository {
*/
private $service = null;
/**
* Search keyword text.
* @var string
*/
protected $keyword;
/**
* Youtube plugin constructor
* @param int $repositoryid