| 1 | <?php  | 
            ||
| 5 | class VersionedUploadExtension extends Extension  | 
            ||
| 6 | { | 
            ||
| 7 | /**  | 
            ||
| 8 | * There is some duplication in the Upload: replaceFile functionality and the versionedFiles replace  | 
            ||
| 9 | * functionality. With the CMS replace function the versionedFiles replace does't work and vice-versa.  | 
            ||
| 10 | * This extension detects if the replaceFile config setting is turned on and hooks in to add create  | 
            ||
| 11 | * a new version on each upload from the CMS, if that is the case.  | 
            ||
| 12 | * @param $file File - the uploaded File object  | 
            ||
| 13 | */  | 
            ||
| 14 | public function onAfterLoad($file)  | 
            ||
| 20 | }  | 
            ||
| 21 |