本文整理汇总了PHP中Includes\Utils\FileManager类的典型用法代码示例。如果您正苦于以下问题:PHP FileManager类的具体用法?PHP FileManager怎么用?PHP FileManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FileManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getStoreFileSystemRoot
/**
* Get valid file system storage root
*
* @return string
*/
protected function getStoreFileSystemRoot()
{
$shipments = $this->getLink()->getManifest()->getShipments();
$path = parent::getStoreFileSystemRoot() . $shipments[0]->getParcel()->getOrder()->getOrderId() . LC_DS;
\Includes\Utils\FileManager::mkdirRecursive($path);
return $path;
}
示例2: doActionCleanAggregationCache
/**
* Clean aggregation cache directory
*
* @return void
*/
public function doActionCleanAggregationCache()
{
\Includes\Utils\FileManager::unlinkRecursive(LC_DIR_CACHE_RESOURCES);
\Less_Cache::SetCacheDir(LC_DIR_DATACACHE);
\Less_Cache::CleanCache();
\XLite\Core\TopMessage::addInfo('Aggregation cache has been cleaned');
}
示例3: getPromotionMessage
/**
* Get promotion message
*
* @return string
*/
protected function getPromotionMessage()
{
$addons = $this->getAddons();
$modules = array();
$params = array('clearCnd' => 1);
foreach ($addons as $addon => $title) {
if (!\Includes\Utils\Operator::checkIfClassExists('\\XLite\\Module\\' . $addon . '\\Main')) {
$match = explode('\\', $addon);
$mainClassFile = LC_DIR_MODULES . str_replace('\\', '/', $addon) . '/Main.php';
if (\Includes\Utils\FileManager::isExists($mainClassFile)) {
// Module is installed but not enabled
$limit = \XLite\View\Pager\Admin\Module\Manage::getInstance()->getItemsPerPage();
$pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getInstalledPageId($match[0], $match[1], $limit);
$pageParam = 'page';
$target = 'addons_list_installed';
} else {
// Module is not installed
list(, $limit) = $this->getWidget(array(), '\\XLite\\View\\Pager\\Admin\\Module\\Install')->getLimitCondition()->limit;
$pageId = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->getMarketplacePageId($match[0], $match[1], $limit);
$pageParam = 'pageId';
$target = 'addons_list_marketplace';
}
if (0 < $pageId) {
$params[$pageParam] = $pageId;
}
$url = $this->buildURL($target, '', $params) . '#' . $match[1];
$modules[] = '<a href="' . $url . '">' . $title . '</a>';
}
}
return 0 < count($modules) ? static::t('Install additional modules to add more product sources', array('list' => implode(', ', $modules))) : '';
}
示例4: writeCallToSourceFile
/**
* Modify class source
*
* @param \Includes\Decorator\DataStructure\Graph\Classes $node Current node
*
* @return void
*/
protected function writeCallToSourceFile(\Includes\Decorator\DataStructure\Graph\Classes $node)
{
$path = LC_DIR_CACHE_CLASSES . $node->getPath();
$content = \Includes\Utils\FileManager::read($path);
$content .= PHP_EOL . '// Call static constructor' . PHP_EOL;
$content .= '\\' . $node->getClass() . '::' . static::STATIC_CONSTRUCTOR_METHOD . '();';
\Includes\Utils\FileManager::write($path, $content);
}
示例5: getCounter
public static function getCounter()
{
$data = \Includes\Utils\FileManager::read(static::getFilePath());
if ($data) {
$data = substr($data, strlen('; <' . '?php /*' . PHP_EOL), strlen('; */ ?' . '>') * -1);
$data = unserialize($data);
}
return $data && is_array($data) && isset($data['count']) ? intval($data['count']) : 0;
}
示例6: doActionDelete
/**
* doActionDelete
*
* @return void
* @throws
*/
protected function doActionDelete()
{
if (\Includes\Utils\FileManager::isExists($this->sqldumpFile) && !\Includes\Utils\FileManager::deleteFile($this->sqldumpFile)) {
\XLite\Core\TopMessage::addError(static::t('Unable to delete file') . ' ' . $this->sqldumpFile);
} else {
\XLite\Core\TopMessage::addInfo('SQL file was deleted successfully');
}
$this->doRedirect();
}
示例7: testGetPublicTitle
public function testGetPublicTitle()
{
\Includes\Utils\FileManager::unlinkRecursive(LC_DIR_FILES . 'attachments');
$attach = $this->getTestAttachment();
$this->assertEquals('max_ava.png', $attach->getPublicTitle(), 'check default title');
$this->assertEquals('', $attach->getTitle(), 'check empty title');
$attach->setTitle('test');
$this->assertEquals('test', $attach->getPublicTitle(), 'check normal title');
}
示例8: getIconURL
/**
* Return URL for module icon
*
* @return string
*/
public static function getIconURL()
{
list($author, $name) = explode('\\', \Includes\Utils\ModulesManager::getModuleNameByClassName(get_called_class()));
$path = \Includes\Utils\ModulesManager::getModuleIconFile($author, $name);
$url = '';
if (\Includes\Utils\FileManager::isFileReadable($path)) {
$url = \XLite\Core\Converter::buildURL('module', null, compact('author', 'name'), 'image.php');
}
return $url;
}
示例9: __construct
/**
* Constructor
* Creates directory for locks if needed
*/
public function __construct()
{
if (!\Includes\Utils\FileManager::isExists(rtrim(static::LOCK_DIR, LC_DS))) {
\Includes\Utils\FileManager::mkdirRecursive(rtrim(static::LOCK_DIR, LC_DS));
}
if (!\Includes\Utils\FileManager::isReadable(static::LOCK_DIR) || !\Includes\Utils\FileManager::isWriteable(static::LOCK_DIR)) {
\XLite\Logger::getInstance()->log('Cannot create lock for keys', LOG_DEBUG);
}
parent::__construct();
}
示例10: doActionImport
/**
* Action 'import'
*
* @return void
*/
protected function doActionImport()
{
$fileName = \XLite\Core\Session::getInstance()->language_import_file;
if (\Includes\Utils\FileManager::isExists($fileName)) {
$result = \XLite\Core\Database::getRepo('XLite\\Model\\Language')->parseImportFile($fileName, true);
\XLite\Core\Session::getInstance()->language_import_result = $result;
} else {
\XLite\Core\Session::getInstance()->language_import_file = null;
\XLite\Core\TopMessage::addError('File not found');
}
$this->setReturnURL($this->buildURL('languages'));
}
示例11: getClassesTree
/**
* Return classes tree
*
* @param boolean $create Flag OPTIONAL
*
* @return \Includes\Decorator\DataStructure\Graph\Classes
*/
public static function getClassesTree($create = true)
{
if (!isset(static::$classesTree) && $create) {
if (\Includes\Utils\FileManager::isFileReadable(static::getClassesHashPath())) {
$data = unserialize(\Includes\Utils\FileManager::read(static::getClassesHashPath()));
static::$classesTree = array_pop($data);
} else {
static::$classesTree = \Includes\Decorator\Utils\Operator::createClassesTree();
}
}
return static::$classesTree;
}
示例12: getPlugins
/**
* Return list of registered plugins
*
* @param string $hook Hook name OPTIONAL
*
* @return array
*/
protected static function getPlugins($hook = null)
{
if (!isset(static::$plugins)) {
// Check config file
if (\Includes\Utils\FileManager::isFileReadable(static::getConfigFile())) {
// Iterate over all sections
foreach (parse_ini_file(static::getConfigFile(), true) as $section => $plugins) {
// Set plugins order
asort($plugins, SORT_NUMERIC);
// Save plugins list
static::$plugins[$section] = array_fill_keys(array_keys($plugins), null);
}
} else {
\Includes\ErrorHandler::fireError('Unable to read config file for the Decorator plugins');
}
}
return \Includes\Utils\ArrayManager::getIndex(static::$plugins, $hook);
}
示例13: getChain
/**
* Return templates chain
*
* @return array
*/
protected function getChain()
{
$result = array();
/** @var \XLite\Core\Layout $layout */
$layout = \XLite\Core\Layout::getInstance();
$shortPath = $this->getValue();
$files = array();
foreach ($layout->getSkinPaths(\XLite::CUSTOMER_INTERFACE) as $path) {
$fullPath = $path['fs'] . LC_DS . $shortPath;
if (file_exists($fullPath) && is_file($fullPath)) {
array_unshift($files, $fullPath);
}
}
foreach ($files as $fullPath) {
$result[substr($fullPath, strlen(LC_DIR_SKINS))] = htmlspecialchars(\Includes\Utils\FileManager::read($fullPath));
}
return $result;
}
示例14: bindRegionsToUK
function bindRegionsToUK()
{
$statesFile = __DIR__ . LC_DS . 'regionForUkStates.yaml';
if (!\Includes\Utils\FileManager::isFileReadable($statesFile)) {
return false;
}
$data = \Symfony\Component\Yaml\Yaml::parse($statesFile);
foreach ($data['states'] as $state) {
$foundByCode = \XLite\Core\Database::getRepo('XLite\\Model\\State')->findOneBy(array('code' => $state['code']));
// If we found state with code we should bind region
if ($foundByCode) {
$region = \XLite\Core\Database::getRepo('XLite\\Model\\Region')->findOneBy(array('code' => $state['region']['code']));
if ($region) {
$foundByCode->setRegion($region);
}
}
}
\XLite\Core\Database::getEM()->flush();
return true;
}
示例15: executeHookHandler
/**
* Execute certain hook handler
*
* @return void
*/
public function executeHookHandler()
{
// Remove old capsular directories
if (\Includes\Decorator\Utils\CacheManager::isCapsular()) {
$currentKey = \Includes\Decorator\Utils\CacheManager::getKey();
foreach (\Includes\Decorator\Utils\CacheManager::getCacheDirs(true) as $dir) {
$list = glob(rtrim($dir, LC_DS) . '.*');
if ($list) {
foreach ($list as $subdir) {
list($main, $key) = explode('.', $subdir, 2);
if ($key && $key != $currentKey) {
\Includes\Utils\FileManager::unlinkRecursive($subdir);
}
}
}
}
}
\Includes\Decorator\Utils\CacheManager::cleanupCache();
// Load classes from "classes" (do not use cache)
\Includes\Autoloader::switchLcAutoloadDir();
\Includes\Decorator\Plugin\Doctrine\Plugin\QuickData\Main::initializeCounter();
}