Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2014-05-23 06:59:16 +0400
committermattab <matthieu.aubry@gmail.com>2014-05-23 06:59:16 +0400
commit01d9dd07a38f8f0f36839c6dfa3a7ab431ec3493 (patch)
treee08d426a426e71d4993b788b7b6d1f33e102b1f0
parent2141c0c7ee755fa358fd036a787c314a3b98931c (diff)
When deleting htaccess files, make sure we only delete those that we may have created.2.3.0-rc2
Thank you @samiam for the report of bug, that's really helpful. We will not over-delete (often important) htaccess of more Piwik users! refs #4499 Will be available in 2.3.0-rc2
-rw-r--r--core/Updates/2.3.0-rc2.php14
-rw-r--r--core/Version.php2
-rw-r--r--plugins/Installation/ServerFilesGenerator.php34
3 files changed, 39 insertions, 11 deletions
diff --git a/core/Updates/2.3.0-rc2.php b/core/Updates/2.3.0-rc2.php
index 6d9476bff7..0365238ef2 100644
--- a/core/Updates/2.3.0-rc2.php
+++ b/core/Updates/2.3.0-rc2.php
@@ -8,25 +8,19 @@
*/
namespace Piwik\Updates;
-use Faker\Provider\File;
-use Piwik\Filesystem;
use Piwik\Plugins\Installation\ServerFilesGenerator;
use Piwik\Updates;
/**
*/
-class Updates_2_2_3_b7 extends Updates
+class Updates_2_3_0_rc2 extends Updates
{
public static function update()
{
- // Delete all existing htaccess files
- $files = Filesystem::globr( PIWIK_INCLUDE_PATH, ".htaccess");
+ ServerFilesGenerator::deleteHtAccessFiles();
- foreach($files as $file) {
- @unlink($file);
- }
-
- // Re-create them
ServerFilesGenerator::createHtAccessFiles();
}
+
+
}
diff --git a/core/Version.php b/core/Version.php
index 48e8b62d7d..5290e6db34 100644
--- a/core/Version.php
+++ b/core/Version.php
@@ -21,5 +21,5 @@ final class Version
* The current Piwik version.
* @var string
*/
- const VERSION = '2.3.0-rc1';
+ const VERSION = '2.3.0-rc2';
}
diff --git a/plugins/Installation/ServerFilesGenerator.php b/plugins/Installation/ServerFilesGenerator.php
index c5b7baf85b..4c8369a370 100644
--- a/plugins/Installation/ServerFilesGenerator.php
+++ b/plugins/Installation/ServerFilesGenerator.php
@@ -8,6 +8,7 @@
*/
namespace Piwik\Plugins\Installation;
+use Piwik\Filesystem;
use Piwik\SettingsServer;
class ServerFilesGenerator
@@ -246,4 +247,37 @@ HTACCESS_ALLOW;
return $allow;
}
+ /**
+ * Deletes all existing .htaccess files that Piwik may have created
+ *
+ */
+ public static function deleteHtAccessFiles()
+ {
+ $files = Filesystem::globr(PIWIK_INCLUDE_PATH, ".htaccess");
+
+ // that match the list of directories we create htaccess files
+ // (ie. not the root /.htaccess)
+ $directoriesWithAutoHtaccess = array(
+ '/js',
+ '/libs',
+ '/vendor',
+ '/plugins',
+ '/misc/user',
+ '/config',
+ '/core',
+ '/lang',
+ '/tmp',
+ );
+
+ foreach ($files as $file) {
+ foreach ($directoriesWithAutoHtaccess as $dirToDelete) {
+ // only delete the first .htaccess and not the ones in sub-directories
+ $pathToDelete = $dirToDelete . '/.htaccess';
+ if (strpos($file, $pathToDelete) !== false) {
+ @unlink($file);
+ }
+ }
+ }
+ }
+
}