preliminary work for image locking

This commit is contained in:
Shish 2009-01-24 03:59:51 -08:00
parent cfd1b72b86
commit d8e3ba6f4d
2 changed files with 10 additions and 5 deletions

View File

@ -3,20 +3,24 @@
class Upgrade implements Extension { class Upgrade implements Extension {
public function receive_event(Event $event) { public function receive_event(Event $event) {
if($event instanceof InitExtEvent) { if($event instanceof InitExtEvent) {
$this->do_things(); $this->do_things($event->context);
} }
} }
private function do_things() { private function do_things($context) {
global $config; $config = $context->config;
global $database; $database = $context->database;
if(!is_numeric($config->get_string("db_version"))) { if(!is_numeric($config->get_string("db_version"))) {
$config->set_int("db_version", 2); $config->set_int("db_version", 2);
} }
if($config->get_int("db_version") < 6) { if($config->get_int("db_version") < 6) {
$database->upgrade_schema("ext/upgrade/schema.xml"); // cry :S
}
if($config->get_int("db_version") < 6) { // 7
// add column image->locked
} }
} }
} }

View File

@ -187,6 +187,7 @@ function create_tables($dsn) { // {{{
width INTEGER NOT NULL, width INTEGER NOT NULL,
height INTEGER NOT NULL, height INTEGER NOT NULL,
posted TIMESTAMP NOT NULL DEFAULT SCORE_NOW, posted TIMESTAMP NOT NULL DEFAULT SCORE_NOW,
locked SCORE_BOOL NOT NULL DEFAULT SCORE_BOOL_N,
INDEX(owner_id), INDEX(owner_id),
INDEX(width), INDEX(width),
INDEX(height), INDEX(height),