} elseif ( isset( $row->oi_name ) ) {
return call_user_func( $this->oldFileFromRowFactory, $row, $this );
} else {
- throw new MWException( __METHOD__.': invalid row' );
+ throw new MWException( __METHOD__ . ': invalid row' );
}
}
} // else $cachedValue is false or null: cache miss
$id = $this->getArticleID( $title );
- if( !$id ) {
+ if ( !$id ) {
$wgMemc->set( $memcKey, " ", $expiry );
return false;
}
__METHOD__
);
- if( $row && $row->rd_namespace == NS_FILE ) {
+ if ( $row && $row->rd_namespace == NS_FILE ) {
$targetTitle = Title::makeTitle( $row->rd_namespace, $row->rd_title );
$wgMemc->set( $memcKey, $targetTitle->getDBkey(), $expiry );
return $targetTitle;
* @return bool|int|mixed
*/
protected function getArticleID( $title ) {
- if( !$title instanceof Title ) {
+ if ( !$title instanceof Title ) {
return 0;
}
$dbr = $this->getSlaveDB();
* @return array An Array of arrays or iterators of file objects and the hash as key
*/
function findBySha1s( array $hashes ) {
- if( !count( $hashes ) ) {
+ if ( !count( $hashes ) ) {
return array(); //empty parameter
}
return $result;
}
- /**\r
- * Return an array of files where the name starts with $prefix.\r
- *\r
- * @param string $prefix The prefix to search for\r
- * @param int $limit The maximum amount of files to return\r
- * @return array\r
- */\r
+ /**
+ * Return an array of files where the name starts with $prefix.
+ *
+ * @param string $prefix The prefix to search for
+ * @param int $limit The maximum amount of files to return
+ * @return array
+ */
public function findFilesByPrefix( $prefix, $limit ) {
$selectOptions = array( 'ORDER BY' => 'img_name', 'LIMIT' => intval( $limit ) );
- // Query database\r
+ // Query database
$dbr = $this->getSlaveDB();
$res = $dbr->select(
'image',
foreach ( $res as $row ) {
$files[] = $this->newFileFromRow( $row );
}
- return $files;\r
+ return $files;
}
/**