本文整理汇总了PHP中files::scanDir方法的典型用法代码示例。如果您正苦于以下问题:PHP files::scanDir方法的具体用法?PHP files::scanDir怎么用?PHP files::scanDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类files
的用法示例。
在下文中一共展示了files::scanDir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: basename
$zip_file = $new_v ? DC_BACKUP_PATH . '/' . basename($updater->getFileURL()) : '';
$version_info = $new_v ? $updater->getInfoURL() : '';
# Hide "update me" message
if (!empty($_GET['hide_msg'])) {
$updater->setNotify(false);
http::redirect('index.php');
}
$p_url = 'update.php';
$step = isset($_GET['step']) ? $_GET['step'] : '';
$step = in_array($step, array('check', 'download', 'backup', 'unzip')) ? $step : '';
$default_tab = !empty($_GET['tab']) ? html::escapeHTML($_GET['tab']) : 'update';
if (!empty($_POST['backup_file'])) {
$default_tab = 'files';
}
$archives = array();
foreach (files::scanDir(DC_BACKUP_PATH) as $v) {
if (preg_match('/backup-([0-9A-Za-z\\.-]+).zip/', $v)) {
$archives[] = $v;
}
}
if (!empty($archives)) {
usort($archives, "version_compare");
} else {
$default_tab = 'update';
}
# Revert or delete backup file
if (!empty($_POST['backup_file']) && in_array($_POST['backup_file'], $archives)) {
$b_file = $_POST['backup_file'];
try {
if (!empty($_POST['b_del'])) {
if (!@unlink(DC_BACKUP_PATH . '/' . $b_file)) {
示例2: dcUpdate
dcPage::close();
exit;
}
$updater = new dcUpdate(DC_UPDATE_URL, 'dotclear', DC_UPDATE_VERSION, DC_TPL_CACHE . '/versions');
$new_v = $updater->check(DC_VERSION);
$zip_file = $new_v ? DC_ROOT . '/' . basename($updater->getFileURL()) : '';
# Hide "update me" message
if (!empty($_GET['hide_msg'])) {
$updater->setNotify(false);
http::redirect('index.php');
}
$p_url = 'update.php';
$step = isset($_GET['step']) ? $_GET['step'] : '';
$step = in_array($step, array('check', 'download', 'backup', 'unzip')) ? $step : '';
$archives = array();
foreach (files::scanDir(DC_ROOT) as $v) {
if (preg_match('/backup-([0-9A-Za-z\\.-]+).zip/', $v)) {
$archives[] = $v;
}
}
# Revert or delete backup file
if (!empty($_POST['backup_file']) && in_array($_POST['backup_file'], $archives)) {
$b_file = $_POST['backup_file'];
try {
if (!empty($_POST['b_del'])) {
if (!@unlink(DC_ROOT . '/' . $b_file)) {
throw new Exception(sprintf(__('Unable to delete file %s'), html::escapeHTML($b_file)));
}
http::redirect($p_url);
}
if (!empty($_POST['b_revert'])) {
示例3: __flushCache
protected function __flushCache() {
$this->__putLog('Flushing cache');
$sCacheFiles = files::scanDir($this->sCacheDir);
foreach ($sCacheFiles as $v) {
$sCacheFile = $this->sCacheDir.'/'.$v;
$sCacheFile = path::clean(path::real($sCacheFile));
if (is_file($sCacheFile)) {
if (time() - filemtime($sCacheFile) >= $this->nCacheTime) {
unlink($sCacheFile);
$this->__putLog('Deleting '.$v);
}
}
}
$sCacheFiles = files::scanDir($this->sCacheDir);
return true;
}