From: Bartosz DziewoƄski Date: Tue, 29 Mar 2016 16:09:05 +0000 (+0200) Subject: refreshImageMetadata: Allow filtering by 'img_media_type' too X-Git-Tag: 1.31.0-rc.0~7469^2 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=ed3b46d25950118fce7db3c0486a1e7a67c82aa9;p=lhc%2Fweb%2Fwiklou.git refreshImageMetadata: Allow filtering by 'img_media_type' too Unlike 'img_major_mime' and 'img_minor_mime', this shouldn't be "inefficient", since there's an index on it. Bug: T131157 Change-Id: I4985cade41c23ef68f5caf276d4934cf24de2bb6 --- diff --git a/maintenance/refreshImageMetadata.php b/maintenance/refreshImageMetadata.php index 88767de2d1..bdbb347899 100644 --- a/maintenance/refreshImageMetadata.php +++ b/maintenance/refreshImageMetadata.php @@ -68,9 +68,16 @@ class RefreshImageMetadata extends Maintenance { $this->addOption( 'start', 'Name of file to start with', false, true ); $this->addOption( 'end', 'Name of file to end with', false, true ); + $this->addOption( + 'mediatype', + 'Only refresh files with this media type, e.g. BITMAP, UNKNOWN etc.', + false, + true + ); $this->addOption( 'mime', - '(Inefficient!) Only refresh files with this MIME type. Can accept wild-card image/*', + "Only refresh files with this MIME type. Can accept wild-card 'image/*'. " + . "Potentially inefficient unless 'mediatype' is also specified", false, true ); @@ -197,6 +204,7 @@ class RefreshImageMetadata extends Maintenance { $end = $this->getOption( 'end', false ); $mime = $this->getOption( 'mime', false ); + $mediatype = $this->getOption( 'mediatype', false ); $like = $this->getOption( 'metadata-contains', false ); if ( $end !== false ) { @@ -209,6 +217,9 @@ class RefreshImageMetadata extends Maintenance { $conds['img_minor_mime'] = $minor; } } + if ( $mediatype !== false ) { + $conds['img_media_type'] = $mediatype; + } if ( $like ) { $conds[] = 'img_metadata ' . $dbw->buildLike( $dbw->anyString(), $like, $dbw->anyString() ); }