@@ 57-62 (lines=6) @@ | ||
54 | } |
|
55 | ||
56 | $file = wfFindFile( $title, [ 'latest' => true ] ); |
|
57 | if ( !$file ) { |
|
58 | $r['result'] = 'Failure'; |
|
59 | $r['errormessage'] = 'File does not exist'; |
|
60 | $result[] = $r; |
|
61 | continue; |
|
62 | } |
|
63 | $handler = $file->getHandler(); |
|
64 | if ( !$handler || !$handler->canRotate() ) { |
|
65 | $r['result'] = 'Failure'; |
|
@@ 64-69 (lines=6) @@ | ||
61 | continue; |
|
62 | } |
|
63 | $handler = $file->getHandler(); |
|
64 | if ( !$handler || !$handler->canRotate() ) { |
|
65 | $r['result'] = 'Failure'; |
|
66 | $r['errormessage'] = 'File type cannot be rotated'; |
|
67 | $result[] = $r; |
|
68 | continue; |
|
69 | } |
|
70 | ||
71 | // Check whether we're allowed to rotate this file |
|
72 | $permError = $this->checkPermissions( $this->getUser(), $file->getTitle() ); |
|
@@ 73-78 (lines=6) @@ | ||
70 | ||
71 | // Check whether we're allowed to rotate this file |
|
72 | $permError = $this->checkPermissions( $this->getUser(), $file->getTitle() ); |
|
73 | if ( $permError !== null ) { |
|
74 | $r['result'] = 'Failure'; |
|
75 | $r['errormessage'] = $permError; |
|
76 | $result[] = $r; |
|
77 | continue; |
|
78 | } |
|
79 | ||
80 | $srcPath = $file->getLocalRefPath(); |
|
81 | if ( $srcPath === false ) { |
|
@@ 81-86 (lines=6) @@ | ||
78 | } |
|
79 | ||
80 | $srcPath = $file->getLocalRefPath(); |
|
81 | if ( $srcPath === false ) { |
|
82 | $r['result'] = 'Failure'; |
|
83 | $r['errormessage'] = 'Cannot get local file path'; |
|
84 | $result[] = $r; |
|
85 | continue; |
|
86 | } |
|
87 | $ext = strtolower( pathinfo( "$srcPath", PATHINFO_EXTENSION ) ); |
|
88 | $tmpFile = TempFSFile::factory( 'rotate_', $ext, wfTempDir() ); |
|
89 | $dstPath = $tmpFile->getPath(); |