本文整理汇总了PHP中Includes\Utils\FileManager::isFile方法的典型用法代码示例。如果您正苦于以下问题:PHP FileManager::isFile方法的具体用法?PHP FileManager::isFile怎么用?PHP FileManager::isFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Includes\Utils\FileManager
的用法示例。
在下文中一共展示了FileManager::isFile方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getWrongPermissions
/**
* Return wrong permissions
*
* @return array
*/
protected function getWrongPermissions()
{
if (!isset($this->wrongPermissions)) {
$wrongEntries = array('files' => array(), 'dirs' => array());
$common = $this->getCommonFolders();
foreach ($this->getUpgradeEntries() as $entry) {
foreach ($entry->getWrongPermissions() as $path) {
foreach ($common as $folder => $processed) {
if (false !== strpos($path, $folder)) {
if (\Includes\Utils\FileManager::isDir($path) && !$processed['dirs']) {
$this->wrongPermissions[] = 'find ' . $folder . ' -type d -execdir chmod 777 "{}" \\;;';
$common[$folder]['dirs'] = true;
} elseif (\Includes\Utils\FileManager::isFile($path) && !$processed['files']) {
$this->wrongPermissions[] = 'find ' . $folder . ' -type f -execdir chmod 666 "{}" \\;;';
$common[$folder]['files'] = true;
}
continue 2;
}
}
if (\Includes\Utils\FileManager::isDir($path)) {
$wrongEntries['dirs'][] = $path;
} else {
$wrongEntries['files'][] = $path;
}
}
}
foreach ($wrongEntries as $type => $paths) {
if ($paths) {
$permission = $type == 'dirs' ? '777' : '666';
$this->wrongPermissions[] = 'chmod ' . $permission . ' ' . implode(' ', array_unique($paths)) . ';';
}
}
}
return $this->wrongPermissions;
}
示例2: getAccessKey
/**
* Get Access Key
*
* @return string
*/
public static function getAccessKey()
{
if (!\Includes\Utils\FileManager::isFile(static::getAccessKeyFileName())) {
static::regenerateAccessKey();
}
return \Includes\Utils\FileManager::read(static::getAccessKeyFileName());
}
示例3: getResourceFromCache
/**
* Return resource structure from the file cache
*
* @param string $type File type of resource (js/css)
* @param array $resources Resources for caching
* @param array $paramsForCache Parameters of file cache (directory structure path to file)
* @param string $prepareCacheFileMethod Method of $this object to read one resource entity and do some inner work if it is necessary
*
* @return array
*/
protected function getResourceFromCache($type, array $resources, array $paramsForCache, $prepareCacheFileMethod)
{
$pathToCacheDir = static::getResourceCacheDir($paramsForCache);
\Includes\Utils\FileManager::mkdirRecursive($pathToCacheDir);
$file = hash('sha256', serialize($resources)) . '.' . $type;
$filePath = $pathToCacheDir . $file;
if (!\Includes\Utils\FileManager::isFile($filePath)) {
foreach ($resources as $resource) {
\Includes\Utils\FileManager::write($filePath, $this->{$prepareCacheFileMethod}($resource['file']), FILE_APPEND);
}
}
return array('file' => $filePath, 'url' => \XLite::getInstance()->getShopURL(str_replace(LC_DS, '/', substr($filePath, strlen(LC_DIR_ROOT))), \XLite\Core\Request::getInstance()->isHTTPS()));
}
示例4: getUpgradeNoteFile
/**
* Get file with an upgrade note
*
* @param string $type Note type
* @param string $majorVersion Major version to upgrade to
* @param string $minorVersion Minor version to upgrade to
* @param string $languageCode Language code OPTIONAL
*
* @return string
*/
protected function getUpgradeNoteFile($type, $majorVersion, $minorVersion, $languageCode = null)
{
$file = null;
$path = $this->getUpgradeHelpersDir();
if ($path) {
$language = isset($languageCode) ? '.' . $languageCode : '';
$file = $majorVersion . LC_DS . $minorVersion . LC_DS . $type . $language . '.txt';
if (\Includes\Utils\FileManager::isFile($path . $file)) {
$file = $this->getUpgradeHelpersDir(false) . $file;
} else {
$file = null;
}
}
return $file;
}
示例5: cleanupCacheIndicators
/**
* Clean up the cache validity indicators
*
* @return void
*/
public static function cleanupCacheIndicators()
{
foreach (static::getCacheStateFiles() as $file) {
if (\Includes\Utils\FileManager::isFile($file) && !\Includes\Utils\FileManager::deleteFile($file)) {
\Includes\ErrorHandler::fireError('Unable to delete "' . $file . '" file. Please correct the permissions');
}
}
// "Step is running" indicator
static::cleanupRebuildIndicator();
}
示例6: isResizedIconAvailable
/**
* Check - resized icon is available or not
*
* @param string $path Resized image path
*
* @return boolean
*/
protected function isResizedIconAvailable($path)
{
return \Includes\Utils\FileManager::isFile($path) && $this->getDate() <= filemtime($path);
}
示例7: getUpgradeHelperFile
/**
* Get file with an upgrade helper function
*
* @param string $type Helper type
* @param string $majorVersion Major version to upgrade to
* @param string $minorVersion Minor version to upgrade to
*
* @return string
*/
protected function getUpgradeHelperFile($type, $majorVersion, $minorVersion)
{
$file = null;
if ($path = $this->getUpgradeHelpersDir()) {
$file = $majorVersion . LC_DS . $minorVersion . LC_DS . $type . '.php';
if (\Includes\Utils\FileManager::isFile($path . $file)) {
$file = $this->getUpgradeHelpersDir(false) . $file;
} else {
$file = null;
}
}
return $file;
}
示例8: loadServiceYAML
/**
* Load service YAML
*
* @param string $path File path
*
* @return mixed
*/
public static function loadServiceYAML($path)
{
$data = null;
if (\Includes\Utils\FileManager::isFile($path)) {
$data = \Symfony\Component\Yaml\Yaml::parse($path);
}
return $data;
}
示例9: checkIsLCInstalled
/**
* Check if LC is installed
*
* @return void
*/
public static function checkIsLCInstalled()
{
if (!\Includes\Utils\ConfigParser::getOptions(array('database_details', 'database'))) {
$message = 'Probably LC is not installed. Try to run ';
$url = '<strong>install.php</strong>';
$link = \Includes\Utils\URLManager::getShopURL('install.php');
if (\Includes\Utils\FileManager::isFile($link)) {
$url = '<a href="' . $link . '">' . $url . '</a>';
}
static::showErrorPage('ERROR_LC_NOT_INSTALLED', $message . $url, LC_ERROR_PAGE_MESSAGE);
}
}