Пример #1
0
<?php

$basedir = realpath(dirname(__FILE__) . '/../../../');
require_once $basedir . '/vendor/dg/dibi/dibi/dibi.php';
dibi::connect(array('driver' => 'mysql', 'username' => 'root', 'database' => 'judge'));
if (count($_SERVER['argv']) < 2) {
    die('Please submit tag file path to the tag file.' . PHP_EOL);
}
$tagFileName = $_SERVER['argv'][1];
if (false == file_exists($tagFileName)) {
    die('Please submit the correct(!) tag file path to the tag file.' . PHP_EOL);
}
$parser = new TagParser($tagFileName);
$parser->run();
class TagParser
{
    protected $_tagFileName;
    protected $_version;
    protected $_edition;
    protected $_magentoId;
    protected $_knownClasses = array();
    public function __construct($tagFileName)
    {
        $this->_tagFileName = $tagFileName;
    }
    public function run()
    {
        $startedAt = time();
        $tagFile = fopen($this->_tagFileName, 'r');
        $tagFileNameWithoutExt = str_replace('.tags', '', basename($this->_tagFileName));
        list($edition, $this->version) = explode('-', $tagFileNameWithoutExt);