• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CommandLineTool类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了CommandLineTool类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: 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


示例5: 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


示例6: 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


示例7: 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


示例8: 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


示例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: 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


示例11: 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


示例12: 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


示例13: 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


示例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


示例16: buildCss

 /**
  * Constructor.
  * @param $argv array command-line arguments
  */
 function buildCss($argv = array())
 {
     parent::CommandLineTool($argv);
     array_shift($argv);
     // Flush the tool name from the argv list
     $this->force = false;
     while ($option = array_shift($argv)) {
         switch ($option) {
             case 'force':
                 $this->force = true;
                 break;
             default:
                 $this->usage();
                 exit(-1);
         }
     }
 }
开发者ID:yuricampos,项目名称:ojs,代码行数:21,代码来源:buildCss.php


示例17: CopyAccessLogFileTool

 /**
  * Constructor.
  * @param $argv array command-line arguments
  */
 function CopyAccessLogFileTool($argv = array())
 {
     parent::CommandLineTool($argv);
     AppLocale::requireComponents(LOCALE_COMPONENT_OJS_ADMIN);
     if (count($this->argv) < 1 || count($this->argv) > 2) {
         $this->usage();
         exit(1);
     }
     $plugin =& PluginRegistry::getPlugin('generic', 'usagestatsplugin');
     /* @var $plugin UsageStatsPlugin */
     $this->_usageStatsDir = $plugin->getFilesPath();
     $this->_tmpDir = $this->_usageStatsDir . DIRECTORY_SEPARATOR . 'tmp';
     // 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 journal paths.
     $journalDao =& DAORegistry::getDAO('JournalDAO');
     /* @var $journalDao JournalDAO */
     $journalFactory = $journalDao->getJournals();
     $journalPaths = array();
     while ($journal =& $journalFactory->next()) {
         /* @var $journal Journal */
         $journalPaths[] = escapeshellarg($journal->getPath());
     }
     $journalPaths = implode('/|/', $journalPaths);
     $this->_journalPaths = $journalPaths;
 }
开发者ID:EreminDm,项目名称:water-cao,代码行数:48,代码来源:copyAccessLogFileTool.php


示例18: MergeCoverageReportTool

 /**
  * Constructor.
  * @param $argv array command-line arguments
  *  The first argument must be the file to check
  */
 function MergeCoverageReportTool($argv = array())
 {
     parent::CommandLineTool($argv);
     // Show the usage screen if explicitly requested or wrong
     // number of command line arguments.
     $wrongArgCount = count($this->argv) < 2 ? true : false;
     if ($wrongArgCount || $argv[0] == '-h') {
         $this->usage();
         if ($wrongArgCount) {
             printf(PHP_EOL . 'Wrong number of arguments!' . PHP_EOL);
             exit(1);
         } else {
             exit(0);
         }
     }
     // Parse the command line arguments
     $this->script = array_shift($argv);
     $this->target = array_shift($argv);
     if (!is_dir($this->target)) {
         echo "Target directory {$this->target} dosn't exist" . PHP_EOL;
         exit(1);
     }
     if (!is_writable($this->target)) {
         echo "Target directory {$this->target} is not writable" . PHP_EOL;
         exit(1);
     }
     $this->coverageFiles = $argv;
     foreach ($this->coverageFiles as $file) {
         if (!is_readable($file)) {
             echo "Coverage file {$file} is not readable" . PHP_EOL;
             exit(1);
         }
     }
     // Verify that $phpunit is a file
     if (!($this->phpunit = exec('which phpunit') and is_readable($this->phpunit))) {
         echo 'Couldn\'t find phpunit in $PATH' . PHP_EOL;
         exit(1);
     }
 }
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:44,代码来源:mergeCoverageReportTool.php


示例19: PhpCompat

 /**
  * Constructor.
  * @param $argv array command-line arguments
  *  The first argument must be the file to check
  */
 function PhpCompat($argv = array())
 {
     parent::CommandLineTool($argv);
     // Show the usage screen if explicitly requested or wrong
     // number of command line arguments.
     $wrongArgCount = count($this->argv) != 1 ? true : false;
     if ($wrongArgCount || $argv[0] == '-h') {
         $this->usage();
         if ($wrongArgCount) {
             printf("\nWrong number of arguments!", $this->input_file);
             exit(1);
         } else {
             exit(0);
         }
     }
     // Set the source file or directory to be parsed
     $this->input_file = $this->argv[0];
     // Check whether the source exists
     if (!file_exists($this->input_file)) {
         printf("Invalid source \"%s\"!\n", $this->input_file);
         exit(1);
     }
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:28,代码来源:phpCompat.php


示例20: importExport

 /**
  * Constructor.
  * @param $argv array command-line arguments (see usage)
  */
 function importExport($argv = array())
 {
     parent::CommandLineTool($argv);
     $this->command = array_shift($this->argv);
     $this->parameters = $this->argv;
 }
开发者ID:slgodoy,项目名称:ojs,代码行数:10,代码来源:importExport.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Commande类代码示例发布时间:2022-05-23
下一篇:
PHP CommandFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap