本文整理汇总了PHP中DirectoryIterator::isLink方法的典型用法代码示例。如果您正苦于以下问题:PHP DirectoryIterator::isLink方法的具体用法?PHP DirectoryIterator::isLink怎么用?PHP DirectoryIterator::isLink使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DirectoryIterator
的用法示例。
在下文中一共展示了DirectoryIterator::isLink方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _processFile
/**
* Process file
*
* @param int $directoryID
* @param DirectoryIterator $entries
*/
protected final function _processFile($directoryID, DirectoryIterator $entries)
{
$scanID = $this->_scanRow->scanID;
// Load row when exists
$fileRow = $this->_fileTable->fetchRow(array('directoryID' => $directoryID, 'name' => $entries->getFilename()));
// Already scanned
if ($fileRow && $fileRow->lastScanID == $scanID) {
return;
}
$pathname = $entries->getPathname();
// Data
$data = array('modifyDate' => $this->_normalizeDate($entries->getMTime()), 'owner' => $this->_normalizeUser($entries->getOwner()), 'group' => $this->_normalizeGroup($entries->getGroup()), 'permissions' => $entries->getPerms(), 'size' => $entries->getSize(), 'linkTarget' => $entries->isLink() ? $entries->getLinkTarget() : null);
// Content
$contentHash = null;
if (!$entries->isLink() && ($this->_alwaysCheckContent || !$fileRow || $fileRow->modifyDate != $data['modifyDate'] || $fileRow->size != $data['size'])) {
// Non-accessible file
if (!is_readable($pathname)) {
$this->_log(self::LOG_ERROR, "\t{$pathname} cannot be read.");
if ($fileRow) {
$contentHash = $fileRow->contentHash;
}
} else {
$contentHash = md5_file($pathname);
}
}
// Transaction
$this->_db->beginTransaction();
// New row
if ($newRow = !$fileRow) {
fwrite(STDOUT, "\t{$pathname} is new.\n");
$fileRow = $this->_createFileRow(array('directoryID' => $directoryID, 'name' => $entries->getFilename()) + $data);
}
// Store values
$oldValues = $fileRow->toArray();
// Content
if ($fileRow->contentHash != $contentHash) {
$data['contentHash'] = $contentHash;
if ($this->_storagePath) {
$data['storedAs'] = $this->_copyFile($fileRow->fileID, $entries);
}
}
// Update row
$this->_updateFileRow($pathname, $fileRow, $data);
$fileRow->lastScanID = $scanID;
$fileRow->save();
// Scan row update
$this->_scanRow->lastOperationDate = new SeekR_Expression('NOW()');
$this->_scanRow->save();
// Transaction
$this->_db->commit();
}
示例2: _elmsln_alises_build_server
/**
* Automatically find and create drush aliases on the server.
* @param array $aliases array of drush aliases
*/
function _elmsln_alises_build_server(&$aliases, &$authorities = array())
{
// static cache assembled aliases as this can get tripped often
static $pulledaliases = array();
static $pulledauthorities = array();
static $config = array();
// check for pervasive cache if static is empty
if (empty($pulledaliases)) {
// assumption here is that it lives where we expect
// change this line if that's not the case though we really don't
// support changes to that part of the install routine
$cfg = file_get_contents('/var/www/elmsln/config/scripts/drush-create-site/config.cfg');
$lines = explode("\n", $cfg);
// read each line of the config file
foreach ($lines as $line) {
// make sure this line isn't a comment and has a = in it
if (strpos($line, '#') !== 0 && strpos($line, '=')) {
$tmp = explode('=', $line);
// ensure we have 2 settings before doing this
if (count($tmp) == 2) {
// never pass around the dbsu
if (!in_array($tmp[0], array('dbsu', 'dbsupw'))) {
// strip encapsulation if it exists
$config[$tmp[0]] = str_replace('"', '', str_replace("'", '', $tmp[1]));
}
}
}
}
// support the fact that $elmsln is used to reference in many bash vars
foreach ($config as $key => $value) {
if (strpos($value, '$elmsln') !== FALSE) {
$config[$key] = str_replace('$elmsln', $config['elmsln'], $value);
}
}
// base address of all domains
$address = $config['address'];
// your web root
$root = $config['stacks'] . '/';
// calculate the stacks we have
$stacks = array();
$stackfinder = new DirectoryIterator("{$root}");
while ($stackfinder->valid()) {
// Look for directories that are stacks
if ($stackfinder->isDir() && !$stackfinder->isDot() && !$stackfinder->isLink()) {
$stacks[] = $stackfinder->getBasename();
}
$stackfinder->next();
}
// loop through known stacks
foreach ($stacks as $stack) {
// step through sites directory assuming it isn't the 'default'
if ($stack != 'default' && is_dir("{$root}{$stack}/sites/{$stack}")) {
try {
$stackdir = new DirectoryIterator("{$root}{$stack}/sites/{$stack}");
while ($stackdir->valid()) {
// Look for directories containing a 'settings.php' file
if ($stackdir->isDir() && !$stackdir->isDot() && !$stackdir->isLink()) {
$group = $stackdir->getBasename();
// only include stack if it has things we can step through
// this helps avoid issues of unused stacks throwing errors
if (file_exists("{$root}{$stack}/sites/{$stack}/{$group}")) {
// build root alias for the stack
$pulledauthorities[$stack] = array('root' => $root . $stack, 'uri' => "{$stack}.{$address}");
// step through sites directory
if (is_dir("{$root}{$stack}/sites/{$stack}/{$group}")) {
$site = new DirectoryIterator("{$root}{$stack}/sites/{$stack}/{$group}");
while ($site->valid()) {
// Look for directories containing a 'settings.php' file
if ($site->isDir() && !$site->isDot() && !$site->isLink()) {
if (file_exists($site->getPathname() . '/settings.php')) {
// Add site alias
$basename = $site->getBasename();
// test that this isn't actually something like coursename = host
if ($basename == $config['host'] && !is_dir("{$root}{$stack}/sites/{$stack}/{$group}/{$group}")) {
$pulledaliases["{$stack}.{$basename}"] = array('root' => $root . $stack, 'uri' => "{$stack}.{$address}");
} else {
$pulledaliases["{$stack}.{$basename}"] = array('root' => $root . $stack, 'uri' => "{$stack}.{$address}.{$basename}");
}
}
}
$site->next();
}
}
}
}
$stackdir->next();
}
} catch (Exception $e) {
// that tool doesn't have a directory, oh well
}
}
}
}
$aliases = $pulledaliases;
$authorities = $pulledauthorities;
return $config;
//.........这里部分代码省略.........
示例3: _isModelFile
/**
* returns true if $fileinfo describes a model file
*
* @param DirectoryIterator $fileinfo
* @return bool
*/
protected function _isModelFile(DirectoryIterator $fileinfo)
{
$isModel = !$fileinfo->isDot() && !$fileinfo->isLink() && $fileinfo->isFile() && !preg_match('/filter\\.php/i', $fileinfo->getBasename()) && !preg_match('/abstract\\.php/i', $fileinfo->getBasename());
return $isModel;
}