Skip to content

Commit

Permalink
Remove some scary debug code.
Browse files Browse the repository at this point in the history
  • Loading branch information
bharat committed Jul 29, 2009
1 parent ead6a61 commit 7438a9c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
10 changes: 0 additions & 10 deletions modules/gallery/helpers/gallery_installer.php
Expand Up @@ -102,16 +102,6 @@ static function install() {
KEY `weight` (`weight` DESC))
ENGINE=InnoDB DEFAULT CHARSET=utf8;");

$db->query("DELIMITER |
CREATE TRIGGER setweight BEFORE INSERT ON {items}
FOR EACH ROW BEGIN
DECLARE new_weight int(9);
SELECT weight+1 FROM {items}
ORDER BY weight LIMIT 1 INTO new_weight;
SET NEW.weight = new_weight;
END;|
DELIMITER ;");

$db->query("CREATE TABLE {logs} (
`id` int(9) NOT NULL auto_increment,
`category` varchar(64) default NULL,
Expand Down
16 changes: 2 additions & 14 deletions modules/gallery/models/item.php
Expand Up @@ -350,21 +350,9 @@ public function save() {
if (!empty($this->changed) && $this->changed != array("view_count" => "view_count")) {
$this->updated = time();
if (!$this->loaded) {
try {
$this->created = $this->updated;
Kohana::log("error", "get Weight");
$weight = ORM::factory("item")
->select("weight")
->orderby("weight", "DESC")
->limit(1)
->find_all()
->current()->weight;
Kohana::log("error", "Weight: $weight");
$this->weight = $weight + 1;
} catch (Exception $e) {
Kohana::log("error", $e->__toString());
throw $e;
}
$r = ORM::factory("item")->select("MAX(weight) as max_weight")->find();
$this->weight = $r->max_weight + 1;
} else {
$send_event = 1;
}
Expand Down

0 comments on commit 7438a9c

Please sign in to comment.