Commit 72a75a21 authored by Jerome Mariette's avatar Jerome Mariette
Browse files

make runs and analyses storage size be updated at upgrade step

parent 0846010c
......@@ -23,6 +23,7 @@
***************************************************************/
require_once(PATH_tslib.'class.tslib_pibase.php');
require_once(t3lib_extMgm::extPath('nG6').'/lib/class.tx_nG6_db.php');
/**
* Class_nG6_db' for the 'nG6' extension.
......@@ -37,13 +38,13 @@ class tx_nG6_upgrade {
*
* @param string $version the version
*/
function upgrade($version){
function upgrade($version, $data_storage){
// version 1.2 : users rights' system
if($version == '1.2'){
tx_nG6_upgrade::upgrade_1_2();
return "Upgrade successfuly ended to version 1.2!";
} else if($version == '2.0'){
tx_nG6_upgrade::upgrade_2_0();
tx_nG6_upgrade::upgrade_2_0($data_storage);
return "Upgrade successfuly ended to version 2.0!";
} else {
return "Upgrading to version " . $version . " not suported!";
......@@ -58,7 +59,7 @@ class tx_nG6_upgrade {
/**
* Main function to upgrade to version 2.0.
*/
function upgrade_2_0(){
function upgrade_2_0($data_storage){
// Update cruser_id of tx_nG6_project
$queryUpdateCruseridProject = "
UPDATE tx_nG6_project p
......@@ -125,7 +126,8 @@ class tx_nG6_upgrade {
ADD storage_size int(11) NOT NULL DEFAULT '0' AFTER sequencer
";
// TODO: process the update of these fields
// finaly update storage fields
tx_nG6_upgrade::set_storage_size($data_storage);
/*
* Execute all queries
......@@ -140,6 +142,41 @@ class tx_nG6_upgrade {
$GLOBALS['TYPO3_DB']->sql_query($queryAlterTxNG6Run);
}
function set_storage_size($data_storage) {
// update run storage size
$queryParts = array(
'SELECT' => 'tx_nG6_run.uid as uid',
'FROM' => 'tx_nG6_run ',
'WHERE' => "",
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
$current_size = 0;
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$current_size = tx_nG6_db::get_run_size($res_row['uid'], $data_storage, false);
$GLOBALS['TYPO3_DB']-> exec_UPDATEquery('tx_nG6_run', 'uid='.$res_row['uid'], array('storage_size' => strval($current_size)));
}
// update analysis storage size
$queryParts = array(
'SELECT' => 'tx_nG6_analyze.uid as uid',
'FROM' => 'tx_nG6_analyze ',
'WHERE' => "",
'GROUPBY' => '',
'ORDERBY' => '',
'LIMIT' => ''
);
$res = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($queryParts);
$current_size = 0;
while($res_row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$current_size = tx_nG6_db::get_analysis_size($res_row['uid'], $data_storage);
$GLOBALS['TYPO3_DB']-> exec_UPDATEquery('tx_nG6_analyze', 'uid='.$res_row['uid'], array('storage_size' => strval($current_size)));
}
}
/*
* version 1.2
*------------------------------------------------------------*/
......
......@@ -91,7 +91,7 @@ class tx_nG6_pi1 extends tslib_pibase {
// if asked to upgrade to version 1.2
if($this->piVars['upgrade']){
$content = tx_nG6_upgrade::upgrade($this->piVars['upgrade']);
$content = '<div class="sub-content sc-top">'.tx_nG6_upgrade::upgrade($this->piVars['upgrade'], $this->conf["data"]).'</div>';
}
else if(! $this->pi_is_install_finalized()) {
$content .= $this->pi_install_view();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment