fix connection failed when view empty category, add list order column, add detecting change of package.inc.php

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8738 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
flyskyko 2011-08-10 02:10:55 +00:00
parent aa7b7de8f5
commit b574bdffe9
17 changed files with 99 additions and 32 deletions

View file

@ -210,12 +210,14 @@
{
$xmlDoc->response->categorylist->item = array($xmlDoc->response->categorylist->item);
}
$list_order = 0;
foreach($xmlDoc->response->categorylist->item as $item)
{
$args = null;
$args->category_srl = $item->category_srl->body;
$args->parent_srl = $item->parent_srl->body;
$args->title = $item->title->body;
$args->list_order = $list_order++;
$output = executeQuery("autoinstall.insertCategory", $args);
}
}

View file

@ -229,6 +229,11 @@
$lUpdateDoc = $xml_lUpdate->parse($buff);
$updateDate = $lUpdateDoc->response->updatedate->body;
if (!$updateDate)
{
return $this->stop('msg_connection_fail');
}
$oModel = &getModel('autoinstall');
$item = $oModel->getLatestPackage();
if(!$item || $item->updatedate < $updateDate || count($this->categories) < 1)
@ -323,7 +328,7 @@
}
else
{
return $this->stop('Connection failed');
return $this->stop('msg_connection_fail');
}
}
}

View file

