Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 2ec0a23

Browse files
author
Charles Marion
committed
ENH: The installation now use the last sql version
1 parent ebf31f8 commit 2ec0a23

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

core/controllers/InstallController.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ function step2Action()
103103
{
104104
$databaseConfig = parse_ini_file(BASE_PATH.'/core/configs/database.ini', true);
105105
$MyDirectory = opendir(BASE_PATH."/core/database/".$type);
106-
while($Entry = readdir($MyDirectory))
107-
{
108-
if(strpos($Entry, ".sql") != false)
109-
{
110-
$sqlFile = BASE_PATH."/core/database/".$type."/".$Entry;
111-
}
112-
}
113-
if(!isset($sqlFile))
106+
107+
require_once BASE_PATH.'/core/controllers/components/UpgradeComponent.php';
108+
$upgradeComponent = new UpgradeComponent();
109+
$upgradeComponent->dir = BASE_PATH."/core/database/".$type;
110+
$upgradeComponent->init = true;
111+
$sqlFile = $upgradeComponent->getNewestVersion(true);
112+
$sqlFile = BASE_PATH."/core/database/".$type."/".$sqlFile.'.sql';
113+
if(!isset($sqlFile) ||!file_exists($sqlFile))
114114
{
115115
throw new Zend_Exception("Unable to find sql file");
116116
}

core/controllers/components/UpgradeComponent.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
class UpgradeComponent extends AppComponent
44
{
55

6-
protected $dir;
6+
public $dir;
77
protected $module;
88
protected $db;
99
protected $dbtype;
1010
protected $dbtypeShort;
11-
protected $init = false;
11+
public $init = false;
1212

1313
/** init upgrade Componenet*/
1414
public function initUpgrade($module, $db, $dbtype)
@@ -87,6 +87,15 @@ public function getMigrationFiles()
8787
'version' => $versionNumber,
8888
'versionText' => $versionText);
8989
}
90+
if(preg_match('/^([0-9]+)(.)([0-9]+)(.)([0-9]+)\.sql/i', $entry, $matches) )
91+
{
92+
$versionText = basename(str_replace(".sql", "", $entry));
93+
$versionNumber = $this->transformVersionToNumeric($versionText);
94+
$files[$versionNumber] = array(
95+
'filename' => $entry,
96+
'version' => $versionNumber,
97+
'versionText' => $versionText);
98+
}
9099
}
91100
$d->close();
92101
}

core/public/js/install/install.step2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
checkDB($(this));
4343
});
4444

45-
$('.dbForm .adminAcountForm input').focusout(function()
45+
$('.dbForm .adminAcountForm input').keyup(function()
4646
{
4747
var obj=$(this);
4848
checkAll(obj);

0 commit comments

Comments
 (0)