当前位置: 首页>>代码示例>>PHP>>正文


PHP FileUtil::unifyDirSeparator方法代码示例

本文整理汇总了PHP中wcf\util\FileUtil::unifyDirSeparator方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::unifyDirSeparator方法的具体用法?PHP FileUtil::unifyDirSeparator怎么用?PHP FileUtil::unifyDirSeparator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wcf\util\FileUtil的用法示例。


在下文中一共展示了FileUtil::unifyDirSeparator方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: compile

 /**
  * Compiles LESS stylesheets.
  * 
  * @param	\wcf\data\style\Style	$style
  */
 public function compile(Style $style)
 {
     // read stylesheets by dependency order
     $conditions = new PreparedStatementConditionBuilder();
     $conditions->add("filename REGEXP ?", array('style/([a-zA-Z0-9\\_\\-\\.]+)\\.less'));
     $sql = "SELECT\t\tfilename, application\n\t\t\tFROM\t\twcf" . WCF_N . "_package_installation_file_log\n\t\t\t" . $conditions . "\n\t\t\tORDER BY\tpackageID";
     $statement = WCF::getDB()->prepareStatement($sql);
     $statement->execute($conditions->getParameters());
     $files = array();
     while ($row = $statement->fetchArray()) {
         $files[] = Application::getDirectory($row['application']) . $row['filename'];
     }
     // get style variables
     $variables = $style->getVariables();
     $individualLess = '';
     if (isset($variables['individualLess'])) {
         $individualLess = $variables['individualLess'];
         unset($variables['individualLess']);
     }
     // add style image path
     $imagePath = '../images/';
     if ($style->imagePath) {
         $imagePath = FileUtil::getRelativePath(WCF_DIR . 'style/', WCF_DIR . $style->imagePath);
         $imagePath = FileUtil::addTrailingSlash(FileUtil::unifyDirSeparator($imagePath));
     }
     $variables['style_image_path'] = "'{$imagePath}'";
     // apply overrides
     if (isset($variables['overrideLess'])) {
         $lines = explode("\n", StringUtil::unifyNewlines($variables['overrideLess']));
         foreach ($lines as $line) {
             if (preg_match('~^@([a-zA-Z]+): ?([@a-zA-Z0-9 ,\\.\\(\\)\\%\\#-]+);$~', $line, $matches)) {
                 $variables[$matches[1]] = $matches[2];
             }
         }
         unset($variables['overrideLess']);
     }
     $this->compileStylesheet(WCF_DIR . 'style/style-' . $style->styleID, $files, $variables, $individualLess, new Callback(function ($content) use($style) {
         return "/* stylesheet for '" . $style->styleName . "', generated on " . gmdate('r') . " -- DO NOT EDIT */\n\n" . $content;
     }));
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:45,代码来源:StyleCompiler.class.php

示例2: readData

 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     // init cache data
     $this->cacheData = array('source' => get_class(CacheHandler::getInstance()->getCacheSource()), 'version' => '', 'size' => 0, 'files' => 0);
     switch ($this->cacheData['source']) {
         case 'wcf\\system\\cache\\source\\DiskCacheSource':
             // set version
             $this->cacheData['version'] = WCF_VERSION;
             $this->readCacheFiles('data', WCF_DIR . 'cache');
             break;
         case 'wcf\\system\\cache\\source\\MemcachedCacheSource':
             // set version
             $this->cacheData['version'] = WCF_VERSION;
             break;
     }
     $this->readCacheFiles('language', FileUtil::unifyDirSeparator(WCF_DIR . 'language'));
     $this->readCacheFiles('template', FileUtil::unifyDirSeparator(WCF_DIR . 'templates/compiled'), new Regex('\\.meta\\.php$'));
     $this->readCacheFiles('template', FileUtil::unifyDirSeparator(WCF_DIR . 'acp/templates/compiled'), new Regex('\\.meta\\.php$'));
     $this->readCacheFiles('style', FileUtil::unifyDirSeparator(WCF_DIR . 'style'), null, 'css');
     $this->readCacheFiles('style', FileUtil::unifyDirSeparator(WCF_DIR . 'acp/style'), new Regex('WCFSetup.css$'), 'css');
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:25,代码来源:CacheListPage.class.php

示例3: export


//.........这里部分代码省略.........
     $styleTar->addString('variables.xml', $xml->endDocument());
     unset($string);
     if ($templates && $this->templateGroupID) {
         $templateGroup = new TemplateGroup($this->templateGroupID);
         // create templates tar
         $templatesTarName = FileUtil::getTemporaryFilename('templates', '.tar');
         $templatesTar = new TarWriter($templatesTarName);
         FileUtil::makeWritable($templatesTarName);
         // append templates to tar
         // get templates
         $sql = "SELECT\t\ttemplate.*, package.package\n\t\t\t\tFROM\t\twcf" . WCF_N . "_template template\n\t\t\t\tLEFT JOIN\twcf" . WCF_N . "_package package\n\t\t\t\tON\t\t(package.packageID = template.packageID)\n\t\t\t\tWHERE\t\ttemplate.templateGroupID = ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array($this->templateGroupID));
         while ($row = $statement->fetchArray()) {
             $packageDir = 'com.woltlab.wcf';
             $package = null;
             if ($row['application'] != 'wcf') {
                 $application = ApplicationHandler::getInstance()->getApplication($row['application']);
                 $package = PackageCache::getInstance()->getPackage($application->packageID);
                 $packageDir = $package->package;
             } else {
                 $application = ApplicationHandler::getInstance()->getWCF();
                 $package = PackageCache::getInstance()->getPackage($application->packageID);
             }
             $filename = FileUtil::addTrailingSlash(FileUtil::getRealPath(WCF_DIR . $package->packageDir . 'templates/' . $templateGroup->templateGroupFolderName)) . $row['templateName'] . '.tpl';
             $templatesTar->add($filename, $packageDir, dirname($filename));
         }
         // append templates tar to style tar
         $templatesTar->create();
         $styleTar->add($templatesTarName, 'templates.tar', $templatesTarName);
         @unlink($templatesTarName);
     }
     if ($images && ($this->imagePath && $this->imagePath != 'images/')) {
         // create images tar
         $imagesTarName = FileUtil::getTemporaryFilename('images_', '.tar');
         $imagesTar = new TarWriter($imagesTarName);
         FileUtil::makeWritable($imagesTarName);
         // append images to tar
         $path = FileUtil::addTrailingSlash(WCF_DIR . $this->imagePath);
         if (file_exists($path) && is_dir($path)) {
             $handle = opendir($path);
             $regEx = new Regex('\\.(jpg|jpeg|gif|png|svg)$', Regex::CASE_INSENSITIVE);
             while (($file = readdir($handle)) !== false) {
                 if (is_file($path . $file) && $regEx->match($file)) {
                     $imagesTar->add($path . $file, '', $path);
                 }
             }
         }
         // append images tar to style tar
         $imagesTar->create();
         $styleTar->add($imagesTarName, 'images.tar', $imagesTarName);
         @unlink($imagesTarName);
     }
     // output file content
     $styleTar->create();
     // export as style package
     if (empty($packageName)) {
         readfile($styleTarName);
     } else {
         // export as package
         // create package tar
         $packageTarName = FileUtil::getTemporaryFilename('package_', '.tar.gz');
         $packageTar = new TarWriter($packageTarName, true);
         // append style tar
         $styleTarName = FileUtil::unifyDirSeparator($styleTarName);
         $packageTar->add($styleTarName, '', FileUtil::addTrailingSlash(dirname($styleTarName)));
         // create package.xml
         $xml->beginDocument('package', 'http://www.woltlab.com', 'http://www.woltlab.com/XSD/maelstrom/package.xsd', array('name' => $packageName));
         $xml->startElement('packageinformation');
         $xml->writeElement('packagename', $this->styleName);
         // description
         foreach ($styleDescriptions as $languageCode => $value) {
             $xml->writeElement('packagedescription', $value, array('language' => $languageCode));
         }
         $xml->writeElement('version', $this->styleVersion);
         $xml->writeElement('date', $this->styleDate);
         $xml->endElement();
         $xml->startElement('authorinformation');
         $xml->writeElement('author', $this->authorName);
         if ($this->authorURL) {
             $xml->writeElement('authorurl', $this->authorURL);
         }
         $xml->endElement();
         $xml->startElement('requiredpackages');
         $xml->writeElement('requiredpackage', 'com.woltlab.wcf', array('minversion' => PackageCache::getInstance()->getPackageByIdentifier('com.woltlab.wcf')->packageVersion));
         $xml->endElement();
         $xml->startElement('excludedpackages');
         $xml->writeElement('excludedpackage', 'com.woltlab.wcf', array('version' => self::EXCLUDE_WCF_VERSION));
         $xml->endElement();
         $xml->startElement('instructions', array('type' => 'install'));
         $xml->writeElement('instruction', basename($styleTarName), array('type' => 'style'));
         $xml->endElement();
         // append package info file to package tar
         $packageTar->addString(PackageArchive::INFO_FILE, $xml->endDocument());
         $packageTar->create();
         readfile($packageTarName);
         @unlink($packageTarName);
     }
     @unlink($styleTarName);
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:101,代码来源:StyleEditor.class.php

示例4: validate

 /**
  * @see	\wcf\form\IForm::validate()
  */
 public function validate()
 {
     parent::validate();
     if (empty($this->authorName)) {
         throw new UserInputException('authorName');
     }
     // validate date
     if (empty($this->styleDate)) {
         throw new UserInputException('styleDate');
     } else {
         try {
             DateUtil::validateDate($this->styleDate);
         } catch (SystemException $e) {
             throw new UserInputException('styleDate', 'notValid');
         }
     }
     if (empty($this->styleName)) {
         throw new UserInputException('styleName');
     }
     // validate version
     if (empty($this->styleVersion)) {
         throw new UserInputException('styleVersion');
     } else {
         if (!Package::isValidVersion($this->styleVersion)) {
             throw new UserInputException('styleVersion', 'notValid');
         }
     }
     // validate style description
     if (!I18nHandler::getInstance()->validateValue('styleDescription', true, true)) {
         throw new UserInputException('styleDescription');
     }
     // validate template group id
     if ($this->templateGroupID) {
         if (!isset($this->availableTemplateGroups[$this->templateGroupID])) {
             throw new UserInputException('templateGroupID');
         }
     }
     // ensure image path is below WCF_DIR/images/
     if ($this->imagePath) {
         $relativePath = FileUtil::unifyDirSeparator(FileUtil::getRelativePath(WCF_DIR . 'images/', WCF_DIR . $this->imagePath));
         if (strpos($relativePath, '../') !== false) {
             throw new UserInputException('imagePath', 'notValid');
         }
     }
     if (!empty($this->variables['overrideLess'])) {
         $this->parseOverrides();
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:51,代码来源:StyleAddForm.class.php

示例5: getRequestURI

 /**
  * Returns the request uri of the active request.
  * 
  * @return	string
  */
 public static function getRequestURI()
 {
     $REQUEST_URI = '';
     $appendQueryString = true;
     if (!empty($_SERVER['ORIG_PATH_INFO']) && strpos($_SERVER['ORIG_PATH_INFO'], '.php') !== false) {
         $REQUEST_URI = $_SERVER['ORIG_PATH_INFO'];
     } else {
         if (!empty($_SERVER['ORIG_SCRIPT_NAME'])) {
             $REQUEST_URI = $_SERVER['ORIG_SCRIPT_NAME'];
         } else {
             if (!empty($_SERVER['SCRIPT_NAME']) && (isset($_SERVER['PATH_INFO']) && !empty($_SERVER['PATH_INFO']))) {
                 $REQUEST_URI = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
             } else {
                 if (isset($_SERVER['REQUEST_URI']) && !empty($_SERVER['REQUEST_URI'])) {
                     $REQUEST_URI = $_SERVER['REQUEST_URI'];
                     $appendQueryString = false;
                 } else {
                     if (!empty($_SERVER['PHP_SELF'])) {
                         $REQUEST_URI = $_SERVER['PHP_SELF'];
                     } else {
                         if (!empty($_SERVER['PATH_INFO'])) {
                             $REQUEST_URI = $_SERVER['PATH_INFO'];
                         }
                     }
                 }
             }
         }
     }
     if ($appendQueryString && !empty($_SERVER['QUERY_STRING'])) {
         $REQUEST_URI .= '?' . $_SERVER['QUERY_STRING'];
     }
     // fix encoding
     if (!StringUtil::isUTF8($REQUEST_URI)) {
         $REQUEST_URI = StringUtil::convertEncoding('ISO-8859-1', 'UTF-8', $REQUEST_URI);
     }
     return mb_substr(FileUtil::unifyDirSeparator($REQUEST_URI), 0, 255);
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:42,代码来源:UserUtil.class.php

示例6: addFile

 /**
  * Adds a file to the tar archive.
  * 
  * @param	string		$filename
  * @param	string		$addDir
  * @param	string		$removeDir
  * @return	boolean		result
  */
 protected function addFile($filename, $addDir, $removeDir)
 {
     $filename = FileUtil::unifyDirSeparator($filename);
     $storedFilename = $filename;
     if (!empty($removeDir)) {
         $storedFilename = StringUtil::replaceIgnoreCase($removeDir, '', $filename);
     }
     if (!empty($addDir)) {
         $storedFilename = $addDir . $storedFilename;
     }
     if (is_file($filename)) {
         // open file
         $file = new File($filename, 'rb');
         // write header
         if (!$this->writeFileHeader($filename, $storedFilename)) {
             return false;
         }
         // write file content
         while (($buffer = $file->read(512)) != '') {
             $this->file->write(pack('a512', $buffer));
         }
         // close file
         $file->close();
     } else {
         // only directory header
         if (!$this->writeFileHeader($filename, $storedFilename)) {
             return false;
         }
     }
     return true;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:39,代码来源:TarWriter.class.php

示例7: scanFileObjects

 /**
  * Fills the list of available files, with DirectoryIterator object as value
  */
 protected function scanFileObjects()
 {
     // value is cached
     if (!empty($this->fileObjects)) {
         return;
     }
     if ($this->recursive) {
         $it = new \RecursiveIteratorIterator($this->obj, \RecursiveIteratorIterator::CHILD_FIRST);
         foreach ($it as $filename => $obj) {
             // ignore . and ..
             if ($it->isDot()) {
                 continue;
             }
             $this->fileObjects[FileUtil::unifyDirSeparator($filename)] = $obj;
         }
     } else {
         foreach ($this->obj as $obj) {
             // ignore . and ..
             if ($this->obj->isDot()) {
                 continue;
             }
             $this->fileObjects[FileUtil::unifyDirSeparator($obj->getFilename())] = $obj;
         }
     }
     // add the directory itself
     $this->fileObjects[$this->directory] = new \SplFileInfo($this->directory);
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:30,代码来源:DirectoryUtil.class.php

示例8: getInstalledFiles

 /**
  * Scans the given dir for installed files.
  * 
  * @param	string		$dir
  */
 protected function getInstalledFiles($dir)
 {
     if ($files = glob($dir . '*')) {
         foreach ($files as $file) {
             if (is_dir($file)) {
                 $this->getInstalledFiles(FileUtil::addTrailingSlash($file));
             } else {
                 self::$installedFiles[] = FileUtil::unifyDirSeparator($file);
             }
         }
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:17,代码来源:WCFSetup.class.php

示例9: compile

 /**
  * Compiles LESS stylesheets.
  * 
  * @param	\cms\data\stylesheet\Stylesheet		$stylesheet
  * @param	integer					$styleID
  */
 public function compile(Stylesheet $stylesheet, $styleID = null)
 {
     $styles = StyleHandler::getInstance()->getStyles();
     // compile stylesheet for all installed styles
     if ($styleID === null) {
         foreach ($styles as $style) {
             $this->compile($stylesheet, $style->styleID);
         }
         return;
     }
     $style = $styles[$styleID];
     // get style variables
     $variables = $style->getVariables();
     if (isset($variables['individualLess'])) {
         unset($variables['individualLess']);
     }
     // add style image path
     $imagePath = '../images/';
     if ($style->imagePath) {
         $imagePath = FileUtil::getRelativePath(WCF_DIR . 'style/', WCF_DIR . $style->imagePath);
         $imagePath = FileUtil::addTrailingSlash(FileUtil::unifyDirSeparator($imagePath));
     }
     $variables['style_image_path'] = "'{$imagePath}'";
     // apply overrides
     if (isset($variables['overrideLess'])) {
         $lines = explode("\n", StringUtil::unifyNewlines($variables['overrideLess']));
         foreach ($lines as $line) {
             if (preg_match('~^@([a-zA-Z]+): ?([@a-zA-Z0-9 ,\\.\\(\\)\\%\\#-]+);$~', $line, $matches)) {
                 $variables[$matches[1]] = $matches[2];
             }
         }
         unset($variables['overrideLess']);
     }
     // add options as LESS variables
     foreach (Option::getOptions() as $constantName => $option) {
         if (in_array($option->optionType, array('boolean', 'integer'))) {
             $variables['wcf_option_' . mb_strtolower($constantName)] = '~"' . $option->optionValue . '"';
         }
     }
     // compile
     $this->compiler->setVariables($variables);
     $content = "/* stylesheet for '" . $stylesheet->getTitle() . "', generated on " . gmdate('r') . " -- DO NOT EDIT */\n\n";
     $content .= $this->compiler->compile($stylesheet->less);
     // compress stylesheet
     $lines = explode("\n", $content);
     $content = $lines[0] . "\n" . $lines[1] . "\n";
     for ($i = 2, $length = count($lines); $i < $length; $i++) {
         $line = trim($lines[$i]);
         $content .= $line;
         switch (substr($line, -1)) {
             case ',':
                 $content .= ' ';
                 break;
             case '}':
                 $content .= "\n";
                 break;
         }
         if (substr($line, 0, 6) == '@media') {
             $content .= "\n";
         }
     }
     // write stylesheet
     $filename = $stylesheet->getLocation($styleID);
     file_put_contents($filename, $content);
     FileUtil::makeWritable($filename);
     // write rtl stylesheet
     $content = StyleUtil::convertCSSToRTL($content);
     $filename = $stylesheet->getLocation($styleID, true);
     file_put_contents($filename, $content);
     FileUtil::makeWritable($filename);
 }
开发者ID:knzo,项目名称:Fireball,代码行数:77,代码来源:StylesheetCompiler.class.php

示例10: show

    /**
     * @see	\wcf\system\exception\IPrintableException::show()
     */
    public function show()
    {
        // send status code
        @header('HTTP/1.1 503 Service Unavailable');
        // show user-defined system-exception
        if (defined('SYSTEMEXCEPTION_FILE') && file_exists(SYSTEMEXCEPTION_FILE)) {
            require SYSTEMEXCEPTION_FILE;
            return;
        }
        $innerMessage = '';
        try {
            if (is_object(WCF::getLanguage())) {
                $innerMessage = WCF::getLanguage()->get('wcf.global.error.exception', true);
            }
        } catch (\Exception $e) {
        }
        if (empty($innerMessage)) {
            $innerMessage = 'Please send the ID above to the site administrator.<br />The error message can be looked up at &ldquo;ACP &raquo; Logs &raquo; Errors&rdquo;.';
        }
        // print report
        $e = $this->getPrevious() ?: $this;
        ?>
<!DOCTYPE html>
		<html>
			<head>
				<title>Fatal error: <?php 
        echo StringUtil::encodeHTML($this->_getMessage());
        ?>
</title>
				<meta charset="utf-8" />
				<style>
					.systemException {
						font-family: 'Trebuchet MS', Arial, sans-serif !important;
						font-size: 80% !important;
						text-align: left !important;
						border: 1px solid #036;
						border-radius: 7px;
						background-color: #eee !important;
						overflow: auto !important;
					}
					.systemException h1 {
						font-size: 130% !important;
						font-weight: bold !important;
						line-height: 1.1 !important;
						text-decoration: none !important;
						text-shadow: 0 -1px 0 #003 !important;
						color: #fff !important;
						word-wrap: break-word !important;
						border-bottom: 1px solid #036;
						border-top-right-radius: 6px;
						border-top-left-radius: 6px;
						background-color: #369 !important;
						margin: 0 !important;
						padding: 5px 10px !important;
					}
					.systemException div {
						border-top: 1px solid #fff;
						border-bottom-right-radius: 6px;
						border-bottom-left-radius: 6px;
						padding: 0 10px !important;
					}
					.systemException h2 {
						font-size: 130% !important;
						font-weight: bold !important;
						color: #369 !important;
						text-shadow: 0 1px 0 #fff !important;
						margin: 5px 0 !important;
					}
					.systemException pre, .systemException p {
						text-shadow: none !important;
						color: #555 !important;
						margin: 0 !important;
					}
					.systemException pre {
						font-size: .85em !important;
						font-family: "Courier New" !important;
						text-overflow: ellipsis;
						padding-bottom: 1px;
						overflow: hidden !important;
					}
					.systemException pre:hover{
						text-overflow: clip;
						overflow: auto !important;
					}
				</style>
			</head>
			<body>
				<div class="systemException">
					<h1>Fatal error: <?php 
        if (!$this->getExceptionID()) {
            ?>
Unable to write log file, please make &quot;<?php 
            echo FileUtil::unifyDirSeparator(WCF_DIR);
            ?>
log/&quot; writable!<?php 
        } else {
            echo StringUtil::encodeHTML($this->_getMessage());
//.........这里部分代码省略.........
开发者ID:nick-strohm,项目名称:WCF,代码行数:101,代码来源:SystemException.class.php

示例11: promptPackageDir

 /**
  * Prompts for a text input for package directory (applies for applications only)
  * 
  * @return	\wcf\system\form\FormDocument
  */
 protected function promptPackageDir()
 {
     if (!PackageInstallationFormManager::findForm($this->queue, 'packageDir')) {
         $container = new GroupFormElementContainer();
         $packageDir = new TextInputFormElement($container);
         $packageDir->setName('packageDir');
         $packageDir->setLabel(WCF::getLanguage()->get('wcf.acp.package.packageDir.input'));
         $defaultPath = FileUtil::addTrailingSlash(FileUtil::unifyDirSeparator(dirname(WCF_DIR)));
         // check if there is already an application
         $sql = "SELECT\tCOUNT(*) AS count\n\t\t\t\tFROM\twcf" . WCF_N . "_package\n\t\t\t\tWHERE\tpackageDir = ?";
         $statement = WCF::getDB()->prepareStatement($sql);
         $statement->execute(array('../'));
         $row = $statement->fetchArray();
         if ($row['count']) {
             // use abbreviation
             $defaultPath .= strtolower(Package::getAbbreviation($this->getPackage()->package)) . '/';
         }
         $packageDir->setValue($defaultPath);
         $container->appendChild($packageDir);
         $document = new FormDocument('packageDir');
         $document->appendContainer($container);
         PackageInstallationFormManager::registerForm($this->queue, $document);
         return $document;
     } else {
         $document = PackageInstallationFormManager::getForm($this->queue, 'packageDir');
         $document->handleRequest();
         $packageDir = FileUtil::addTrailingSlash(FileUtil::getRealPath(FileUtil::unifyDirSeparator($document->getValue('packageDir'))));
         if ($packageDir === '/') {
             $packageDir = '';
         }
         if ($packageDir !== null) {
             // validate package dir
             if (file_exists($packageDir . 'global.php')) {
                 $document->setError('packageDir', WCF::getLanguage()->get('wcf.acp.package.packageDir.notAvailable'));
                 return $document;
             }
             // set package dir
             $packageEditor = new PackageEditor($this->getPackage());
             $packageEditor->update(array('packageDir' => FileUtil::getRelativePath(WCF_DIR, $packageDir)));
             // determine domain path, in some environments (e.g. ISPConfig) the $_SERVER paths are
             // faked and differ from the real filesystem path
             if (PACKAGE_ID) {
                 $wcfDomainPath = ApplicationHandler::getInstance()->getWCF()->domainPath;
             } else {
                 $sql = "SELECT\tdomainPath\n\t\t\t\t\t\tFROM\twcf" . WCF_N . "_application\n\t\t\t\t\t\tWHERE\tpackageID = ?";
                 $statement = WCF::getDB()->prepareStatement($sql);
                 $statement->execute(array(1));
                 $row = $statement->fetchArray();
                 $wcfDomainPath = $row['domainPath'];
             }
             $documentRoot = str_replace($wcfDomainPath, '', FileUtil::unifyDirSeparator(WCF_DIR));
             $domainPath = str_replace($documentRoot, '', $packageDir);
             // update application path
             $application = new Application($this->getPackage()->packageID);
             $applicationEditor = new ApplicationEditor($application);
             $applicationEditor->update(array('domainPath' => $domainPath, 'cookiePath' => $domainPath));
             // create directory and set permissions
             @mkdir($packageDir, 0777, true);
             FileUtil::makeWritable($packageDir);
         }
         return null;
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:68,代码来源:PackageInstallationDispatcher.class.php

示例12: removeFiles

 /**
  * Removes files matching given pattern.
  * 
  * @param	string		$pattern
  */
 protected function removeFiles($pattern)
 {
     $directory = FileUtil::unifyDirSeparator(WCF_DIR . 'cache/');
     $pattern = str_replace('*', '.*', str_replace('.', '\\.', $pattern));
     $this->getDirectoryUtil()->executeCallback(new Callback(function ($filename) {
         if (!@touch($filename, 1)) {
             @unlink($filename);
             WCF::resetZendOpcache($filename);
         }
     }), new Regex('^' . $directory . $pattern . '$', Regex::CASE_INSENSITIVE));
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:16,代码来源:DiskCacheSource.class.php


注:本文中的wcf\util\FileUtil::unifyDirSeparator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。