Skip to content

Commit

Permalink
upgrader
Browse files Browse the repository at this point in the history
  • Loading branch information
KellyLSB committed Apr 19, 2012
1 parent 31db48a commit 8592090
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions _bundle.php
Expand Up @@ -89,4 +89,32 @@ public function __callExtend($func, $args) {
throw new callException;
}

public function route() {
$tables = e::$sql->query("SHOW TABLES LIKE '\$tags%'")->all();
foreach($tables as &$table)
$table = array_shift($table);

foreach($tables as $table) {
$tags = e::$sql->query("SELECT * FROM `$table`")->all();
foreach($tags as $tag) {

if($tag['model'] !== 'taxonomy.tag')
continue;

$owner = $tag['owner'];
$id = $tag['model-id'];
$tag = $this->getTag($id);

e::$sql->update($table, array(
'string' => $tag->category.':'.$tag->name
), "WHERE `owner` = '$owner'");

$tag->__destruct();
unset($tag);
}
}
echo "Upgrade completed";
e\Complete();
}

}
2 changes: 1 addition & 1 deletion extend/sql/library/extensions/taxonomy.php
Expand Up @@ -98,7 +98,7 @@ public function modelAddTag(Model $model, $map = false, $priority = 0) {
if(isset($realtag))
$insert['string'] = $map->category.':'.$map->name;

if(!$q) e::$sql->insert($tagTable, );
if(!$q) e::$sql->insert($tagTable, $insert);

return true;
}
Expand Down

0 comments on commit 8592090

Please sign in to comment.