當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Wind::getRootPath方法代碼示例

本文整理匯總了PHP中Wind::getRootPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP Wind::getRootPath方法的具體用法?PHP Wind::getRootPath怎麽用?PHP Wind::getRootPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Wind的用法示例。


在下文中一共展示了Wind::getRootPath方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sortFile

 private function sortFile($file)
 {
     $directory = $this->_getDefaultDirectory();
     $sort = array('HTML', 'ATTACH', 'TPL', 'THEMES', 'ACLOUD', 'WINDID', 'REP', 'SRV', 'LIB', 'HOOK', 'EXT', 'APPS', 'CONF', 'DATA', 'SRC', 'PUBLIC');
     $strtr = array();
     $localDirectory = @(include Wind::getRealPath('CONF:directory.php', true));
     foreach ($sort as $v) {
         if ($directory[$v] == $localDirectory[$v]) {
             continue;
         }
         $search = PwSystemHelper::relative(WEKIT_PATH . $directory[$v]);
         $strtr[$search] = Wind::getRootPath($v);
     }
     $_file = ROOT_PATH . $file;
     foreach ($strtr as $search => $replace) {
         if (0 === strpos($_file, $search)) {
             $file = str_replace(ROOT_PATH, '', $replace . substr($_file, strlen($search)));
             break;
         }
     }
     return $file;
 }
開發者ID:fanqimeng,項目名稱:4tweb,代碼行數:22,代碼來源:PwPatchUpdate.php

