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


PHP phutil_load_library函数代码示例

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


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

示例1: init_phabricator_script

function init_phabricator_script()
{
    phutil_load_library('/srv/phab/libphutil/src');
    phutil_load_library('/srv/phab/phabricator/src');
    phutil_load_library('/srv/phab/Sprint/src');
    phutil_load_library('/srv/phab/arcanist/src');
    PhabricatorEnv::initializeScriptEnvironment();
}
开发者ID:yangming85,项目名称:phabricator-extensions-Sprint,代码行数:8,代码来源:__init_script__.php

示例2: testPhutilExtensions

 public function testPhutilExtensions()
 {
     $root = dirname(phutil_get_library_root('phutil'));
     $path = array($root, 'support', 'phutiltestlib');
     $path = implode(DIRECTORY_SEPARATOR, $path);
     phutil_load_library($path);
     $this->assertEqual(true, class_exists('PhutilTestClassA'));
     $this->assertEqual(true, class_exists('PhutilTestClassB'));
     $this->assertEqual(true, class_exists('PhutilTestClassC'));
     $symbols = id(new PhutilSymbolLoader())->setAncestorClass('PhutilTestClassA')->setConcreteOnly(true)->selectAndLoadSymbols();
     $this->assertEqual(2, count($symbols));
 }
开发者ID:chaozhang80,项目名称:tool-package,代码行数:12,代码来源:PhutilExtensionsTestCase.php

示例3: init_phabricator_script

function init_phabricator_script()
{
    error_reporting(E_ALL | E_STRICT);
    ini_set('display_errors', 1);
    $include_path = ini_get('include_path');
    ini_set('include_path', $include_path . PATH_SEPARATOR . dirname(__FILE__) . '/../../');
    @(include_once 'libphutil/scripts/__init_script__.php');
    if (!@constant('__LIBPHUTIL__')) {
        echo "ERROR: Unable to load libphutil. Update your PHP 'include_path' to " . "include the parent directory of libphutil/.\n";
        exit(1);
    }
    phutil_load_library('arcanist/src');
    phutil_load_library(dirname(__FILE__) . '/../src/');
    PhabricatorEnv::initializeScriptEnvironment();
}
开发者ID:denghp,项目名称:phabricator,代码行数:15,代码来源:__init_script__.php

示例4: error_reporting

<?php

/*
 * Copyright 2011 Facebook, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
$include_path = ini_get('include_path');
ini_set('include_path', $include_path . ':' . dirname(__FILE__) . '/../../');
@(include_once 'libphutil/src/__phutil_library_init__.php');
if (!@constant('__LIBPHUTIL__')) {
    echo "ERROR: Unable to load libphutil. Update your PHP 'include_path' to " . "include the parent directory of libphutil/.\n";
    exit(1);
}
phutil_load_library(dirname(__FILE__) . '/../src/');
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:27,代码来源:__init_script__.php

示例5: buildSkin

 public function buildSkin(AphrontRequest $request)
 {
     foreach ($this->phutilLibraries as $library) {
         phutil_load_library($library);
     }
     return newv($this->getSkinClass(), array($request, $this));
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:7,代码来源:PhameSkinSpecification.php

示例6: loadCoreLibraries

 public static function loadCoreLibraries()
 {
     $phabricator_root = dirname(dirname(__FILE__));
     $libraries_root = dirname($phabricator_root);
     $root = null;
     if (!empty($_SERVER['PHUTIL_LIBRARY_ROOT'])) {
         $root = $_SERVER['PHUTIL_LIBRARY_ROOT'];
     }
     ini_set('include_path', $libraries_root . PATH_SEPARATOR . ini_get('include_path'));
     @(include_once $root . 'libphutil/src/__phutil_library_init__.php');
     if (!@constant('__LIBPHUTIL__')) {
         self::didFatal("Unable to load libphutil. Put libphutil/ next to phabricator/, or " . "update your PHP 'include_path' to include the parent directory of " . "libphutil/.");
     }
     phutil_load_library('arcanist/src');
     // Load Phabricator itself using the absolute path, so we never end up doing
     // anything surprising (loading index.php and libraries from different
     // directories).
     phutil_load_library($phabricator_root . '/src');
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:19,代码来源:PhabricatorStartup.php

示例7: setup_aphront_basics

/**
 * @group aphront
 */
