本文整理汇总了PHP中Updater::checkRequirements方法的典型用法代码示例。如果您正苦于以下问题:PHP Updater::checkRequirements方法的具体用法?PHP Updater::checkRequirements怎么用?PHP Updater::checkRequirements使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Updater
的用法示例。
在下文中一共展示了Updater::checkRequirements方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareUpdate
/**
* @param $manual
* @param $handle
* @return array
*/
public function prepareUpdate($manual, $handle)
{
Craft::log('Preparing to update ' . $handle . '.', LogLevel::Info, true);
try {
$updater = new Updater();
// No need to get the latest update info if this is a manual update.
if (!$manual) {
$updater->getLatestUpdateInfo();
}
$updater->checkRequirements();
Craft::log('Finished preparing to update ' . $handle . '.', LogLevel::Info, true);
return array('success' => true);
} catch (\Exception $e) {
return array('success' => false, 'message' => $e->getMessage());
}
}
示例2: prepareUpdate
/**
* @param $manual
* @param $handle
*
* @return array
*/
public function prepareUpdate($manual, $handle)
{
Craft::log('Preparing to update ' . $handle . '.', LogLevel::Info, true);
try {
// Fire an 'onBeginUpdate' event and pass in the type
$this->onBeginUpdate(new Event($this, array('type' => $manual ? 'manual' : 'auto')));
$updater = new Updater();
// Make sure we still meet the existing requirements.
$updater->checkRequirements();
// No need to get the latest update info if this is a manual update.
if (!$manual) {
$updateModel = $this->getUpdates();
if ($handle == 'craft') {
Craft::log('Updating from ' . $updateModel->app->localVersion . '.' . $updateModel->app->localBuild . ' to ' . $updateModel->app->latestVersion . '.' . $updateModel->app->latestBuild . '.', LogLevel::Info, true);
} else {
$latestVersion = null;
$localVersion = null;
$class = null;
foreach ($updateModel->plugins as $pluginUpdateModel) {
if (strtolower($pluginUpdateModel->class) === $handle) {
$latestVersion = $pluginUpdateModel->latestVersion;
$localVersion = $pluginUpdateModel->localVersion;
$class = $pluginUpdateModel->class;
break;
}
}
Craft::log('Updating plugin "' . $class . '" from ' . $localVersion . ' to ' . $latestVersion . '.', LogLevel::Info, true);
}
$result = $updater->getUpdateFileInfo($handle);
}
$result['success'] = true;
Craft::log('Finished preparing to update ' . $handle . '.', LogLevel::Info, true);
return $result;
} catch (\Exception $e) {
return array('success' => false, 'message' => $e->getMessage());
}
}