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


PHP realPath函数代码示例

本文整理汇总了PHP中realPath函数的典型用法代码示例。如果您正苦于以下问题:PHP realPath函数的具体用法?PHP realPath怎么用?PHP realPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: getDetails

function getDetails($array, $useHash, $realPath, $dirRoot, $urlPrefix)
{
    foreach ($array as $file) {
        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        $pathFile = str_replace($realPath, $dirRoot, realPath($file));
        // remove last directory path from arguments. ex : /home/user/doc/file.txt to file.txt
        $realPathFile = str_replace($dirRoot . "/", "", $pathFile);
        // Exclude dir from list
        if (is_dir($file) == false) {
            $files[$realPathFile]['location'] = $realPathFile;
            $files[$realPathFile]['url'] = $urlPrefix . $realPathFile;
            $files[$realPathFile]['type'] = finfo_file($finfo, $file);
            $files[$realPathFile]['size'] = filesize($file);
            $files[$realPathFile]['last_modified'] = date("F d Y H:i:s", filemtime($file));
            if ($useHash == true) {
                $files[$realPathFile]['md5'] = md5_file($file);
                $files[$realPathFile]['crc32'] = hash_file('crc32', $file);
                $files[$realPathFile]['sha1'] = hash_file('sha1', $file);
                $files[$realPathFile]['sha256'] = hash_file('sha256', $file);
                $files[$realPathFile]['sha512'] = hash_file('sha512', $file);
            }
            echo "Processing File " . $realPathFile . " ...\n";
        }
        finfo_close($finfo);
    }
    return array('files' => $files);
}
开发者ID:aancw,项目名称:dirList-JSON-Hash,代码行数:27,代码来源:dirList-JSON-Hash.php

