Просмотр исходного кода

#2682 Add "updated" date along with "installed" date

RomanL 5 лет назад
Родитель
Сommit
df748808cf

+ 6 - 6
install/sql/system.sql

@@ -294,11 +294,10 @@ SET @iCategoryId = LAST_INSERT_ID();
 INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_params`, `check_error`, `order`) VALUES
 INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_params`, `check_error`, `order`) VALUES
 (@iCategoryId, 'sys_cron_time', '_adm_stg_cpt_option_sys_cron_time', '0', 'digit', '', '', '', '', 2),
 (@iCategoryId, 'sys_cron_time', '_adm_stg_cpt_option_sys_cron_time', '0', 'digit', '', '', '', '', 2),
 (@iCategoryId, 'sys_install_time', '_adm_stg_cpt_option_sys_install_time', '0', 'digit', '', '', '', '', 3),
 (@iCategoryId, 'sys_install_time', '_adm_stg_cpt_option_sys_install_time', '0', 'digit', '', '', '', '', 3),
-(@iCategoryId, 'sys_update_time', '_adm_stg_cpt_option_sys_update_time', '0', 'digit', '', '', '', '', 4),
-(@iCategoryId, 'sys_upgrade_channel', '_adm_stg_cpt_option_sys_upgrade_channel', 'stable', 'select', 'stable,beta', '', '', '', 5),
-(@iCategoryId, 'sys_revision', '_adm_stg_cpt_option_sys_revision', '0', 'digit', '', '', '', '', 6),
-(@iCategoryId, 'sys_eq_time', '_adm_stg_cpt_option_sys_eq_time', '0', 'digit', '', '', '', '', 7),
-(@iCategoryId, 'sys_push_queue_time', '_adm_stg_cpt_option_sys_push_queue_time', '0', 'digit', '', '', '', '', 8),
+(@iCategoryId, 'sys_upgrade_channel', '_adm_stg_cpt_option_sys_upgrade_channel', 'stable', 'select', 'stable,beta', '', '', '', 4),
+(@iCategoryId, 'sys_revision', '_adm_stg_cpt_option_sys_revision', '0', 'digit', '', '', '', '', 5),
+(@iCategoryId, 'sys_eq_time', '_adm_stg_cpt_option_sys_eq_time', '0', 'digit', '', '', '', '', 6),
+(@iCategoryId, 'sys_push_queue_time', '_adm_stg_cpt_option_sys_push_queue_time', '0', 'digit', '', '', '', '', 7),
 
 
 (@iCategoryId, 'sys_ftp_login', '_adm_stg_cpt_option_sys_ftp_login', '', 'digit', '', '', '', '', 10),
 (@iCategoryId, 'sys_ftp_login', '_adm_stg_cpt_option_sys_ftp_login', '', 'digit', '', '', '', '', 10),
 (@iCategoryId, 'sys_ftp_password', '_adm_stg_cpt_option_sys_ftp_password', '', 'digit', '', '', '', '', 11),
 (@iCategoryId, 'sys_ftp_password', '_adm_stg_cpt_option_sys_ftp_password', '', 'digit', '', '', '', '', 11),
@@ -1352,6 +1351,7 @@ CREATE TABLE `sys_modules` (
   `enabled` tinyint(1) NOT NULL default '0',
   `enabled` tinyint(1) NOT NULL default '0',
   `pending_uninstall` tinyint(4) NOT NULL,
   `pending_uninstall` tinyint(4) NOT NULL,
   `hash` varchar(32) NOT NULL default '',
   `hash` varchar(32) NOT NULL default '',
+  `updated` int(11) unsigned NOT NULL default '0',
   PRIMARY KEY  (`id`),
   PRIMARY KEY  (`id`),
   UNIQUE KEY `name` (`name`),
   UNIQUE KEY `name` (`name`),
   UNIQUE KEY `path` (`path`(191)),
   UNIQUE KEY `path` (`path`(191)),
@@ -1361,7 +1361,7 @@ CREATE TABLE `sys_modules` (
 );
 );
 
 
 INSERT INTO `sys_modules` (`type`, `name`, `title`, `vendor`, `version`, `path`, `uri`, `class_prefix`, `db_prefix`, `lang_category`, `dependencies`, `date`, `enabled`) VALUES
 INSERT INTO `sys_modules` (`type`, `name`, `title`, `vendor`, `version`, `path`, `uri`, `class_prefix`, `db_prefix`, `lang_category`, `dependencies`, `date`, `enabled`) VALUES
