当前位置: 首页>>代码示例>>PHP>>正文


PHP fileatime函数代码示例

本文整理汇总了PHP中fileatime函数的典型用法代码示例。如果您正苦于以下问题:PHP fileatime函数的具体用法?PHP fileatime怎么用?PHP fileatime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了fileatime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的fileatime函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。