mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-27559-master-v2' of https://github.com/mackensen/moodle
This commit is contained in:
commit
7df271d9b3
6 changed files with 26 additions and 8 deletions
|
@ -8,7 +8,9 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
|
||||||
require_once($CFG->dirroot.'/backup/bb/xsl_emulate_xslt.inc');
|
require_once($CFG->dirroot.'/backup/bb/xsl_emulate_xslt.inc');
|
||||||
|
|
||||||
function get_subdirs($directory){
|
function get_subdirs($directory){
|
||||||
$opendirectory = opendir( $directory );
|
if (!$opendirectory = opendir( $directory )) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
while(false !== ($filename = readdir($opendirectory))) {
|
while(false !== ($filename = readdir($opendirectory))) {
|
||||||
if (is_dir($directory.$filename) and $filename != ".." and $filename != "."){
|
if (is_dir($directory.$filename) and $filename != ".." and $filename != "."){
|
||||||
$subdirs[] = $filename;
|
$subdirs[] = $filename;
|
||||||
|
|
|
@ -79,7 +79,9 @@ abstract class backup_general_helper extends backup_helper {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$dir = opendir($path);
|
if (!$dir = opendir($path)) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
while (false !== ($file = readdir($dir))) {
|
while (false !== ($file = readdir($dir))) {
|
||||||
if ($file == '.' || $file == '..') { // Skip dots
|
if ($file == '.' || $file == '..') { // Skip dots
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -2535,7 +2535,10 @@ function fulldelete($location) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (is_dir($location)) {
|
if (is_dir($location)) {
|
||||||
$currdir = opendir($location);
|
|
||||||
|
if (!$currdir = opendir($location)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
while (false !== ($file = readdir($currdir))) {
|
while (false !== ($file = readdir($currdir))) {
|
||||||
if ($file <> ".." && $file <> ".") {
|
if ($file <> ".." && $file <> ".") {
|
||||||
$fullfile = $location."/".$file;
|
$fullfile = $location."/".$file;
|
||||||
|
|
|
@ -8029,7 +8029,10 @@ function get_list_of_plugins($directory='mod', $exclude='', $basedir='') {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file_exists($basedir) && filetype($basedir) == 'dir') {
|
if (file_exists($basedir) && filetype($basedir) == 'dir') {
|
||||||
$dirhandle = opendir($basedir);
|
if (!$dirhandle = opendir($basedir)) {
|
||||||
|
debugging("Directory permission error for plugin ({$directory}). Directory exists but cannot be read.", DEBUG_DEVELOPER);
|
||||||
|
return array();
|
||||||
|
}
|
||||||
while (false !== ($dir = readdir($dirhandle))) {
|
while (false !== ($dir = readdir($dirhandle))) {
|
||||||
$firstchar = substr($dir, 0, 1);
|
$firstchar = substr($dir, 0, 1);
|
||||||
if ($firstchar === '.' or $dir === 'CVS' or $dir === '_vti_cnf' or $dir === 'simpletest' or $dir === 'yui' or $dir === 'phpunit' or $dir === $exclude) {
|
if ($firstchar === '.' or $dir === 'CVS' or $dir === '_vti_cnf' or $dir === 'simpletest' or $dir === 'yui' or $dir === 'phpunit' or $dir === $exclude) {
|
||||||
|
@ -10225,7 +10228,7 @@ function apd_get_profiling() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete directory or only it's content
|
* Delete directory or only its content
|
||||||
*
|
*
|
||||||
* @param string $dir directory path
|
* @param string $dir directory path
|
||||||
* @param bool $content_only
|
* @param bool $content_only
|
||||||
|
@ -10236,7 +10239,9 @@ function remove_dir($dir, $content_only=false) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
$handle = opendir($dir);
|
if (!$handle = opendir($dir)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$result = true;
|
$result = true;
|
||||||
while (false!==($item = readdir($handle))) {
|
while (false!==($item = readdir($handle))) {
|
||||||
if($item != '.' && $item != '..') {
|
if($item != '.' && $item != '..') {
|
||||||
|
|
|
@ -110,7 +110,10 @@ function rss_delete_file($componentname, $instance) {
|
||||||
|
|
||||||
$dirpath = "$CFG->cachedir/rss/$componentname";
|
$dirpath = "$CFG->cachedir/rss/$componentname";
|
||||||
if (is_dir($dirpath)) {
|
if (is_dir($dirpath)) {
|
||||||
$dh = opendir($dirpath);
|
if (!$dh = opendir($dirpath)) {
|
||||||
|
error_log("Directory permission error. RSS directory store for component '{$componentname}' exists but cannot be opened.", DEBUG_DEVELOPER);
|
||||||
|
return;
|
||||||
|
}
|
||||||
while (false !== ($filename = readdir($dh))) {
|
while (false !== ($filename = readdir($dh))) {
|
||||||
if ($filename!='.' && $filename!='..') {
|
if ($filename!='.' && $filename!='..') {
|
||||||
if (preg_match("/{$instance->id}_/", $filename)) {
|
if (preg_match("/{$instance->id}_/", $filename)) {
|
||||||
|
|
|
@ -946,7 +946,10 @@ EOD;
|
||||||
if ($result) {
|
if ($result) {
|
||||||
// recurse directories
|
// recurse directories
|
||||||
if (is_dir($localpath)) {
|
if (is_dir($localpath)) {
|
||||||
$dp = opendir($localpath);
|
if (!$dp = opendir($localpath)) {
|
||||||
|
$this->_error_log("Could not open localpath for reading");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$fl = array();
|
$fl = array();
|
||||||
while($filename = readdir($dp)) {
|
while($filename = readdir($dp)) {
|
||||||
if ((is_file($localpath."/".$filename) || is_dir($localpath."/".$filename)) && $filename!="." && $filename != "..") {
|
if ((is_file($localpath."/".$filename) || is_dir($localpath."/".$filename)) && $filename!="." && $filename != "..") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue