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


PHP SettingsPiwik::rewriteTmpPathWithHostname方法代码示例

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


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

示例1: tableInsertBatch

 /**
  * Performs a batch insert into a specific table using either LOAD DATA INFILE or plain INSERTs,
  * as a fallback. On MySQL, LOAD DATA INFILE is 20x faster than a series of plain INSERTs.
  *
  * @param string $tableName PREFIXED table name! you must call Common::prefixTable() before passing the table name
  * @param array $fields array of unquoted field names
  * @param array $values array of data to be inserted
  * @param bool $throwException Whether to throw an exception that was caught while trying
  *                                LOAD DATA INFILE, or not.
  * @throws Exception
  * @return bool  True if the bulk LOAD was used, false if we fallback to plain INSERTs
  */
 public static function tableInsertBatch($tableName, $fields, $values, $throwException = false)
 {
     $filePath = PIWIK_USER_PATH . '/tmp/assets/' . $tableName . '-' . Common::generateUniqId() . '.csv';
     $filePath = SettingsPiwik::rewriteTmpPathWithHostname($filePath);
     $loadDataInfileEnabled = Config::getInstance()->General['enable_load_data_infile'];
     if ($loadDataInfileEnabled && Db::get()->hasBulkLoader()) {
         try {
             $fileSpec = array('delim' => "\t", 'quote' => '"', 'escape' => '\\\\', 'escapespecial_cb' => function ($str) {
                 return str_replace(array(chr(92), chr(34)), array(chr(92) . chr(92), chr(92) . chr(34)), $str);
             }, 'eol' => "\r\n", 'null' => 'NULL');
             // hack for charset mismatch
             if (!DbHelper::isDatabaseConnectionUTF8() && !isset(Config::getInstance()->database['charset'])) {
                 $fileSpec['charset'] = 'latin1';
             }
             self::createCSVFile($filePath, $fileSpec, $values);
             if (!is_readable($filePath)) {
                 throw new Exception("File {$filePath} could not be read.");
             }
             $rc = self::createTableFromCSVFile($tableName, $fields, $filePath, $fileSpec);
             if ($rc) {
                 unlink($filePath);
                 return true;
             }
         } catch (Exception $e) {
             Log::info("LOAD DATA INFILE failed or not supported, falling back to normal INSERTs... Error was: %s", $e->getMessage());
             if ($throwException) {
                 throw $e;
             }
         }
     }
     // if all else fails, fallback to a series of INSERTs
     @unlink($filePath);
     self::tableInsertBatchIterate($tableName, $fields, $values);
     return false;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:47,代码来源:BatchInsert.php

示例2: __construct

 public function __construct()
 {
     $loader = $this->getDefaultThemeLoader();
     $this->addPluginNamespaces($loader);
     // If theme != default we need to chain
     $chainLoader = new Twig_Loader_Chain(array($loader));
     // Create new Twig Environment and set cache dir
     $templatesCompiledPath = PIWIK_USER_PATH . '/tmp/templates_c';
     $templatesCompiledPath = SettingsPiwik::rewriteTmpPathWithHostname($templatesCompiledPath);
     $this->twig = new Twig_Environment($chainLoader, array('debug' => true, 'strict_variables' => true, 'cache' => $templatesCompiledPath));
     $this->twig->addExtension(new Twig_Extension_Debug());
     $this->twig->clearTemplateCache();
     $this->addFilter_translate();
     $this->addFilter_urlRewriteWithParameters();
     $this->addFilter_sumTime();
     $this->addFilter_money();
     $this->addFilter_truncate();
     $this->addFilter_notificiation();
     $this->addFilter_percentage();
     $this->twig->addFilter(new Twig_SimpleFilter('implode', 'implode'));
     $this->twig->addFilter(new Twig_SimpleFilter('ucwords', 'ucwords'));
     $this->addFunction_includeAssets();
     $this->addFunction_linkTo();
     $this->addFunction_sparkline();
     $this->addFunction_postEvent();
     $this->addFunction_isPluginLoaded();
     $this->addFunction_getJavascriptTranslations();
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:28,代码来源:Twig.php

示例3: __construct

 /**
  * @param string $directory directory to use
  * @param int $timeToLiveInSeconds TTL
  */
 public function __construct($directory, $timeToLiveInSeconds = 300)
 {
     $cachePath = PIWIK_USER_PATH . '/tmp/cache/' . $directory . '/';
     $this->cachePath = SettingsPiwik::rewriteTmpPathWithHostname($cachePath);
     if ($timeToLiveInSeconds < self::MINIMUM_TTL) {
         $timeToLiveInSeconds = self::MINIMUM_TTL;
     }
     $this->ttl = $timeToLiveInSeconds;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:13,代码来源:CacheFile.php

示例4: installOrUpdatePluginFromFile

 public function installOrUpdatePluginFromFile($pathToZip)
 {
     $tmpPluginFolder = PIWIK_USER_PATH . self::PATH_TO_DOWNLOAD . $this->pluginName;
     $tmpPluginFolder = SettingsPiwik::rewriteTmpPathWithHostname($tmpPluginFolder);
     try {
         $this->makeSureFoldersAreWritable();
         $this->extractPluginFiles($pathToZip, $tmpPluginFolder);
         $this->makeSurePluginJsonExists($tmpPluginFolder);
         $metadata = $this->getPluginMetadataIfValid($tmpPluginFolder);
         $this->makeSureThereAreNoMissingRequirements($metadata);
         $this->pluginName = $metadata->name;
         $this->fixPluginFolderIfNeeded($tmpPluginFolder);
         $this->copyPluginToDestination($tmpPluginFolder);
     } catch (\Exception $e) {
         $this->removeFileIfExists($pathToZip);
         $this->removeFolderIfExists($tmpPluginFolder);
         throw $e;
     }
     $this->removeFileIfExists($pathToZip);
     $this->removeFolderIfExists($tmpPluginFolder);
     return $metadata;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:22,代码来源:PluginInstaller.php

示例5: oneClick_Unpack

 private function oneClick_Unpack()
 {
     $pathExtracted = PIWIK_USER_PATH . self::PATH_TO_EXTRACT_LATEST_VERSION;
     $pathExtracted = SettingsPiwik::rewriteTmpPathWithHostname($pathExtracted);
     $this->pathRootExtractedPiwik = $pathExtracted . 'piwik';
     if (file_exists($this->pathRootExtractedPiwik)) {
         Filesystem::unlinkRecursive($this->pathRootExtractedPiwik, true);
     }
     $archive = Unzip::factory('PclZip', $this->pathPiwikZip);
     if (0 == ($archive_files = $archive->extract($pathExtracted))) {
         throw new Exception(Piwik::translate('CoreUpdater_ExceptionArchiveIncompatible', $archive->errorInfo()));
     }
     if (0 == count($archive_files)) {
         throw new Exception(Piwik::translate('CoreUpdater_ExceptionArchiveEmpty'));
     }
     unlink($this->pathPiwikZip);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:17,代码来源:Controller.php

示例6: setLogFilePathFromConfig

 private function setLogFilePathFromConfig($logConfig)
 {
     $logPath = $logConfig[self::LOGGER_FILE_PATH_CONFIG_OPTION];
     if (!SettingsServer::isWindows() && $logPath[0] != '/') {
         $logPath = PIWIK_USER_PATH . DIRECTORY_SEPARATOR . $logPath;
     }
     $logPath = SettingsPiwik::rewriteTmpPathWithHostname($logPath);
     if (is_dir($logPath)) {
         $logPath .= '/piwik.log';
     }
     $this->logToFilePath = $logPath;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:12,代码来源:Log.php

示例7: getOutputPath

 /**
  * Return $filename with temp directory and delete file
  *
  * @static
  * @param  $filename
  * @return string path of file in temp directory
  */
 protected static function getOutputPath($filename)
 {
     $outputFilename = PIWIK_USER_PATH . '/tmp/assets/' . $filename;
     $outputFilename = SettingsPiwik::rewriteTmpPathWithHostname($outputFilename);
     @chmod($outputFilename, 0600);
     @unlink($outputFilename);
     return $outputFilename;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:15,代码来源:StaticGraph.php

示例8: getSessionsDirectory

 /**
  * Returns the directory session files are stored in.
  *
  * @return string
  */
 public static function getSessionsDirectory()
 {
     $path = PIWIK_USER_PATH . '/tmp/sessions';
     return SettingsPiwik::rewriteTmpPathWithHostname($path);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:10,代码来源:Session.php

示例9: define

 * Piwik - Open source web analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 * @category Piwik_Plugins
 * @package ScheduledReports
 */
/**
 * Override settings in libs/tcpdf_config.php
 *
 * @package ScheduledReports
 */
define('K_PATH_MAIN', PIWIK_INCLUDE_PATH . '/libs/tcpdf/');
$pathTmpTCPDF = PIWIK_USER_PATH . '/tmp/tcpdf/';
$pathTmpTCPDF = \Piwik\SettingsPiwik::rewriteTmpPathWithHostname($pathTmpTCPDF);
define('K_PATH_CACHE', $pathTmpTCPDF);
define('K_PATH_IMAGES', $pathTmpTCPDF);
if (!defined('K_TCPDF_EXTERNAL_CONFIG')) {
    // DOCUMENT_ROOT fix for IIS Webserver
    if (!isset($_SERVER['DOCUMENT_ROOT']) or empty($_SERVER['DOCUMENT_ROOT'])) {
        if (isset($_SERVER['SCRIPT_FILENAME'])) {
            $_SERVER['DOCUMENT_ROOT'] = str_replace('\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0 - strlen($_SERVER['PHP_SELF'])));
        } elseif (isset($_SERVER['PATH_TRANSLATED'])) {
            $_SERVER['DOCUMENT_ROOT'] = str_replace('\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0 - strlen($_SERVER['PHP_SELF'])));
        } else {
            // define here your DOCUMENT_ROOT path if the previous fails
            $_SERVER['DOCUMENT_ROOT'] = '/var/www';
        }
    }
    if (!defined('K_PATH_MAIN')) {
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:31,代码来源:tcpdf_config.php

示例10: getAssetDirectory

 /**
  * Check if the merged file directory exists and is writable.
  *
  * @return string The directory location
  * @throws Exception if directory is not writable.
  */
 public function getAssetDirectory()
 {
     $mergedFileDirectory = PIWIK_USER_PATH . "/tmp/assets";
     $mergedFileDirectory = SettingsPiwik::rewriteTmpPathWithHostname($mergedFileDirectory);
     if (!is_dir($mergedFileDirectory)) {
         Filesystem::mkdir($mergedFileDirectory);
     }
     if (!is_writable($mergedFileDirectory)) {
         throw new Exception("Directory " . $mergedFileDirectory . " has to be writable.");
     }
     return $mergedFileDirectory;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:18,代码来源:AssetManager.php


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