本文整理汇总了PHP中OC_Filesystem::stat方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Filesystem::stat方法的具体用法?PHP OC_Filesystem::stat怎么用?PHP OC_Filesystem::stat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OC_Filesystem
的用法示例。
在下文中一共展示了OC_Filesystem::stat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDirectoryContent
/**
* get the content of a directory
* @param dir $directory
*/
public static function getDirectoryContent($directory)
{
if (strpos($directory, OC::$CONFIG_DATADIRECTORY) === 0) {
$directory = substr($directory, strlen(OC::$CONFIG_DATADIRECTORY));
}
$filesfound = true;
$content = array();
$dirs = array();
$file = array();
$files = array();
if (OC_Filesystem::is_dir($directory)) {
if ($dh = OC_Filesystem::opendir($directory)) {
while (($filename = readdir($dh)) !== false) {
if ($filename != '.' and $filename != '..' and substr($filename, 0, 1) != '.') {
$file = array();
$filesfound = true;
$file['name'] = $filename;
$file['directory'] = $directory;
$stat = OC_Filesystem::stat($directory . '/' . $filename);
$file = array_merge($file, $stat);
$file['size'] = OC_Filesystem::filesize($directory . '/' . $filename);
$file['mime'] = OC_Files::getMimeType($directory . '/' . $filename);
$file['readable'] = OC_Filesystem::is_readable($directory . '/' . $filename);
$file['writeable'] = OC_Filesystem::is_writeable($directory . '/' . $filename);
$file['type'] = OC_Filesystem::filetype($directory . '/' . $filename);
if ($file['type'] == 'dir') {
$dirs[$file['name']] = $file;
} else {
$files[$file['name']] = $file;
}
}
}
closedir($dh);
}
}
uksort($dirs, "strnatcasecmp");
uksort($files, "strnatcasecmp");
$content = array_merge($dirs, $files);
if ($filesfound) {
return $content;
} else {
return false;
}
}
示例2: stat
/**
* Set the stat cache
*/
protected function stat()
{
if (!isset($this->stat_cache)) {
$this->stat_cache = OC_Filesystem::stat($this->path);
}
}
示例3: getFileinfoCache
/**
* Make sure the fileinfo cache is filled. Uses OC_FileCache or a direct stat
*/
protected function getFileinfoCache()
{
if (!isset($this->fileinfo_cache)) {
if ($fileinfo_cache = OC_FileCache::get($this->path)) {
} else {
$fileinfo_cache = OC_Filesystem::stat($this->path);
}
$this->fileinfo_cache = $fileinfo_cache;
}
}