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


PHP Zend_Console_Getopt::toArray方法代码示例

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


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

示例1: routeStartup

 public function routeStartup(Zend_Controller_Request_Abstract $request)
 {
     try {
         $opts = new Zend_Console_Getopt(array('controller|c=s' => 'Name of the controller to open', 'action|a=s' => 'The command line action to execute', 'cityId|ci=i' => 'City id to get trend data for', 'startDate|sd=s' => 'Start date for the price trends', 'endDate|ed=s' => 'End date for the price trends', 'hours|h=i' => 'How many hours to simulate for'));
         $opts->parse();
         $args = $opts->getRemainingArgs();
         if (!isset($opts->action)) {
             throw new Zend_Console_Getopt_Exception('Action parameter missing');
         }
         $cliAction = $opts->action;
         $cliController = $opts->controller;
         $paramters = array();
         $optArray = $opts->toArray();
         for ($i = 0; $i < count($optArray); $i += 2) {
             $paramters[$optArray[$i]] = $optArray[$i + 1];
         }
     } catch (Zend_Console_Getopt_Exception $e) {
         echo $opts->getUsageMessage();
         exit;
     }
     // set the request as a CLI request
     $request = new Zend_Controller_Request_Simple($cliAction, $cliController, 'cli');
     foreach ($paramters as $key => $paramVal) {
         $request->setParam($key, $paramVal);
     }
     foreach ($args as $argument) {
         $request->setParam($argument, true);
     }
     $response = new Zend_Controller_Response_Cli();
     $front = Zend_Controller_Front::getInstance();
     $front->setRequest($request)->setResponse($response);
 }
开发者ID:georgetutuianu,项目名称:licenta,代码行数:32,代码来源:CliInitializer.php