function setup_aphront_basics()
{
    $aphront_root = dirname(dirname(__FILE__));
    $libraries_root = dirname($aphront_root);
    $root = null;
    if (!empty($_SERVER['PHUTIL_LIBRARY_ROOT'])) {
        $root = $_SERVER['PHUTIL_LIBRARY_ROOT'];
    }
    ini_set('include_path', $libraries_root . PATH_SEPARATOR . ini_get('include_path'));
    @(include_once $root . 'libphutil/src/__phutil_library_init__.php');
    if (!@constant('__LIBPHUTIL__')) {
        echo "ERROR: Unable to load libphutil. Put libphutil/ next to " . "phabricator/, or update your PHP 'include_path' to include " . "the parent directory of libphutil/.\n";
        exit(1);
    }
    // Load Phabricator itself using the absolute path, so we never end up doing
    // anything surprising (loading index.php and libraries from different
    // directories).
    phutil_load_library($aphront_root . '/src');
    phutil_load_library('arcanist/src');
}
开发者ID:rudimk,项目名称:phabricator,代码行数:23,代码来源:index.php

示例8: ini_get

 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
$include_path = ini_get('include_path');
ini_set('include_path', $include_path . ':' . dirname(__FILE__) . '/../../');
require_once dirname(dirname(__FILE__)) . '/conf/__init_conf__.php';
$env = isset($_SERVER['PHABRICATOR_ENV']) ? $_SERVER['PHABRICATOR_ENV'] : getenv('PHABRICATOR_ENV');
if (!$env) {
    echo "Define PHABRICATOR_ENV before running this script.\n";
    exit(1);
}
$conf = phabricator_read_config_file($env);
$conf['phabricator.env'] = $env;
phutil_require_module('phabricator', 'infrastructure/env');
PhabricatorEnv::setEnvConfig($conf);
phutil_load_library('arcanist/src');
foreach (PhabricatorEnv::getEnvConfig('load-libraries') as $library) {
    phutil_load_library($library);
}
PhutilErrorHandler::initialize();
$tz = PhabricatorEnv::getEnvConfig('phabricator.timezone');
if ($tz) {
    date_default_timezone_set($tz);
}
开发者ID:nguyennamtien,项目名称:phabricator,代码行数:31,代码来源:__init_env__.php

示例9: buildConfigurationSourceStack

 private static function buildConfigurationSourceStack()
 {
     self::dropConfigCache();
     $stack = new PhabricatorConfigStackSource();
     self::$sourceStack = $stack;
     $default_source = id(new PhabricatorConfigDefaultSource())->setName(pht('Global Default'));
     $stack->pushSource($default_source);
     $env = self::getSelectedEnvironmentName();
     if ($env) {
         $stack->pushSource(id(new PhabricatorConfigFileSource($env))->setName(pht("File '%s'", $env)));
     }
     $stack->pushSource(id(new PhabricatorConfigLocalSource())->setName(pht('Local Config')));
     // If the install overrides the database adapter, we might need to load
     // the database adapter class before we can push on the database config.
     // This config is locked and can't be edited from the web UI anyway.
     foreach (self::getEnvConfig('load-libraries') as $library) {
         phutil_load_library($library);
     }
     // If custom libraries specify config options, they won't get default
     // values as the Default source has already been loaded, so we get it to
     // pull in all options from non-phabricator libraries now they are loaded.
     $default_source->loadExternalOptions();
     // If this install has site config sources, load them now.
     $site_sources = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorConfigSiteSource')->loadObjects();
     $site_sources = msort($site_sources, 'getPriority');
     foreach ($site_sources as $site_source) {
         $stack->pushSource($site_source);
     }
     try {
         $stack->pushSource(id(new PhabricatorConfigDatabaseSource('default'))->setName(pht('Database')));
     } catch (AphrontQueryException $exception) {
         // If the database is not available, just skip this configuration
         // source. This happens during `bin/storage upgrade`, `bin/conf` before
         // schema setup, etc.
     }
 }
