{"action":"created","issue":{"url":"https://api.github.com/repos/mattpass/ICEcoder/issues/587","labels_url":"https://api.github.com/repos/mattpass/ICEcoder/issues/587/labels{/name}","comments_url":"https://api.github.com/repos/mattpass/ICEcoder/issues/587/comments","events_url":"https://api.github.com/repos/mattpass/ICEcoder/issues/587/events","html_url":"https://github.com/mattpass/ICEcoder/issues/587","id":104846312,"number":587,"title":"Version control","user":{"login":"mattpass","id":1311155,"avatar_url":"https://avatars.githubusercontent.com/u/1311155?v=3","gravatar_id":"","url":"https://api.github.com/users/mattpass","html_url":"https://github.com/mattpass","followers_url":"https://api.github.com/users/mattpass/followers","following_url":"https://api.github.com/users/mattpass/following{/other_user}","gists_url":"https://api.github.com/users/mattpass/gists{/gist_id}","starred_url":"https://api.github.com/users/mattpass/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattpass/subscriptions","organizations_url":"https://api.github.com/users/mattpass/orgs","repos_url":"https://api.github.com/users/mattpass/repos","events_url":"https://api.github.com/users/mattpass/events{/privacy}","received_events_url":"https://api.github.com/users/mattpass/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mattpass/ICEcoder/labels/Feature","name":"Feature","color":"02e10c"},{"url":"https://api.github.com/repos/mattpass/ICEcoder/labels/Version%205.4","name":"Version 5.4","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-09-04T08:01:16Z","updated_at":"2015-09-04T15:10:08Z","closed_at":null,"body":"A couple of people have asked about version control of files and while we have the ZipIt! plugin, it backs up an entire dir on an interval and GitHub integration, it involves a few clicks of switching into that mode, committing, pushing etc. There's no simple, local version control.\r\n\r\nAdding a couple of lines to /processes/on-file-save.php will save the file with a timestamp in the /backups dir:\r\n```\r\n$pathParts = pathinfo($fileName);\r\ncopy($docRoot.$fileLoc.\"/\".$fileName, \"../backups/\".$pathParts['filename'].\"-\".time().\".\".$pathParts['extension']);\r\n```\r\n\r\nHowever, this simple 2 line solution doesn't include a dir structure or any simple way to get back to an older version of a file, plus you need to know it's saved there.\r\n\r\nWould suggest expanding on this 2 line solution to include dir structure also within the backups dir. Then right clicking on a file, you could access a new option - 'Version Control' which would show a list of all saved backups (ordering by filename would put this into timestamp order and allow us to display as version 1, version 2 and so on).\r\n\r\nThe user would need choices on what to do next from the Version Control screen:\r\n\r\n```\r\nVersion 1      Open in new tab      Open in diff mode      Restore as new version\r\nVersion 2      Open in new tab      Open in diff mode      Restore as new version\r\nVersion 3      Open in new tab      Open in diff mode      Restore as new version\r\nVersion 4      Open in new tab      Open in diff mode      Restore as new version\r\n```\r\n\r\nOpen in new tab will open it in a new tab. Open in diff mode will open current version in left pane and that older version in the right pane. Restore as new version would move the current version to the /backups dir as Version 5 and copy the older version chosen over to the live dir as well as copying it as version 6 in the /backups dir so live and the latest backup are in sync."},"comment":{"url":"https://api.github.com/repos/mattpass/ICEcoder/issues/comments/137762027","html_url":"https://github.com/mattpass/ICEcoder/issues/587#issuecomment-137762027","issue_url":"https://api.github.com/repos/mattpass/ICEcoder/issues/587","id":137762027,"user":{"login":"webguide","id":8831484,"avatar_url":"https://avatars.githubusercontent.com/u/8831484?v=3","gravatar_id":"","url":"https://api.github.com/users/webguide","html_url":"https://github.com/webguide","followers_url":"https://api.github.com/users/webguide/followers","following_url":"https://api.github.com/users/webguide/following{/other_user}","gists_url":"https://api.github.com/users/webguide/gists{/gist_id}","starred_url":"https://api.github.com/users/webguide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webguide/subscriptions","organizations_url":"https://api.github.com/users/webguide/orgs","repos_url":"https://api.github.com/users/webguide/repos","events_url":"https://api.github.com/users/webguide/events{/privacy}","received_events_url":"https://api.github.com/users/webguide/received_events","type":"User","site_admin":false},"created_at":"2015-09-04T15:10:08Z","updated_at":"2015-09-04T15:10:08Z","body":"IMHO it's a good idea, and even if you will never know that, there will be many moments in the world when a developer will thank you for allowing him not to lose his work. Common users love the trash can, but even developers are happy when they do not lose hours or days of coding..."}}