From 916fa5ea70737968d7bb6c41b21c470bc280838c Mon Sep 17 00:00:00 2001 From: patdenice Date: Wed, 14 Oct 2009 14:59:23 +0000 Subject: Plugins upgrade now delete obsolete files from obsolete.list. git-svn-id: http://piwigo.org/svn/branches/2.0@4033 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/include/plugins.class.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'admin/include') diff --git a/admin/include/plugins.class.php b/admin/include/plugins.class.php index fd1700447..9c5b238df 100644 --- a/admin/include/plugins.class.php +++ b/admin/include/plugins.class.php @@ -412,6 +412,27 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id="' . $plugin_id . '"'; break; } } + if (file_exists($extract_path.'/obsolete.list') + and $old_files = file($extract_path.'/obsolete.list', FILE_IGNORE_NEW_LINES) + and !empty($old_files)) + { + array_push($old_files, 'obsolete.list'); + foreach($old_files as $old_file) + { + $path = $extract_path.'/'.$old_file; + if (is_file($path)) + { + @unlink($path); + } + elseif (is_dir($path)) + { + if (!$this->deltree($path)) + { + $this->send_to_trash($path); + } + } + } + } } else $status = 'extract_error'; } -- cgit v1.2.3