开发者ID:JohnnyEstilles,项目名称:phabricator,代码行数:36,代码来源:PhabricatorEnv.php

示例10: arcanist_load_libraries

function arcanist_load_libraries($load, $must_load, $lib_source, ArcanistWorkingCopyIdentity $working_copy)
{
    if (!$load) {
        return;
    }
    if (!is_array($load)) {
        $error = "Libraries specified by {$lib_source} are invalid; expected " . "a list. Check your configuration.";
        $console = PhutilConsole::getConsole();
        $console->writeErr("WARNING: %s\n", $error);
        return;
    }
    foreach ($load as $location) {
        // Try to resolve the library location. We look in several places, in
        // order:
        //
        //  1. Inside the working copy. This is for phutil libraries within the
        //     project. For instance "library/src" will resolve to
        //     "./library/src" if it exists.
        //  2. In the same directory as the working copy. This allows you to
        //     check out a library alongside a working copy and reference it.
        //     If we haven't resolved yet, "library/src" will try to resolve to
        //     "../library/src" if it exists.
        //  3. Using normal libphutil resolution rules. Generally, this means
        //     that it checks for libraries next to libphutil, then libraries
        //     in the PHP include_path.
        //
        // Note that absolute paths will just resolve absolutely through rule (1).
        $resolved = false;
        // Check inside the working copy. This also checks absolute paths, since
        // they'll resolve absolute and just ignore the project root.
        $resolved_location = Filesystem::resolvePath($location, $working_copy->getProjectRoot());
        if (Filesystem::pathExists($resolved_location)) {
            $location = $resolved_location;
            $resolved = true;
        }
        // If we didn't find anything, check alongside the working copy.
        if (!$resolved) {
            $resolved_location = Filesystem::resolvePath($location, dirname($working_copy->getProjectRoot()));
            if (Filesystem::pathExists($resolved_location)) {
                $location = $resolved_location;
                $resolved = true;
            }
        }
        $console = PhutilConsole::getConsole();
        $console->writeLog("Loading phutil library from '%s'...\n", $location);
        $error = null;
        try {
            phutil_load_library($location);
        } catch (PhutilBootloaderException $ex) {
            $error = "Failed to load phutil library at location '{$location}'. " . "This library is specified by {$lib_source}. Check that the " . "setting is correct and the library is located in the right " . "place.";
            if ($must_load) {
                throw new ArcanistUsageException($error);
            } else {
                fwrite(STDERR, phutil_console_wrap('WARNING: ' . $error . "\n\n"));
            }
        } catch (PhutilLibraryConflictException $ex) {
            if ($ex->getLibrary() != 'arcanist') {
                throw $ex;
            }
            $arc_dir = dirname(dirname(__FILE__));
            $error = "You are trying to run one copy of Arcanist on another copy of " . "Arcanist. This operation is not supported. To execute Arcanist " . "operations against this working copy, run './bin/arc' (from the " . "current working copy) not some other copy of 'arc' (you ran one " . "from '{$arc_dir}').";
            throw new ArcanistUsageException($error);
        }
    }
}
开发者ID:ivoryxiong,项目名称:arcanist,代码行数:65,代码来源:arcanist.php

示例11: exit

<?php

// The include_path should have had libphutil's path appended when this file is
// included from the `arc unit` workflow.
@(include_once 'libphutil/scripts/__init_script__.php');
if (!@constant('__LIBPHUTIL__')) {
    echo "ERROR: Unable to load libphutil. Update your PHP 'include_path' to " . "include the parent directory of libphutil/.\n";
    exit(1);
}
phutil_load_library('arcanist/src');
// Fake out the interaction between Composer and libphutil's autoloaders:
// Composer always prepends its loader, and libphutil will throw an exception
// if a class is not found if there is no loader that runs after its own. This
// adds a do-nothing loader after libphutil's to avoid the `throw`. Mostly,
// this avoids some bogus `class_exists` failures in PHPUnit itself.
spl_autoload_register(function ($class) {
});
开发者ID:firehed,项目名称:arctools,代码行数:17,代码来源:bootstrap.php

