Skip to content

Commit ef84f4e

Browse files
author
Till Brehm
committed
Merge branch 'stable-3.1' of git.ispconfig.org:ispconfig/ispconfig3 into stable-3.1
2 parents f4cb85f + 31a4a5f commit ef84f4e

File tree

4 files changed

+28
-8
lines changed

4 files changed

+28
-8
lines changed

install/lib/installer_base.lib.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function warning($msg) {
5959
}
6060

6161
public function simple_query($query, $answers, $default, $name = '') {
62-
global $autoinstall;
62+
global $autoinstall, $autoupdate;
6363
$finished = false;
6464
do {
6565
if($name != '' && $autoinstall[$name] != '') {
@@ -104,7 +104,7 @@ public function simple_query($query, $answers, $default, $name = '') {
104104
}
105105

106106
public function free_query($query, $default, $name = '') {
107-
global $autoinstall;
107+
global $autoinstall, $autoupdate;
108108
if($name != '' && $autoinstall[$name] != '') {
109109
if($autoinstall[$name] == 'default') {
110110
$input = $default;

interface/lib/classes/aps_crawler.inc.php

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,13 @@ public function startCrawler()
261261
// Get all known apps from the database and the highest known version
262262
// Note: A dirty hack is used for numerical sorting of the VARCHAR field Version: +0 -> cast
263263
// A longer but typesafe way would be: ORDER BY CAST(REPLACE(Version, '.', '') AS UNSIGNED) DESC
264-
$existing_apps = $app->db->queryAllRecords("SELECT * FROM (
265-
SELECT name AS Name, CONCAT(version, '-', CAST(`release` AS CHAR)) AS CurrentVersion
266-
FROM aps_packages ORDER BY REPLACE(version, '.', '')+0 DESC, `release` DESC
267-
) as Versions GROUP BY name");
264+
$existing_apps = array();
265+
$tmpres = $app->db->query("SELECT name as `Name`, CONCAT(version, '-', CAST(`release` AS CHAR)) AS CurrentVersion FROM aps_packages ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(version,'.0.0.0'),'.',4)) DESC, `release` DESC");
266+
while($tmp = $tmpres->get()) {
267+
if(!array_key_exists($tmp['Name'], $existing_apps)) $existing_apps[$tmp['Name']] = $tmp;
268+
}
269+
$tmpres->free();
270+
unset($tmp);
268271
//var_dump($existing_apps);
269272

270273
// Used for statistics later
@@ -492,6 +495,23 @@ public function startCrawler()
492495
$app->log($this->log_prefix.'Processed '.$apps_in_repo.
493496
' apps from the repo. Downloaded '.$apps_updated.
494497
' updates, '.$apps_downloaded.' new apps');
498+
499+
$prevapp = '';
500+
$res = $app->db->query("SELECT `id`, `name`, `version`, `release`, `package_status` FROM `aps_packages` WHERE 1 ORDER BY `name` ASC, INET_ATON(SUBSTRING_INDEX(CONCAT(version,'.0.0.0'),'.',4)) DESC, `release` DESC");
501+
while($curapp = $res->get()) {
502+
if($curapp['name'] != $prevapp) {
503+
$prevapp = $curapp['name'];
504+
continue;
505+
}
506+
if($curapp['package_status'] != PACKAGE_OUTDATED) {
507+
$app->log($this->log_prefix.'Tagging ' . $curapp['name'] . ' ' . $curapp['version'] . '-' . $curapp['release'] . ' as outdated.');
508+
$app->db->query("UPDATE `aps_packages` SET `package_status` = ? WHERE `id` = ?", PACKAGE_OUTDATED, $curapp['id']);
509+
$app->db->datalogUpdate('aps_packages', array("package_status" => PACKAGE_OUTDATED), 'id', $curapp['id']);
510+
}
511+
}
512+
$res->free();
513+
unset($curapp);
514+
unset($prevapp);
495515
}
496516

497517
catch(Exception $e)

interface/lib/classes/aps_guicontroller.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function getNewestPackageID($id)
166166
FROM aps_packages
167167
WHERE name = (SELECT name FROM aps_packages WHERE id = ?)
168168
AND package_status = 2
169-
ORDER BY REPLACE(version, '.', '')+0 DESC, `release` DESC", $id);
169+
ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(version,'.0.0.0'),'.',4)) DESC, `release` DESC", $id);
170170

171171
if(!empty($result) && ($id != $result['id'])) return $result['id'];
172172

server/lib/classes/aps_installer.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ private function prepareDatabase($task, $sxe)
306306
$db_id = parent::getXPathValue($sxe, '//db:id');
307307
if(empty($db_id)) return; // No database needed
308308

309-
$mysqlver_res = $app->db->queryOneRecord('SELECT VERSION() as ver;');
309+
$mysqlver_res = $app->db->queryOneRecord('SELECT VERSION() as ver');
310310
$mysqlver = $mysqlver_res['ver'];
311311

312312
$tmp = $app->db->queryOneRecord("SELECT value FROM aps_instances_settings WHERE name = 'main_database_password' AND instance_id = ?", $task['instance_id']);

0 commit comments

Comments
 (0)