コード例 #1
0
#!/usr/bin/env php
<?php 
/**
 * Script to upgrade tariff templates
 */
require_once realpath(dirname(__FILE__) . '/lib/Cli.php');
$cli = new Cli(array('file|f=s' => 'Path to zone upgrading file. REQUIRED', 'zoneNamesfile|n=s' => 'Path to zone names file.', 'orgId|o=s' => 'Organization where upgrade tariff templates. If it is not defined it will try to use the name of file as orgId', 'separator|s=s' => "Separator of file data. Defautl \"\t\" [TAB]"));
try {
    $logs = array();
    App_MigrationTool_TemplatesTo20_ServiceTariffUtils::performUpgrade($cli->getOption('o'), $cli->getOption('f'), $cli->getOption('n'), $cli->getOption('s'), $logs);
    foreach ($logs as $line) {
        echo $line . "\n";
    }
} catch (Exception $e) {
    echo 'AN ERROR HAS OCCURRED:' . PHP_EOL;
    echo $e->getMessage() . PHP_EOL;
    foreach ($logs as $line) {
        echo $line . "\n";
    }
    exit(1);
}
// generally speaking, this script will be run from the command line
exit(0);