示例12: liberateRunVerify

 private function liberateRunVerify($path)
 {
     phutil_load_library($path);
     $paths = $this->liberateGetChangedPaths($path);
     $results = $this->liberateLintModules($path, $paths);
     $renderer = new ArcanistLintRenderer();
     $unresolved = false;
     foreach ($results as $result) {
         foreach ($result->getMessages() as $message) {
             echo $renderer->renderLintResult($result);
             $unresolved = true;
             break;
         }
     }
     return (int) $unresolved;
 }
开发者ID:nik-kor,项目名称:arcanist,代码行数:16,代码来源:ArcanistLiberateWorkflow.php

示例13: buildConfigurationSourceStack

 private static function buildConfigurationSourceStack($config_optional)
 {
     self::dropConfigCache();
     $stack = new PhabricatorConfigStackSource();
     self::$sourceStack = $stack;
     $default_source = id(new PhabricatorConfigDefaultSource())->setName(pht('Global Default'));
     $stack->pushSource($default_source);
     $env = self::getSelectedEnvironmentName();
     if ($env) {
         $stack->pushSource(id(new PhabricatorConfigFileSource($env))->setName(pht("File '%s'", $env)));
     }
     $stack->pushSource(id(new PhabricatorConfigLocalSource())->setName(pht('Local Config')));
     // If the install overrides the database adapter, we might need to load
     // the database adapter class before we can push on the database config.
     // This config is locked and can't be edited from the web UI anyway.
     foreach (self::getEnvConfig('load-libraries') as $library) {
         phutil_load_library($library);
     }
     // If custom libraries specify config options, they won't get default
     // values as the Default source has already been loaded, so we get it to
     // pull in all options from non-phabricator libraries now they are loaded.
     $default_source->loadExternalOptions();
     // If this install has site config sources, load them now.
     $site_sources = id(new PhutilClassMapQuery())->setAncestorClass('PhabricatorConfigSiteSource')->setSortMethod('getPriority')->execute();
     foreach ($site_sources as $site_source) {
         $stack->pushSource($site_source);
     }
     $master = PhabricatorDatabaseRef::getMasterDatabaseRef();
     if (!$master) {
         self::setReadOnly(true, self::READONLY_MASTERLESS);
     } else {
         if ($master->isSevered()) {
             $master->checkHealth();
             if ($master->isSevered()) {
                 self::setReadOnly(true, self::READONLY_SEVERED);
             }
         }
     }
     try {
         $stack->pushSource(id(new PhabricatorConfigDatabaseSource('default'))->setName(pht('Database')));
     } catch (AphrontSchemaQueryException $exception) {
         // If the database is not available, just skip this configuration
         // source. This happens during `bin/storage upgrade`, `bin/conf` before
         // schema setup, etc.
     } catch (AphrontConnectionQueryException $ex) {
         if (!$config_optional) {
             throw $ex;
         }
     } catch (AphrontInvalidCredentialsQueryException $ex) {
         if (!$config_optional) {
             throw $ex;
         }
     }
 }
开发者ID:endlessm,项目名称:phabricator,代码行数:54,代码来源:PhabricatorEnv.php

