Permalink
Browse files

MDL-38570 admin: fix cron_delete_from_temp on windows

  • Loading branch information...
Tim Gus authored and danpoltawski committed Sep 12, 2013
1 parent ef9ca10 commit c4012e7e82186e082fff23d25be2c7d323be1ec9
Showing with 12 additions and 10 deletions.
  1. +1 −1 lib/cronlib.php
  2. +11 −9 lib/tests/cronlib_test.php
View
@@ -790,7 +790,7 @@ function cron_delete_from_temp() {
$iter = new RecursiveIteratorIterator($dir, RecursiveIteratorIterator::CHILD_FIRST);
for ($iter->rewind(); $iter->valid(); $iter->next()) {
- $node = $iter->getPathname();
+ $node = $iter->getRealPath();
if (!is_readable($node)) {
continue;
}
View
@@ -37,6 +37,8 @@ class cronlib_testcase extends basic_testcase {
*/
public function cron_delete_from_temp_provider() {
global $CFG;
+
+ $tmpdir = realpath($CFG->tempdir);
$time = time();
$weekstime = $time - strtotime('1 week');
@@ -97,14 +99,14 @@ public function cron_delete_from_temp_provider() {
array(
array($node1, $node2, $node3, $node4, $node5, $node6, $node7, $node8, $node9, $node10),
array(
- "$CFG->tempdir/dir1",
- "$CFG->tempdir/dir1/dir1_1",
- "$CFG->tempdir/dir1/dir1_1/dir1_2",
- "$CFG->tempdir/dir1/dir1_1/dir1_2/file2",
- "$CFG->tempdir/dir1/dir1_4",
- "$CFG->tempdir/dir1/dir1_4/file2",
- "$CFG->tempdir/dir2",
- "$CFG->tempdir/file1",
+ $tmpdir.DIRECTORY_SEPARATOR.'dir1',
+ $tmpdir.DIRECTORY_SEPARATOR.'dir1'.DIRECTORY_SEPARATOR.'dir1_1',
+ $tmpdir.DIRECTORY_SEPARATOR.'dir1'.DIRECTORY_SEPARATOR.'dir1_1'.DIRECTORY_SEPARATOR.'dir1_2',
+ $tmpdir.DIRECTORY_SEPARATOR.'dir1'.DIRECTORY_SEPARATOR.'dir1_1'.DIRECTORY_SEPARATOR.'dir1_2'.DIRECTORY_SEPARATOR.'file2',
+ $tmpdir.DIRECTORY_SEPARATOR.'dir1'.DIRECTORY_SEPARATOR.'dir1_4',
+ $tmpdir.DIRECTORY_SEPARATOR.'dir1'.DIRECTORY_SEPARATOR.'dir1_4'.DIRECTORY_SEPARATOR.'file2',
+ $tmpdir.DIRECTORY_SEPARATOR.'dir2',
+ $tmpdir.DIRECTORY_SEPARATOR.'file1',
)
),
array(
@@ -143,7 +145,7 @@ public function test_cron_delete_from_temp($nodes, $expected) {
$actual = array();
for ($iter->rewind(); $iter->valid(); $iter->next()) {
if (!$iter->isDot()) {
- $actual[] = $iter->getPathname();
+ $actual[] = $iter->getRealPath();
}
}

0 comments on commit c4012e7

Please sign in to comment.