Index: trunk/phase3/includes/filerepo/File.php |
— | — | @@ -892,13 +892,18 @@ |
893 | 893 | /** |
894 | 894 | * Get the relative path for an archived file |
895 | 895 | * |
896 | | - * @param $archiveName string the timestamped name of an archived image |
897 | | - * @param $suffix bool|string if not false, the name of a thumbnail file |
| 896 | + * @param $suffix bool|string if not false, the name of an archived thumbnail file |
898 | 897 | * |
899 | 898 | * @return string |
900 | 899 | */ |
901 | | - function getArchiveRel( $archiveName ) { |
902 | | - return 'archive/' . $this->getHashPath() . $archiveName; |
| 900 | + function getArchiveRel( $suffix = false ) { |
| 901 | + $path = 'archive/' . $this->getHashPath(); |
| 902 | + if ( $suffix === false ) { |
| 903 | + $path = substr( $path, 0, -1 ); |
| 904 | + } else { |
| 905 | + $path .= $suffix; |
| 906 | + } |
| 907 | + return $path; |
903 | 908 | } |
904 | 909 | |
905 | 910 | /** |
— | — | @@ -921,12 +926,12 @@ |
922 | 927 | /** |
923 | 928 | * Get the path of the archived file. |
924 | 929 | * |
925 | | - * @param $archiveName the timestamped name of an archived image |
| 930 | + * @param $suffix bool|string if not false, the name of an archived file. |
926 | 931 | * |
927 | 932 | * @return string |
928 | 933 | */ |
929 | | - function getArchivePath( $archiveName ) { |
930 | | - return $this->repo->getZonePath( 'public' ) . '/' . $this->getArchiveRel( $archiveName ); |
| 934 | + function getArchivePath( $suffix = false ) { |
| 935 | + return $this->repo->getZonePath( 'public' ) . '/' . $this->getArchiveRel( $suffix ); |
931 | 936 | } |
932 | 937 | |
933 | 938 | /** |
— | — | @@ -957,14 +962,20 @@ |
958 | 963 | } |
959 | 964 | |
960 | 965 | /** |
961 | | - * Get the URL of the archived file |
| 966 | + * Get the URL of the archive directory, or a particular file if $suffix is specified |
962 | 967 | * |
963 | | - * @param $archiveName string |
| 968 | + * @param $suffix bool|string if not false, the name of an archived file |
964 | 969 | * |
965 | 970 | * @return string |
966 | 971 | */ |
967 | | - function getArchiveUrl( $archiveName ) { |
968 | | - return $this->repo->getZoneUrl('public') . '/archive/' . $this->getHashPath() . rawurlencode( $archiveName ); |
| 972 | + function getArchiveUrl( $suffix = false ) { |
| 973 | + $path = $this->repo->getZoneUrl('public') . '/archive/' . $this->getHashPath(); |
| 974 | + if ( $suffix === false ) { |
| 975 | + $path = substr( $path, 0, -1 ); |
| 976 | + } else { |
| 977 | + $path .= rawurlencode( $suffix ); |
| 978 | + } |
| 979 | + return $path; |
969 | 980 | } |
970 | 981 | |
971 | 982 | /** |