本文整理汇总了PHP中FileBackend::getFileList方法的典型用法代码示例。如果您正苦于以下问题:PHP FileBackend::getFileList方法的具体用法?PHP FileBackend::getFileList怎么用?PHP FileBackend::getFileList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileBackend
的用法示例。
在下文中一共展示了FileBackend::getFileList方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteFiles
private function deleteFiles($container)
{
$base = self::baseStorePath();
$iter = $this->backend->getFileList(array('dir' => "{$base}/{$container}"));
if ($iter) {
foreach ($iter as $file) {
$this->backend->quickDelete(array('src' => "{$base}/{$container}/{$file}"));
}
// free the directory, to avoid Permission denied under windows on rmdir
unset($iter);
}
$this->backend->clean(array('dir' => "{$base}/{$container}", 'recursive' => 1));
}
示例2: enumFilesInStorage
/**
* Call a callback function for every public file in the repository.
* May use either the database or the filesystem.
*
* @param $callback Array|string
* @return void
*/
protected function enumFilesInStorage( $callback ) {
$publicRoot = $this->getZonePath( 'public' );
$numDirs = 1 << ( $this->hashLevels * 4 );
// Use a priori assumptions about directory structure
// to reduce the tree height of the scanning process.
for ( $flatIndex = 0; $flatIndex < $numDirs; $flatIndex++ ) {
$hexString = sprintf( "%0{$this->hashLevels}x", $flatIndex );
$path = $publicRoot;
for ( $hexPos = 0; $hexPos < $this->hashLevels; $hexPos++ ) {
$path .= '/' . substr( $hexString, 0, $hexPos + 1 );
}
$iterator = $this->backend->getFileList( array( 'dir' => $path ) );
foreach ( $iterator as $name ) {
// Each item returned is a public file
call_user_func( $callback, "{$path}/{$name}" );
}
}
}
示例3: getFileList
public function getFileList(array $params)
{
return $this->backend->getFileList($params);
}
示例4: getListingDiffRel
/**
* @param FileBackend $src
* @param FileBackend $dst
* @param string $backendRel
* @return array (rel paths in $src minus those in $dst)
*/
protected function getListingDiffRel( FileBackend $src, FileBackend $dst, $backendRel ) {
$srcPathsRel = $src->getFileList( array(
'dir' => $src->getRootStoragePath() . "/$backendRel" ) );
if ( $srcPathsRel === null ) {
$this->error( "Could not list files in source container.", 1 ); // die
}
$dstPathsRel = $dst->getFileList( array(
'dir' => $dst->getRootStoragePath() . "/$backendRel" ) );
if ( $dstPathsRel === null ) {
$this->error( "Could not list files in destination container.", 1 ); // die
}
// Get the list of destination files
$relFilesDstSha1 = array();
foreach ( $dstPathsRel as $dstPathRel ) {
$relFilesDstSha1[sha1( $dstPathRel )] = 1;
}
unset( $dstPathsRel ); // free
// Get the list of missing files
$missingPathsRel = array();
foreach ( $srcPathsRel as $srcPathRel ) {
if ( !isset( $relFilesDstSha1[sha1( $srcPathRel )] ) ) {
$missingPathsRel[] = $srcPathRel;
}
}
unset( $srcPathsRel ); // free
return $missingPathsRel;
}