/**
* Base code for files.
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
* @file
* @ingroup FileAbstraction
*/
*/
protected $url, $extension, $name, $path, $hashPath, $pageCount, $transformScript;
+ protected $redirectTitle;
+
/**
* @var bool
*/
*
* @param $title Title|string
* @param $exception string|bool Use 'exception' to throw an error on bad titles
+ * @throws MWException
* @return Title|null
*/
static function normalizeTitle( $title, $exception = false ) {
}
}
+ // If the backend is ready-only, don't keep generating thumbnails
+ // only to return transformation errors, just return the error now.
+ if ( $this->repo->getReadOnlyReason() !== false ) {
+ $thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags );
+ break;
+ }
+
// Create a temp FS file with the same extension and the thumbnail
$thumbExt = FileBackend::extensionFromPath( $thumbPath );
$tmpFile = TempFSFile::factory( 'transform_', $thumbExt );
$thumb = $this->handler->getTransform( $this, $tmpThumbPath, $thumbUrl, $params );
}
} elseif ( $this->repo && $thumb->hasFile() && !$thumb->fileIsSource() ) {
- $backend = $this->repo->getBackend();
// Copy the thumbnail from the file system into storage...
$status = $this->repo->quickImport( $tmpThumbPath, $thumbPath );
if ( $status->isOK() ) {
} else {
$thumb = $this->transformErrorOutput( $thumbPath, $thumbUrl, $params, $flags );
}
+ // Give extensions a chance to do something with this thumbnail...
+ wfRunHooks( 'FileTransformed', array( $this, $thumb, $tmpThumbPath, $thumbPath ) );
}
// Purge. Useful in the event of Core -> Squid connection failure or squid
*
* @return array
*/
- function getHistory($limit = null, $start = null, $end = null, $inc=true) {
+ function getHistory( $limit = null, $start = null, $end = null, $inc=true ) {
return array();
}