'image',
LocalFile::selectFields(),
array( 'img_sha1' => $hash ),
- __METHOD__
+ __METHOD__,
+ array( 'ORDER BY' => 'img_name' )
);
$result = array();
foreach ( $this->foreignRepos as $repo ) {
$result = array_merge( $result, $repo->findBySha1( $hash ) );
}
+ usort( $result, 'File::compare' );
return $result;
}
}
}
+ /**
+ * Callback for usort() to do file sorts by title
+ *
+ * @param $a File
+ * @param $b File
+ *
+ * @return Integer: result of title comparison
+ */
+ public static function compare( File $a, File $b ) {
+ return Title::compare( $a->getTitle(), $b->getTitle() );
+ }
+
/**
* Return the name of this file
*