Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

I've removed attributes.php from the uploads directory, as this file …

…is automatically created/updated by the software, and so should not be under version control (it always gets marked as changed, which is incorrect and confusing, and may end up causing the changes to be committed to the repo accidentally). We also don't want any of the files that the application generates in this directory (the uploads themselves) to be accidentally committed to the repository, so I've added a .gitignore file to ignore everything except itself. Now that this is present, we no longer need empty.txt, which was originally added to make sure that Git created the directory (as there is no way to create truly empty directories in Git).

I've added a check to FilesController::repair() so that it works correctly when the file is not there, however the code which is used for all normal usage is nicely encapsulated in the FileRepository_Backend_FileSystem class, which already handles things correctly if the file is missing, so that was the only place that needed updating.

The only other reference to attributes.php is in tools/db2fs.php, but this is referring to a local version of the file in that directory, and so is unaffected by this change.
  • Loading branch information...
commit 2ed1a3ebc9c41d5d5e89fe9b2f6bd7a931177a99 1 parent fbd062f
Mark Clements MarkMaldaba authored
7 application/plugins/files/controllers/FilesController.class.php
View
@@ -1056,8 +1056,13 @@ function detach_from_object() {
* @return null
*/
function repair() {
+ $attributesFile = ROOT . '/upload/attributes.php';
+ if (is_file($attributesFile)) {
+ $attributes = include $attributesFile;
+ } else {
+ $attributes = array();
+ }
- $attributes = include ROOT . '/upload/attributes.php';
foreach ($attributes as $k => $v) {
$files = ProjectFiles::findAll(array(
5 upload/.gitignore
View
@@ -0,0 +1,5 @@
+# Ignore everything in this directory...
+*
+
+# ...except this file
+!.gitignore
6 upload/attributes.php
View
@@ -1,6 +0,0 @@
-<?php
-
-return array (
-);
-
-?>
0  upload/empty.txt
View
No changes.
Please sign in to comment.
Something went wrong with that request. Please try again.