diff options
author | patdenice <patdenice@piwigo.org> | 2009-10-14 15:01:20 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2009-10-14 15:01:20 +0000 |
commit | 6d5d2133cfaeb17d526dc62b52fdf99e6d665340 (patch) | |
tree | 4ef9656b2ba3f25951a01475c98ac52edf2e41b5 | |
parent | 69d4be7677b97a65208357caa4ee413213e83cf2 (diff) |
merge r4033 from branch 2.0 to trunk
Plugins upgrade now delete obsolete files from obsolete.list.
git-svn-id: http://piwigo.org/svn/trunk@4034 68402e56-0260-453c-a942-63ccdbb3a9ee
-rw-r--r-- | admin/include/plugins.class.php | 21 |
1 files changed, 21 insertions, 0 deletions
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'; } |