本文整理汇总了PHP中fileatime函数的典型用法代码示例。如果您正苦于以下问题:PHP fileatime函数的具体用法?PHP fileatime怎么用?PHP fileatime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fileatime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$path = TMPL_PATH . 'Home/pigcms';
foreach (glob($path . '/*') as $k => $item) {
if (is_file($item)) {
if (strstr($item, 'about')) {
$list[$k]['name'] = '关于我们';
$list[$k]['m_name'] = $item;
$list[$k]['m_time'] = filemtime($item);
$list[$k]['c_time'] = filectime($item);
$list[$k]['a_time'] = fileatime($item);
} elseif (strstr($item, 'fc')) {
$list[$k]['name'] = '功能介绍';
$list[$k]['m_name'] = $item;
$list[$k]['m_time'] = filemtime($item);
$list[$k]['c_time'] = filectime($item);
$list[$k]['a_time'] = fileatime($item);
} elseif (strstr($item, 'price')) {
$list[$k]['name'] = '资费';
$list[$k]['m_name'] = $item;
$list[$k]['m_time'] = filemtime($item);
$list[$k]['c_time'] = filectime($item);
$list[$k]['a_time'] = fileatime($item);
} elseif (strstr($item, 'help')) {
$list[$k]['name'] = '帮助';
$list[$k]['m_name'] = $item;
$list[$k]['m_time'] = filemtime($item);
$list[$k]['c_time'] = filectime($item);
$list[$k]['a_time'] = fileatime($item);
}
}
}
$this->assign('list', $list);
$this->display();
}
开发者ID:ww102111,项目名称:weixin,代码行数:35,代码来源:CustomAction.class.php
示例2: sweep
public static function sweep()
{
$watch_path = LookoutController::watchPath();
$inactive_users = array();
$orig_dir = getcwd();
chdir($watch_path);
$worked = false;
$watch_files = glob('*.sess');
foreach ($watch_files as $file) {
$file_access_time = fileatime($file);
$current_time = time();
$inactive = $current_time - $file_access_time > MAX_INACTIVE_TIME;
if ($inactive) {
$userid = explode('.', $file);
array_push($inactive_users, $userid[0]);
}
$worked = true;
}
chdir($orig_dir);
if (sizeof($inactive_users) > 0) {
LookoutController::deleteInactiveWatch($inactive_users);
AuthenticationController::autoLogout($inactive_users);
$worked = true;
}
return $worked;
}
开发者ID:ademolaoduguwa,项目名称:pms,代码行数:26,代码来源:LookoutController.php
示例3: execute
public function execute()
{
global $CFG, $DB;
$deleted_files_num = 0;
$deleted_filesize_num = 0;
$undeleted_filesize_num = 0;
$directory = $CFG->dirroot . '/mod/quiz/report/nitroreportpdf/cache';
$now = strtotime('now');
$handle = opendir($directory);
while (FALSE !== ($item = readdir($handle))) {
$path = $directory . '/' . $item;
if ($item != '.' || $item != '..') {
if ($now >= fileatime($path) + 21600 || $now >= filectime($path) + 21600 || $now >= filemtime($path) + 21600) {
$deleted_files_num++;
$deleted_filesize_num += filesize($path);
unlink($path);
} else {
$undeleted_filesize_num += filesize($path);
}
}
}
closedir($handle);
echo "... Deleted files: " . $deleted_files_num . " \r\n";
echo "... Free Space: " . number_format($deleted_filesize_num / 1048576, 2, '.', '') . " MB \r\n";
echo "... Busy Space: " . number_format($undeleted_filesize_num / 1048576, 2, '.', '') . " MB \r\n";
}
开发者ID:nitro2010,项目名称:nitro_moodle_plugins,代码行数:26,代码来源:clearcache.php
示例4: getContent
public function getContent()
{
$url = $this->getConfigVar('feed_url');
if ($url == '') {
return 'Enter a RSS Feed in this Widget configuration.';
}
// Cache File path
$cacheFile = PATH_site . 'typo3temp/mydashboard' . substr(md5($url . $this->getConfigVar('feed_title')), 0, 15) . '.cache';
// Update rules
$updateRSS = isset($_POST['ajax']) && isset($_POST['action']) && $_POST['action'] == 'refresh';
// Load a Cache File
if (file_exists($cacheFile) && !$updateRSS) {
$fileinfo = fileatime($cacheFile);
if ($fileinfo > time() - (int) $this->getConfigVar('cache_time_h')) {
$data = $this->loadRSSData($cacheFile);
return $this->renderRSSArray($data);
}
# if
}
# if
// Load the rss2array class and fetch the RSS Feed
require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('mydashboard', 'widgets/helper/rss2array.php');
$rss_array = rss2array($url);
// Safe the Feed in a Cache File
$this->safeRSSData($cacheFile, $rss_array);
return $this->renderRSSArray($rss_array);
}
开发者ID:7elix,项目名称:mydashboard,代码行数:27,代码来源:class.tx_mydashboard_rssfeed.php
示例5: index
public function index($id=null)
{
if ($id==null)
{
$data=PATH_APP.'data/inventory.data';
$maxtime=(isset($_GET['refresh'])) ? -300 : 300;
if ((file_exists($data)) && (fileatime($data)>(time()-$maxtime)))
$slices=unserialize(file_get_contents($data));
else
{
$slices=$this->slicehost->slices;
file_put_contents($data,serialize($slices));
}
return array(
'slice' => null,
'slices' => $slices
);
}
$slice=new SliceResource($this->slicehost,$id);
return array(
'slice' => $slice,
'slices' => null,
'images' => $this->slicehost->images,
'backups' => $this->slicehost->backups,
'flavors' => $this->slicehost->flavors
);
}
开发者ID:jawngee,项目名称:Thor,代码行数:31,代码来源:slices.php
示例6: testComprobarArchivos
public function testComprobarArchivos()
{
$CarpetaRespaldos = POS_PATH_TO_SERVER_ROOT . "/../static_content/db_backups/";
$nArchivos = 0;
$directorio = dir($CarpetaRespaldos);
$d1 = date("d", time());
//Dia Actual
$d2 = null;
$m1 = date("m", time());
//Mes actual
$m2 = null;
$a1 = date("y", time());
//Año actual
$a2 = null;
while ($archivo = $directorio->read()) {
//Cada nombre de archivo debe medir 30 caracteres
if (strlen($archivo) > 2) {
$d2 = date("d", fileatime($CarpetaRespaldos . $archivo));
$m2 = date("m", fileatime($CarpetaRespaldos . $archivo));
$a2 = date("y", fileatime($CarpetaRespaldos . $archivo));
if (substr($archivo, 10, 14) == "_pos_instance_" && substr($archivo, strlen($archivo) - 4, 4) == ".sql") {
$nArchivos++;
}
if ($d1 > $d2 + 7 || $m1 > $m2 || $a1 > $a2 && (substr($archivo, 10, 14) == "_pos_instance_" && substr($archivo, strlen($archivo) - 3, 3) == "sql")) {
//Comprueba que se borró correctamente el archivo viejo
$this->assertTrue(unlink($CarpetaRespaldos . $archivo));
}
}
}
$directorio->close();
}
开发者ID:kailIII,项目名称:pos-erp,代码行数:31,代码来源:InstanciasControllerTest.php
示例7: build
public function build($file, $mode = false)
{
$files = $this->getBuilderArr($this->getBuilderJsonArr(), $file);
if (count($files) == 0) {
throw NGS()->getDebugException("Please add less files in builder");
}
$options = array();
if ($mode) {
$options["compress"] = true;
}
$this->lessParser = new \Less_Parser($options);
$this->lessParser->parse('@NGS_PATH: "' . NGS()->getHttpUtils()->getHttpHost(true) . '";');
$this->lessParser->parse('@NGS_MODULE_PATH: "' . NGS()->getPublicHostByNS() . '";');
$this->setLessFiles($files);
if ($mode) {
$outFileName = $files["output_file"];
if ($this->getOutputFileName() != null) {
$outFileName = $this->getOutputFileName();
}
$outFile = $this->getOutputDir() . "/" . $outFileName;
touch($outFile, fileatime($this->getBuilderFile()));
file_put_contents($outFile, $this->lessParser->getCss());
exit;
return true;
}
header('Content-type: ' . $this->getContentType());
echo $this->lessParser->getCss();
exit;
}
开发者ID:pars5555,项目名称:crm,代码行数:29,代码来源:LessBuilder.class.php
示例8: listFile
public function listFile($pathname, $pattern = "*")
{
static $_listDirs = array();
$guid = md5($pathname . $pattern);
if (!isset($_listDirs[$guid])) {
$dir = array();
$list = glob($pathname . $pattern);
foreach ($list as $i => $file) {
$dir[$i]["filename"] = preg_replace("/^.+[\\\\\\/]/", "", $file);
$dir[$i]["pathname"] = realpath($file);
$dir[$i]["owner"] = fileowner($file);
$dir[$i]["perms"] = fileperms($file);
$dir[$i]["inode"] = fileinode($file);
$dir[$i]["group"] = filegroup($file);
$dir[$i]["path"] = dirname($file);
$dir[$i]["atime"] = fileatime($file);
$dir[$i]["ctime"] = filectime($file);
$dir[$i]["size"] = filesize($file);
$dir[$i]["type"] = filetype($file);
$dir[$i]["ext"] = is_file($file) ? strtolower(substr(strrchr(basename($file), "."), 1)) : "";
$dir[$i]["mtime"] = filemtime($file);
$dir[$i]["isDir"] = is_dir($file);
$dir[$i]["isFile"] = is_file($file);
$dir[$i]["isLink"] = is_link($file);
$dir[$i]["isReadable"] = is_readable($file);
$dir[$i]["isWritable"] = is_writable($file);
}
$cmp_func = create_function("\$a,\$b", "\r\n\t\t\t\$k = \"isDir\";\r\n\t\t\tif(\$a[\$k] == \$b[\$k]) return 0;\r\n\t\t\treturn \$a[\$k]>\$b[\$k]?-1:1;\r\n\t\t\t");
usort($dir, $cmp_func);
$this->_values = $dir;
$_listDirs[$guid] = $dir;
} else {
$this->_values = $_listDirs[$guid];
}
}
开发者ID:AxelPanda,项目名称:ibos,代码行数:35,代码来源:Dir.php
示例9: getLastAccessedAt
/**
* Gets last access time.
*
* @return DateTime
*/
public function getLastAccessedAt()
{
$timestamp = fileatime($this->pathname);
$time = new DateTime();
$time->setTimestamp($timestamp);
return $time;
}
开发者ID:phootwork,项目名称:file,代码行数:12,代码来源:FileOperationTrait.php
示例10: doBuild
protected function doBuild($file)
{
$files = $this->getBuilderArr(json_decode(file_get_contents($this->getBuilderFile())), $file);
if (!$files) {
return;
}
$outDir = $this->getOutputDir();
$buf = "";
foreach ($files["files"] as $value) {
$module = "";
if ($value["module"] == null) {
$module = "ngs";
}
$inputFile = realpath(NGS()->getCssDir($module) . "/" . trim($value["file"]));
if (!$inputFile) {
throw new DebugException($filePath . " not found");
}
$buf .= file_get_contents($inputFile) . "\n\r";
}
if ($files["compress"] == true) {
$buf = $this->doCompress($buf);
}
touch($outDir . "/" . $files["output_file"], fileatime($this->getBuilderFile()));
file_put_contents($outDir . "/" . $files["output_file"], $buf);
}
开发者ID:naghashyan,项目名称:Naghashyan-PHP-Framework-Core,代码行数:25,代码来源:CssBuilder.php
示例11: clearCachePostProc
/**
* Clear cache post processor
*
* This method deletes all temporary files that are older than one month and
* if the deletion of the whole cache is requested.
*
* @param object $params parameter array
* @return void
*/
public function clearCachePostProc(&$params) {
if ($params['cacheCmd'] !== 'all') {
return;
}
$now = time();
foreach ($this->tempDirectories as $tempDirectory => $maxAge) {
if (!is_dir($tempDirectory)) {
continue;
}
$handle = opendir($tempDirectory);
while (FALSE !== ($file = readdir($handle))) {
if ($file === '.' || $file === '..') {
continue;
}
if (is_file($tempDirectory . $file)) {
// get last modification time
$lastAccess = fileatime($tempDirectory . $file);
$age = $now - $lastAccess;
if ($age >= $maxAge) {
unlink($tempDirectory . $file);
}
}
}
}
}
开发者ID:rafu1987,项目名称:t3bootstrap-project,代码行数:39,代码来源:class.tx_scriptmerger_cache.php
示例12: cleanup_location
function cleanup_location($temp_disk)
{
global $id;
$list = scandir($temp_disk);
if ($list === false) {
return false;
}
$wait_seconds = 60;
// After a minute of not being accessed or modified,
// we assume that the file is an orphan.
foreach ($list as $entry) {
$path = "{$temp_disk}/{$entry}";
if (is_file($path)) {
$access_interval = time() - fileatime($path);
$modify_interval = time() - filemtime($path);
if ($access_interval > $wait_seconds && $modify_interval > $wait_seconds) {
syslog(LOG_WARNING, "get_archive.php?id={$id}: found what appears to be orphan file {$path}: has not been (accessed,modified) for ({$access_interval},{$modify_interval}) seconds. Deleting it.");
if (unlink($path)) {
syslog(LOG_ERR, "get_archive.php?id={$id}: error unlinking {$path}");
}
}
}
}
return true;
}
开发者ID:pegahgh,项目名称:kaldi-asr,代码行数:25,代码来源:get_archive.php
示例13: cacheData
public function cacheData($key, $value = '', $cacheTime = 0)
{
$filename = $this->_dir . $key . self::EXT;
if ($value !== '') {
if (is_null($value)) {
return @unlink($filename);
}
$dir = dirname($filename);
if (!is_dir($dir)) {
mkdir($dir, 0777);
}
$cacheTime = sprintf('%011d', $cacheTime);
return file_put_contents($filename, $cacheTime . json_encode($value));
}
if (!is_file($filename)) {
return FALSE;
}
$contents = file_get_contents($filename, true);
$cacheTime = (int) substr($contents, 0, 11);
$value = substr($contents, 11);
if ($cacheTime != 0 && $cacheTime + fileatime($filename) < time()) {
unlink($filename);
return FALSE;
}
return json_decode($value, true);
}
开发者ID:oMengLvRong,项目名称:APP-Server-PHP-Demo,代码行数:26,代码来源:file.php
示例14: find_old_files
function find_old_files($dirname, $before_date)
{
$dir = new DirectoryIterator($dirname);
foreach ($dir as $file) {
if ($file->isDot()) {
continue;
}
if ($file->getFilename() == 'kfm') {
continue;
}
$fname = $dirname . '/' . $file->getFilename();
if (is_dir($fname)) {
find_old_files($fname, $before_date);
} else {
$delete = fileatime($fname) < $before_date;
if (!$delete) {
continue;
}
$GLOBALS['deleted']++;
$GLOBALS['saved'] += filesize($fname);
echo date('Y-m-d', fileatime($fname)) . ' ' . $fname . '<br />';
unlink($fname);
}
}
}
开发者ID:AmandaSyachri,项目名称:webworks-webme,代码行数:25,代码来源:remove-old-caches.php
示例15: getLastAccessTime
public function getLastAccessTime()
{
if (!$this->isExists()) {
throw new FileNotFoundException($this->originalPath);
}
return fileatime($this->getPhysicalPath());
}
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:7,代码来源:file.php
示例16: get_recent_audiomark
function get_recent_audiomark()
{
// get the most recent filename
$files_in_directory = scandir(AUDIO_FOLDER);
$recent_file_name = '';
$recent_file_access_time = 0;
foreach ($files_in_directory as $file) {
if ($file == '.' || $file == '..') {
continue;
}
$file_time = fileatime(AUDIO_FOLDER . $file);
if ($file_time > $recent_file_access_time) {
$recent_file_access_time = $file_time;
$recent_file_name = $file;
}
}
// get file as binary string
$filename = AUDIO_FOLDER . $file;
try {
$handle = fopen($filename, "rb");
$filecontent = fread($handle, filesize($filename));
fclose($handle);
} catch (Exception $e) {
echo 'Problem: ', $e->getMessage(), "\n";
}
$filecontent = addslashes($filecontent);
return $filecontent;
}
开发者ID:ulfst,项目名称:radiomark-yourls-plugin,代码行数:28,代码来源:functions.php
示例17: listFile
public function listFile($pathname, $pattern = '*')
{
static $_listDirs = array();
$guid = md5($pathname . $pattern);
if (!isset($_listDirs[$guid])) {
$dir = array();
$list = glob($pathname . $pattern);
foreach ($list as $i => $file) {
$dir[$i]['filename'] = basename($file);
$dir[$i]['pathname'] = realpath($file);
$dir[$i]['owner'] = fileowner($file);
$dir[$i]['perms'] = fileperms($file);
$dir[$i]['inode'] = fileinode($file);
$dir[$i]['group'] = filegroup($file);
$dir[$i]['path'] = dirname($file);
$dir[$i]['atime'] = fileatime($file);
$dir[$i]['ctime'] = filectime($file);
$dir[$i]['size'] = filesize($file);
$dir[$i]['type'] = filetype($file);
$dir[$i]['ext'] = is_file($file) ? strtolower(substr(strrchr(basename($file), '.'), 1)) : '';
$dir[$i]['mtime'] = filemtime($file);
$dir[$i]['isDir'] = is_dir($file);
$dir[$i]['isFile'] = is_file($file);
$dir[$i]['isLink'] = is_link($file);
$dir[$i]['isReadable'] = is_readable($file);
$dir[$i]['isWritable'] = is_writable($file);
}
$cmp_func = create_function('$a,$b', '' . "\r\n" . ' $k = "isDir";' . "\r\n" . ' if($a[$k] == $b[$k]) return 0;' . "\r\n" . ' return $a[$k]>$b[$k]?-1:1;' . "\r\n" . ' ');
usort($dir, $cmp_func);
$this->_values = $dir;
$_listDirs[$guid] = $dir;
} else {
$this->_values = $_listDirs[$guid];
}
}
开发者ID:fkssei,项目名称:pigcms10,代码行数:35,代码来源:Dir.class.php
示例18: setFileInformations
/**
* collect all fileinformations of given file and
* save them to the global fileinformation array
*
* @param string $file
* @return boolean is valid file?
*/
protected function setFileInformations($file)
{
$this->fileInfo = array();
// reset previously information to have a cleaned object
$this->file = $file instanceof \TYPO3\CMS\Core\Resource\File ? $file : NULL;
if (is_string($file) && !empty($file)) {
$this->fileInfo = TYPO3\CMS\Core\Utility\GeneralUtility::split_fileref($file);
$this->fileInfo['mtime'] = filemtime($file);
$this->fileInfo['atime'] = fileatime($file);
$this->fileInfo['owner'] = fileowner($file);
$this->fileInfo['group'] = filegroup($file);
$this->fileInfo['size'] = filesize($file);
$this->fileInfo['type'] = filetype($file);
$this->fileInfo['perms'] = fileperms($file);
$this->fileInfo['is_dir'] = is_dir($file);
$this->fileInfo['is_file'] = is_file($file);
$this->fileInfo['is_link'] = is_link($file);
$this->fileInfo['is_readable'] = is_readable($file);
$this->fileInfo['is_uploaded'] = is_uploaded_file($file);
$this->fileInfo['is_writeable'] = is_writeable($file);
}
if ($file instanceof \TYPO3\CMS\Core\Resource\File) {
$pathInfo = \TYPO3\CMS\Core\Utility\PathUtility::pathinfo($file->getName());
$this->fileInfo = array('file' => $file->getName(), 'filebody' => $file->getNameWithoutExtension(), 'fileext' => $file->getExtension(), 'realFileext' => $pathInfo['extension'], 'atime' => $file->getCreationTime(), 'mtime' => $file->getModificationTime(), 'owner' => '', 'group' => '', 'size' => $file->getSize(), 'type' => 'file', 'perms' => '', 'is_dir' => FALSE, 'is_file' => $file->getStorage()->getDriverType() === 'Local' ? is_file($file->getForLocalProcessing(FALSE)) : TRUE, 'is_link' => $file->getStorage()->getDriverType() === 'Local' ? is_link($file->getForLocalProcessing(FALSE)) : FALSE, 'is_readable' => TRUE, 'is_uploaded' => FALSE, 'is_writeable' => FALSE);
}
return $this->fileInfo !== array();
}
开发者ID:mneuhaus,项目名称:ke_search,代码行数:34,代码来源:class.tx_kesearch_lib_fileinfo.php
示例19: rmdirr
function rmdirr($dirname, $oc = 0)
{
// Sanity check
if (!file_exists($dirname)) {
return false;
}
// Simple delete for a file
if (is_file($dirname) && time() - fileatime($dirname) > 3600) {
return unlink($dirname);
}
// Loop through the folder
if (is_dir($dirname)) {
$dir = dir($dirname);
while (false !== ($entry = $dir->read())) {
// Skip pointers
if ($entry === '.' || $entry === '..') {
continue;
}
// Recurse
rmdirr($dirname . '/' . $entry, $oc);
}
$dir->close();
}
// Clean up
if ($oc == 1) {
return rmdir($dirname);
}
}
开发者ID:moscarar,项目名称:cityhow,代码行数:28,代码来源:css_optimiser.php
示例20: tree
/**
* 遍历目录内容
* @param string $dirName 目录名
* @param string $exts 读取的文件扩展名
* @param int $son 是否显示子目录
* @param array $list
* @return array
*/
public static function tree($dirName = null, $exts = '', $son = 0, $list = array())
{
if (is_null($dirName)) {
$dirName = '.';
}
$dirPath = self::dirPath($dirName);
static $id = 0;
if (is_array($exts)) {
$exts = implode("|", $exts);
}
foreach (glob($dirPath . '*') as $v) {
$id++;
if (is_dir($v) || !$exts || preg_match("/\\.({$exts})/i", $v)) {
$list[$id]['name'] = basename($v);
$list[$id]['path'] = str_replace("\\", "/", realpath($v));
$list[$id]['type'] = filetype($v);
$list[$id]['filemtime'] = filemtime($v);
$list[$id]['fileatime'] = fileatime($v);
$list[$id]['size'] = is_file($v) ? filesize($v) : self::get_dir_size($v);
$list[$id]['iswrite'] = is_writeable($v) ? 1 : 0;
$list[$id]['isread'] = is_readable($v) ? 1 : 0;
}
if ($son) {
if (is_dir($v)) {
$list = self::tree($v, $exts, $son = 1, $list);
}
}
}
return $list;
}
开发者ID:jyht,项目名称:v5,代码行数:38,代码来源:Dir.class.php
注:本文中的fileatime函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论