| @@ 218-230 (lines=13) @@ | ||
| 215 | * or the empty string if not $wgFileCacheDepth |
|
| 216 | * @return string |
|
| 217 | */ |
|
| 218 | protected function hashSubdirectory() { |
|
| 219 | global $wgFileCacheDepth; |
|
| 220 | ||
| 221 | $subdir = ''; |
|
| 222 | if ( $wgFileCacheDepth > 0 ) { |
|
| 223 | $hash = md5( $this->mKey ); |
|
| 224 | for ( $i = 1; $i <= $wgFileCacheDepth; $i++ ) { |
|
| 225 | $subdir .= substr( $hash, 0, $i ) . '/'; |
|
| 226 | } |
|
| 227 | } |
|
| 228 | ||
| 229 | return $subdir; |
|
| 230 | } |
|
| 231 | ||
| 232 | /** |
|
| 233 | * Roughly increments the cache misses in the last hour by unique visitors |
|
| @@ 682-694 (lines=13) @@ | ||
| 679 | * @param int $levels |
|
| 680 | * @return string |
|
| 681 | */ |
|
| 682 | protected static function getHashPathForLevel( $name, $levels ) { |
|
| 683 | if ( $levels == 0 ) { |
|
| 684 | return ''; |
|
| 685 | } else { |
|
| 686 | $hash = md5( $name ); |
|
| 687 | $path = ''; |
|
| 688 | for ( $i = 1; $i <= $levels; $i++ ) { |
|
| 689 | $path .= substr( $hash, 0, $i ) . '/'; |
|
| 690 | } |
|
| 691 | ||
| 692 | return $path; |
|
| 693 | } |
|
| 694 | } |
|
| 695 | ||
| 696 | /** |
|
| 697 | * Get the number of hash directory levels |
|