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


PHP CommandLineTool::CommandLineTool方法代码示例

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


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

示例1: localeCheck

 function localeCheck($args)
 {
     parent::CommandLineTool($args);
     array_shift($args);
     // Knock the tool name off the list
     $this->locales = $args;
 }
开发者ID:jalperin,项目名称:harvester,代码行数:7,代码来源:localeCheck.php

示例2: XmlToSqlTool

 /**
  * Constructor.
  * @param $argv array command-line arguments
  * 	If specified, the first argument should be the file to parse
  */
 function XmlToSqlTool($argv = array())
 {
     parent::CommandLineTool($argv);
     if (isset($this->argv[0]) && in_array($this->argv[0], array('-schema', '-data'))) {
         $this->type = substr($this->argv[0], 1);
         $argOffset = 1;
     } else {
         $this->type = 'schema';
         $argOffset = 0;
     }
     if (!isset($this->argv[$argOffset]) || !in_array($this->argv[$argOffset], array('print', 'save', 'print_upgrade', 'save_upgrade', 'execute'))) {
         $this->usage();
         exit(1);
     }
     $this->command = $this->argv[$argOffset];
     $file = isset($this->argv[$argOffset + 1]) ? $this->argv[$argOffset + 1] : DATABASE_XML_FILE;
     if (!file_exists($file) && !file_exists($file2 = PWD . '/' . $file)) {
         printf("Input file \"%s\" does not exist!\n", $file);
         exit(1);
     }
     $this->inputFile = isset($file2) ? $file2 : $file;
     $this->outputFile = isset($this->argv[$argOffset + 2]) ? PWD . '/' . $this->argv[$argOffset + 2] : null;
     if (in_array($this->command, array('save', 'save_upgrade')) && ($this->outputFile == null || file_exists($this->outputFile) && (is_dir($this->outputFile) || !is_writeable($this->outputFile)) || !is_writable(dirname($this->outputFile)))) {
         printf("Invalid output file \"%s\"!\n", $this->outputFile);
         exit(1);
     }
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:32,代码来源:XmlToSqlTool.inc.php

示例3: preCompile

 /**
  * Constructor.
  * @param $argv array command-line arguments
  */
 function preCompile($argv = array())
 {
     parent::CommandLineTool($argv);
     if (isset($this->argv[0]) && $this->argv[0] == '-h') {
         $this->usage();
         exit(0);
     }
 }
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:12,代码来源:preCompile.php

示例4: upgradeTool

 /**
  * Constructor.
  * @param $argv array command-line arguments
  */
 function upgradeTool($argv = array())
 {
     parent::CommandLineTool($argv);
     if (!isset($this->argv[0]) || !in_array($this->argv[0], array('check', 'latest', 'upgrade', 'patch', 'download'))) {
         $this->usage();
         exit(1);
     }
     $this->command = $this->argv[0];
 }
开发者ID:ingmarschuster,项目名称:MindResearchRepository,代码行数:13,代码来源:UpgradeTool.inc.php

示例5: SubmissionDeletionTool

 /**
  * Constructor.
  * @param $argv array command-line arguments
  */
 function SubmissionDeletionTool($argv = array())
 {
     parent::CommandLineTool($argv);
     if (!sizeof($this->argv)) {
         $this->usage();
         exit(1);
     }
     $this->parameters = $this->argv;
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:13,代码来源:deleteSubmissions.php

示例6: genEmailUpdates

 /**
  * Constructor.
  * @param $argv array command-line arguments
  * 	If specified, the first argument should be the file to parse
  */
 function genEmailUpdates($argv = array())
 {
     parent::CommandLineTool($argv);
     if (count($argv) != 3) {
         $this->usage();
         exit(1);
     }
     $this->oldTag = $argv[1];
     $this->newTag = $argv[2];
 }
开发者ID:laelnasan,项目名称:UTFPR-ojs,代码行数:15,代码来源:genEmailUpdates.php

示例7: upgradeTool

 /**
  * Constructor.
  * @param $argv array command-line arguments
  */
 function upgradeTool($argv = array())
 {
     parent::CommandLineTool($argv);
     if (!isset($this->argv[0]) || !in_array($this->argv[0], array('check', 'latest', 'upgrade', 'patch', 'download'))) {
         $this->usage();
         exit(1);
     }
     $this->command = $this->argv[0];
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_INSTALLER);
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:14,代码来源:UpgradeTool.inc.php

示例8: mergeUsers

 /**
  * Constructor.
  * @param $argv array command-line arguments
  */
 function mergeUsers($argv = array())
 {
     parent::CommandLineTool($argv);
     if (!isset($this->argv[0]) || !isset($this->argv[1])) {
         $this->usage();
         exit(1);
     }
     $this->username1 = $this->argv[0];
     $this->username2 = $this->argv[1];
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:14,代码来源:mergeUsers.php

示例9: CopyAccessLogFileTool

 /**
  * Constructor.
  * @param $argv array command-line arguments
  */
 function CopyAccessLogFileTool($argv = array())
 {
     parent::CommandLineTool($argv);
     if (sizeof($this->argv) !== 1) {
         $this->usage();
         exit(1);
     }
     $plugin =& PluginRegistry::getPlugin('generic', 'usagestatsplugin');
     /* @var $plugin UsageStatsPlugin */
     $this->_usageStatsDir = $plugin->getFilesPath();
     $this->_tmpDir = $this->_usageStatsDir . DIRECTORY_SEPARATOR . 'tmp';
     AppLocale::requireComponents(LOCALE_COMPONENT_PKP_ADMIN);
     // This tool needs egrep and gunzip path configured.
     $this->_egrepPath = escapeshellarg(Config::getVar('cli', 'egrep'));
     if ($this->_egrepPath == "''") {
         printf(__('admin.copyAccessLogFileTool.error.noEgrep') . "\n");
         exit(1);
     }
     $this->_gunzipPath = escapeshellarg(Config::getVar('cli', 'gunzip'));
     if ($this->_gunzipPath == "''") {
         printf(__('admin.copyAccessLogFileTool.error.noGunzip') . "\n");
         exit(1);
     }
     // Get a list of files currently inside the usage stats dir.
     $fileLoaderDirs = array(FILE_LOADER_PATH_STAGING, FILE_LOADER_PATH_PROCESSING, FILE_LOADER_PATH_ARCHIVE, FILE_LOADER_PATH_REJECT);
     $usageStatsFiles = array();
     foreach ($fileLoaderDirs as $dir) {
         $dirFiles = glob($this->_usageStatsDir . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . '*');
         if (is_array($dirFiles) && count($dirFiles) > 0) {
             foreach ($dirFiles as $file) {
                 if (!is_file($file)) {
                     continue;
                 }
                 $fileBasename = pathinfo($file, PATHINFO_BASENAME);
                 if (pathinfo($file, PATHINFO_EXTENSION) == 'gz') {
                     // Always save the filename without compression extension.
                     $fileBasename = substr($fileBasename, 0, -3);
                 }
                 $usageStatsFiles[] = $fileBasename;
             }
         }
     }
     $this->_usageStatsFiles = $usageStatsFiles;
     // Get a list of context paths.
     $contextDao =& Application::getContextDAO();
     /* @var $contextDao ContextDAO */
     $contextFactory = $contextDao->getAll();
     $contextPaths = array();
     while ($context =& $contextFactory->next()) {
         /* @var $context Context */
         $contextPaths[] = escapeshellarg($context->getPath());
     }
     $contextPaths = implode('/|/', $contextPaths);
     $this->_contextPaths = $contextPaths;
 }
开发者ID:doana,项目名称:pkp-lib,代码行数:59,代码来源:copyAccessLogFileTool.php

示例10: migrate

 /**
  * Constructor.
  * @param $argv array command-line arguments
  */
 function migrate($argv = array())
 {
     parent::CommandLineTool($argv);
     if (!isset($this->argv[0]) || !isset($this->argv[1])) {
         $this->usage();
         exit(1);
     }
     $this->journalPath = $this->argv[0];
     $this->importPath = $this->argv[1];
     $this->options = array_slice($this->argv, 2);
 }
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:15,代码来源:migrate.php

示例11: poToCountries

 /**
  * Constructor
  */
 function poToCountries($argv = array())
 {
     parent::CommandLineTool($argv);
     $toolName = array_shift($argv);
     $this->locale = array_shift($argv);
     $this->translationFile = array_shift($argv);
     if (!preg_match('/^[a-z]{2}_[A-Z]{2}$/', $this->locale) || empty($this->translationFile) || !file_exists($this->translationFile)) {
         $this->usage();
         exit(1);
     }
 }
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:14,代码来源:poToCountries.php

示例12: fixFilenames

 /**
  * Constructor.
  * @param $argv array command-line arguments
  */
 function fixFilenames($argv = array())
 {
     parent::CommandLineTool($argv);
     if (($arg = array_pop($this->argv)) == '--dry-run') {
         $this->dryrun = true;
     } elseif ($arg == '') {
         $this->dryrun = false;
     } else {
         $this->usage();
         exit;
     }
 }
开发者ID:PublishingWithoutWalls,项目名称:omp,代码行数:16,代码来源:fixFilenames.php

示例13: genTestLocale

 /**
  * Constructor.
  * @param $argv array command-line arguments
  * 		If specified, the first parameter should be the input locale (default "en_US")
  * 		and the second parameter the output locale (default "te_ST")
  */
 function genTestLocale($argv = array())
 {
     parent::CommandLineTool($argv);
     if (count($this->argv) == 2) {
         $this->inLocale = $this->argv[0];
         $this->outLocale = $this->argv[1];
     } else {
         $this->inLocale = DEFAULT_IN_LOCALE;
         $this->outLocale = DEFAULT_OUT_LOCALE;
     }
     $this->replaceMap = array('a' => "å", 'A' => "Æ", 'c' => "ç", 'C' => "Ç", 'd' => "ð", 'D' => "Ð", 'e' => "è", 'E' => "É", 'i' => "î", 'I' => "Î", 'n' => "ñ", 'N' => "Ñ", 'o' => "ó", 'O' => "Ò", 's' => "þ", 'S' => "ß", 'u' => "ü", 'U' => "Ü", 'y' => "ý", 'Y' => "Ý", '&' => "&");
 }
开发者ID:alenoosh,项目名称:ojs,代码行数:18,代码来源:genTestLocale.php

示例14: harvest

 function harvest($argv = array())
 {
     parent::CommandLineTool($argv);
     array_shift($argv);
     // Clear the tool name from argv
     $this->firstParam = array_shift($argv);
     $archiveDao =& DAORegistry::getDAO('ArchiveDAO');
     if ($this->firstParam === 'all') {
         $this->archives =& $archiveDao->getArchives();
     } else {
         $archive = $archiveDao->getArchive((int) $this->firstParam, false);
         if ($archive) {
             $archives = array($archive);
             import('lib.pkp.classes.core.ArrayItemIterator');
             $this->archives = new ArrayItemIterator($archives);
         } else {
             $this->archives = null;
             // Invalid ID specified
         }
     }
     // Set the various flags for the parser, if supported.
     $this->params = array();
     foreach ($argv as $arg) {
         switch ($arg) {
             case 'verbose':
                 $this->params['callback'] = array(&$this, 'statusCallback');
                 break;
             case 'parallel':
                 $this->params['parallel'] = true;
                 break;
             default:
                 if (($i = strpos($arg, '=')) !== false) {
                     // Treat the parameter like a name=value pair
                     $paramName = substr($arg, 0, $i);
                     $paramValue = substr($arg, $i + 1);
                     if (!isset($this->params[$paramName])) {
                         $this->params[$paramName] = $paramValue;
                     } else {
                         if (is_array($this->params[$paramName])) {
                             $this->params[$paramName][] = $paramValue;
                         } else {
                             $this->params[$paramName] = array($this->params[$paramName], $paramValue);
                         }
                     }
                 } else {
                     // Treat the parameter like a boolean.
                     $this->params[$arg] = true;
                 }
                 break;
         }
     }
 }
开发者ID:Rygbee,项目名称:harvester,代码行数:52,代码来源:harvest.php

示例15: ScheduledTaskTool

 /**
  * Constructor.
  * @param $argv array command-line arguments
  * 		If specified, the first parameter should be the path to
  *		a tasks XML descriptor file (other than the default)
  */
 function ScheduledTaskTool($argv = array())
 {
     parent::CommandLineTool($argv);
     if (isset($this->argv[0])) {
         $this->file = $this->argv[0];
     } else {
         $this->file = TASKS_REGISTRY_FILE;
     }
     if (!file_exists($this->file) || !is_readable($this->file)) {
         printf("Tasks file \"%s\" does not exist or is not readable!\n", $this->file);
         exit(1);
     }
     $this->taskDao =& DAORegistry::getDAO('ScheduledTaskDAO');
 }
开发者ID:farhanabbas1983,项目名称:ojs-1,代码行数:20,代码来源:ScheduledTaskTool.inc.php


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