From: Aaron Schulz Date: Fri, 28 Oct 2011 22:21:03 +0000 (+0000) Subject: FU r100716: X-Git-Tag: 1.31.0-rc.0~26839 X-Git-Url: http://git.cyclocoop.org/%22%2C%20generer_url_ecrire%28?a=commitdiff_plain;h=d3cb63fb5bd8cc57e3ba92960ec4f56a9f0dae88;p=lhc%2Fweb%2Fwiklou.git FU r100716: * Pass the File object in LocalFilePurgeThumbnails so handlers can use the getRel() functions and such * Also added the hook to hooks.txt, as this could be useful for other caches or things in thumb_handler.php --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 5b5234fb3e..7eeed9f020 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1177,13 +1177,17 @@ completed &updater: A DatabaseUpdater subclass 'LocalFile::getHistory': called before file history query performed -$file: the file +$file: the File object $tables: tables $fields: select fields $conds: conditions $opts: query options $join_conds: JOIN conditions +'LocalFilePurgeThumbnails': called before thumbnails for a local file a purged +$file: the File object +$type: either "current" or "archive" + 'LocalisationCacheRecache': Called when loading the localisation data into cache $cache: The LocalisationCache object $code: language code diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index c26812a9fe..c3f04522f9 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -691,7 +691,7 @@ class LocalFile extends File { */ function purgeOldThumbnails( $archiveName ) { global $wgUseSquid; - // get a list of old thumbnails and URLs + // Get a list of old thumbnails and URLs $files = $this->getThumbnails( $archiveName ); $dir = array_shift( $files ); $this->purgeThumbList( $dir, $files ); @@ -705,8 +705,8 @@ class LocalFile extends File { } wfRestoreWarnings(); - # Temporary hook for purging Swift thumbnail cache - wfRunHooks( 'LocalFilePurgeThumbnails', array( $dir, 'old' ) ); + // Purge any custom thumbnail caches + wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, 'archive' ) ); // Purge the squid if ( $wgUseSquid ) { @@ -730,8 +730,8 @@ class LocalFile extends File { $dir = array_shift( $files ); $this->purgeThumbList( $dir, $files ); - # Temporary hook for purging Swift thumbnail cache - wfRunHooks( 'LocalFilePurgeThumbnails', array( $dir, 'current' ) ); + // Purge any custom thumbnail caches + wfRunHooks( 'LocalFilePurgeThumbnails', array( $this, 'current' ) ); // Purge the squid if ( $wgUseSquid ) {