Skip to content

Commit

Permalink
Update tracks setting for new comment track.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohler committed Sep 10, 2024
1 parent 0caf8b4 commit 139f201
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/conference.php
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ function __load_settings() {

function load_settings() {
$this->__load_settings();
if ($this->sversion < 301) {
if ($this->sversion < 302) {
$old_nerrors = Dbl::$nerrors;
while ((new UpdateSchema($this))->run()) {
usleep(50000);
Expand Down
2 changes: 1 addition & 1 deletion src/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ CREATE TABLE `TopicInterest` (
-- Initial settings
-- (each setting must be on its own line for createdb.php/createdb.sh)
insert into Settings (name, value, data) values
('allowPaperOption', 301, null), -- schema version
('allowPaperOption', 302, null), -- schema version
('setupPhase', 1, null), -- initial user is chair
('no_papersub', 1, null), -- no submissions yet
('sub_pcconf', 1, null), -- collect PC conflicts, not collaborators
Expand Down
20 changes: 20 additions & 0 deletions src/updateschema.php
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,22 @@ private function v297_helper_update_pid_rid($qstager, $pid, $rid, $cetime, $ause
}
}

private function v302_update_comment_tracks() {
if (($tj = $this->conf->setting_json("tracks"))) {
$changed = false;
foreach ((array) $tj as $tag => $v) {
if (isset($v->unassrev) && !isset($v->comment)) {
$v->comment = $v->unassrev;
$changed = true;
}
}
if ($changed) {
$this->conf->save_setting("tracks", $this->conf->setting("tracks"), json_encode_db($tj));
}
}
return true;
}

/** @return bool */
function run() {
$conf = $this->conf;
Expand Down Expand Up @@ -3119,6 +3135,10 @@ function run() {
&& $conf->ql_ok("update Settings set value=2 where name='cmt_author' and value=1")) {
$conf->update_schema_version(301);
}
if ($conf->sversion === 301
&& $this->v302_update_comment_tracks()) {
$conf->update_schema_version(302);
}

$conf->ql_ok("delete from Settings where name='__schema_lock'");
Conf::$main = $old_conf_g;
Expand Down

0 comments on commit 139f201

Please sign in to comment.