本文整理汇总了PHP中Change::parseFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Change::parseFile方法的具体用法?PHP Change::parseFile怎么用?PHP Change::parseFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Change
的用法示例。
在下文中一共展示了Change::parseFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(&$return, $req)
{
$cf = new Change($this->settings, $this->changeFactory, $this->changeFactory->getCacher());
$cf->parseFile(DBC_EXECUTION_MODE == 'web' ? $req['file'] : $req[0]);
$cf->setIsExecuted(true);
$return['data'] = $cf->getAsyncStatus();
}
示例2: process
public function process(&$return, $req)
{
$cf = new Change($this->settings, $this->changeFactory, $this->changeFactory->getCacher());
$cf->parseFile(DBC_EXECUTION_MODE == 'web' ? $req['file'] : $req[0]);
//only if the setting api_execute_async is true and execution_mode is web, then execute it async
$async = $this->settings->getApiExecuteAsync() && DBC_EXECUTION_MODE == 'web';
$return['data'] = $cf->executeSql($async);
}
示例3: process
public function process(&$return, $req)
{
if (DBC_EXECUTION_MODE != 'cli') {
throw new Exception('runAll is only valid in CLI mode.');
}
parent::process($return, $req);
$cardStack = (array) $return['data'];
$cardStack = array_reverse($cardStack);
//execute in reverse order
$errCount = 0;
$cardCount = sizeof($cardStack);
foreach ($cardStack as $entry) {
try {
$changeFile = $entry['file'];
$cf = new Change($this->settings, $this->changeFactory, $this->changeFactory->getCacher());
$cf->parseFile($changeFile);
try {
if (!$cf->doExecuteSql()) {
$errStat = $cf->getAsyncStatus();
throw new Exception($errStat['message']);
}
echo '[DONE] ' . $changeFile . PHP_EOL;
} catch (Exception $e) {
$errCount++;
echo '[FAILED] ' . $changeFile . ' :: ' . $e->getMessage() . PHP_EOL;
echo $cf->getSql() . PHP_EOL;
if (in_array('--force', $req) || in_array('-f', $req)) {
try {
$cf->failedToExecuted();
echo '[IGNORE] ' . $changeFile . PHP_EOL;
} catch (Exception $e) {
echo '[FAILED] ' . $changeFile . ' IGNORE FAILED :: ' . $e->getMessage() . PHP_EOL;
}
}
}
} catch (Execution $e) {
echo '[FAILED] ' . $changeFile . ' Unrecoverable error :: ' . $e->getMessage() . PHP_EOL;
}
if (sizeof($cf->getExecute())) {
echo '[IGNORE] ' . $changeFile . ' PATCHES: ' . implode(', ', $cf->getExecute()) . PHP_EOL;
}
}
$return['data'] = PHP_EOL . '*** FINISHED ' . $cardCount . ' CHANGES' . ($errCount ? ' WITH ' . $errCount . ' FAIL(S)' : ' SUCCESSFULLY');
$return['status'] = 'ok';
}
示例4: getChange
/**
* @param string $filename
* @return Change
*/
public function getChange($filename)
{
$cf = new Change($this->settings, $this, $this->cacheFactory->getPersistentBackend());
$cf->parseFile($filename)->checkIsExecuted();
return $cf;
}