https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112326
Revision: 112326
Author: hashar
Date: 2012-02-24 15:41:06 +0000 (Fri, 24 Feb 2012)
Log Message:
-----------
move wfRecursiveRemoveDir to global functions
That useful method was hidden in SeleniumWebSettings. I need it to clean
up test files leakages.
Modified Paths:
--------------
trunk/phase3/includes/GlobalFunctions.php
trunk/phase3/includes/SeleniumWebSettings.php
Modified: trunk/phase3/includes/GlobalFunctions.php
===================================================================
--- trunk/phase3/includes/GlobalFunctions.php 2012-02-24 15:01:35 UTC (rev
112325)
+++ trunk/phase3/includes/GlobalFunctions.php 2012-02-24 15:41:06 UTC (rev
112326)
@@ -2616,6 +2616,29 @@
}
/**
+ * Remove a directory and all its content.
+ * Does not hide error.
+ */
+function wfRecursiveRemoveDir( $dir ) {
+ wfDebug( __FUNCTION__ . "( $dir )\n" );
+ // taken from http://de3.php.net/manual/en/function.rmdir.php#98622
+ if ( is_dir( $dir ) ) {
+ $objects = scandir( $dir );
+ foreach ( $objects as $object ) {
+ if ( $object != "." && $object != ".." ) {
+ if ( filetype( $dir . '/' . $object ) == "dir"
) {
+ wfRecursiveRemoveDir( $dir . '/' .
$object );
+ } else {
+ unlink( $dir . '/' . $object );
+ }
+ }
+ }
+ reset( $objects );
+ rmdir( $dir );
+ }
+}
+
+/**
* @param $nr Mixed: the number to format
* @param $acc Integer: the number of digits after the decimal point, default 2
* @param $round Boolean: whether or not to round the value, default true
Modified: trunk/phase3/includes/SeleniumWebSettings.php
===================================================================
--- trunk/phase3/includes/SeleniumWebSettings.php 2012-02-24 15:01:35 UTC
(rev 112325)
+++ trunk/phase3/includes/SeleniumWebSettings.php 2012-02-24 15:41:06 UTC
(rev 112326)
@@ -201,21 +201,3 @@
$testUploadPath = getTestUploadPathFromResourceName( $testResourceName
);
$wgUploadPath = $testUploadPath;
}
-
-function wfRecursiveRemoveDir( $dir ) {
- // taken from http://de3.php.net/manual/en/function.rmdir.php#98622
- if ( is_dir( $dir ) ) {
- $objects = scandir( $dir );
- foreach ( $objects as $object ) {
- if ( $object != "." && $object != ".." ) {
- if ( filetype( $dir . '/' . $object ) == "dir"
) {
- wfRecursiveRemoveDir( $dir . '/' .
$object );
- } else {
- unlink( $dir . '/' . $object );
- }
- }
- }
- reset( $objects );
- rmdir( $dir );
- }
-}
\ No newline at end of file
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs