boolinate approval
This commit is contained in:
parent
607803c04f
commit
0cf35db00c
@ -127,7 +127,7 @@ class Approval extends Extension
|
|||||||
$matches = [];
|
$matches = [];
|
||||||
|
|
||||||
if (is_null($event->term) && $this->no_approval_query($event->context)) {
|
if (is_null($event->term) && $this->no_approval_query($event->context)) {
|
||||||
$event->add_querylet(new Querylet($database->scoreql_to_sql("approved = SCORE_BOOL_Y ")));
|
$event->add_querylet(new Querylet("approved = :true", ["true"=>true]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_null($event->term)) {
|
if (is_null($event->term)) {
|
||||||
@ -135,9 +135,9 @@ class Approval extends Extension
|
|||||||
}
|
}
|
||||||
if (preg_match(self::SEARCH_REGEXP, strtolower($event->term), $matches)) {
|
if (preg_match(self::SEARCH_REGEXP, strtolower($event->term), $matches)) {
|
||||||
if ($user->can(Permissions::APPROVE_IMAGE) && $matches[1] == "no") {
|
if ($user->can(Permissions::APPROVE_IMAGE) && $matches[1] == "no") {
|
||||||
$event->add_querylet(new Querylet($database->scoreql_to_sql("approved = SCORE_BOOL_N ")));
|
$event->add_querylet(new Querylet("approved != :true", ["true"=>true]));
|
||||||
} else {
|
} else {
|
||||||
$event->add_querylet(new Querylet($database->scoreql_to_sql("approved = SCORE_BOOL_Y ")));
|
$event->add_querylet(new Querylet("approved = :true", ["true"=>true]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -261,15 +261,15 @@ class Approval extends Extension
|
|||||||
global $database;
|
global $database;
|
||||||
|
|
||||||
if ($this->get_version(ApprovalConfig::VERSION) < 1) {
|
if ($this->get_version(ApprovalConfig::VERSION) < 1) {
|
||||||
$database->execute($database->scoreql_to_sql(
|
$database->execute("ALTER TABLE images ADD COLUMN approved BOOLEAN NOT NULL DEFAULT FALSE");
|
||||||
"ALTER TABLE images ADD COLUMN approved SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N"
|
$database->execute("ALTER TABLE images ADD COLUMN approved_by_id INTEGER NULL");
|
||||||
));
|
|
||||||
$database->execute(
|
|
||||||
"ALTER TABLE images ADD COLUMN approved_by_id INTEGER NULL"
|
|
||||||
);
|
|
||||||
|
|
||||||
$database->execute("CREATE INDEX images_approved_idx ON images(approved)");
|
$database->execute("CREATE INDEX images_approved_idx ON images(approved)");
|
||||||
$this->set_version(ApprovalConfig::VERSION, 1);
|
$this->set_version(ApprovalConfig::VERSION, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->get_version(ApprovalConfig::VERSION) < 2) {
|
||||||
|
$database->standardise_boolean("images", "approved");
|
||||||
|
$this->set_version(ApprovalConfig::VERSION, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user