Buildtools BuildTranslateInputFile.php updated for git
[spidio.git] / _devtools_cli / qcodo_updater.inc.php
bloba9ed75ad3f179b5be90c13ceeb3f7220528fc546
1 <?php
2 /* This includes library file is used by the qcodo_updater.cli and qcodo_updater.phpexe scripts
3 * to perform the Qcodo Update Utility functionality.
4 */
6 // Call the CLI prepend.inc.php
7 require('cli_prepend.inc.php');
9 // Finally, load the QUpdateUtility class itself
10 require(__QCODO_CORE__ . '/framework/QUpdateUtility.class.php');
12 // Ensure that there are parameters
13 if ($_SERVER['argc'] < 2)
14 QUpdateUtility::PrintUpdaterInstructions();
16 // Setup Parameter Defaults
17 $strInteractionType = QUpdateUtility::Interactive;
18 $blnQuietMode = false;
20 for ($intIndex = 1; $intIndex < $_SERVER['argc']; $intIndex++) {
21 $strArgument = strtolower($_SERVER['argv'][$intIndex]);
23 if ($strArgument == '--quiet') {
24 if ($intIndex == $_SERVER['argc'] - 1)
25 QUpdateUtility::Error('No Qcodo Version was specified');
26 $blnQuietMode = true;
27 } else if (substr($strArgument, 0, strlen('--interaction')) == '--interaction') {
28 $strArgument = substr($strArgument, strlen('--interaction='));
29 switch ($strArgument) {
30 case QUpdateUtility::Interactive:
31 $strInteractionType = QUpdateUtility::Interactive;
32 break;
33 case QUpdateUtility::Rename:
34 $strInteractionType = QUpdateUtility::Rename;
35 break;
36 case QUpdateUtility::Force:
37 $strInteractionType = QUpdateUtility::Force;
38 break;
39 case QUpdateUtility::ReportOnly:
40 $strInteractionType = QUpdateUtility::ReportOnly;
41 break;
42 default:
43 QUpdateUtility::Error('Invalid Interaction Mode: ' . $strArgument);
44 break;
47 if ($intIndex == $_SERVER['argc'] - 1)
48 QUpdateUtility::Error('No Qcodo Version was specified');
49 } else if ($strArgument == '--help') {
50 QUpdateUtility::PrintUpdaterInstructions(true);
51 } else {
52 if (($intIndex != ($_SERVER['argc'] - 1)) ||
53 (substr($strArgument, 0, 1) == '-'))
54 QUpdateUtility::Error('Invalid Option/Argument: ' . $strArgument);
58 if ($strInteractionType != QUpdateUtility::ReportOnly)
59 printf("Qcodo Update Utility - Performing '%s' Update...\r\n", $strInteractionType);
61 $strVersion = $_SERVER['argv'][$_SERVER['argc'] - 1];
62 $objUpdateUtility = new QUpdateUtility($strVersion);
63 $objUpdateUtility->RunUpdater($strInteractionType, $blnQuietMode);