-('module', 'system', 'System', 'UNA, Inc', '9', '', 'system', 'Bx', 'sys_', 'System', '', 0, 1);
+('module', 'system', 'System', 'UNA, Inc', '9', '', 'system', 'Bx', 'sys_', 'System', '', UNIX_TIMESTAMP(), 1);
 
 
 
 
 CREATE TABLE `sys_modules_file_tracks` (
 CREATE TABLE `sys_modules_file_tracks` (

+ 1 - 1
studio/classes/BxDolStudioDashboard.php

@@ -71,7 +71,7 @@ class BxDolStudioDashboard extends BxTemplStudioWidget
                         $aResult = array('code' => 1, 'message' => $oUpgrader->getError());
                         $aResult = array('code' => 1, 'message' => $oUpgrader->getError());
 					}
 					}
                     else{
                     else{
-						$this->oDb->setUpdateDate();
+						BxDolModuleQuery::getInstance()->updateModule(array('updated' => time()), array('name' => 'system'));
                         $aResult = array('code' => 0, 'message' => _t('_adm_dbd_msg_upgrade_started', BX_DOL_URL_STUDIO));
                         $aResult = array('code' => 0, 'message' => _t('_adm_dbd_msg_upgrade_started', BX_DOL_URL_STUDIO));
 					}
 					}
                     break;
                     break;

+ 0 - 6
studio/classes/BxDolStudioDashboardQuery.php

@@ -19,12 +19,6 @@ class BxDolStudioDashboardQuery extends BxDolStudioPageQuery
     	$sSql = "SELECT SUM(`current_size`) AS `size` FROM `sys_objects_storage` WHERE `object` LIKE " . $this->escape($sModule . '%') . " LIMIT 1";
     	$sSql = "SELECT SUM(`current_size`) AS `size` FROM `sys_objects_storage` WHERE `object` LIKE " . $this->escape($sModule . '%') . " LIMIT 1";
     	return $this->getOne($sSql);
     	return $this->getOne($sSql);
     }
     }
-    
-    function setUpdateDate()
-    {
-    	$sSql = "UPDATE `sys_options` SET value = :value WHERE `name` = 'sys_update_time'";
-    	return $this->query($sSql, ['value' => time()]);
-    }
 }
 }
 
 
 /** @} */
 /** @} */

+ 1 - 1
studio/classes/BxDolStudioUpdater.php

@@ -104,7 +104,7 @@ class BxDolStudioUpdater extends BxDolStudioInstaller
         //--- Perform action and check results ---//
         //--- Perform action and check results ---//
         $aResult = array_merge($aResult, $this->_perform('install', $aParams));
         $aResult = array_merge($aResult, $this->_perform('install', $aParams));
         if($aResult['result']) {
         if($aResult['result']) {
-            $this->oDb->updateModule(array('version' => $this->_aConfig['version_to']), array('id' => $aModuleInfo['id']));
+            $this->oDb->updateModule(array('version' => $this->_aConfig['version_to'], 'updated' => time()), array('id' => $aModuleInfo['id']));
 
 
             //--- Remove update package ---//
             //--- Remove update package ---//
             $this->delete($aParams);
             $this->delete($aParams);

+ 4 - 4
studio/template/scripts/BxBaseStudioDashboard.php

@@ -114,16 +114,16 @@ class BxBaseStudioDashboard extends BxDolStudioDashboard
 	public function serviceGetBlockVersion()
 	public function serviceGetBlockVersion()
     {
     {
     	$sJsObject = $this->getPageJsObject();
     	$sJsObject = $this->getPageJsObject();
-
+        $aSysInfo = BxDolModuleQuery::getInstance()->getModuleByName('system');
         $sContent = BxDolStudioTemplate::getInstance()->parseHtmlByName('dbd_versions.html', array(
         $sContent = BxDolStudioTemplate::getInstance()->parseHtmlByName('dbd_versions.html', array(
         	'js_object' => $sJsObject,
         	'js_object' => $sJsObject,
             'domain' => getParam('site_title'),
             'domain' => getParam('site_title'),
             'version' => bx_get_ver(),
             'version' => bx_get_ver(),
-            'installed' => bx_time_js(getParam('sys_install_time')),
+            'installed' => bx_time_js($aSysInfo['date']),
 			'bx_if:show_update_info' => array(
 			'bx_if:show_update_info' => array(
-        		'condition' => getParam('sys_update_time') > 0,
+        		'condition' => $aSysInfo['updated'] > 0,
         		'content' => array(
         		'content' => array(
-		        	'updated' => bx_time_js(getParam('sys_update_time')),
+		        	'updated' => bx_time_js($aSysInfo['updated']),
        			)
        			)
        		),
        		),
         ));
         ));