本文整理汇总了PHP中PHPCI\Builder::interpolate方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::interpolate方法的具体用法?PHP Builder::interpolate怎么用?PHP Builder::interpolate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PHPCI\Builder
的用法示例。
在下文中一共展示了Builder::interpolate方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Set up the plugin, configure options, etc.
* @param Builder $phpci
* @param Build $build
* @param array $options
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
{
$path = $phpci->buildPath;
$this->phpci = $phpci;
$this->build = $build;
$this->directory = isset($options['directory']) ? $this->phpci->interpolate($options['directory']) : $path;
}
示例2: execute
/**
* Connects to PgSQL and runs a specified set of queries.
* @return boolean
*/
public function execute()
{
try {
$opts = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION);
$pdo = new PDO('pgsql:host=' . $this->host, $this->user, $this->pass, $opts);
foreach ($this->queries as $query) {
$pdo->query($this->phpci->interpolate($query));
}
} catch (\Exception $ex) {
$this->phpci->logFailure($ex->getMessage());
return false;
}
return true;
}
示例3: execute
/**
* Runs the shell command.
*/
public function execute()
{
if (!defined('ENABLE_SHELL_PLUGIN') || !ENABLE_SHELL_PLUGIN) {
throw new \Exception('The shell plugin is not enabled.');
}
$success = true;
foreach ($this->commands as $command) {
$command = $this->phpci->interpolate($command);
if (!$this->phpci->executeCommand($command)) {
$success = false;
}
}
return $success;
}
示例4: executeFile
/**
* @param string $query
* @return boolean
* @throws \Exception
*/
protected function executeFile($query)
{
if (!isset($query['file'])) {
throw new \Exception(Lang::get('import_file_key'));
}
$import_file = $this->phpci->buildPath . $this->phpci->interpolate($query['file']);
if (!is_readable($import_file)) {
throw new \Exception(Lang::get('cannot_open_import', $import_file));
}
$database = isset($query['database']) ? $this->phpci->interpolate($query['database']) : null;
$import_command = $this->getImportCommand($import_file, $database);
if (!$this->phpci->executeCommand($import_command)) {
throw new \Exception(Lang::get('unable_to_execute'));
}
return true;
}
示例5: executeFile
/**
* @param string $query
* @return boolean
* @throws \Exception
*/
protected function executeFile($query)
{
if (!isset($query['file'])) {
throw new \Exception("Import statement must contain a 'file' key");
}
$import_file = $this->phpci->buildPath . $this->phpci->interpolate($query['file']);
if (!is_readable($import_file)) {
throw new \Exception("Cannot open SQL import file: {$import_file}");
}
$database = isset($query['database']) ? $this->phpci->interpolate($query['database']) : null;
$import_command = $this->getImportCommand($import_file, $database);
if (!$this->phpci->executeCommand($import_command)) {
throw new \Exception("Unable to execute SQL file");
}
return true;
}