function writeLexems($locVersion, $fileName) { LocVersion::changeDatabase($locVersion); $dbResult = db_execute(DB_QUERY, PDO::FETCH_ASSOC); $handle = fopen($fileName, 'w'); foreach ($dbResult as $row) { $l = Model::factory('Lexem')->create($row); fprintf($handle, AdminStringUtil::padRight(mb_strtoupper($l->form), 20)); fprintf($handle, AdminStringUtil::padRight($l->modelType, 4)); fprintf($handle, AdminStringUtil::padRight($l->modelNumber, 8)); fprintf($handle, $l->restriction . "\n"); } fclose($handle); }
<?php require_once "../../phplib/util.php"; $modelType = util_getRequestParameter('modelType'); $locVersion = util_getRequestParameter('locVersion'); if ($locVersion) { LocVersion::changeDatabase($locVersion); } $models = FlexModel::loadByType($modelType); foreach ($models as $m) { print "{$m->id}\n{$m->number}\n{$m->exponent}\n"; }
function run() { $this->cleanup(); // Write forms log_scriptLog('** dumping ' . $this->getName()); foreach (Config::getLocVersions() as $v) { if (!$v->freezeTimestamp || $this->allVersions) { log_scriptLog("* dumping version {$v->name}"); LocVersion::changeDatabase($v->name); $txtFile = $this->getTxtFileName($v); $zipFile = $this->getZipFileName($v); $ftpFile = $this->getFtpFileName($v); $this->writeForms($txtFile); $this->postProcess($txtFile); $this->zipAndShip($txtFile, $zipFile, $ftpFile); } } // Write diffs foreach (Config::getLocVersions() as $i => $v1) { foreach (Config::getLocVersions() as $j => $v2) { if ($i > $j && (!$v2->freezeTimestamp || $this->allVersions)) { log_scriptLog("* computing diffs between {$v1->name} and {$v2->name}"); $this->downloadAndUnzip($v1); $this->downloadAndUnzip($v2); $txt1 = $this->getTxtFileName($v1); $txt2 = $this->getTxtFileName($v2); $diffTxt = $this->getTxtDiffFileName($v1, $v2); $diffZip = $this->getZipDiffFileName($v1, $v2); $diffFtp = $this->getFtpDiffFileName($v1, $v2); OS::executeAndAssert("diff {$txt1} {$txt2} | grep '[<>]' > {$diffTxt} || true"); $this->zipAndShip($diffTxt, $diffZip, $diffFtp); } } } $this->cleanup(); }