本文整理汇总了PHP中SplFileInfo::getCTime方法的典型用法代码示例。如果您正苦于以下问题:PHP SplFileInfo::getCTime方法的具体用法?PHP SplFileInfo::getCTime怎么用?PHP SplFileInfo::getCTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplFileInfo
的用法示例。
在下文中一共展示了SplFileInfo::getCTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Hash constructor.
* creates a new hash set from a list of files
*
* @constructor
* @access public
* @param array $fileList
*/
public function __construct(array $fileList)
{
$this->fileList = $fileList;
foreach ($this->fileList as $filePath) {
$file = new \SplFileInfo($filePath);
// hash the file path, size and CTime using murmur
$this->hashSet[$file->getRealPath()] = murmurhash3($file->getRealPath() . $file->getSize() . $file->getCTime());
}
}
示例2: toArray
/**
* @return array
*/
public function toArray()
{
$rows = [];
$currentDir = getcwd() . DIRECTORY_SEPARATOR;
/* @var $reflection ReflectionFile */
foreach ($this->getIterator() as $reflection) {
$row = [];
$file = new \SplFileInfo($reflection->getName());
$row = array("Files" => str_replace($currentDir, "", $file->getPathName()), "Owner" => $file->getOwner(), "Group" => $file->getGroup(), "Permissions" => $file->getPerms(), "Created" => date("d.m.Y h:m:s", $file->getCTime()), "Modified" => date("d.m.Y h:m:s", $file->getMTime()));
$rows[] = $row;
}
return $rows;
}
示例3: createFileFromFileInfo
/**
* create file from SplFileInfo
*
* @param SplFileInfo $file
* @return Post
*/
private function createFileFromFileInfo(\SplFileInfo $file)
{
$post = new Post($this->getFilter());
$post->setText(file_get_contents((string) $file));
$post->setIdentifier(str_replace('.markdown', '', $file->getFilename()));
$post->setCreated($file->getCTime());
$post->setModified($file->getMTime());
$matches = array();
$found = preg_match('/#.*/', $post->getText(), $matches);
if ($found === false) {
$title = $file->getFilename();
} else {
$title = ltrim(array_shift($matches), '#');
}
$post->setTitle($title);
//parse title out of body text
return $post;
}
示例4: findAll
/**
* @inheritDoc
*/
public function findAll()
{
try {
$domainFiles = $this->finder->files('*')->depth('>= 1')->in($this->baseDir);
} catch (\InvalidArgumentException $e) {
$domainFiles = array();
}
$output = array();
foreach ($domainFiles as $file) {
$domainName = explode('/', $file->getPath());
$domainName = array_pop($domainName);
if (!array_key_exists($domainName, $output)) {
$domainDir = new \SplFileInfo($file->getPath());
$creationDate = $domainDir->getCTime();
$output[$domainName] = new Domain($creationDate);
}
$domain = $output[$domainName];
$domain->addFile($file, $this->read($file->getPathName()));
}
return $output;
}
示例5: workload_image
public function workload_image($courseInstructorId, $lastDataUpdate = null)
{
$svgFilename = WEBROOT_DIR . DS . 'img' . DS . 'stats' . DS . $courseInstructorId . DS . "{$courseInstructorId}Workload.svg";
$pngFilename = WEBROOT_DIR . DS . 'img' . DS . 'stats' . DS . $courseInstructorId . DS . "{$courseInstructorId}Workload.png";
$createFile = true;
if (!empty($lastDataUpdate) && file_exists(APP . $pngFilename)) {
$lastDataUpdate = intval($lastDataUpdate);
$fileInfo = new SplFileInfo(APP . $pngFilename);
$lastFileChange = $fileInfo->getCTime();
if ($lastDataUpdate < $lastFileChange) {
$createFile = false;
}
}
if ($createFile) {
$this->_generateWorkloadPngFromSvg(APP . $svgFilename, APP . $pngFilename);
}
$this->response->file($pngFilename);
return $this->response;
}
示例6: testDecoratedMethods
public function testDecoratedMethods()
{
$decorated = $this->getMockBuilder('hanneskod\\classtools\\Tests\\MockSplFileInfo')->setConstructorArgs([''])->getMock();
$decorated->expects($this->once())->method('getRelativePath');
$decorated->expects($this->once())->method('getRelativePathname');
$decorated->expects($this->once())->method('getContents');
$decorated->expects($this->once())->method('getATime');
$decorated->expects($this->once())->method('getBasename');
$decorated->expects($this->once())->method('getCTime');
$decorated->expects($this->once())->method('getExtension');
$decorated->expects($this->once())->method('getFileInfo');
$decorated->expects($this->once())->method('getFilename');
$decorated->expects($this->once())->method('getGroup');
$decorated->expects($this->once())->method('getInode');
$decorated->expects($this->once())->method('getLinkTarget');
$decorated->expects($this->once())->method('getMTime');
$decorated->expects($this->once())->method('getOwner');
$decorated->expects($this->once())->method('getPath');
$decorated->expects($this->once())->method('getPathInfo');
$decorated->expects($this->once())->method('getPathname');
$decorated->expects($this->once())->method('getPerms');
$decorated->expects($this->once())->method('getRealPath');
$decorated->expects($this->once())->method('getSize');
$decorated->expects($this->once())->method('getType');
$decorated->expects($this->once())->method('isDir');
$decorated->expects($this->once())->method('isExecutable');
$decorated->expects($this->once())->method('isFile');
$decorated->expects($this->once())->method('isLink');
$decorated->expects($this->once())->method('isReadable');
$decorated->expects($this->once())->method('isWritable');
$decorated->expects($this->once())->method('openFile');
$decorated->expects($this->once())->method('setFileClass');
$decorated->expects($this->once())->method('setInfoClass');
$decorated->expects($this->once())->method('__toString')->will($this->returnValue(''));
$fileInfo = new SplFileInfo($decorated);
$fileInfo->getRelativePath();
$fileInfo->getRelativePathname();
$fileInfo->getContents();
$fileInfo->getATime();
$fileInfo->getBasename();
$fileInfo->getCTime();
$fileInfo->getExtension();
$fileInfo->getFileInfo();
$fileInfo->getFilename();
$fileInfo->getGroup();
$fileInfo->getInode();
$fileInfo->getLinkTarget();
$fileInfo->getMTime();
$fileInfo->getOwner();
$fileInfo->getPath();
$fileInfo->getPathInfo();
$fileInfo->getPathname();
$fileInfo->getPerms();
$fileInfo->getRealPath();
$fileInfo->getSize();
$fileInfo->getType();
$fileInfo->isDir();
$fileInfo->isExecutable();
$fileInfo->isFile();
$fileInfo->isLink();
$fileInfo->isReadable();
$fileInfo->isWritable();
$fileInfo->openFile();
$fileInfo->setFileClass();
$fileInfo->setInfoClass();
(string) $fileInfo;
}
示例7: getCTime
public function getCTime()
{
return $this->file->getCTime();
}
示例8: date
if (!empty($_SERVER['SERVER_SOFTWARE'])) {
?>
<tr>
<td class="">Server Software</td>
<td><?php
echo $_SERVER['SERVER_SOFTWARE'];
?>
</td>
</tr>
<?php
}
?>
<tr>
<td class="">Start Time</td>
<td><?php
echo date($date_format, $file_info->getCTime());
?>
</td>
</tr>
<tr>
<td class="">Last Modified Time</td>
<td><?php
echo date($date_format, $file_info->getMTime());
?>
</td>
</tr>
</tbody>
</table>
</section>
<section>
示例9: SplFileInfo
<?php
include __DIR__ . '/../../../test/sample_dir/fix_mtimes.inc';
$info = new SplFileInfo(__DIR__ . '/../../sample_dir');
if (!$info->isFile()) {
echo $info->getRealPath();
}
$info = new SplFileInfo(__DIR__ . '/../../sample_dir/file');
var_dump($info->getbaseName());
var_dump($info->getbaseName('.cpp'));
$info->getCTime();
$info->getGroup();
$info->getInode();
$info->getMTime();
$info->getOwner();
$info->getPerms();
$info->getSize();
$info->getType();
$info->isDir();
$info->isFile();
$info->isLink();
$info->isReadable();
$info->isWritable();
示例10: fetchMetadata
/**
* Fetch item metadata
*
* @param string $key
* @return array
*/
public function fetchMetadata($key)
{
$info = new \SplFileInfo("{$this->root}/{$key}");
return array('size' => $info->getSize(), 'change_time' => $info->getCTime());
}
示例11: getCTime
public function getCTime($format = false)
{
if ($format) {
return date($format, parent::getCTime());
}
return parent::getCTime();
}
示例12: testLastChanged
/**
* @depends testExist
* @return void
*/
public function testLastChanged()
{
$filePath = __DIR__ . '/example.txt';
$fileObject = new File($filePath);
$this->assertGreaterThanOrEqual(0, $fileObject->getCTime());
$this->assertInstanceOf('DateTime', $fileObject->lastChanged());
$fileObject = new \SplFileInfo($filePath);
$this->assertGreaterThanOrEqual(0, $fileObject->getCTime());
}
示例13: getFileDetailsRawStatistic
protected function getFileDetailsRawStatistic(\SplFileInfo $info, $fileGiven)
{
return ['File is Dir' => $info->isDir(), 'File is Executable' => $info->isExecutable(), 'File is File' => $info->isFile(), 'File is Link' => $info->isLink(), 'File is Readable' => $info->isReadable(), 'File is Writable' => $info->isWritable(), 'File Permissions' => $this->explainPerms($info->getPerms()), 'Size' => $info->getSize(), 'Sha1' => sha1_file($fileGiven), 'Timestamp Accessed' => $this->getFileTimes($info->getATime()), 'Timestamp Changed' => $this->getFileTimes($info->getCTime()), 'Timestamp Modified' => $this->getFileTimes($info->getMTime())];
}
示例14: errorRemember
/**
* Check if this error is overdue of fixing
*
* Set interval via system settings
*
* @return boolean TRUE or FALSE
*/
public function errorRemember()
{
$interval = $this->modx->getOption('jslog.error_interval', '', 0);
$file = new SplFileInfo($this->config['errorPath'] . $this->error['key']);
$interval = 0;
if ($file->getCTime() < time() - $interval) {
touch($this->config['errorPath'] . $this->error['key']);
return true;
// unlink($this->config['errorPath'] . $this->error['key']);
}
return false;
}
示例15: fromSplFileInfo
/**
* Create file instance from \SplFileInfo instance.
*
* @param \SplFileInfo $file
* @param null|string $rootPath Root path of file.
* @return File
*/
public static function fromSplFileInfo(\SplFileInfo $file, $rootPath = null)
{
return new static($file->getPathname(), $rootPath, $file->getSize(), $file->getCTime(), $file->getMTime());
}