本文整理汇总了PHP中SplFileInfo::isDot方法的典型用法代码示例。如果您正苦于以下问题:PHP SplFileInfo::isDot方法的具体用法?PHP SplFileInfo::isDot怎么用?PHP SplFileInfo::isDot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SplFileInfo
的用法示例。
在下文中一共展示了SplFileInfo::isDot方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moveChildren
/**
* Move the children of this directory into targetDir
*
* @param string $targetDir Target directory pathname
*
* @return void
*/
public function moveChildren($targetDir)
{
$info = new \SplFileInfo($targetDir);
if (!$info->isDir()) {
throw new InvalidArgumentException(sprintf('Target dir not found'));
}
if (!$info->isReadable()) {
throw new InvalidArgumentException(sprintf('Target dir not readable'));
}
if (!$info->isWritable()) {
throw new InvalidArgumentException(sprintf('Target dir not writable'));
}
foreach (new \DirectoryIterator($this->dir) as $info) {
if ($info->isDot()) {
continue;
}
$sourcePathname = $info->getPathname();
$subdirPathname = $this->subtractBasedir($sourcePathname, $this->dir);
$targetPathname = sprintf('%s/%s', $targetDir, $subdirPathname);
rename($sourcePathname, $targetPathname);
}
}
示例2: deleteSubDir
public function deleteSubDir($subDir)
{
$pathname = $this->getPathname($subDir);
if (!$this->isValidSubDir($pathname)) {
throw new InvalidArgumentException(sprintf('Not a valid subDir of temporary dir: "%s"', $pathname));
}
$fileInfo = new \SplFileInfo($pathname);
if (!$fileInfo->isDir() || !$fileInfo->isReadable() || !$fileInfo->isWritable()) {
return;
}
foreach (new \DirectoryIterator($pathname) as $fileInfo) {
if ($fileInfo->isDot()) {
continue;
}
if ($fileInfo->isDir()) {
$this->deleteSubDir($this->getSubDir($fileInfo->getPathname()));
} else {
unlink($fileInfo->getPathname());
}
}
rmdir($pathname);
}
示例3: flushEntry
/**
* Flushes the cache record for the given file info instance, independent if
* it is a file, directory or symlink.
*
* @param \SplFileInfo $file
* @return void
*/
protected function flushEntry(\SplFileInfo $file)
{
$path = $file->getRealPath();
if ($file->isDot()) {
return;
} elseif ($file->isFile()) {
unlink($path);
} else {
$this->flushDirectory($path);
rmdir($path);
}
}
示例4: updateConfigs
/**
* Writes new config to files.
* @throws \Exception
*/
private function updateConfigs()
{
$configDir = $this->configDir;
$fileInfo = new \SplFileInfo($configDir);
if (!$fileInfo->isDir()) {
if (!mkdir($configDir, 0777, true)) {
throw new \Exception("Please create config directory [{$configDir}] and give PHP full access to it.");
}
}
$configDir = realpath($configDir);
if (!$fileInfo->isWritable()) {
$this->canWrite = false;
}
if (isset($this->previousSteps['admin_credentials'])) {
$adminCredSettings = $this->previousSteps['admin_credentials']->getViewData();
$this->pixie->config->load_inherited_group('parameters');
$paramsConfig = $this->pixie->config->get_group('parameters');
$paramsConfig['installer_password'] = $adminCredSettings['password'];
$this->writeConfigFile($this->configDir . "/parameters.php", $paramsConfig);
} else {
$this->createOverriddenConfig('parameters');
}
$this->createOverriddenConfig('rest');
// Update DB settings
$dbConfig = $this->pixie->config->get('db');
/** @var AbstractStep $dbSettings */
$dbSettings = $this->previousSteps['db_settings'];
$dbSettings = $dbSettings->getViewData();
$dbConfig['default']['user'] = $dbSettings['user'];
$dbConfig['default']['password'] = $dbSettings['password'];
$dbConfig['default']['db'] = $dbSettings['db'];
$dbConfig['default']['host'] = $dbSettings['host'];
$dbConfig['default']['port'] = $dbSettings['port'];
$dbConfig['default']['driver'] = 'PDOV';
$dbConfig['default']['connection'] = 'mysql:host=' . $dbSettings['host'] . ';port=' . $dbSettings['port'] . ';dbname=' . $dbSettings['db'];
$this->writeConfigFile($configDir . '/db.php', $dbConfig);
// Update email settings
$dbConfig = $this->pixie->config->get('email');
/** @var AbstractStep $dbSettings */
$dbSettings = $this->previousSteps['email_settings'];
$dbSettings = $dbSettings->getViewData();
$dbConfig['default']['type'] = $dbSettings['type'];
$dbConfig['default']['sendmail_command'] = $dbSettings['sendmail_command'];
$dbConfig['default']['mail_parameters'] = $dbSettings['mail_parameters'];
$dbConfig['default']['hostname'] = $dbSettings['hostname'];
$dbConfig['default']['port'] = $dbSettings['port'];
$dbConfig['default']['username'] = $dbSettings['username'];
$dbConfig['default']['password'] = $dbSettings['password'];
$dbConfig['default']['encryption'] = $dbSettings['encryption'];
$dbConfig['default']['timeout'] = $dbSettings['timeout'];
$this->writeConfigFile($configDir . '/email.php', $dbConfig);
// Vuln configs
$vulnSampleDir = $this->configDir . '/vuln.sample';
$vulnTargetDir = $this->configDir . '/vuln';
foreach (new \DirectoryIterator($vulnSampleDir) as $fileInfo) {
if ($fileInfo->isDot() || $fileInfo->getExtension() != 'php') {
continue;
}
$configName = $fileInfo->getBasename();
$targetFileName = $vulnTargetDir . '/' . $configName;
if (file_exists($targetFileName) && is_file($targetFileName)) {
continue;
}
try {
copy($fileInfo->getPathname(), $targetFileName);
} catch (\Exception $e) {
$this->configsToAdd[$targetFileName] = file_get_contents($fileInfo->getPathname());
}
}
}