@ -33,10 +33,24 @@
class autoinstall extends ModuleObject {
var $tmp_dir = './files/cache/autoinstall/';
function autoinstall()
{
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('autoinstall');
if ($config->downloadServer != _XE_DOWNLOAD_SERVER_)
{
$this->stop('msg_not_match_server');
}
}
/**
* @brief for additional tasks required when installing
**/
function moduleInstall() {
$oModuleController = &getController('module');
$config->downloadServer = _XE_DOWNLOAD_SERVER_;
$oModuleController->insertModuleConfig('autoinstall', $config);
}
/**
@ -44,6 +58,8 @@
**/
function checkUpdate() {
$oDB =& DB::getInstance();
$oModuleModel = &getModel('module');
if(!file_exists(FileHandler::getRealPath("./modules/autoinstall/schemas/autoinstall_installed_packages.xml"))
&& $oDB->isTableExists("autoinstall_installed_packages"))
{
@ -55,6 +71,13 @@
return true;
}
// 2011.08.08 add column 'list_order' in ai_remote_categories
if (!$oDB->isColumnExists('ai_remote_categories', 'list_order')) return true;
// 2011.08.08 set _XE_DOWNLOAD_SERVER_ at module config
$config = $oModuleModel->getModuleConfig('autoinstall');
if (!isset($config->downloadServer)) return true;
return false;
}
@ -63,6 +86,9 @@
**/
function moduleUpdate() {
$oDB =& DB::getInstance();
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
if(!file_exists(FileHandler::getRealPath("./modules/autoinstall/schemas/autoinstall_installed_packages.xml"))
&& $oDB->isTableExists("autoinstall_installed_packages"))
{
@ -73,6 +99,21 @@
{
$oDB->dropTable("autoinstall_remote_categories");
}
// 2011.08.08 add column 'list_order' in 'ai_remote_categories
if (!$oDB->isColumnExists('ai_remote_categories', 'list_order'))
{
$oDB->addColumn('ai_remote_categories', 'list_order', 'number', 11, null, true);
$oDB->addIndex('ai_remote_categories', 'idx_list_order', array('list_order'));
}
// 2011. 08. 08 set _XE_DOWNLOAD_SERVER_ at module config
$config = $oModuleModel->getModuleConfig('autoinstall');
if (!isset($config->downloadServer)){
$config->downloadServer = _XE_DOWNLOAD_SERVER_;
$oModuleController->insertModuleConfig('autoinstall', $config);
}
return new Object(0, 'success_updated');
}

View file

@ -72,7 +72,7 @@
if(!method_exists($oModule, "moduleUninstall")) return new Object(-1, 'msg_invalid_request');
$output = $oModule->moduleUninstall();
if(!$output->toBool()) return $output;
if(is_subclass_of($output, 'Object') && !$output->toBool()) return $output;
$schema_dir = sprintf('%s/schemas/', $this->package->path);
$schema_files = FileHandler::readDir($schema_dir);

View file

@ -37,4 +37,6 @@
$lang->dependant_list = "Dependant package list of the current package";
$lang->msg_avail_update = 'There is available update for this item.';
$lang->msg_do_you_like_update = 'Would you like to update?';
$lang->msg_connection_fail = 'Connection failed.';
$lang->msg_not_match_server = 'Server settings are incorrect.';
?>

View file

@ -36,4 +36,6 @@
$lang->dependant_list = "このパッケージに依存するパッケージのリスト";
$lang->msg_avail_update = 'There is available update for this item.';
$lang->msg_do_you_like_update = 'Would you like to update?';
$lang->msg_connection_fail = 'Connection failed.';
$lang->msg_not_match_server = 'Server settings are incorrect.';
?>

View file

@ -36,4 +36,6 @@
$lang->dependant_list = "이 패키지에 의존하는 패키지 목록";
$lang->msg_avail_update = '이 항목 업데이트가 가능합니다.';
$lang->msg_do_you_like_update = '업데이트 하시겠습니까?';
$lang->msg_connection_fail = '서버 접속이 원할하지 않습니다.';
$lang->msg_not_match_server = '서버 설정이 올바르지 않습니다.';
?>

View file

@ -36,4 +36,6 @@
$lang->dependant_list = "Dependant package list of the current package";
$lang->msg_avail_update = 'There is available update for this item.';
$lang->msg_do_you_like_update = 'Would you like to update?';
$lang->msg_connection_fail = 'Connection failed.';
$lang->msg_not_match_server = 'Server settings are incorrect.';
?>

View file

@ -36,4 +36,6 @@
$lang->dependant_list = "Mevcut pakete bağlı paket listesi";
$lang->msg_avail_update = 'There is available update for this item.';
$lang->msg_do_you_like_update = 'Would you like to update?';
$lang->msg_connection_fail = 'Connection failed.';
$lang->msg_not_match_server = 'Server settings are incorrect.';
?>

View file

@ -36,4 +36,6 @@
$lang->dependant_list = "Gói cài đặt này phụ thuộc vào các gói khác trong danh sách";
$lang->msg_avail_update = 'There is available update for this item.';
$lang->msg_do_you_like_update = 'Would you like to update?';
$lang->msg_connection_fail = 'Connection failed.';
$lang->msg_not_match_server = 'Server settings are incorrect.';
?>

View file

@ -36,4 +36,6 @@
$lang->dependant_list = "联动数据包列表";
$lang->msg_avail_update = 'There is available update for this item.';
$lang->msg_do_you_like_update = 'Would you like to update?';
$lang->msg_connection_fail = 'Connection failed.';
$lang->msg_not_match_server = 'Server settings are incorrect.';
?>

View file

@ -37,4 +37,6 @@
$lang->dependant_list = "與此程式相關程式列表";
$lang->msg_avail_update = 'There is available update for this item.';
$lang->msg_do_you_like_update = 'Would you like to update?';
$lang->msg_connection_fail = 'Connection failed.';
$lang->msg_not_match_server = 'Server settings are incorrect.';
?>

View file

@ -5,4 +5,7 @@
<columns>
<column name="*" />
</columns>
<navigation>
<index default="list_order" var="list_order" order="asc" />
</navigation>
</query>

View file

@ -6,5 +6,6 @@
<column name="category_srl" var="category_srl" filter="number" notnull="notnull" />
<column name="parent_srl" var="parent_srl" filter="number" notnull="notnull" />
<column name="title" var="title" minlength="1" maxlength="250" />
<column name="list_order" var="list_order" filter="number" notnull="notnull" />
</columns>
</query>

View file

@ -2,4 +2,5 @@
<column name="category_srl" type="number" size="11" default="0" notnull="notnull" primary_key="primary_key" />
<column name="parent_srl" type="number" size="11" default="0" notnull="notnull" index="idx_parent_srl" />
<column name="title" type="varchar" size="250" notnull="notnull" />
<column name="list_order" type="number" size="11" notnull="notnull" index="idx_list_order" />
</table>

View file

@ -11,11 +11,9 @@
<form action="" method="post">
<input type="hidden" name="module" value="autoinstall" />
<input type="hidden" name="act" value="procAutoinstallAdminUpdateinfo" />
{@$btnUpdate = sprintf('<input type="submit" value="%s" />', $lang->status_update)}
{@$btnUpdate = sprintf('<input type="submit" value="%s" class="text" />', $lang->status_update)}
{sprintf($lang->description_update, $btnUpdate)}
</form>
</p>
<block cond="$item_list">
<include target="list.html" />
</block>
<include target="list.html" />

View file

@ -68,7 +68,7 @@
</table>
</div>
<div class="search">
<form action="./" class="pagination">
<form action="./" class="pagination" cond="$page_navigation">
<input type="hidden" name="error_return_url" value="" />
<input type="hidden" name="module" value="{$module}" />
<input type="hidden" name="act" value="{$act}" />