示例2: __construct

 /**
  * @param \Slim\App $slimInstance
  * @param string|string[] $controllerDirs
  * @param string $cacheDir
  * @throws \Exception
  */
 public function __construct(\Slim\App $slimInstance, $controllerDirs, $cacheDir, RouteParser $parser = null, DataGenerator $generator = null)
 {
     parent::__construct($parser, $generator);
     // We save current Slim instance
     self::$_slimInstance = $slimInstance;
     // We save controller dirs
     if (is_string($controllerDirs)) {
         $controllerDirs = [$controllerDirs];
     }
     if (!is_array($controllerDirs)) {
         throw new \InvalidArgumentException('Controllers directory must be either string or array');
     }
     $this->_controllerDirs = [];
     foreach ($controllerDirs as $d) {
         $realPath = realPath($d);
         if ($realPath !== false) {
             $this->_controllerDirs[] = $realPath;
         }
     }
     // We save the cache dir
     if (!is_dir($cacheDir)) {
         $result = @mkdir($cacheDir, 0777, true);
         if ($result === false) {
             throw new \RuntimeException('Can\'t create cache directory');
         }
     }
     if (!is_writable($cacheDir)) {
         throw new \RuntimeException('Cache directory must be writable by web server');
     }
     $this->_cacheDir = rtrim($cacheDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
     $this->_generateRoutes();
 }
开发者ID:RemyJeancolas,项目名称:slim-annotations-router,代码行数:38,代码来源:Router.php

示例3: compileViews

 /**
  * Build views in order to parse php files
  *
  * @param array $viewPaths
  * @param string $domain
  * @return bool
  * @throws FileCreationException
  */
 public function compileViews(array $viewPaths, $domain)
 {
     // Check the output directory
     $targetDir = $this->storagePath . DIRECTORY_SEPARATOR . $this->storageContainer;
     if (!file_exists($targetDir)) {
         $this->createDirectory($targetDir);
     }
     // Domain separation
     $domainDir = $targetDir . DIRECTORY_SEPARATOR . $domain;
     $this->clearDirectory($domainDir);
     $this->createDirectory($domainDir);
     foreach ($viewPaths as $path) {
         $path = $this->basePath . DIRECTORY_SEPARATOR . $path;
         if (!($realPath = realPath($path))) {
             throw new Exceptions\DirectoryNotFoundException("Failed to resolve {$path}, please check that it exists");
         }
         $fs = new \Illuminate\Filesystem\Filesystem($path);
         $files = $fs->allFiles($realPath);
         $compiler = new \Illuminate\View\Compilers\BladeCompiler($fs, $domainDir);
         foreach ($files as $file) {
             $filePath = $file->getRealPath();
             $compiler->setPath($filePath);
             $contents = $compiler->compileString($fs->get($filePath));
             $compiledPath = $compiler->getCompiledPath($compiler->getPath());
             $fs->put($compiledPath . '.php', $contents);
         }
     }
     return true;
 }
开发者ID:xinax,项目名称:laravel-gettext,代码行数:37,代码来源:FileSystem.php

示例4: load

 /**
  * {@inheritdoc}
  */
 public function load($filePath)
 {
     $yaml = new Parser();
     $filePath = realPath($filePath);
     if (!$filePath) {
         throw new \InvalidArgumentException(sprintf('Constant File Does not Exist! %s', $filePath));
     }
     return $yaml->parse(file_get_contents($filePath));
 }
开发者ID:renegare,项目名称:skip,代码行数:12,代码来源:YamlLoader.php

示例5: run

 public function run($addonId, $path)
 {
     $addonModel = XenForo_Model::create('XenForo_Model_AddOn');
     $this->printMessage('Importing ' . $addonId . ' from ' . realPath($path) . '...');
     $print = 'importing addon.xml...';
     $print .= str_repeat(' ', $this->_column - strlen($print));
     $t = microtime(true);
     $m = memory_get_usage(true);
     $this->printMessage($print, false);
     $xml = new SimpleXMLElement($path . '/addon.xml', 0, true);
     $addOnData = array('addon_id' => (string) $xml['addon_id'], 'title' => (string) $xml['title'], 'version_string' => (string) $xml['version_string'], 'version_id' => (string) $xml['version_id'], 'install_callback_class' => (string) $xml['install_callback_class'], 'install_callback_method' => (string) $xml['install_callback_method'], 'uninstall_callback_class' => (string) $xml['uninstall_callback_class'], 'uninstall_callback_method' => (string) $xml['uninstall_callback_method'], 'url' => (string) $xml['url']);
     $version = file_get_contents($path . '/version.txt');
     if ($version) {
         foreach ($addOnData as &$data) {
             $data = str_replace('{@revision}', $version, $data);
         }
     }
     $addOnData['version_id'] = (int) $addOnData['version_id'];
     $existingAddOn = $addonModel->verifyAddOnIsInstallable($addOnData, $addonModel->getAddonById($addonId) ? $addonId : false);
     $db = XenForo_Application::getDb();
     XenForo_Db::beginTransaction($db);
     if ($addOnData['install_callback_class'] && $addOnData['install_callback_method']) {
         call_user_func(array($addOnData['install_callback_class'], $addOnData['install_callback_method']), $existingAddOn, $addOnData);
     }
     $addOnDw = XenForo_DataWriter::create('XenForo_DataWriter_AddOn');
     if ($existingAddOn) {
         $addOnDw->setExistingData($existingAddOn, true);
     }
     $addOnDw->bulkSet($addOnData);
     $addOnDw->save();
     $t = abs(microtime(true) - $t);
     $m = abs(memory_get_usage(true) - $m);
     $m = $m / 1024 / 1024;
     $this->printMessage('done (' . number_format($t, 2) . 'sec, ' . number_format($m, 2) . 'mb)');
     $this->_importXml($addonId, $path . '/admin_navigation.xml', 'AdminNavigation');
     $this->_importXml($addonId, $path . '/admin_permissions.xml', 'Admin', 'importAdminPermissionsAddOnXml');
     $this->_importXml($addonId, $path . '/code_events.xml', 'CodeEvent', 'importEventsAddOnXml');
     $this->_importXml($addonId, $path . '/code_event_listeners.xml', 'CodeEvent', 'importEventListenersAddOnXml');
     $this->_importXml($addonId, $path . '/cron.xml', 'Cron', 'importCronEntriesAddOnXml');
     $this->_importXml($addonId, $path . '/email_templates.xml', 'EmailTemplate');
     $this->_importXml($addonId, $path . '/options.xml', 'Option');
     $this->_importXml($addonId, $path . '/permissions.xml', 'Permission');
     $this->_importXml($addonId, $path . '/route_prefixes.xml', 'RoutePrefix', 'importPrefixesAddOnXml');
     $this->_importXml($addonId, $path . '/style_properties.xml', 'StyleProperty', 'importStylePropertyXml', array(0, $addonId));
     $this->_importXml($addonId, $path . '/admin_style_properties.xml', 'StyleProperty', 'importStylePropertyXml', array(-1, $addonId));
     foreach (array('templates/admin', 'templates/master', 'phrases') as $dir) {
         $this->_removeDirectory(XenForo_Application::getInstance()->getRootDir() . '/' . $dir . '/' . $addonId);
     }
     $this->_importXml($addonId, $path . '/templates.xml', 'Template');
     $this->_importXml($addonId, $path . '/admin_templates.xml', 'AdminTemplate');
     $this->_importXml($addonId, $path . '/phrases.xml', 'Phrase');
     // TODO: bbcode
     XenForo_Db::commit($db);
     $this->printEmptyLine();
     $this->manualRun('rebuild', false, false, array('caches' => 'addon'));
 }
开发者ID:robclancy,项目名称:XenForo-Build-Tools,代码行数:56,代码来源:Buildimport.php

示例6: getDestination

 public function getDestination($realPath = true)
 {
     $destination = $this->destination;
     if ($realPath) {
         $destination = realPath($destination);
         if (false === $destination) {
             throw new \RuntimeException("Invalid destination path ({$this->destination})");
         }
     }
     return $destination;
 }
开发者ID:jmfontaine,项目名称:sherpa,代码行数:11,代码来源:AbstractRenderer.php

示例7: extract

 /**
  * Extracts the zip file $zipFile into the folder $folder. Some validation on content types may be given in $types.
  * @param str $zipFile The path to the zip file
  * @param str $folder The path of the folder to extract the zip to
  * @param str|array $types A string or an array containing either :
  * <ul><li>"*" (default behaviour) to extract any kind of contents</li>
  * <li>An array of the extensions that are allowed to be axtracted</li>
  * </ul>
  * @return ZipArchive The archive object
  */
 public function extract($zipFile, $folder, $types = '*')
 {
     if ($types == '*' || $types == array('*') || empty($types)) {
         $allTypes = true;
     } else {
         $allTypes = false;
     }
     $symlinksFiles = array();
     $zip = new ZipArchive();
     if ($zip->open($zipFile)) {
         for ($i = 0; $i < $zip->numFiles; $i++) {
             $entry = $zip->getNameIndex($i);
             if (substr($entry, -1) == '/') {
                 $isFolder = true;
             } else {
                 $ext = array_pop(explode('.', $entry));
                 $isFolder = false;
             }
             if ($allTypes || $isFolder || in_array($ext, $types)) {
                 // We verify if the file is a symlink
                 $fileName = basename($entry);
                 if ($fileName == self::SYMLINK_FILENAME) {
                     // after the dezipping process, we will add the symlinks
                     $symlinksFiles[] = $entry;
                 }
                 $zip->extractTo($folder, $entry);
             }
         }
         foreach ($symlinksFiles as $symlinksFile) {
             $symlinks = file($folder . '/' . $symlinksFile);
             foreach ($symlinks as $symlink) {
                 list($source, $destination) = explode(' ', $symlink, 2);
                 $this->helper->create_symLink($source, realPath(dirname($source) . '/' . $destination));
             }
             //echo 'On a un symlink de '.$source.' vers '.$destination.'<br />';
         }
         $zip->close();
     } else {
         return false;
     }
     return $zip;
 }
开发者ID:briceparent,项目名称:Shopsailors,代码行数:52,代码来源:sh_zipper.cls.php

示例8: fire

 public function fire(Factory $viewFactory)
 {
     //add config templates directory to view locations
     $viewFactory->addLocation(realpath(__DIR__ . '/ConfigMigrations/templates'));
     if (($destPath = $this->option('dest-path')) === null) {
         $destPath = 'config';
     }
     if (($author = $this->argument('author')) === null) {
         throw new InvalidArgumentException('Missing author option');
     }
     if (($sourceFilePath = $this->option('source-file')) === null) {
         $sourceFilePath = 'config/doctrine.php';
     }
     $destPath = realpath($destPath);
     if (!is_dir($destPath)) {
         mkdir($destPath, 0777, true);
     }
     if (!is_writable($destPath)) {
         throw new InvalidArgumentException(sprintf("Configuration destination directory '<info>%s</info>' does not have write permissions.", $destPath));
     }
     $destFilePath = $destPath . '/doctrine.generated.php';
     $originalSourceFilePath = $sourceFilePath;
     $sourceFilePath = realPath($sourceFilePath);
     if (!file_exists($sourceFilePath)) {
         throw new InvalidArgumentException(sprintf("Source file at path '<info>%s</info>' does not exist.", $originalSourceFilePath));
     }
     $sourceArrayConfig = (include $sourceFilePath);
     //TODO make this relative
     switch ($author) {
         case 'atrauzzi':
             //$convertedConfigString = $this->convertAtrauzzi($sourceArrayConfig, $viewFactory);
             break;
         case 'mitchellvanw':
             $convertedConfigString = $this->convertMitchell($sourceArrayConfig, $viewFactory);
             break;
         default:
             throw new InvalidArgumentException('Author provided was not a valid choice.');
     }
     file_put_contents($destFilePath, '<?php ' . $convertedConfigString);
     $this->info('Conversion successful. File generated at ' . $destFilePath);
 }
开发者ID:jee7,项目名称:orm,代码行数:41,代码来源:ConvertConfigCommand.php

示例9: uploadBuild

 public function uploadBuild($target)
 {
     if (!isset($_FILES[$target]["name"]) || !$_FILES[$target]["size"]) {
         $this->error_id = 1;
         $this->error_message = "No file provided.";
         return $this->error_id;
     }
     if ($_FILES[$target]["size"] > 10000000) {
         $this->error_id = 2;
         $this->error_message = "The Maximum upload file size is 10 MB";
         return $this->error_id;
     }
     //a filter for file names
     //allows letters, numbers, '.', '-', '_', '\'', and ' '
     $this->name = basename($_FILES[$target]["name"]);
     if (preg_replace("/[^a-zA-Z0-9\\.\\-\\_\\ \\']/", "", $this->name) !== $this->name) {
         $this->error_id = 2;
         $this->error_message = "Invalid characters in file name";
         return $this->error_id;
     }
     $fileExt = pathinfo($this->name, PATHINFO_EXTENSION);
     $targetPath = realPath(dirname(__FILE__) . "uploads/" . $this->name);
     if ($fileExt != "bls") {
         $this->error_id = 2;
         $this->error_message = "Only .bls files are allowed";
         return $this->error_id;
     }
     if (file_exists($targetPath)) {
         $this->error_id = 2;
         $this->error_message = "A file with that name already exists.";
         return $this->error_id;
     }
     //basic parse of .bls file
     //$contents = explode("\n", file_get_contents($_FILES["uploadfile"]["tmp_name"]));
     $contents = file($_FILES[$target]["tmp_name"]);
     return $this->validateFileContents($contents);
 }
开发者ID:hoff121324,项目名称:GlassWebsite,代码行数:37,代码来源:BLSParser.php

示例10: execute

 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return int|null|void
  */
 public function execute(InputInterface $input, OutputInterface $output)
 {
     if (($destPath = $input->getOption('dest-path')) === null) {
         $destPath = 'config';
     }
     if (($author = $input->getArgument('author')) === null) {
         throw new InvalidArgumentException('Missing author option');
     }
     if (($sourceFilePath = $input->getOption('source-file')) === null) {
         $sourceFilePath = 'config/doctrine.php';
     }
     $destPath = realpath($destPath);
     if (!is_dir($destPath)) {
         mkdir($destPath, 0777, true);
     }
     if (!is_writable($destPath)) {
         throw new InvalidArgumentException(sprintf("Configuration destination directory '<info>%s</info>' does not have write permissions.", $destPath));
     }
     $destFilePath = $destPath . '/doctrine.generated.php';
     $originalSourceFilePath = $sourceFilePath;
     $sourceFilePath = realPath($sourceFilePath);
     if (!file_exists($sourceFilePath)) {
         throw new InvalidArgumentException(sprintf("Source file at path '<info>%s</info>' does not exist.", $originalSourceFilePath));
     }
     $sourceArrayConfig = (include $sourceFilePath);
     $viewFactory = $this->createViewFactory();
     $className = __NAMESPACE__ . '\\ConfigMigrations\\' . ucfirst($author) . 'Migrator';
     if (!class_exists($className)) {
         throw new InvalidArgumentException('Author provided was not a valid choice.');
     } else {
         $configMigrator = new $className($viewFactory);
         $convertedConfigString = $configMigrator->convertConfiguration($sourceArrayConfig);
     }
     file_put_contents($destFilePath, '<?php ' . $convertedConfigString);
     $output->writeln('Conversion successful. File generated at ' . $destFilePath);
 }
开发者ID:Devitek,项目名称:orm,代码行数:42,代码来源:ConvertConfigCommand.php

示例11: iwp_mmb_get_file_size

 function iwp_mmb_get_file_size($file)
 {
     clearstatcache();
     $normal_file_size = filesize($file);
     if ($normal_file_size !== false && $normal_file_size >= 0) {
         return $normal_file_size;
     } else {
         $file = realPath($file);
         if (!$file) {
             echo 'iwp_mmb_get_file_size_error : realPath error';
         }
         $ch = curl_init("file://" . $file);
         curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_FILE);
         curl_setopt($ch, CURLOPT_NOBODY, true);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
         curl_setopt($ch, CURLOPT_HEADER, true);
         $data = curl_exec($ch);
         $curl_error = curl_error($ch);
         curl_close($ch);
         if ($data !== false && preg_match('/Content-Length: (\\d+)/', $data, $matches)) {
             return (string) $matches[1];
         } else {
             echo 'iwp_mmb_get_file_size_error : ' . $curl_error;
             return $normal_file_size;
         }
     }
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:27,代码来源:pclzip.class.php

示例12: saveFormDataToDb

 /**
  * Save the form controls data to the database
  *
  * @param object $form Jelix jForm object
  * @return Boolean True if the has been saved
  */
 public function saveFormDataToDb($form)
 {
     // Set the form from request
     //$form->initFromRequest();
     // Optionnaly query for the feature
     $cnx = jDb::getConnection($this->layerId);
     $layerName = $this->layerName;
     $capabilities = $this->project->getEditionLayers()->{$layerName}->capabilities;
     // Update or Insert
     $updateAction = false;
     $insertAction = false;
     if ($this->featureId) {
         $updateAction = true;
     } else {
         $insertAction = true;
     }
     // Get list of fields which are not primary keys
     $fields = array();
     foreach ($this->dataFields as $fieldName => $prop) {
         // For update : And get only fields corresponding to edition capabilities
         if (!$prop->primary and (strtolower($capabilities->modifyAttribute) == 'true' and $fieldName != $this->geometryColumn or strtolower($capabilities->modifyGeometry) == 'true' and $fieldName == $this->geometryColumn or $insertAction)) {
             $fields[] = $fieldName;
         }
     }
     if (count($fields) == 0) {
         jLog::log('Not enough capabilities for this layer ! SQL cannot be constructed: no fields available !', 'error');
         $form->setErrorOn($this->geometryColumn, 'An error has been raised when saving the form: Not enough capabilities for this layer !');
         jMessage::clearAll();
         jMessage::add(jLocale::get('view~edition.link.error.sql'), 'error');
         return false;
     }
     // Loop though the fields and filter the form posted values
     $update = array();
     $insert = array();
     $refs = array();
     foreach ($fields as $ref) {
         // Get and filter the posted data foreach form control
         $value = $form->getData($ref);
         if (is_array($value)) {
             $value = '{' . implode(',', $value) . '}';
         }
         switch ($this->formControls[$ref]->fieldDataType) {
             case 'geometry':
                 $value = "ST_GeomFromText('" . filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES) . "', " . $this->srid . ")";
                 $rs = $cnx->query('SELECT GeometryType(' . $value . ') as geomtype');
                 $rs = $rs->fetch();
                 if (!preg_match('/' . $this->geometryType . '/', strtolower($rs->geomtype))) {
                     if (preg_match('/' . str_replace('multi', '', $this->geometryType) . '/', strtolower($rs->geomtype))) {
                         $value = 'ST_Multi(' . $value . ')';
                     } else {
                         $form->setErrorOn($this->geometryColumn, "The geometry type doen't match!");
                         return false;
                     }
                 }
                 break;
             case 'date':
             case 'datetime':
                 $value = filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES);
                 if (!$value) {
                     $value = 'NULL';
                 } else {
                     $value = $cnx->quote($value);
                 }
                 break;
             case 'integer':
                 $value = filter_var($value, FILTER_SANITIZE_NUMBER_INT);
                 if (!$value) {
                     $value = 'NULL';
                 }
                 break;
             case 'float':
                 $value = (double) $value;
                 if (!$value) {
                     $value = 'NULL';
                 }
                 break;
             default:
                 $value = $cnx->quote(filter_var($value, FILTER_SANITIZE_STRING, FILTER_FLAG_NO_ENCODE_QUOTES));
                 break;
         }
         if ($form->hasUpload() && array_key_exists($ref, $form->getUploads())) {
             $value = $form->getData($ref);
             $choiceValue = $form->getData($ref . '_choice');
             $hiddenValue = $form->getData($ref . '_hidden');
             $repPath = $this->repository->getPath();
             if ($choiceValue == 'update') {
                 $refPath = realpath($repPath . '/media') . '/upload/' . $this->project->getKey() . '/' . $this->tableName . '/' . $ref;
                 $form->saveFile($ref, $refPath);
                 $value = 'media' . '/upload/' . $this->project->getKey() . '/' . $this->tableName . '/' . $ref . '/' . $value;
                 if ($hiddenValue && file_exists(realPath($repPath) . '/' . $hiddenValue)) {
                     unlink(realPath($repPath) . '/' . $hiddenValue);
                 }
             } else {
                 if ($choiceValue == 'delete') {
//.........这里部分代码省略.........
开发者ID:NaturalGIS,项目名称:lizmap-web-client,代码行数:101,代码来源:edition.classic.php

示例13: defined

<?php

defined('APP_CONFIG_NAME') or define('APP_CONFIG_NAME', 'backend');
// web application configuration
return array('basePath' => realPath(__DIR__ . '/..'), 'aliases' => array('bootstrap' => 'application.modules.bootstrap', 'menu' => 'application.modules.pb_menu', 'chartjs' => 'bootstrap.extensions.yii-chartjs-master'), 'behaviors' => array(), 'preload' => array('bootstrap', 'chartjs'), 'controllerMap' => array(), 'import' => array('bootstrap.*', 'bootstrap.components.*', 'bootstrap.models.*', 'bootstrap.controllers.*', 'bootstrap.helpers.*', 'bootstrap.widgets.*', 'bootstrap.extensions.*', 'chartjs.*', 'chartjs.widgets.*', 'chartjs.components.*', 'menu.*', 'menu.models.*', 'menu.widgets.*', 'menu.components.*', 'menu.controllers.*', 'menu.extensions.*'), 'modules' => array('bootstrap' => array('class' => 'bootstrap.BootStrapModule'), 'menu' => array('class' => 'menu.PbMenuModule')), 'components' => array('bsHtml' => array('class' => 'bootstrap.components.BSHtml'), 'chartjs' => array('class' => 'bootstrap.extensions.yii-chartjs-master.components.ChartJs'), 'menu' => array('class' => 'menu.components.MenuPlugin'), 'clientScript' => array(), 'urlManager' => array('urlFormat' => 'path', 'showScriptName' => false, 'rules' => array('<controller:\\w+>/<id:\\d+>' => '<controller>/view', '<controller:\\w+>/<action:\\w+>/<id:\\d+>' => '<controller>/<action>', '<controller:\\w+>/<action:\\w+>' => '<controller>/<action>')), 'user' => array('allowAutoLogin' => true), 'errorHandler' => array('errorAction' => 'site/error')));
开发者ID:bafio89,项目名称:qea-u,代码行数:5,代码来源:backend.php

示例14: fromTo

function fromTo($from, $to)
{
    echo "\t", sprintf('%-20s', $from), ' => ', $to, PHP_EOL;
}
echo 'Setting up', PHP_EOL;
$root = realPath(__DIR__ . '/../application/settings') . DIRECTORY_SEPARATOR;
$env = isset($_SERVER['argv'][1]) ? $_SERVER['argv'][1] : 'dev';
fromTo('env.php', $root . 'env.php');
file_put_contents($root . 'env.php', '<?php $config = \'' . $env . '\';');
require dirName(__DIR__) . '/library/Nano.php';
$files = array('db.php' => 'db.php', 'log.php' => 'log.php', 'selenium.php' => 'selenium.php', 'web.php' => 'web.php', 'assets.php' => 'assets.php', 'plugins.php' => 'plugins.php');
$source = __DIR__ . '/setup/' . $env;
if (file_exists($source)) {
    foreach ($files as $from => $to) {
        $sourceFile = $source . DS . $from;
        $destinationDir = realPath(dirName($root . $to));
        $destinationFile = $destinationDir . DS . baseName($to);
        if (file_exists($sourceFile)) {
            fromTo($from, $destinationFile);
            copy($sourceFile, $destinationFile);
        }
    }
}
echo 'Done', PHP_EOL;
if (file_exists($source . '.php')) {
    include $source . '.php';
    if (function_exists('setupEnv')) {
        setupEnv();
    }
}
Nano::reloadConfig();
开发者ID:studio-v,项目名称:nano,代码行数:31,代码来源:setup.php

示例15: set_time_limit

 $url = $rowInstall['link'];
 $certPath = MODX_CORE_PATH . 'components/upgrademodx/cacert.pem';
 if (!file_exists($certPath)) {
     MODXInstaller::quit('Could not find cacert.pem');
 }
 set_time_limit(0);
 $success = MODXInstaller::downloadFile($url, $source, $method, $certPath);
 /* Make sure we have the downloaded file */
 if ($success !== true) {
     MODXInstaller::quit($success);
 } elseif (!file_exists($source)) {
     MODXInstaller::quit('Missing file: ' . $source);
 } elseif (filesize($source) < 64) {
     MODXInstaller::quit('File: ' . $source . ' is empty -- download failed');
 }
 $tempDir = realPath(dirname(__FILE__)) . '/temp';
 MODXInstaller::mmkdir($tempDir);
 clearstatcache();
 $destination = $tempDir;
 if (!file_exists($tempDir)) {
     MODXInstaller::quit('Unable to create directory: ' . $tempDir);
 }
 if (!is_readable($tempDir)) {
     MODXInstaller::quit('Unable to read from /temp directory');
 }
 set_time_limit(0);
 $success = MODXInstaller::unZip(MODX_CORE_PATH, $source, $destination, $forcePclZip);
 if ($success !== true) {
     MODXInstaller::quit($success);
 }
 $directories = MODXInstaller::getDirectories();
开发者ID:BobRay,项目名称:UpgradeMODX,代码行数:31,代码来源:upgrademodxsnippetscriptsource.chunk.php


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