* finish task #1511.
This commit is contained in:
@@ -143,6 +143,22 @@ class extensionModel extends model
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check incompatible extension
|
||||
*
|
||||
* @param array $versions
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function checkIncompatible($versions)
|
||||
{
|
||||
$apiURL = $this->apiRoot . 'apiCheckCompatible-' . helper::safe64Encode(json_encode($versions)) . '.json';
|
||||
$data = $this->fetchAPI($apiURL);
|
||||
if(isset($data->incompatibleExts)) return (array)$data->incompatibleExts;
|
||||
return array();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Download an extension.
|
||||
*
|
||||
@@ -804,6 +820,13 @@ class extensionModel extends model
|
||||
return $this->dao->update(TABLE_EXTENSION)->data($data)->where('code')->eq($extension)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check depends extension.
|
||||
*
|
||||
* @param string $extension
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function checkDepends($extension)
|
||||
{
|
||||
$result = array();
|
||||
@@ -820,6 +843,15 @@ class extensionModel extends model
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare for limit data.
|
||||
*
|
||||
* @param string $version
|
||||
* @param array $limit
|
||||
* @param string $type
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function compare4Limit($version, $limit, $type = 'between')
|
||||
{
|
||||
$result = false;
|
||||
|
||||
@@ -69,7 +69,23 @@ class upgrade extends control
|
||||
|
||||
if(!$this->upgrade->isError())
|
||||
{
|
||||
$this->view->result = 'success';
|
||||
$this->loadModel('extension');
|
||||
$extensions = $this->extension->getLocalExtensions('installed');
|
||||
|
||||
foreach($extensions as $code => $extension) $versions[$code] = $extension->version;
|
||||
|
||||
$incompatibleExts = $this->extension->checkIncompatible($versions);
|
||||
$extensionsName = array();
|
||||
|
||||
foreach($incompatibleExts as $extension)
|
||||
{
|
||||
$this->extension->updateExtension($extension, array('status' => 'deactivated'));
|
||||
$this->extension->removePackage($extension);
|
||||
$extensionsName[] = $extensions[$extension]->name;
|
||||
}
|
||||
|
||||
$this->view->extensionsName = $extensionsName;
|
||||
$this->view->result = 'success';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -37,6 +37,7 @@ $lang->upgrade->fromVersion = 'From version';
|
||||
$lang->upgrade->toVersion = 'To version';
|
||||
$lang->upgrade->confirm = 'Confirm the sql to executed.';
|
||||
$lang->upgrade->sureExecute = 'Execute';
|
||||
$lang->upgrade->forbiddenExt = 'Because it is incompatible with this version, the following extension automatically disabled, :';
|
||||
|
||||
$lang->upgrade->fromVersions['0_3beta'] = '0.3 BETA';
|
||||
$lang->upgrade->fromVersions['0_4beta'] = '0.4 BETA';
|
||||
|
||||
@@ -37,6 +37,7 @@ $lang->upgrade->fromVersion = '原来的版本';
|
||||
$lang->upgrade->toVersion = '升级到';
|
||||
$lang->upgrade->confirm = '确认要执行的SQL语句';
|
||||
$lang->upgrade->sureExecute = '确认执行';
|
||||
$lang->upgrade->forbiddenExt = '以下插件与新版本不兼容,自动禁用:';
|
||||
|
||||
$lang->upgrade->fromVersions['0_3beta'] = '0.3 BETA';
|
||||
$lang->upgrade->fromVersions['0_4beta'] = '0.4 BETA';
|
||||
|
||||
@@ -27,4 +27,13 @@
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
if(!empty($extensionsName))
|
||||
{
|
||||
echo "<h3>{$lang->upgrade->forbiddenExt}</h3>";
|
||||
echo '<ul>';
|
||||
foreach($incompatibleExts as $extensionName) echo "<li>$extensionName</li>";
|
||||
echo '</ul>';
|
||||
}
|
||||
?>
|
||||
<?php include '../../common/view/footer.lite.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user