本文整理汇总了PHP中filectime函数的典型用法代码示例。如果您正苦于以下问题:PHP filectime函数的具体用法?PHP filectime怎么用?PHP filectime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了filectime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printqueue_GET
function printqueue_GET(Web $w)
{
$print_folder = FILE_ROOT . "print";
$path = realpath($print_folder);
// Check if folder exists
if ($path === false) {
// Make print folder (If you specify a full path, use the recursion flag because it seems to crash without it in unix)
// Other wise you would need to chdir to the parent folder, create and change back to wherever execution currently was at
mkdir($print_folder, 0777, true);
$path = realpath($print_folder);
}
$exclude = array("THUMBS.db");
$objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path));
$table_data = array();
$table_header = array("Name", "Size", "Date Created", "Actions");
foreach ($objects as $name => $object) {
$filename = $object->getFilename();
// Ignore files starting with '.' and in exclude array
if ($filename[0] === '.' || in_array($filename, $exclude)) {
continue;
}
$table_data[] = array(Html::a("/uploads/print/" . $filename, $filename), humanReadableBytes($object->getSize()), date("H:i d/m/Y", filectime($name)), Html::box("/admin/printfile?filename=" . urlencode($name), "Print", true) . " " . Html::b("/admin/deleteprintfile?filename=" . urlencode($name), "Delete", "Are you sure you want to remove this file? (This is irreversible)"));
}
$w->out(Html::table($table_data, null, "tablesorter", $table_header));
}
示例2: run
/**
* Auszuführender Cron-Code
*/
public function run()
{
if (!\fpcm\classes\baseconfig::asyncCronjobsEnabled()) {
return false;
}
if (!is_writable(\fpcm\classes\baseconfig::$tempDir)) {
trigger_error('Unable to cleanup ' . \fpcm\classes\baseconfig::$tempDir . '! Access denied!');
return false;
}
$tempFiles = glob(\fpcm\classes\baseconfig::$tempDir . '*');
if (!is_array($tempFiles) || !count($tempFiles)) {
return true;
}
foreach ($tempFiles as $tempFile) {
if ($tempFile == \fpcm\classes\baseconfig::$tempDir . 'index.html') {
continue;
}
if (filectime($tempFile) + 3600 * 24 > time()) {
continue;
}
if (is_dir($tempFile)) {
\fpcm\model\files\ops::deleteRecursive($tempFile);
continue;
}
unlink($tempFile);
}
\fpcm\classes\logs::syslogWrite('Temp files cleanup in ' . \fpcm\classes\baseconfig::$tempDir);
return true;
}
示例3: resize
public function resize($filename, $width, $height)
{
if (!is_file(DIR_IMAGE . $filename)) {
return;
}
$extension = pathinfo($filename, PATHINFO_EXTENSION);
$old_image = $filename;
$new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
if (!is_file(DIR_IMAGE . $new_image) || filectime(DIR_IMAGE . $old_image) > filectime(DIR_IMAGE . $new_image)) {
$path = '';
$directories = explode('/', dirname(str_replace('../', '', $new_image)));
foreach ($directories as $directory) {
$path = $path . '/' . $directory;
if (!is_dir(DIR_IMAGE . $path)) {
@mkdir(DIR_IMAGE . $path, 0777);
}
}
list($width_orig, $height_orig) = getimagesize(DIR_IMAGE . $old_image);
if ($width_orig != $width || $height_orig != $height) {
$image = new Image(DIR_IMAGE . $old_image);
$image->resize($width, $height);
$image->save(DIR_IMAGE . $new_image);
} else {
copy(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image);
}
}
if ($this->request->server['HTTPS']) {
return $this->config->get('config_ssl') . 'image/' . $new_image;
} else {
return $this->config->get('config_url') . 'image/' . $new_image;
}
}
示例4: dir_get_infos
function dir_get_infos($dir = '')
{
if ($dir == '') {
return;
}
$dir = str_replace('//', '/', $dir . '/');
foreach (self::glob($dir . '*') as $file) {
$array = array();
if (!is_dir($file)) {
if (self::webos() !== 'Windows') {
if (function_exists('posix_getpwuid')) {
$tmp = posix_getpwuid(fileowner($file));
$array['owner'] = $tmp['name'];
}
}
$array['md5file'] = md5_file($file);
$array['file'] = $file;
$array['filectime'] = filectime($file);
$array['filemtime'] = filemtime($file);
$array['isdir'] = false;
$return[] = $array;
} else {
$return[] = array('file' => $file, 'isdir' => true);
}
}
return serialize($return);
}
示例5: deleteDirectory
public static function deleteDirectory($dir, $expireTime = null)
{
if (!file_exists($dir)) {
return false;
}
if (!is_dir($dir) || is_link($dir)) {
if ($expireTime) {
$fileCreationTime = filectime($dir);
if (time() - $fileCreationTime < $expireTime) {
return true;
}
}
return unlink($dir);
}
foreach (scandir($dir) as $item) {
if ($item == '.' || $item == '..') {
continue;
}
if (!org_glizy_helpers_Files::deleteDirectory($dir . "/" . $item, $expireTime)) {
chmod($dir . "/" . $item, 0777);
if (!org_glizy_helpers_Files::deleteDirectory($dir . "/" . $item, $expireTime)) {
return false;
}
}
}
return @rmdir($dir);
}
示例6: FastEncodeVideo
/**
* Asyncrhonous Convert all Video format to video/webm
*
* Use ffmpeg for conversion
* @return void
* @author Cédric Levasseur
*/
public static function FastEncodeVideo($file)
{
$basefile = new File($file);
$basepath = File::a2r($file);
$path_thumb_webm = File::Root() . '/' . Settings::$thumbs_dir . dirname($basepath) . "/" . $basefile->name . '.webm';
$path_thumb_jpg = File::Root() . '/' . Settings::$thumbs_dir . dirname($basepath) . "/" . $basefile->name . '.jpg';
if (!file_exists($path_thumb_webm) || filectime($file) > filectime($path_thumb_webm)) {
/// Create Folder
if (!file_exists(dirname($path_thumb_webm))) {
@mkdir(dirname($path_thumb_webm), 0755, true);
}
}
error_log($file, 0);
error_log($path_thumb_webm, 0);
if ($basefile->extension != "webm") {
if (!file_exists($path_thumb_webm)) {
///Create Thumbnail jpg in Thumbs folder
$u = Settings::$ffmpeg_path . ' -itsoffset -4 -i ' . $file . ' -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 -y ' . $path_thumb_jpg;
error_log($u, 0);
pclose(popen('start /b ' . $u . '', 'r'));
///Convert video to webm format in Thumbs folder
$u = Settings::$ffmpeg_path . ' -threads 4 -i ' . $file . ' ' . Settings::$ffmpeg_option . ' -y ' . $path_thumb_webm . ' 2>&1';
error_log($u, 0);
pclose(popen('start /b ' . $u . '', 'r'));
}
} else {
//Create Thumbnail jpg in Thumbs folder
$u = Settings::$ffmpeg_path . ' -itsoffset -4 -i ' . $file . ' -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 -y ' . $path_thumb_jpg;
pclose(popen('start /b ' . $u . '', 'r'));
///Copy original webm video to Thumbs folder
copy($file, $path_thumb_webm);
}
}
示例7: get_forecast_data
/**
* Perform a retrieval for the Wunderground forecast information
*/
function get_forecast_data($force = FALSE)
{
$req = "http://api.yr.no/weatherapi/locationforecast/1.8/?lat={$this->lat};lon={$this->lon};msl={$this->msl}";
if ($this->cache_dir && !$force) {
$cfile = "{$this->cache_dir}/WU-{$this->lat}-{$this->lon}-{$this->msl}.xml";
// Tidy cache
$expiry = mktime() + $this->cache_expiry;
foreach (glob("{$this->cache_dir}/*.xml") as $file) {
if (filectime($file) > $expiry) {
unlink($file);
}
}
if (!file_exists($cfile)) {
$blob = file_get_contents($req);
if (!$blob) {
die("Invalid return from request to {$req}");
}
$fh = fopen($cfile, 'w');
fwrite($fh, $blob);
fclose($fh);
}
$this->forecast_xml = simplexml_load_file($cfile);
} else {
$this->forecast_xml = simplexml_load_file($req);
}
}
示例8: eDoUpdateOnclick
function eDoUpdateOnclick($table, $idf, $onclickf, $filename)
{
global $empire, $dbtbpre, $public_r;
if (!file_exists($filename)) {
return '';
}
if (filesize($filename) >= $public_r['onclickfilesize'] * 1024 || time() - filectime($filename) >= $public_r['onclickfiletime'] * 60) {
$lr = $ocr = array();
if (@($lr = file($filename))) {
if (!@unlink($filename)) {
if ($fp = @fopen($filename, 'w')) {
fwrite($fp, '');
fclose($fp);
}
}
$lr = array_count_values($lr);
foreach ($lr as $id => $oc) {
$ocr[$oc] .= $id > 0 ? ',' . intval($id) : '';
}
foreach ($ocr as $oc => $ids) {
$empire->query("UPDATE LOW_PRIORITY {$table} SET {$onclickf}={$onclickf}+'{$oc}' WHERE {$idf} IN (0{$ids})");
}
}
}
}
示例9: filelist
function filelist($fold, $type = "fold", $cen = 1)
{
global $download_fold;
$cen1 = 3;
$handle = opendir($download_fold . $fold);
if ($handle) {
$fold1 = iconv("GB2312", "UTF-8", $fold);
while ($filedir1 = readdir($handle)) {
if ($filedir1[0] == '.' || $filedir1 == '..') {
continue;
}
$filename = $download_fold . $fold . "/" . $filedir1;
$filedir11 = iconv("GB2312", "UTF-8", $filedir1);
if (is_dir($filename) == false && $type == "file") {
$filetype = typeoffile($filedir1);
$filesize = filesize($filename);
$filetime = date("Y年m月d日H:i:s.", filectime($filename));
$filedir1 = urlencode($filedir1);
echo "<li class=\"{$filetype}\"><a href='http://zhiqiang.org/download{$fold1}/{$filedir1}'>{$filedir11}</a><br/><span>大小:{$filesize} Bytes</span><span><a href=\"javascript:\" onclick=\"ajaxShowPost('http://zhiqiang.org/blog/wp-content/themes/yuewei/jscript/searchfile.php?file={$fold}/{$filedir1}&cen={$cen1}&r='+parseInt(Math.random()*99999999), 'searchfile');return false;\">阅微堂上相关文章</a><span></li>";
} else {
if (is_dir($filename) == true && $type == "fold") {
$r = rand(1, 10000);
$filedir1 = urlencode($filedir1);
echo "<li class=\"folder\"><h{$cen1}><a href=\"javascript:\" onclick=\"if(\$('r{$r}').innerHTML==''){ajaxShowPost('http://zhiqiang.org/blog/wp-content/themes/yuewei/jscript/filelist.php?fold={$fold}/{$filedir1}&cen={$cen1}&r='+parseInt(Math.random()*99999999), 'r{$r}');}else{ \$('r{$r}').style.display!='none'?\$('r{$r}').style.display='none':\$('r{$r}').style.display='block';}return false;\">{$filedir11}</a></h{$cen1}><ul id=\"r{$r}\" style=\"list-style-type:none;\"></ul></li>";
}
}
}
closedir($handle);
}
}
示例10: load
public function load($path)
{
$r = array();
$path = $this->configuration['basepath'] . $path;
if (is_dir($path)) {
if (false !== ($d = @opendir($path))) {
while (false !== ($f = @readdir($d))) {
if (0 == strncmp($f, '.', 1)) {
continue;
}
$full_path = $path . '/' . $f;
$r2 = array();
$r2['basename'] = $f;
$is_collection = is_dir($full_path);
$r2['is_collection'] = $is_collection ? '1' : '0';
$r2['size'] = $is_collection ? 0 : @filesize($full_path);
$r2['date_created'] = $is_collection ? 0 : @filectime($full_path);
$r2['date_modified'] = $r2['date_created'];
$r2['content_type'] = amy_mime_content_type($full_path);
$r2['version'] = 1;
$r[] = $r2;
}
@closedir($d);
}
} else {
$r = @file_get_contents($path);
}
return $r;
}
示例11: __construct
public function __construct($folder = array())
{
$this->domainDirectory = 'http://' . $_SERVER['HTTP_HOST'] . '/';
$this->pathDirectory = $_SERVER['DOCUMENT_ROOT'] . '/';
foreach ($folder as $name) {
$this->domainFolder .= rawurlencode($name) . '/';
$this->pathFolder .= $name . '/';
}
$targetDirectory = $this->pathDirectory . $this->pathFolder;
$directory = opendir($targetDirectory);
while (($entry = readdir($directory)) !== false) {
if ($entry !== '.' && $entry !== '..') {
$data = array();
$data['name'] = iconv('tis-620', 'utf-8', $entry);
$splitName = explode('[', $entry);
if (count($splitName) > 1) {
$status = explode(']', $splitName[1]);
$data['status'] = $status[0];
} else {
$data['status'] = 'OnGoing';
}
if (is_file($targetDirectory . $entry)) {
$data['path'] = $targetDirectory . $entry;
$data['source'] = $this->domainDirectory . $this->domainFolder . rawurlencode($entry);
} elseif (is_dir($targetDirectory . $entry)) {
$data['path'] = $targetDirectory . $entry . '/';
}
$data['created'] = filectime($data['path']);
$this->arrayDirectory[] = $data;
}
}
closedir($directory);
}
示例12: getPatch
public static function getPatch(array $patch)
{
static $cache = array();
if (!isset($cache[$patch['url']])) {
if (!empty($patch['local'])) {
if (is_file($patch['url']) && filesize($patch['url'])) {
$cache[$patch['url']] = $patch['url'];
} else {
throw new Exception("Unable to read patch from local path {$patch['url']}.");
}
} elseif (drush_get_option('no-cache')) {
$temp_file = drush_tempnam('drush_patchfile_', NULL, '.patch');
$cache[$patch['url']] = static::downloadPatch($patch['url'], $temp_file);
} else {
$cache_file = drush_directory_cache('patchfile') . '/' . md5($patch['url']) . '.patch';
if (is_file($cache_file) && filectime($cache_file) > $_SERVER['REQUEST_TIME'] - DRUSH_CACHE_LIFETIME_DEFAULT) {
drush_log(dt('Remote patch URL @url fetched from cache file @cache.', array('@url' => $patch['url'], '@cache' => $cache_file)));
$cache[$patch['url']] = $cache_file;
} else {
$cache[$patch['url']] = static::downloadPatch($patch['url'], $cache_file);
}
}
}
return $cache[$patch['url']];
}
示例13: rotate
/**
* @ignore
*/
private function rotate()
{
if ($this->_rotated) {
return;
}
if (!is_file($this->filename)) {
return;
}
clearstatcache($this->filename);
if (filesize($this->filename) >= $this->_max_size * 1024 && filectime($this->filename) >= time() - $this->_max_age * 3600) {
return;
}
// gotta rotate
$dest_pattern = $this->filename . '.%d';
$files = glob($this->filename . '.*');
if (is_array($files) && count($files)) {
for ($i = $this->_keepmax - 1; $i > 0; $i--) {
$test_fn = sprintf($dest_pattern, $i);
if (is_file($test_fn)) {
if ($i == $this->_keepmax) {
// only keeping a certain many of these.
unlink($test_fn);
} else {
// rename the file, incremeinging the number
$dest_fn = sprintf($dest_pattern, $i + 1);
rename($test_fn, $dest_fn);
}
}
}
}
$dest_fn = sprintf($dest_pattern, 1);
rename($this->filename, $dest_fn);
$this->_rotated = 1;
}
示例14: list_dirs
function list_dirs($dir, $mask = "")
{
$return = array();
if (!$mask) {
$mask = $this->mask;
}
if (!file_exists($dir)) {
echo "PHP_Dir: Directory does not exist";
return $return;
}
if (!($d = opendir($dir))) {
exit("PHP_Dir: Failure opening directory");
}
$counter = 0;
while ($file = readdir($d)) {
if (is_dir($dir . $file)) {
$return['dirname'][$counter] = $file;
$return[$counter]['dirsize'] = "-";
$return[$counter]['dirtype'] = "DIR";
$return[$counter]['dirctime'] = filectime($dir);
++$counter;
}
}
if (1 <= sizeof($return['dirname'])) {
sort($return['dirname']);
}
return $return;
}
示例15: resize
public function resize($filename, $width, $height)
{
if (!file_exists(DIR_IMAGE . $filename) || !is_file(DIR_IMAGE . $filename)) {
return;
}
$info = pathinfo($filename);
$extension = $info['extension'];
$old_image = $filename;
$new_image = 'cache/' . utf8_substr($filename, 0, utf8_strrpos($filename, '.')) . '-' . $width . 'x' . $height . '.' . $extension;
if (!file_exists(DIR_IMAGE . $new_image) || filectime(DIR_IMAGE . $old_image) > filectime(DIR_IMAGE . $new_image)) {
$path = '';
$directories = explode('/', dirname(str_replace('../', '', $new_image)));
foreach ($directories as $directory) {
$path = $path . '/' . $directory;
if (!file_exists(DIR_IMAGE . $path)) {
@mkdir(DIR_IMAGE . $path, 0777);
}
}
$image = new Image(DIR_IMAGE . $old_image);
$image->resize($width, $height);
$image->save(DIR_IMAGE . $new_image);
}
if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
return HTTPS_CATALOG . 'image/' . $new_image;
} elseif (isset($this->request->server['HTTP_X_FORWARDED_PROTO']) && $this->request->server['HTTP_X_FORWARDED_PROTO'] == 'https') {
return HTTPS_CATALOG . 'image/' . $new_image;
} else {
return HTTP_CATALOG . 'image/' . $new_image;
}
}