Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy DB setup code #2267

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions app/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -465,46 +465,6 @@ public function install(): View
if ($db_created) {
Artisan::call('migrate --force');

// If we are with PostGreSQL we need to add some extra functions
if ($db_type == 'pgsql') {
$sqlfile = base_path('/app/cdash/sql/pgsql/cdash.ext.sql');

// Create the language. PgSQL has no way to know if the language already
// exists
@pdo_query('CREATE LANGUAGE plpgsql');

$file_content = file($sqlfile);
$query = '';
foreach ($file_content as $sql_line) {
$tsl = trim($sql_line);
if ($sql_line !== '' && !str_starts_with($tsl, '--')) {
$query .= $sql_line;
$possemicolon = strrpos($query, ';');
if ($possemicolon !== false && substr_count($query, '\'', 0, $possemicolon) % 2 == 0) {
// We need to remove only the last semicolon
$pos = strrpos($query, ';');
if ($pos !== false) {
$query = substr($query, 0, $pos) . substr($query, $pos + 1);
}
$result = pdo_query($query);
if (!$result) {
$xml .= '<db_created>0</db_created>';
abort(500, pdo_error());
}
$query = '';
}
}
}

// Check the version of PostgreSQL
$result_version = pdo_query('SELECT version()');
$version_array = pdo_fetch_array($result_version);
if (str_contains(strtolower($version_array[0]), 'postgresql 9.')) {
// For PgSQL 9.0 we need to set the bytea_output to 'escape' (it was changed to hexa)
@pdo_query("ALTER DATABASE {$db_name} SET bytea_output TO 'escape'");
}
}

$user = new \CDash\Model\User();
$user->Email = $admin_email;
$user->Password = password_hash($admin_password, PASSWORD_DEFAULT);
Expand Down
8 changes: 6 additions & 2 deletions app/cdash/app/Model/BuildUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

use CDash\Database;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use PDO;

class BuildUpdate
Expand Down Expand Up @@ -404,8 +405,7 @@ public function FillFromBuildId(): bool
$stmt = $this->PDO->prepare(
"SELECT uf.* FROM updatefile uf
JOIN build2update b2u ON uf.updateid = b2u.updateid
WHERE b2u.buildid = ?
ORDER BY REVERSE(RIGHT(REVERSE(filename),LOCATE('/',REVERSE(filename))))");
WHERE b2u.buildid = ?");
pdo_execute($stmt, [$this->BuildId]);
while ($row = $stmt->fetch()) {
$file = new BuildUpdateFile();
Expand All @@ -423,6 +423,10 @@ public function FillFromBuildId(): bool
$this->AddFile($file);
}

usort($this->Files, function ($file1, $file2) {
return Str::afterLast('/', $file1->Filename) <=> Str::afterLast('/', $file2->Filename);
});

return true;
}

Expand Down
18 changes: 0 additions & 18 deletions app/cdash/sql/convert.sh

This file was deleted.

109 changes: 0 additions & 109 deletions app/cdash/sql/convert_alter_table.pl

This file was deleted.

Loading