diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-08-09 18:40:50 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-08-12 11:58:50 +0400 |
commit | 6320f5e35a766b8cf1bb618c87192943fbcef62b (patch) | |
tree | d05d2d52eed5fde7f8fa5bca1262537a92036094 /plugins | |
parent | 16a1add7034f3c18137354c39f1748b2f65008f5 (diff) |
refs #5936 started to work on removing files from core and the plugins directories that are no longer present in the new build
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/CoreUpdater/Controller.php | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins/CoreUpdater/Controller.php b/plugins/CoreUpdater/Controller.php index a78f8667f9..aba935637a 100644 --- a/plugins/CoreUpdater/Controller.php +++ b/plugins/CoreUpdater/Controller.php @@ -243,6 +243,26 @@ class Controller extends \Piwik\Plugin\Controller } } + private function getPluginsFromDirectoy($directoryToLook) + { + $directories = _glob($directoryToLook . '/plugins/' . '*', GLOB_ONLYDIR); + + $directories = array_map(function ($directory) use ($directoryToLook) { + return str_replace($directoryToLook, '', $directory); + }, $directories); + + return $directories; + } + + private function removeGoneFiles($source, $target) + { + Filesystem::unlinkTargetFilesNotPresentInSource($source . '/core', $target . '/core'); + + foreach ($this->getPluginsFromDirectoy($source) as $pluginDir) { + Filesystem::unlinkTargetFilesNotPresentInSource($source . $pluginDir, $target . $pluginDir); + } + } + private function oneClick_Copy() { /* @@ -257,6 +277,7 @@ class Controller extends \Piwik\Plugin\Controller * These files are accessed through the dispatcher. */ Filesystem::copyRecursive($this->pathRootExtractedPiwik, PIWIK_INCLUDE_PATH); + $this->removeGoneFiles($this->pathRootExtractedPiwik, PIWIK_INCLUDE_PATH); /* * These files are visible in the web root and are generally @@ -280,6 +301,7 @@ class Controller extends \Piwik\Plugin\Controller * Copy the non-PHP files (e.g., images, css, javascript) */ Filesystem::copyRecursive($this->pathRootExtractedPiwik, PIWIK_DOCUMENT_ROOT, true); + $this->removeGoneFiles($this->pathRootExtractedPiwik, PIWIK_DOCUMENT_ROOT); } /* |