/** * Constructor. * @param $argv array command-line arguments * If specified, the first argument should be the file to parse */ function __construct($argv = array()) { parent::__construct($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); } }
/** * Constructor. * @param $argv array command-line arguments */ function __construct($argv = array()) { parent::__construct($argv); if (!sizeof($this->argv)) { $this->usage(); exit(1); } $this->parameters = $this->argv; }
/** * Constructor. * @param $argv array command-line arguments */ function __construct($argv = array()) { parent::__construct($argv); if (!isset($this->argv[0]) || !isset($this->argv[1])) { $this->usage(); exit(1); } $this->username1 = $this->argv[0]; $this->username2 = $this->argv[1]; }
/** * Constructor. * @param $argv array command-line arguments */ function __construct($argv = array()) { parent::__construct($argv); if (!isset($this->argv[0]) || !in_array($this->argv[0], array('check', 'latest', 'upgrade', 'download'))) { $this->usage(); exit(1); } $this->command = $this->argv[0]; AppLocale::requireComponents(LOCALE_COMPONENT_PKP_INSTALLER); }
/** * Constructor. * @param $argv array command-line arguments * If specified, the first argument should be the file to parse */ function __construct($argv = array()) { parent::__construct($argv); if (count($argv) != 3) { $this->usage(); exit(1); } $this->oldTag = $argv[1]; $this->newTag = $argv[2]; }
/** * Constructor */ function __construct($argv = array()) { parent::__construct($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); } }
/** * 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 __construct($argv = array()) { parent::__construct($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' => "Ý", '&' => "&"); }
/** * Constructor. * @param $argv array command-line arguments */ function __construct($argv = array()) { parent::__construct($argv); if (($arg = array_pop($this->argv)) == '--dry-run') { $this->dryrun = true; } elseif ($arg == '') { $this->dryrun = false; } else { $this->usage(); exit; } }
/** * Constructor. * @param $argv array command-line arguments */ function __construct($argv = array()) { parent::__construct($argv); AppLocale::requireComponents(LOCALE_COMPONENT_PKP_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'; // This tool needs egrep path configured. $this->_egrepPath = escapeshellarg(Config::getVar('cli', 'egrep')); if ($this->_egrepPath == "''") { printf(__('admin.error.executingUtil', array('utilPath' => $this->_egrepPath, 'utilVar' => 'egrep')) . "\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; }
/** * 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 __construct($argv = array()) { parent::__construct($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'); }
/** * Constructor. * @param $argv array command-line arguments * The first argument must be the file to check */ function __construct($argv = array()) { parent::__construct($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); } }
/** * Constructor. * @param $argv array command-line arguments (see usage) */ function __construct($argv = array()) { parent::__construct($argv); $this->command = array_shift($this->argv); $this->parameters = $this->argv; }
/** * Constructor * @param $argv array */ function __construct($argv) { parent::__construct($argv); }
/** * Constructor. * @param $argv array command-line arguments */ function __construct($argv = array()) { parent::__construct($argv); }