示例14: buildConfigurationSourceStack

 private static function buildConfigurationSourceStack($config_optional)
 {
     self::dropConfigCache();
     $stack = new PhabricatorConfigStackSource();
     self::$sourceStack = $stack;
     $default_source = id(new PhabricatorConfigDefaultSource())->setName(pht('Global Default'));
     $stack->pushSource($default_source);
     $env = self::getSelectedEnvironmentName();
     if ($env) {
         $stack->pushSource(id(new PhabricatorConfigFileSource($env))->setName(pht("File '%s'", $env)));
     }
     $stack->pushSource(id(new PhabricatorConfigLocalSource())->setName(pht('Local Config')));
     // If the install overrides the database adapter, we might need to load
     // the database adapter class before we can push on the database config.
     // This config is locked and can't be edited from the web UI anyway.
     foreach (self::getEnvConfig('load-libraries') as $library) {
         phutil_load_library($library);
     }
     // Drop any class map caches, since they will have generated without
     // any classes from libraries. Without this, preflight setup checks can
     // cause generation of a setup check cache that omits checks defined in
     // libraries, for example.
     PhutilClassMapQuery::deleteCaches();
     // If custom libraries specify config options, they won't get default
     // values as the Default source has already been loaded, so we get it to
     // pull in all options from non-phabricator libraries now they are loaded.
     $default_source->loadExternalOptions();
     // If this install has site config sources, load them now.
     $site_sources = id(new PhutilClassMapQuery())->setAncestorClass('PhabricatorConfigSiteSource')->setSortMethod('getPriority')->execute();
     foreach ($site_sources as $site_source) {
         $stack->pushSource($site_source);
     }
     $masters = PhabricatorDatabaseRef::getMasterDatabaseRefs();
     if (!$masters) {
         self::setReadOnly(true, self::READONLY_MASTERLESS);
     } else {
         // If any master is severed, we drop to readonly mode. In theory we
         // could try to continue if we're only missing some applications, but
         // this is very complex and we're unlikely to get it right.
         foreach ($masters as $master) {
             // Give severed masters one last chance to get healthy.
             if ($master->isSevered()) {
                 $master->checkHealth();
             }
             if ($master->isSevered()) {
                 self::setReadOnly(true, self::READONLY_SEVERED);
                 break;
             }
         }
     }
     try {
         $stack->pushSource(id(new PhabricatorConfigDatabaseSource('default'))->setName(pht('Database')));
     } catch (AphrontSchemaQueryException $exception) {
         // If the database is not available, just skip this configuration
         // source. This happens during `bin/storage upgrade`, `bin/conf` before
         // schema setup, etc.
     } catch (AphrontConnectionQueryException $ex) {
         if (!$config_optional) {
             throw $ex;
         }
     } catch (AphrontInvalidCredentialsQueryException $ex) {
         if (!$config_optional) {
             throw $ex;
         }
     }
 }
开发者ID:NeoArmageddon,项目名称:phabricator,代码行数:66,代码来源:PhabricatorEnv.php

示例15: dirname

             $location = $resolved_location;
             $resolved = true;
         }
         // If we didn't find anything, check alongside the working copy.
         if (!$resolved) {
             $resolved_location = Filesystem::resolvePath($location, dirname($working_copy->getProjectRoot()));
             if (Filesystem::pathExists($resolved_location)) {
                 $location = $resolved_location;
                 $resolved = true;
             }
         }
         if ($config_trace_mode) {
             echo "Loading phutil library '{$name}' from '{$location}'...\n";
         }
         try {
             phutil_load_library($location);
         } catch (PhutilBootloaderException $ex) {
             $error_msg = sprintf('Failed to load library "%s" at location "%s". Please check the ' . '"phutil_libraries" setting in your .arcconfig file. Refer to ' . '<http://www.phabricator.com/docs/phabricator/article/' . 'Arcanist_User_Guide_Configuring_a_New_Project.html> ' . 'for more information.', $name, $location);
             throw new ArcanistUsageException($error_msg);
         } catch (PhutilLibraryConflictException $ex) {
             if ($ex->getLibrary() != 'arcanist') {
                 throw $ex;
             }
             $arc_dir = dirname(dirname(__FILE__));
             $error_msg = "You are trying to run one copy of Arcanist on another copy of " . "Arcanist. This operation is not supported. To execute Arcanist " . "operations against this working copy, run './bin/arc' (from the " . "current working copy) not some other copy of 'arc' (you ran one " . "from '{$arc_dir}').";
             throw new ArcanistUsageException($error_msg);
         }
     }
 }
 $user_config = ArcanistBaseWorkflow::readUserConfigurationFile();
 $config = $working_copy->getConfig('arcanist_configuration');
开发者ID:nik-kor,项目名称:arcanist,代码行数:31,代码来源:arcanist.php


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