2011-01-01 17:26:39 +00:00
|
|
|
<?php defined("SYSPATH") or die("No direct script access.");
|
2011-01-01 18:14:59 +00:00
|
|
|
/**
|
|
|
|
* Gallery - a web based photo album viewer and editor
|
2011-01-22 07:12:44 +00:00
|
|
|
* Copyright (C) 2000-2011 Bharat Mediratta
|
2011-01-01 18:14:59 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or (at
|
|
|
|
* your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
class picasa_faces_installer {
|
|
|
|
static function install() {
|
|
|
|
// Create a table to store face mappings in.
|
|
|
|
$db = Database::instance();
|
2011-01-01 17:26:39 +00:00
|
|
|
|
2011-01-01 18:14:59 +00:00
|
|
|
$db->query(
|
2011-01-01 19:16:29 +00:00
|
|
|
"CREATE TABLE IF NOT EXISTS {picasa_faces} (
|
2011-01-01 18:14:59 +00:00
|
|
|
`id` int(9) NOT NULL auto_increment,
|
|
|
|
`face_id` varchar(16) NOT NULL,
|
|
|
|
`tag_id` int(9) NOT NULL,
|
|
|
|
`user_id` int(9) NOT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
KEY `face_id` (`face_id`,`id`)
|
|
|
|
) DEFAULT CHARSET=utf8;"
|
|
|
|
);
|
2011-01-01 17:26:39 +00:00
|
|
|
|
2011-01-01 18:14:59 +00:00
|
|
|
// Set the module version number.
|
|
|
|
module::set_version("picasa_faces", 2);
|
|
|
|
}
|
2011-01-01 17:26:39 +00:00
|
|
|
|
2011-01-01 18:14:59 +00:00
|
|
|
static function upgrade($version) {
|
|
|
|
if ($version == 1) {
|
|
|
|
Database::instance()->query(
|
|
|
|
"ALTER TABLE `picasa_faces` ADD `user_id` int(9) NOT NULL"
|
|
|
|
);
|
2011-01-01 17:26:39 +00:00
|
|
|
|
2011-01-01 18:14:59 +00:00
|
|
|
module::set_version("picasa_faces", 2);
|
2011-01-01 17:26:39 +00:00
|
|
|
}
|
2011-01-01 18:14:59 +00:00
|
|
|
}
|
2011-01-01 17:26:39 +00:00
|
|
|
|
2011-01-01 18:14:59 +00:00
|
|
|
static function deactivate() {
|
|
|
|
// Clear the require photo annototaion message when picasa faces is deactivated.
|
|
|
|
site_status::clear("picasa_faces_needs_photoannotation");
|
|
|
|
}
|
2011-01-01 17:26:39 +00:00
|
|
|
|
2011-01-01 18:14:59 +00:00
|
|
|
static function uninstall() {
|
|
|
|
// Delete the face mapping table before uninstalling.
|
|
|
|
$db = Database::instance();
|
|
|
|
$db->query("DROP TABLE IF EXISTS {picasa_faces};");
|
|
|
|
module::delete("picasa_faces");
|
|
|
|
}
|
2011-01-01 17:26:39 +00:00
|
|
|
}
|
2011-01-01 18:14:59 +00:00
|
|
|
|
|
|
|
?>
|