本文整理匯總了PHP中Variable::peek方法的典型用法代碼示例。如果您正苦於以下問題:PHP Variable::peek方法的具體用法?PHP Variable::peek怎麽用?PHP Variable::peek使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Variable
的用法示例。
在下文中一共展示了Variable::peek方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: foreach
foreach ($argv as $i => $arg) {
if ($i) {
switch ($arg) {
case '--dry-run':
$dryRun = true;
break;
default:
print "Unknown flag {$arg} -- ignored\n";
exit;
}
}
}
if ($dryRun) {
print "---- DRY RUN ONLY ----\n";
}
$schemaVersion = db_tableExists('Variable') ? Variable::peek('Schema.version', '00000') : '00000';
print "Current schema version is <{$schemaVersion}>\n";
$patchFiles = getPatches(PATCH_DIR, $schemaVersion);
$numPatches = 0;
foreach ($patchFiles as $fileName) {
runPatch(PATCH_DIR . $fileName, $dryRun);
$numPatches++;
$schemaVersion = stripExtension($fileName);
if (!$dryRun) {
// Update after each patch, in case one of the patches terminates with error.
Variable::poke('Schema.version', $schemaVersion);
}
}
print "{$numPatches} patches applied.\n";
print "New schema version is <{$schemaVersion}>\n";
/*****************************************************************/