]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10905 iterating correctly with readdir (as shown in php doc)
authornicolasconnault <nicolasconnault>
Mon, 15 Oct 2007 05:18:58 +0000 (05:18 +0000)
committernicolasconnault <nicolasconnault>
Mon, 15 Oct 2007 05:18:58 +0000 (05:18 +0000)
13 files changed:
admin/delete.php
backup/bb/restore_bb.php
backup/lib.php
mod/assignment/db/mysql.php
mod/assignment/db/postgres7.php
mod/hotpot/lib.php
mod/resource/type/ims/finder.php
mod/resource/type/ims/repository_deploy.php
mod/wiki/ewiki/ewiki.php
mod/wiki/ewiki/plugins/init.php
mod/wiki/ewiki/plugins/spages.php
question/format/blackboard_6/format.php
question/format/coursetestmanager/format.php

index 6762cf44196188d906ecba8b29102aaa1f974794..1498dbfcaa29d7cb7800404e10c2ae6fc3f00448 100644 (file)
@@ -54,7 +54,7 @@ function delete_subdirectories($rootdir) {
 
     $dir = opendir($rootdir);
 
-    while ($file = readdir($dir)) {
+    while (false !== ($file = readdir($dir))) {
         if ($file != '.' and $file != '..') {
             $fullfile = $rootdir .'/'. $file;
             if (filetype($fullfile) == 'dir') {
index 4e63c404478c0703755b22476c62d77a6baf8d62..0793a860688864f9858572ab5bb6f97baf42f5c3 100644 (file)
@@ -9,7 +9,7 @@ require_once($CFG->dirroot.'/backup/bb/xsl_emulate_xslt.inc');
   
 function get_subdirs($directory){
     $opendirectory = opendir( $directory );
-    while($filename = readdir($opendirectory)) {
+    while(false !== ($filename = readdir($opendirectory))) {
         if (is_dir($directory.$filename) and $filename != ".." and $filename != "."){
             $subdirs[] = $filename;
         }
index 2afe506b6a0e9648e1706dc02d096e2086cf1e44..25880c6ecb9b34e44e13370f2341a85192c3b49d 100644 (file)
         }
 
         // Loop through all directory entries, and construct two temporary arrays containing files and sub directories
-        while($entry = readdir($handle)) {
+        while(false !== ($entry = readdir($handle))) {
             if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != "." && $entry != $excludeddir) {
                 $dir_subdirs[] = $dir. $slash .$entry;
             }
         $results = null;
 
         $dir = opendir($rootdir);
-        while ($file=readdir($dir)) {
+        while (false !== ($file=readdir($dir))) {
             if ($file=="." || $file=="..") {
                 continue;
             }
         $results = "";
 
         $dir = opendir($rootdir);
-        while ($file=readdir($dir)) {
+        while (false !== ($file=readdir($dir))) {
             if ($file=="." || $file=="..") {
                 continue;
             }
             $status = check_dir_exists($to_file, true, true);
         }
         $dir = opendir($from_file);
-        while ($file=readdir($dir)) {
+        while (false !== ($file=readdir($dir))) {
             if ($file=="." || $file=="..") {
                 continue;
             }
index 632e6574ad0533dda676f135f5c4c1571efce826..b54e4c344f6c1fd3dbe1a034b1dbe163839463c4 100644 (file)
@@ -62,7 +62,7 @@ function assignment_upgrade($oldversion) {
         notify("Moving location of assignment files...");
 
         $basedir = opendir("$CFG->dataroot");
-        while ($dir = readdir($basedir)) {
+        while (false !== ($dir = readdir($basedir))) {
             if ($dir == "." || $dir == ".." || $dir == "users") {
                 continue;
             }
index f00034372bc173880a51034c5d9dcec40d2b70ea..d7558df16592d59ecb42e8deaeae1786e1fea7a4 100644 (file)
@@ -60,7 +60,7 @@ function assignment_upgrade($oldversion) {
         notify("Moving location of assignment files...");
 
         $basedir = opendir("$CFG->dataroot");
-        while ($dir = readdir($basedir)) {
+        while (false !== ($dir = readdir($basedir))) {
             if ($dir == "." || $dir == ".." || $dir == "users") {
                 continue;
             }
index 8d117767577eb771f4cacb49d740bd8bc9a15021..a8b1bf152fa767a8959283d6f41f6a6c43e36fb6 100644 (file)
@@ -472,7 +472,7 @@ function hotpot_add_chain(&$hotpot) {
 
         // get list of hotpot files in this folder
         if ($dh = @opendir($xml_quiz->filepath)) {
-            while ($file = @readdir($dh)) {
+            while (false !== ($file = @readdir($dh))) {
                 if (preg_match('/\.(jbc|jcl|jcw|jmt|jmx|jqz|htm|html)$/', $file)) {
                     $hotpot->references[] = "$xml_quiz->reference/$file";
                 }
index da688179296db281f09c27a9626d2d7f2be754b4..ff52cdb0eca587a08c935cc7014d1ffb70a304e7 100644 (file)
@@ -30,7 +30,7 @@
     
 /// Loops though dir building a list of all relevent entries. Ignores files.
 /// Asks for deploy if admin user AND no serialized file found.
-    while (false != ($filename = readdir($repository_dir))) {
+    while (false !== ($filename = readdir($repository_dir))) {
         if ($filename != '.' && $filename != '..' && is_dir("$CFG->repository/$directory/$filename")) {
             unset($item);
             $item->type = '';
index 6f148b5b43202f3e961461983a64a8dfd25ec322..f3509958374e01ffb6cefa01e8a880c1c0578760 100644 (file)
@@ -7,7 +7,7 @@
 // Moodle - Modular Object-Oriented Dynamic Learning Environment         //
 //          http://moodle.com                                            //
 //                                                                       //
-// Copyright (C) 1999 onwards Martin Dougiamas        http://dougiamas.com  //
+// Copyright (C) 1999 onwards Martin Dougiamas     http://dougiamas.com  //
 //           (C) 2001-3001 Eloy Lafuente (stronk7) http://contiento.com  //
 //                                                                       //
 // This program is free software; you can redistribute it and/or modify  //
@@ -68,7 +68,7 @@
         
         $dirpath = "$CFG->repository/$file";
         $dir = opendir($dirpath);
-        while (false != ($filename = readdir($dir))) {
+        while (false !== ($filename = readdir($dir))) {
             if ($filename != '.' && $filename != '..') {
                 $path = $dirpath.'/'.$filename;
                 if (is_dir($path) && file_exists("$path/imsmanifest.xml")) {
index eeeb2f00a2ac6d9ac101c2296cfa3547ac1835b4..be5f40e840776f36a8969fed3feb0d4e3297c48a 100644 (file)
@@ -3189,7 +3189,7 @@ function ewiki_eventually_initialize(&$id, &$data, &$action) {
       $path=EWIKI_INIT_PAGES;
       if (!empty($path)) {
         if ($dh = @opendir($path=EWIKI_INIT_PAGES)) {
-         while ($filename = readdir($dh)) {
+         while (false !== ($filename = readdir($dh))) {
 #### MOODLE CHANGE TO SOLVE BUG #3830. Original doesn't support dots in names.
     //Orig->if (preg_match('/^(['.EWIKI_CHARS_U.']+['.EWIKI_CHARS_L.']+\w*)+/', $filename)) {
             if ($filename == clean_filename($filename) && !is_dir($path.'/'.$filename)) {
index 2359c5a9d084fd5ca1b05fdd46856c9751ddad53..f53711421ee06e6cfce3a6b0474d69ac08f6fa84 100644 (file)
@@ -79,7 +79,7 @@ function ewiki_initialization_wizard($id, &$data, &$action) {
       else {
          ewiki_database("INIT", array());
          if ($dh = @opendir($path=EWIKI_INIT_PAGES)) {
-            while ($filename = readdir($dh)) {
+            while (false !== ($filename = readdir($dh))) {
                if (preg_match('/^(['.EWIKI_CHARS_U.']+['.EWIKI_CHARS_L.']+\w*)+/', $filename)) {
                   $found = ewiki_database("FIND", array($filename));
                   if (! $found[$filename]) {
@@ -119,4 +119,4 @@ function ewiki_initialization_wizard($id, &$data, &$action) {
 }
 
 
-?>
\ No newline at end of file
+?>
index 301ed4be0fea2058eea1c1f3d60946980dccd046..8f062c6d7c94373b403eb3344cb6a630a12e6376 100644 (file)
@@ -141,7 +141,7 @@ function ewiki_init_spages($dirs, $idprep="") {
 
       #-- read in one directory
       $dh = opendir($dir);
-      while ($fn = readdir($dh)) {
+      while (false !== ($fn = readdir($dh))) {
 
          #-- skip over . and ..
          if ($fn[0] == ".") { continue; }
@@ -179,4 +179,4 @@ function ewiki_init_spages($dirs, $idprep="") {
 
 
 
-?>
\ No newline at end of file
+?>
index 10b65b8bf96f396828c8262ecef2b07590e09c30..efd791587071c5223a91169b6782479c0e9d4707 100644 (file)
@@ -60,7 +60,7 @@ class qformat_blackboard_6 extends qformat_default {
         }
 
         // Loop through all directory entries, and construct two temporary arrays containing files and sub directories
-        while($entry = readdir($handle)) {
+        while(false !== ($entry = readdir($handle))) {
             if (is_dir($dir. $slash .$entry) && $entry != ".." && $entry != ".") {
                 $dir_subdirs[] = $dir. $slash .$entry;
             }
index 206a42d864031e546e3be82ce4327362ebcc0c0b..f5676bb2e9f9182f47097038582dca4078dd8113 100755 (executable)
@@ -434,7 +434,7 @@ class qformat_coursetestmanager extends qformat_default {
     function fulldelete($location) {
         if (is_dir($location)) {
             $currdir = opendir($location);
-            while ($file = readdir($currdir)) {
+            while (false !== ($file = readdir($currdir))) {
                 if ($file <> ".." && $file <> ".") {
                     $fullfile = $location."/".$file;
                     if (is_dir($fullfile)) {