示例2: handle

 /**
  * handler for command line scripts
  * 
  * @return boolean
  */
 public function handle()
 {
     try {
         $opts = new Zend_Console_Getopt(array('help|h' => 'Display this help Message', 'verbose|v' => 'Output messages', 'config|c=s' => 'Path to config.inc.php file', 'setconfig' => 'Update config. To specify the key and value, append \' -- configKey="your_key" configValue="your config value"\'
                      Examples:
                        setup.php --setconfig -- configkey=sample1 configvalue=value11
                        setup.php --setconfig -- configkey=sample2 configvalue=arrayKey1:Value1,arrayKey2:value2', 'check_requirements' => 'Check if all requirements are met to install and run tine20', 'create_admin' => 'Create new admin user (or reactivate if already exists)', 'install-s' => 'Install applications [All] or comma separated list;' . ' To specify the login name and login password of the admin user that is created during installation, append \' -- adminLoginName="admin" adminPassword="password"\'' . ' To add imap or smtp settings, append (for example) \' -- imap="host:mail.example.org,port:143,dbmail_host:localhost" smtp="ssl:tls"\'', 'update-s' => 'Update applications [All] or comma separated list', 'uninstall-s' => 'Uninstall application [All] or comma separated list', 'list-s' => 'List installed applications', 'sync_accounts_from_ldap' => 'Import user and groups from ldap', 'egw14import' => 'Import user and groups from egw14
                      Examples: 
                       setup.php --egw14import egwdbhost egwdbuser egwdbpass egwdbname latin1
                       setup.php --egw14import egwdbhost egwdbuser egwdbpass egwdbname utf8'));
         $opts->parse();
     } catch (Zend_Console_Getopt_Exception $e) {
         echo "Invalid usage: {$e->getMessage()}\n\n";
         echo $e->getUsageMessage();
         exit;
     }
     if (count($opts->toArray()) === 0 || $opts->h || empty($opts->install) && empty($opts->update) && empty($opts->uninstall) && empty($opts->list) && empty($opts->sync_accounts_from_ldap) && empty($opts->egw14import) && empty($opts->check_requirements) && empty($opts->create_admin) && empty($opts->setconfig)) {
         echo $opts->getUsageMessage();
         exit;
     }
     if ($opts->config) {
         // add path to config.inc.php to include path
         $path = strstr($opts->config, 'config.inc.php') !== false ? dirname($opts->config) : $opts->config;
         set_include_path($path . PATH_SEPARATOR . get_include_path());
     }
     Setup_Core::initFramework();
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Is cli request. method: ' . (isset($opts->mode) ? $opts->mode : 'EMPTY'));
     }
     $setupServer = new Setup_Frontend_Cli();
     #$setupServer->authenticate($opts->username, $opts->password);
     return $setupServer->handle($opts);
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:38,代码来源:Cli.php

示例3: handle

 /**
  * (non-PHPdoc)
  * @see Tinebase_Server_Interface::handle()
  */
 public function handle(\Zend\Http\Request $request = null, $body = null)
 {
     try {
         $opts = new Zend_Console_Getopt(array('help|h' => 'Display this help Message', 'verbose|v' => 'Output messages', 'config|c=s' => 'Path to config.inc.php file', 'setconfig' => 'Update config. To specify the key and value, append \' -- configkey="your_key" configValue="your config value"\'
                      Examples:
                        setup.php --setconfig -- configkey=sample1 configvalue=value11
                        setup.php --setconfig -- configkey=sample2 configvalue=arrayKey1:Value1,arrayKey2:value2
                       ', 'getconfig' => 'Get Config value for a specify the key \' -- configkey="your_key"\'', 'check_requirements' => 'Check if all requirements are met to install and run tine20', 'create_admin' => 'Create new admin user (or reactivate if already exists)', 'install-s' => 'Install applications [All] or comma separated list;' . ' To specify the login name and login password of the admin user that is created during installation, append \' -- adminLoginName="admin" adminPassword="password"\'' . ' To add imap or smtp settings, append (for example) \' -- imap="host:mail.example.org,port:143,dbmail_host:localhost" smtp="ssl:tls"\'', 'update-s' => 'Update applications [All] or comma separated list', 'uninstall-s' => 'Uninstall application [All] or comma separated list', 'list-s' => 'List installed applications', 'sync_accounts_from_ldap' => 'Import user and groups from ldap', 'dbmailldap' => 'Only usable with sync_accounts_from_ldap. Fetches dbmail email user data from LDAP.', 'onlyusers' => 'Only usable with sync_accounts_from_ldap. Fetches only users and no groups from LDAP.', 'syncdeletedusers' => 'Only usable with sync_accounts_from_ldap. Removes users from Tine 2.0 DB that no longer exist in LDAP', 'syncaccountstatus' => 'Only usable with sync_accounts_from_ldap. Synchronizes current account status from LDAP', 'syncontactphoto' => 'Only usable with sync_accounts_from_ldap. Always syncs contact photo from ldap', 'sync_passwords_from_ldap' => 'Synchronize user passwords from ldap', 'egw14import' => 'Import user and groups from egw14
                      Examples: 
                       setup.php --egw14import /path/to/config.ini', 'reset_demodata' => 'reinstall applications and install Demodata (Needs Admin user)', 'updateAllImportExportDefinitions' => 'update ImportExport definitions for all applications', 'backup' => 'backup config and data
                      Examples:
                        setup.php --backup -- config=1 db=1 files=1 backupDir=/backup/tine20 noTimestamp=1', 'restore' => 'restore config and data
                      Examples:
                        setup.php --restore -- config=1 db=1 files=1 backupDir=/backup/tine20'));
         $opts->parse();
     } catch (Zend_Console_Getopt_Exception $e) {
         echo "Invalid usage: {$e->getMessage()}\n\n";
         echo $e->getUsageMessage();
         exit;
     }
     if (count($opts->toArray()) === 0 || $opts->h || empty($opts->install) && empty($opts->update) && empty($opts->uninstall) && empty($opts->list) && empty($opts->sync_accounts_from_ldap) && empty($opts->sync_passwords_from_ldap) && empty($opts->egw14import) && empty($opts->check_requirements) && empty($opts->reset_demodata) && empty($opts->updateAllImportExportDefinitions) && empty($opts->create_admin) && empty($opts->setconfig) && empty($opts->backup) && empty($opts->restore) && empty($opts->getconfig)) {
         echo $opts->getUsageMessage();
         exit;
     }
     if ($opts->config) {
         // add path to config.inc.php to include path
         $path = strstr($opts->config, 'config.inc.php') !== false ? dirname($opts->config) : $opts->config;
         set_include_path($path . PATH_SEPARATOR . get_include_path());
     }
     Setup_Core::initFramework();
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Is cli request. method: ' . $this->getRequestMethod());
     }
     $setupServer = new Setup_Frontend_Cli();
     #$setupServer->authenticate($opts->username, $opts->password);
     return $setupServer->handle($opts);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:41,代码来源:Cli.php

示例4: testGetoptDumpArray

 public function testGetoptDumpArray()
 {
     $opts = new Zend_Console_Getopt('abp:', array('-a', '-p', 'p_arg'));
     $this->assertEquals(implode(',', $opts->toArray()), 'a,p,p_arg');
 }
开发者ID:travisj,项目名称:zf,代码行数:5,代码来源:GetoptTest.php

示例5: array

/**
 * anonymous methods (no pw/user required)
 */
$anonymousMethods = array('Tinebase.triggerAsyncEvents');
/**
 * options
 */
try {
    $opts = new Zend_Console_Getopt(array('help|h' => 'Display this help Message', 'verbose|v' => 'Output messages', 'dry|d' => "Dry run - don't change anything", 'info|i' => 'Get usage description of method', 'method=s' => 'Method to call [required]', 'username=s' => 'Username [required]', 'password=s' => 'Password', 'passwordfile=s' => 'Name of file that contains password'));
    $opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
    echo $e->getMessage() . "\n";
    echo $e->getUsageMessage();
    exit;
}
if (count($opts->toArray()) === 0 || $opts->h || empty($opts->method)) {
    echo $opts->getUsageMessage();
    exit;
}
// get username / password if not already set
if (!in_array($opts->method, $anonymousMethods)) {
    if (empty($opts->username)) {
        $opts->username = Tinebase_Server_Cli::promptInput('username');
    }
    if (empty($opts->username)) {
        echo "error: username must be given! exiting \n";
        exit(1);
    }
    if (empty($opts->password)) {
        if (empty($opts->passwordfile)) {
            $opts->password = Tinebase_Server_Cli::promptInput('password', TRUE);
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:31,代码来源:tine20.php

示例6: catch

 */
if (file_exists(__DIR__ . '/../conf/config.php')) {
    require_once __DIR__ . '/../conf/config.php';
}
/**
 * Try  processing Zend_Console_Getopt
 */
try {
    $opts = new Zend_Console_Getopt(array('help' => 'Displays usage information.', 'version|v' => 'Version', 'username|u=s' => 'Username', 'password|p=s' => 'password', 'host|h=s' => 'Hudson URL', 'restart|r' => 'restart Hudson', 'output|o=s' => 'output path', 'configs|c' => 'get Hudson Configs', 'jobs|j' => 'print jobs list', 'search|s=s' => 'search job', 'artifact|a=s' => 'get artifacts for job', 'debug|d' => 'debug'));
    $opts->parse();
} catch (Zend_Console_Getopt_Exception $e) {
    exit($e->getMessage() . "\n\n" . $e->getUsageMessage());
}
// start processing ops
// help + without arguments
if (count($opts->toArray()) == 0 || isset($opts->help)) {
    php4hudsonUI::printVersion();
    echo $opts->getUsageMessage();
    exit;
}
// version
if (isset($opts->v)) {
    php4hudsonUI::printVersion();
    echo $opts->getUsageMessage();
}
// username
if (isset($opts->u)) {
    $username = $opts->u;
} else {
    $username = null;
}
开发者ID:abtris,项目名称:php4hudson,代码行数:31,代码来源:hudson-cli.php

示例7: chr

    } else {
        echo 'Working on Application "' . $opts->app . '"...' . chr(10);
    }
}
if ($opts->wipe) {
    foreach (Tinebase_Translation::getTranslationDirs() as $appName => $translationPath) {
        if (!checkAppName($appName, $_verbose)) {
            continue;
        }
        if ($_verbose) {
            echo "Processing {$appName} po files \n";
        }
        `cd "{$translationPath}" \n        rm *`;
    }
}
if (count($opts->toArray()) === 0 || $opts->h) {
    echo $opts->getUsageMessage();
    exit;
}
if ($opts->u || $opts->contribute) {
    $opts->pot = $opts->potmerge = $opts->mo = $opts->c = true;
}
if ($opts->pot) {
    generatePOTFiles($opts->v);
}
if ($opts->potmerge) {
    potmerge($opts->v);
}
if ($opts->newlang) {
    generateNewTranslationFiles($opts->newlang, $opts->v, $opts->overwrite);
    potmerge($opts->v);
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:31,代码来源:langHelper.php


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