cvs: php4 /pear/PEAR Common.php
| From: | Stig Bakken | Date: | Fri, 29 Mar 2002 00:05:56 +0000 |
| Subject: | cvs: php4 /pear/PEAR Common.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-2891@lists.php.net to get a copy of this message | ||
ssb Thu Mar 28 19:05:56 2002 EDT
Modified files:
/php4/pear/PEAR Common.php
Log:
* fix tempfile cleanup
Index: php4/pear/PEAR/Common.php
diff -u php4/pear/PEAR/Common.php:1.37 php4/pear/PEAR/Common.php:1.38
--- php4/pear/PEAR/Common.php:1.37 Thu Mar 28 18:44:31 2002
+++ php4/pear/PEAR/Common.php Thu Mar 28 19:05:55 2002
@@ -17,12 +17,19 @@
// | Tomas V.V.Cox <cox@idecnet.com> |
// +----------------------------------------------------------------------+
//
-// $Id: Common.php,v 1.37 2002/03/28 23:44:31 ssb Exp $
+// $Id: Common.php,v 1.38 2002/03/29 00:05:55 ssb Exp $
require_once 'PEAR.php';
require_once 'Archive/Tar.php';
require_once 'System.php';
+/**
+ * List of temporary files and directories registered by
+ * PEAR_Common::addTempFile().
+ * @var array
+ */
+$GLOBALS['_PEAR_Common_tempfiles'] = array();
+
/*
* TODO:
* - check in inforFromDescFile that the minimal data needed is present
@@ -46,9 +53,6 @@
/** array of attributes of the currently parsed XML element */
var $current_attributes = array();
- /** list of temporary files created by this object */
- var $_tempfiles = array();
-
/** assoc with information about a package */
var $pkginfo = array();
@@ -75,8 +79,6 @@
*/
function PEAR_Common()
{
- $GLOBALS['_PEAR_Common_tempfiles'] = array();
- $this->_tempfiles =& $GLOBALS['_PEAR_Common_tempfiles'];
$this->PEAR();
}
@@ -93,9 +95,7 @@
// doesn't work due to bug #14744
//$tempfiles = $this->_tempfiles;
$tempfiles =& $GLOBALS['_PEAR_Common_tempfiles'];
- while (is_array($tempfiles) &&
- $file = array_shift($tempfiles))
- {
+ while ($file = array_shift($tempfiles)) {
if (@is_dir($file)) {
System::rm("-rf $file");
} elseif (file_exists($file)) {
@@ -120,7 +120,7 @@
*/
function addTempFile($file)
{
- $this->_tempfiles[] = $file;
+ $GLOBALS['_PEAR_Common_tempfiles'][] = $file;
}
// }}}