add site quality audits and pagebuilder viewport selection
Add published-page accessibility and link checks with localized reports, and add responsive viewport controls to the page builder. Detect schema drift beyond matching hashes and apply lowercase definitions when creating or updating tables. Refresh generated admin, page-builder, and website-manager assets, and add coverage for quality checks, viewport selection, and schema migrations.
This commit is contained in:
@@ -241,6 +241,7 @@ class DB
|
||||
}
|
||||
|
||||
public function resolveDiffDB() {
|
||||
$definitions = $this->getDBDefinition();
|
||||
$diff = $this->diffDB();
|
||||
foreach ($diff as $table => $tableDiff) {
|
||||
$tableName = $_ENV['DATABASE_PREFIX'] . phpb_remove_non_alpha_numeric($table);
|
||||
@@ -248,20 +249,29 @@ class DB
|
||||
$this->query("CREATE TABLE {$tableName} (`id` int NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");
|
||||
$this->query("ALTER TABLE {$tableName} ADD PRIMARY KEY (`id`)");
|
||||
$this->query("ALTER TABLE {$tableName} MODIFY `id` int NOT NULL AUTO_INCREMENT");
|
||||
} elseif (is_array($tableDiff)) {
|
||||
$tableDefinition = $definitions[$table] ?? ['columns' => [], 'uniqueKeys' => []];
|
||||
$tableDiff = [
|
||||
'columns' => $tableDefinition['columns'] ?? [],
|
||||
'uniqueKeys' => [],
|
||||
];
|
||||
foreach ($tableDefinition['uniqueKeys'] ?? [] as $key => $columns) {
|
||||
$tableDiff['uniqueKeys'][$key] = '`' . implode('`,`', $columns) . '`';
|
||||
}
|
||||
}
|
||||
if (is_array($tableDiff)) {
|
||||
foreach ($tableDiff['columns'] as $column => $columnDefinition) {
|
||||
// Validate column name to prevent SQL injection
|
||||
$sanitizedColumn = phpb_remove_non_alpha_numeric($column);
|
||||
if (empty($sanitizedColumn)) continue;
|
||||
// Validate column definition against a safe pattern
|
||||
if (!preg_match('/^[A-Z\s(),0-9_`]+$/', $columnDefinition)) continue;
|
||||
if (!is_string($columnDefinition) || !preg_match('/^[A-Z\s(),0-9_`]+$/i', $columnDefinition)) continue;
|
||||
$this->query("ALTER TABLE {$tableName} ADD {$sanitizedColumn} {$columnDefinition}");
|
||||
}
|
||||
foreach ($tableDiff['uniqueKeys'] as $key => $keyDefinition) {
|
||||
// Validate key name and definition
|
||||
$sanitizedKey = phpb_remove_non_alpha_numeric($key);
|
||||
if (empty($sanitizedKey)) continue;
|
||||
if (!preg_match('/^[A-Z,`\s_]+$/', $keyDefinition)) continue;
|
||||
if (!preg_match('/^[A-Z,`\s_]+$/i', $keyDefinition)) continue;
|
||||
$this->query("ALTER TABLE {$tableName} ADD UNIQUE KEY {$sanitizedKey} ($keyDefinition)");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user