public function __construct(\SPLFileInfo $asset, Pg $db) { $this->location = realpath($asset->getPathname()); $dbSql = $this->dbSql = $db->query(new Query("SELECT * FROM build.assets WHERE location = %location:%", array('location' => $this->location)))->fetch(Result::FETCH_SINGLE); if ($dbSql) { $diff = new Diff(); $this->diffText = $diff->diff($dbSql['sql'], file_get_contents($this->location)); } else { $this->diffText = 'Asset not in database'; } $this->message = sprintf("Database asset `%s` at %s changed at %s.\n%s", substr($asset->getBasename(), 0, -4), $this->location, date('Y-m-d H:i:s', $asset->getMTime()), $this->diffText); }
public function mTime() { return parent::getMTime(); }
<?php $fileName = 'filename.txt'; $fileInfo = new SPLFileInfo($fileName); $fileProps = array(); $fileProps['path'] = $fileInfo->getPath(); $fileProps['filename'] = $fileInfo->getFilename(); $fileProps['pathname'] = $fileInfo->getPathname(); $fileProps['perms'] = $fileInfo->getPerms(); $fileProps['inode'] = $fileInfo->getInode(); $fileProps['size'] = $fileInfo->getSize(); $fileProps['owner'] = $fileInfo->getOwner(); $fileProps['group'] = $fileInfo->getGroup(); $fileProps['atime'] = $fileInfo->getATime(); $fileProps['mtime'] = $fileInfo->getMTime(); $fileProps['ctime'] = $fileInfo->getCTime(); $fileProps['type'] = $fileInfo->getType(); $fileProps['isWritable'] = $fileInfo->isWritable(); $fileProps['isReadable'] = $fileInfo->isReadable(); $fileProps['isExecutable'] = $fileInfo->isExecutable(); $fileProps['isFile'] = $fileInfo->isFile(); $fileProps['isDir'] = $fileInfo->isDir(); $fileProps['isLink'] = $fileInfo->isLink(); var_export($fileProps);