{"action":"created","issue":{"url":"https://api.github.com/repos/ignacionelson/ProjectSend/issues/93","repository_url":"https://api.github.com/repos/ignacionelson/ProjectSend","labels_url":"https://api.github.com/repos/ignacionelson/ProjectSend/issues/93/labels{/name}","comments_url":"https://api.github.com/repos/ignacionelson/ProjectSend/issues/93/comments","events_url":"https://api.github.com/repos/ignacionelson/ProjectSend/issues/93/events","html_url":"https://github.com/ignacionelson/ProjectSend/pull/93","id":143951892,"number":93,"title":"Adding a widget that displays the current disc usage to the home page","user":{"login":"Mactory","id":493594,"avatar_url":"https://avatars.githubusercontent.com/u/493594?v=3","gravatar_id":"","url":"https://api.github.com/users/Mactory","html_url":"https://github.com/Mactory","followers_url":"https://api.github.com/users/Mactory/followers","following_url":"https://api.github.com/users/Mactory/following{/other_user}","gists_url":"https://api.github.com/users/Mactory/gists{/gist_id}","starred_url":"https://api.github.com/users/Mactory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mactory/subscriptions","organizations_url":"https://api.github.com/users/Mactory/orgs","repos_url":"https://api.github.com/users/Mactory/repos","events_url":"https://api.github.com/users/Mactory/events{/privacy}","received_events_url":"https://api.github.com/users/Mactory/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-28T11:07:21Z","updated_at":"2016-03-28T19:39:11Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ignacionelson/ProjectSend/pulls/93","html_url":"https://github.com/ignacionelson/ProjectSend/pull/93","diff_url":"https://github.com/ignacionelson/ProjectSend/pull/93.diff","patch_url":"https://github.com/ignacionelson/ProjectSend/pull/93.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/ignacionelson/ProjectSend/issues/comments/202550333","html_url":"https://github.com/ignacionelson/ProjectSend/pull/93#issuecomment-202550333","issue_url":"https://api.github.com/repos/ignacionelson/ProjectSend/issues/93","id":202550333,"user":{"login":"Mactory","id":493594,"avatar_url":"https://avatars.githubusercontent.com/u/493594?v=3","gravatar_id":"","url":"https://api.github.com/users/Mactory","html_url":"https://github.com/Mactory","followers_url":"https://api.github.com/users/Mactory/followers","following_url":"https://api.github.com/users/Mactory/following{/other_user}","gists_url":"https://api.github.com/users/Mactory/gists{/gist_id}","starred_url":"https://api.github.com/users/Mactory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mactory/subscriptions","organizations_url":"https://api.github.com/users/Mactory/orgs","repos_url":"https://api.github.com/users/Mactory/repos","events_url":"https://api.github.com/users/Mactory/events{/privacy}","received_events_url":"https://api.github.com/users/Mactory/received_events","type":"User","site_admin":false},"created_at":"2016-03-28T19:39:11Z","updated_at":"2016-03-28T19:39:11Z","body":"Hi, \r\n\r\nYes, it is checking each time the page is loaded.\r\nI thought about alternatives but decided for this solution as it concurs with the way the size calculation is solved in the \"files\" view. There the size of each file is calculated as the table is displayed. Therefore I also calculate the size of all files in the file folder on demand.\r\n\r\nI do agree with you, that this could be problematic for large file bases, I did not test this though. On the pro side, i can state, that the file size calculation is done with the help of operating system tools (by usage of the same function as in the file view) which makes it quick.\r\n\r\nPossible solutions:\r\n1. As you stated, this could be done on demand (e.g. by clicking a button) which reduces the load. I would not prefer this solution as it seems better to me to solve the problem in another way.\r\n2. En- / Disabling the feature does not solve the problem in my opinion, as there might be users that want to see the used file size but need this to be calculated quickly.\r\n3. Calculate the size in a cron job: Small system load but the file size is updated to seldom to be of real use. A frequend cron job on the other hand could potentially calculate the same file sizes over and over.\r\n4. Use system tools to calculate the size of the whole folder instead of sum the sizes of each file. I have no idea how this solution would perform. The pro side is that we would always have the most recent sizes of all files in the folder.\r\n5. Use the database to store the file size information, then retrieve the used space by summing the column in the database. The file sizes would need to be calculated on upload / add to the project and then stored in the database. This would seem like the best solution for the project as it is not OS dependent but poses some problems: If files are changed, this change needs to be reflected in the database. Files that were uploaded to the folder via FTP would not be added to the sum. The main problem with this would be the side path via FTP, because all actions that are done via the website could be registered and the sizes in the db updated accordingly.\r\n\r\nI would actually prefer solution 5, as it seems the correct way to me. I would propose to ignore files that are in the uploaded folder but not yet added to the project. The remaining problem would be that files could be changed via FTP. For this I would propose to synchronize the size of a file with the stored value in the database at download time.\r\n\r\nTo implement this myself, I would, however, need some pointers as where to start. Could you point me to the place where I could add the \"migration\" of the database to add the file size column? I usually program for django in Python, so I'm not using PHP on a daily basis. "}}