本文整理匯總了PHP中Updater::error方法的典型用法代碼示例。如果您正苦於以下問題:PHP Updater::error方法的具體用法?PHP Updater::error怎麽用?PHP Updater::error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Updater
的用法示例。
在下文中一共展示了Updater::error方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: fetch
/**
* Fetches an update file and verifies its authenticity before returning
* the file contents. Returns false on failure.
*/
public static function fetch($path)
{
self::$error = false;
$file_url = self::$updates . $path;
$sha_url = self::$checksums . $path . '.sha';
$file = fetch_url($file_url);
if (!$file) {
self::$error = 'Unable to fetch file.';
return false;
}
$sha = fetch_url($sha_url);
if (!$sha) {
self::$error = 'Unable to fetch checksum file.';
return false;
}
if (!self::test_checksum($file, $sha)) {
self::$error = 'Checksum failed!';
return false;
}
return $file;
}
示例2: file_put_contents
echo "Fetching new patch: {$base}\n";
$contents = Updater::fetch($patch_file);
if (!$contents) {
Cli::out('Error: ' . Updater::error() . ' ' . $patch_file, 'error');
return;
}
file_put_contents('conf/updates/' . $base, $contents);
}
}
foreach ($res->scripts as $script_file) {
$base = basename($script_file);
if (!file_exists('conf/updates/' . $base)) {
echo "Fetching new db update: {$base}\n";
$contents = Updater::fetch($script_file);
if (!$contents) {
Cli::out('Error: ' . Updater::error() . ' ' . $script_file, 'error');
return;
}
file_put_contents('conf/updates/' . $base, $contents);
}
}
$versions = cli_get_versions(ELEFANT_VERSION, $latest);
// Test and apply the patches and db updates in sequence
foreach ($versions as $version) {
printf("Testing patch: %s\n", basename($version['patch']));
exec('patch --dry-run -p1 -f -i ' . $version['patch'], $output);
$output = join("\n", $output);
if (strpos($output, 'FAILED')) {
Cli::out('Error applying patch ' . $version['patch'], 'error');
echo "See conf/updates/error.log for details.\n";
file_put_contents('conf/updates/error.log', $output);