Merge branch 'MDL-38366-master' of git://github.com/FMCorz/moodle
This commit is contained in:
@@ -48,9 +48,14 @@ class repository_filesystem extends repository {
|
||||
public function __construct($repositoryid, $context = SYSCONTEXTID, $options = array()) {
|
||||
global $CFG;
|
||||
parent::__construct($repositoryid, $context, $options);
|
||||
$root = $CFG->dataroot.'/repository/';
|
||||
$root = $CFG->dataroot . '/repository/';
|
||||
$subdir = $this->get_option('fs_path');
|
||||
$this->root_path = $root . $subdir . '/';
|
||||
|
||||
$this->root_path = $root;
|
||||
if (!empty($subdir)) {
|
||||
$this->root_path .= $subdir . '/';
|
||||
}
|
||||
|
||||
if (!empty($options['ajax'])) {
|
||||
if (!is_dir($this->root_path)) {
|
||||
$created = mkdir($this->root_path, $CFG->directorypermissions, true);
|
||||
|
||||
+6
-6
@@ -2163,10 +2163,11 @@ abstract class repository implements cacheable_object {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get settings for repository instance
|
||||
* Get settings for repository instance.
|
||||
*
|
||||
* @param string $config
|
||||
* @return array Settings
|
||||
* @param string $config a specific option to get.
|
||||
* @return mixed returns an array of options. If $config is not empty, then it returns that option,
|
||||
* or null if the option does not exist.
|
||||
*/
|
||||
public function get_option($config = '') {
|
||||
global $DB;
|
||||
@@ -2175,13 +2176,12 @@ abstract class repository implements cacheable_object {
|
||||
$entries = $DB->get_records('repository_instance_config', array('instanceid' => $this->id));
|
||||
$cache->set('ops:'. $this->id, $entries);
|
||||
}
|
||||
|
||||
$ret = array();
|
||||
if (empty($entries)) {
|
||||
return $ret;
|
||||
}
|
||||
foreach($entries as $entry) {
|
||||
$ret[$entry->name] = $entry->value;
|
||||
}
|
||||
|
||||
if (!empty($config)) {
|
||||
if (isset($ret[$config])) {
|
||||
return $ret[$config];
|
||||
|
||||
@@ -3,6 +3,11 @@ information provided here is intended especially for developers. Full
|
||||
details of the repository API are available on Moodle docs:
|
||||
http://docs.moodle.org/dev/Repository_API
|
||||
|
||||
=== 2.6 ===
|
||||
|
||||
* get_option() now always return null when the first parameter ($config) is not empty, and
|
||||
no value was found for this $config. Previously this could sometimes return an empty array().
|
||||
|
||||
=== 2.5 ===
|
||||
|
||||
* repository::append_suffix() has been deprecated, use repository::get_unused_filename() if you need
|
||||
|
||||
Reference in New Issue
Block a user