Minor improvement in the update gateway API calls.
This commit is contained in:
parent
064daa2d2e
commit
bff2f1d59e
|
|
@ -557,12 +557,16 @@ class UpdateManager
|
|||
* Downloads a plugin from the update server.
|
||||
* @param string $name Plugin name.
|
||||
* @param string $hash Expected file hash.
|
||||
* @param boolean $installation Indicates whether this is a plugin installation request.
|
||||
* @return self
|
||||
*/
|
||||
public function downloadPlugin($name, $hash)
|
||||
public function downloadPlugin($name, $hash, $installation = false)
|
||||
{
|
||||
$fileCode = $name . $hash;
|
||||
$this->requestServerFile('plugin/get', $fileCode, $hash, ['name' => $name]);
|
||||
$this->requestServerFile('plugin/get', $fileCode, $hash, [
|
||||
'name' => $name,
|
||||
'installation' => $installation ? 1 : 0
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -909,7 +913,13 @@ class UpdateManager
|
|||
*/
|
||||
protected function applyHttpAttributes($http, $postData)
|
||||
{
|
||||
$postData['server'] = base64_encode(serialize(['php' => PHP_VERSION, 'url' => Url::to('/')]));
|
||||
$postData['protocol_version'] = '1.1';
|
||||
|
||||
$postData['server'] = base64_encode(serialize([
|
||||
'php' => PHP_VERSION,
|
||||
'url' => Url::to('/'),
|
||||
'since' => PluginVersion::orderBy('created_at')->value('created_at')
|
||||
]));
|
||||
|
||||
if ($projectId = Parameter::get('system::project.id')) {
|
||||
$postData['project'] = $projectId;
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class PluginInstall extends Command
|
|||
$hash = array_get($pluginDetails, 'hash');
|
||||
|
||||
$this->output->writeln(sprintf('<info>Downloading plugin: %s</info>', $code));
|
||||
$manager->downloadPlugin($code, $hash);
|
||||
$manager->downloadPlugin($code, $hash, true);
|
||||
|
||||
$this->output->writeln(sprintf('<info>Unpacking plugin: %s</info>', $code));
|
||||
$manager->extractPlugin($code, $hash);
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ class Updates extends Controller
|
|||
break;
|
||||
|
||||
case 'downloadPlugin':
|
||||
$manager->downloadPlugin(post('name'), post('hash'));
|
||||
$manager->downloadPlugin(post('name'), post('hash'), post('install'));
|
||||
break;
|
||||
|
||||
case 'downloadTheme':
|
||||
|
|
@ -439,7 +439,7 @@ class Updates extends Controller
|
|||
/*
|
||||
* Update steps
|
||||
*/
|
||||
$updateSteps = $this->buildUpdateSteps($core, $plugins, $themes);
|
||||
$updateSteps = $this->buildUpdateSteps($core, $plugins, $themes, false);
|
||||
|
||||
/*
|
||||
* Finish up
|
||||
|
|
@ -534,7 +534,7 @@ class Updates extends Controller
|
|||
/*
|
||||
* Update steps
|
||||
*/
|
||||
$updateSteps = $this->buildUpdateSteps($core, $plugins, $themes);
|
||||
$updateSteps = $this->buildUpdateSteps($core, $plugins, $themes, false);
|
||||
|
||||
/*
|
||||
* Finish up
|
||||
|
|
@ -553,7 +553,7 @@ class Updates extends Controller
|
|||
return $this->makePartial('execute');
|
||||
}
|
||||
|
||||
protected function buildUpdateSteps($core, $plugins, $themes)
|
||||
protected function buildUpdateSteps($core, $plugins, $themes, $isInstallationRequest)
|
||||
{
|
||||
if (!is_array($core)) {
|
||||
$core = [null, null];
|
||||
|
|
@ -595,7 +595,8 @@ class Updates extends Controller
|
|||
'code' => 'downloadPlugin',
|
||||
'label' => Lang::get('system::lang.updates.plugin_downloading', compact('name')),
|
||||
'name' => $name,
|
||||
'hash' => $hash
|
||||
'hash' => $hash,
|
||||
'install' => $isInstallationRequest ? 1 : 0
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -717,7 +718,7 @@ class Updates extends Controller
|
|||
/*
|
||||
* Update steps
|
||||
*/
|
||||
$updateSteps = $this->buildUpdateSteps(null, $plugins, []);
|
||||
$updateSteps = $this->buildUpdateSteps(null, $plugins, [], true);
|
||||
|
||||
/*
|
||||
* Finish up
|
||||
|
|
@ -845,7 +846,7 @@ class Updates extends Controller
|
|||
/*
|
||||
* Update steps
|
||||
*/
|
||||
$updateSteps = $this->buildUpdateSteps(null, $plugins, $themes);
|
||||
$updateSteps = $this->buildUpdateSteps(null, $plugins, $themes, true);
|
||||
|
||||
/*
|
||||
* Finish up
|
||||
|
|
|
|||
Loading…
Reference in New Issue