示例2: sortDirectory

 /**
  * 根據現有目錄結構調整升級包目錄
  *
  * @param array $fileList        	
  */
 public function sortDirectory($fileList)
 {
     $this->_log('start to sort the directory');
     $sourceDir = $this->tmpPath . DIRECTORY_SEPARATOR . $this->target;
     $directoryFile = $sourceDir . DIRECTORY_SEPARATOR . 'conf/directory.php';
     $directory = @(include $directoryFile);
     if (!is_array($directory)) {
         return new PwError('APPCENTER:upgrade.directory.fail');
     }
     $this->_log('the remote directory is:' . var_export($directory, true));
     $root = Wind::getRealDir('ROOT:');
     $sort = array('TPL', 'THEMES', 'ACLOUD', 'WINDID', 'REP', 'SRV', 'LIB', 'HOOK', 'EXT', 'APPS', 'CONF', 'DATA', 'SRC', 'PUBLIC');
     $strtr = array();
     $localDirectory = @(include Wind::getRealPath('CONF:directory.php', true));
     foreach ($sort as $v) {
         if ($directory[$v] == $localDirectory[$v]) {
             continue;
         }
         $search = PwSystemHelper::relative(WEKIT_PATH . str_replace('/', DIRECTORY_SEPARATOR, $directory[$v]));
         $strtr[rtrim($search, '/\\')] = rtrim(Wind::getRootPath($v), '/\\');
     }
     $this->_log('way of moving directory' . var_export($strtr, true));
     if (!($sourceMd5 = WindFile::read($sourceDir . DIRECTORY_SEPARATOR . 'conf/md5sum'))) {
         return new PwError('APPCENTER:upgrade.target.hash.fail');
     }
     $sourceMd5 = PwSystemHelper::resolveMd5($sourceMd5);
     // md5sum
     $data = '';
     foreach ($sourceMd5 as $v => $md5) {
         $v = trim($v, '/');
         $v = str_replace('/', DIRECTORY_SEPARATOR, $v);
         $_v = ROOT_PATH . $v;
         $file = $v;
         foreach ($strtr as $search => $replace) {
             if (0 === strpos($_v, $search)) {
                 $file = str_replace(ROOT_PATH, '', $replace . substr($_v, strlen($search)));
                 $file = str_replace('//', '/', $file);
                 break;
             }
         }
         $data .= PwSystemHelper::md5content($md5, $file);
     }
     WindFile::write($sourceDir . DIRECTORY_SEPARATOR . 'conf/md5sum', $data);
     $moveList = $newFileList = array();
     $url = PwApplicationHelper::acloudUrl(array('a' => 'forward', 'do' => 'getVersionHash', 'pwversion' => $this->local));
     /* 從線上獲取當前版本的所有文件md5 */
     /* $result = PwApplicationHelper::requestAcloudData($url);
     		if ($result['code'] !== '0' || !$result['info']) return new PwError(array('APPCENTER:upgrade.version.hash.fail', array($result['msg']))); */
     if (!($tmp = WindFile::read(CONF_PATH . 'md5sum'))) {
         return new PwError('APPCENTER:upgrade.hash.fail');
     }
     $md5List = PwSystemHelper::resolveMd5($tmp);
     $this->_log('obtain the md5 list of current version');
     foreach ($fileList as $v) {
         $v = trim($v, '/');
         $v = str_replace('/', DIRECTORY_SEPARATOR, $v);
         $_v = $root . $v;
         $file = $v;
         foreach ($strtr as $search => $replace) {
             if (0 === strpos($_v, $search)) {
                 $file = str_replace($root, '', $replace . substr($_v, strlen($search)));
                 $file = str_replace('//', '/', $file);
                 $moveList[$v] = $file;
                 break;
             }
         }
         $newFileList[$file] = $md5List[str_replace(DIRECTORY_SEPARATOR, '/', $file)];
     }
     $this->_log('files need to move ' . var_export($moveList, true));
     $relativePath_1 = PwSystemHelper::resolveRelativePath(PUBLIC_PATH, Wind::getRealPath('SRC:wekit'));
     $relativePath_2 = PwSystemHelper::resolveRelativePath(PUBLIC_PATH . 'aCloud', Wind::getRealPath('SRC:wekit'));
     foreach ($moveList as $old => $new) {
         WindFolder::mkRecur(dirname($sourceDir . DIRECTORY_SEPARATOR . $new));
         copy($sourceDir . DIRECTORY_SEPARATOR . $old, $sourceDir . DIRECTORY_SEPARATOR . $new);
         WindFile::del($sourceDir . DIRECTORY_SEPARATOR . $old);
         if ('.php' === substr($old, -4) && !strncasecmp($old, 'www' . DIRECTORY_SEPARATOR, 4)) {
             $content = WindFile::read($sourceDir . DIRECTORY_SEPARATOR . $new);
             if (strpos($content, '../../src/wekit.php')) {
                 $content = str_replace('../../src/wekit.php', $relativePath_2, $content);
             } else {
                 $content = str_replace('../src/wekit.php', $relativePath_1, $content);
             }
             // $content = str_replace('../src/wekit.php',
             // Wind::getRealPath('SRC:wekit'), $content);
             WindFile::write($sourceDir . DIRECTORY_SEPARATOR . $new, $content);
         }
     }
     // 目錄文件
     if ($directory != $localDirectory) {
         $directory = array_merge($directory, $localDirectory);
         $temp = "<?php\r\n defined('WEKIT_VERSION') or exit(403);\r\n return ";
         $temp .= WindString::varToString($directory) . ";\r\n?>";
         WindFile::write($directoryFile, $temp);
     }
     Wekit::cache()->set('system_upgrade_replace', 1);
//.........這裏部分代碼省略.........
開發者ID:fanqimeng,項目名稱:4tweb,代碼行數:101,代碼來源:PwSystemInstallation.php

示例3: _checkFileRight

 /**
  * 檢查目錄權限
  *
  * @return array
  */
 private function _checkFileRight()
 {
     $rootdir = Wind::getRootPath('ROOT');
     $files_writeble[] = CONF_PATH;
     $files_writeble[] = DATA_PATH;
     //數據緩存目錄
     $files_writeble[] = DATA_PATH . 'cache/';
     $files_writeble[] = DATA_PATH . 'compile/';
     $files_writeble[] = DATA_PATH . 'log/';
     $files_writeble[] = DATA_PATH . 'tmp/';
     $files_writeble[] = DATA_PATH . 'design/';
     $files_writeble[] = EXT_PATH;
     //擴展應用目錄
     $files_writeble[] = ATTACH_PATH;
     //本地附近目錄
     $files_writeble[] = HTML_PATH;
     //本地靜態文件可寫目錄
     $files_writeble[] = THEMES_PATH;
     //風格目錄
     $files_writeble[] = THEMES_PATH . 'extres/';
     $files_writeble[] = THEMES_PATH . 'forum/';
     $files_writeble[] = THEMES_PATH . 'portal/';
     $files_writeble[] = THEMES_PATH . 'site/';
     $files_writeble[] = THEMES_PATH . 'space/';
     $files_writeble[] = PUBLIC_PATH . 'windid/attachment/';
     $files_writeble[] = $this->_getDatabaseFile();
     $files_writeble[] = $this->_getFounderFile();
     //$files_writeble[] = $this->_getWindidFile();
     $files_writeble = array_unique($files_writeble);
     sort($files_writeble);
     $writable = array();
     foreach ($files_writeble as $file) {
         $key = str_replace($rootdir, '', $file);
         $isWritable = $this->_checkWriteAble($file) ? true : false;
         if ($isWritable) {
             $flag = false;
             foreach ($writable as $k => $v) {
                 if (0 === strpos($key, $k)) {
                     $flag = true;
                 }
             }
             $flag || ($writable[$key] = $isWritable);
         } else {
             $writable[$key] = $isWritable;
         }
     }
     return $writable;
 }
開發者ID:sanzhumu,項目名稱:nextwind,代碼行數:53,代碼來源:IndexController.php

示例4: resolvedPath

 /**
  * 解析資源文件路徑信息
  * 
  * @param string $package
  * @return string
  */
 protected function resolvedPath($package)
 {
     $this->path || ($this->path = Wind::getRootPath(Wind::getAppName()));
     $this->language || ($this->language = $this->getRequest()->getAcceptLanguage());
     $path = $this->path . '/' . $this->language . '/' . strtolower($package);
     $path = Wind::getRealDir(trim($path, '/'), true);
     return $path;
 }
開發者ID:ccq18,項目名稱:EduSoho,代碼行數:14,代碼來源:WindLangResource.php

示例5: _checkFileRight

 /**
  * 檢查目錄權限
  *
  * @return array
  */
 private function _checkFileRight()
 {
     $rootdir = Wind::getRootPath('ROOT');
     $files_writeble[] = CONF_PATH;
     $files_writeble[] = DATA_PATH;
     //數據緩存目錄
     $files_writeble[] = DATA_PATH . 'cache/';
     $files_writeble[] = DATA_PATH . 'compile/';
     $files_writeble[] = DATA_PATH . 'log/';
     $files_writeble[] = DATA_PATH . 'tmp/';
     $files_writeble[] = DATA_PATH . 'design/';
     $files_writeble[] = EXT_PATH;
     //擴展應用目錄
     $files_writeble[] = ATTACH_PATH;
     //本地附近目錄
     $files_writeble[] = HTML_PATH;
     //本地靜態文件可寫目錄
     $files_writeble[] = THEMES_PATH;
     //風格目錄
     $files_writeble[] = THEMES_PATH . 'extres/';
     $files_writeble[] = THEMES_PATH . 'forum/';
     $files_writeble[] = THEMES_PATH . 'portal/';
     $files_writeble[] = THEMES_PATH . 'site/';
     $files_writeble[] = THEMES_PATH . 'space/';
     $files_writeble[] = $this->_getDatabaseFile();
     $files_writeble[] = $this->_getFounderFile();
     $files_writeble[] = $this->_getWindidFile();
     $files_writeble = array_unique($files_writeble);
     sort($files_writeble);
     $writable = array();
     foreach ($files_writeble as $file) {
         $key = str_replace($rootdir, '', $file);
         $writable[$key] = $this->_checkWriteAble($file) ? true : false;
     }
     return $writable;
 }
開發者ID:fanqimeng,項目名稱:4tweb,代碼行數:41,代碼來源:IndexController.php


注:本文中的Wind::getRootPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。