本文整理汇总了PHP中LocalRepo::findFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP LocalRepo::findFiles方法的具体用法?PHP LocalRepo::findFiles怎么用?PHP LocalRepo::findFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalRepo
的用法示例。
在下文中一共展示了LocalRepo::findFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: findFiles
function findFiles($inputItems)
{
if (!$this->reposInitialised) {
$this->initialiseRepos();
}
$items = array();
foreach ($inputItems as $item) {
if (!is_array($item)) {
$item = array('title' => $item);
}
if (!$item['title'] instanceof Title) {
$item['title'] = Title::makeTitleSafe(NS_FILE, $item['title']);
}
if ($item['title']) {
$items[$item['title']->getDBkey()] = $item;
}
}
$images = $this->localRepo->findFiles($items);
foreach ($this->foreignRepos as $repo) {
// Remove found files from $items
foreach ($images as $name => $image) {
unset($items[$name]);
}
$images = array_merge($images, $repo->findFiles($items));
}
return $images;
}
示例2: findFiles
/**
* Search repositories for many files at once.
*
* @param array $items An array of titles, or an array of findFile() options with
* the "title" option giving the title. Example:
*
* $findItem = array( 'title' => $title, 'private' => true );
* $findBatch = array( $findItem );
* $repo->findFiles( $findBatch );
*
* No title should appear in $items twice, as the result use titles as keys
* @param int $flags Supports:
* - FileRepo::NAME_AND_TIME_ONLY : return a (search title => (title,timestamp)) map.
* The search title uses the input titles; the other is the final post-redirect title.
* All titles are returned as string DB keys and the inner array is associative.
* @return array Map of (file name => File objects) for matches
*
* @param array $inputItems
* @param integer $flags
* @return array
*/
function findFiles(array $inputItems, $flags = 0)
{
if (!$this->reposInitialised) {
$this->initialiseRepos();
}
$items = array();
foreach ($inputItems as $item) {
if (!is_array($item)) {
$item = array('title' => $item);
}
$item['title'] = File::normalizeTitle($item['title']);
if ($item['title']) {
$items[$item['title']->getDBkey()] = $item;
}
}
$images = $this->localRepo->findFiles($items, $flags);
foreach ($this->foreignRepos as $repo) {
// Remove found files from $items
foreach ($images as $name => $image) {
unset($items[$name]);
}
$images = array_merge($images, $repo->findFiles($items, $flags));
}
return $images;
}