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


PHP Cli::getResource方法代码示例

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


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

示例1: realpath

#!/usr/bin/env php
<?php 
/**
 * Script for creating and loading database
 * Execute "php load.oracle.php --help" for help
 */
require_once realpath(dirname(__FILE__) . '/lib/Cli.php');
$cli = new Cli(array('fromVerison|f-s' => "Specify from which version it have to update", 'toVersion|t-s' => "Specify to which version it have to update"));
echo "Starting UPDATE application script...\n";
/**
 * @var MongoCollection
 */
$db = $cli->getResource('mongo');
$baseDir = rtrim(dirname(__FILE__), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . 'updates';
if (!file_exists($baseDir)) {
    echo "Update directory does not exist.\n";
    exit(0);
}
$dir = dir($baseDir);
$currentVersionFile = $baseDir . DIRECTORY_SEPARATOR . 'current';
// this block executes the actual statements that were loaded from
// the schema file.
try {
    // let the user know whats going on (we are actually creating a
    // database here)
    if ('testing' != APPLICATION_ENV) {
        echo 'Writing Database for environment <' . APPLICATION_ENV . '> in (control-c to cancel): ' . PHP_EOL;
        for ($x = 3; $x > 0; $x--) {
            echo $x . "\r";
            sleep(1);
        }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:31,代码来源:update.php

示例2: Cli

 * Script for creating and loading database
 * Execute "php load.oracle.php --help" for help
 */
// Initialize the application path and autoloading
require_once 'lib/Cli.php';
$cli = new Cli(array('drop|d' => 'Drop database and data', 'file|f=s' => 'Load file'), false);
try {
    /**
     * @var MongoCollection
     */
    if ($cli->getOption('e') === null) {
        throw new Exception('Need environment param');
    }
    global $db;
    global $drop;
    $db = $cli->getResource('mongo');
    $cli->getResource('cachemanager');
    // let the user know whats going on (we are actually creating a
    // database here)
    if ('testing' != APPLICATION_ENV) {
        echo 'Writing Database for environment <' . APPLICATION_ENV . '> in (control-c to cancel): ' . PHP_EOL;
        for ($x = 3; $x > 0; $x--) {
            echo $x . "\r";
            sleep(1);
        }
    }
    $env = $cli->getOption('e');
    $yamlFile = $cli->getOption('f');
    if (!$yamlFile) {
        $yamlFile = APPLICATION_PATH . '/..' . '/data/default/db/data.mongodb.' . $env . '.yml';
    }
开发者ID:SandeepUmredkar,项目名称:PortalSMIP,代码行数:31,代码来源:load.mongodb.php


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