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
/** 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();
*/
function PEAR_Common()
{
- $GLOBALS['_PEAR_Common_tempfiles'] = array();
- $this->_tempfiles =& $GLOBALS['_PEAR_Common_tempfiles'];
$this->PEAR();
}
// 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)) {
*/
function addTempFile($file)
{
- $this->_tempfiles[] = $file;
+ $GLOBALS['_PEAR_Common_tempfiles'][] = $file;
}
// }}}