diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-12-26 11:24:50 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-12-26 11:24:50 -0800 |
commit | 3060a6f662da66008d57a461bf1c9b5b4aa2b002 (patch) | |
tree | 442fd290505817efc0324f2af6e01805cb7396aa /modules/g2_import/helpers | |
parent | 1cd6a615bb47a33794e4a4f690c87a348ab752d7 (diff) | |
parent | 32d25dafd5b033338b6a9bb8c7c53edab462543a (diff) |
Merge branch 'master' into talmdal_dev
Conflicts:
modules/gallery/controllers/albums.php
modules/gallery/controllers/movies.php
modules/gallery/controllers/photos.php
Diffstat (limited to 'modules/g2_import/helpers')
-rw-r--r-- | modules/g2_import/helpers/g2_import.php | 23 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import_event.php | 5 | ||||
-rw-r--r-- | modules/g2_import/helpers/g2_import_task.php | 4 |
3 files changed, 16 insertions, 16 deletions
diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 202a0e92..a7a69746 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -458,7 +458,7 @@ class g2_import_Core { switch ($g2_type) { case "GalleryPhotoItem": if (!in_array($g2_item->getMimeType(), array("image/jpeg", "image/gif", "image/png"))) { - Kohana::log("alert", "$g2_path is an unsupported image type; using a placeholder gif"); + Kohana_Log::add("alert", "$g2_path is an unsupported image type; using a placeholder gif"); $message[] = t("'%path' is an unsupported image type, using a placeholder", array("path" => $g2_path)); $g2_path = MODPATH . "g2_import/data/broken-image.gif"; @@ -473,7 +473,7 @@ class g2_import_Core { self::_decode_html_special_chars(self::extract_description($g2_item)), self::map($g2_item->getOwnerId())); } catch (Exception $e) { - Kohana::log( + Kohana_Log::add( "alert", "Corrupt image $g2_path\n" . $e->__toString()); $message[] = t("Corrupt image '%path'", array("path" => $g2_path)); $message[] = $e->__toString(); @@ -493,13 +493,13 @@ class g2_import_Core { self::_decode_html_special_chars(self::extract_description($g2_item)), self::map($g2_item->getOwnerId())); } catch (Exception $e) { - Kohana::log("alert", "Corrupt movie $g2_path\n" . $e->__toString()); + Kohana_Log::add("alert", "Corrupt movie $g2_path\n" . $e->__toString()); $message[] = t("Corrupt movie '%path'", array("path" => $g2_path)); $message[] = $e->__toString(); $corrupt = 1; } } else { - Kohana::log("alert", "$g2_path is an unsupported movie type"); + Kohana_Log::add("alert", "$g2_path is an unsupported movie type"); $message[] = t("'%path' is an unsupported movie type", array("path" => $g2_path)); $corrupt = 1; } @@ -611,11 +611,9 @@ class g2_import_Core { array("id" => $g2_item_id, "exception" => $e->__toString())); } - $tags = ""; // Multiword tags have the space changed to dots.s foreach ($tag_names as $tag_name) { - $tags .= (strlen($tags) ? ", " : "") . - tag::add($g3_item, $tag_name); + tag::add($g3_item, $tag_name); } // Tag operations are idempotent so we don't need to map them. Which is good because we don't @@ -634,11 +632,10 @@ class g2_import_Core { $delim = " "; } - $tags = ""; foreach (preg_split("/$delim/", $keywords) as $keyword) { $keyword = trim($keyword); if ($keyword) { - $tags .= (strlen($tags) ? ", " : "") . tag::add($item, $keyword); + tag::add($item, $keyword); } } } @@ -867,8 +864,8 @@ class g2_import_Core { */ static function map($g2_id) { if (!array_key_exists($g2_id, self::$map)) { - $g2_map = ORM::factory("g2_map")->where("g2_id", $g2_id)->find(); - self::$map[$g2_id] = $g2_map->loaded ? $g2_map->g3_id : null; + $g2_map = ORM::factory("g2_map")->where("g2_id", "=", $g2_id)->find(); + self::$map[$g2_id] = $g2_map->loaded() ? $g2_map->g3_id : null; } return self::$map[$g2_id]; @@ -887,7 +884,7 @@ class g2_import_Core { static function log($msg) { message::warning($msg); - Kohana::log("alert", $msg); + Kohana_Log::add("alert", $msg); } } @@ -906,7 +903,7 @@ function g2() { $args = func_get_arg(0); $ret = array_shift($args); if ($ret) { - Kohana::log("error", "Gallery 2 call failed with: " . $ret->getAsText()); + Kohana_Log::add("error", "Gallery 2 call failed with: " . $ret->getAsText()); throw new Exception("@todo G2_FUNCTION_FAILED"); } if (count($args) == 1) { diff --git a/modules/g2_import/helpers/g2_import_event.php b/modules/g2_import/helpers/g2_import_event.php index 609e1a45..02a2126d 100644 --- a/modules/g2_import/helpers/g2_import_event.php +++ b/modules/g2_import/helpers/g2_import_event.php @@ -19,7 +19,10 @@ */ class g2_import_event_Core { static function item_deleted($item) { - Database::instance()->delete("g2_maps", array("g3_id" => $item->id)); + db::build() + ->delete("g2_maps") + ->where("g3_id", "=", $item->id) + ->execute(); } static function item_created($item) { diff --git a/modules/g2_import/helpers/g2_import_task.php b/modules/g2_import/helpers/g2_import_task.php index 47a205bd..e80b88b9 100644 --- a/modules/g2_import/helpers/g2_import_task.php +++ b/modules/g2_import/helpers/g2_import_task.php @@ -65,8 +65,8 @@ class g2_import_task_Core { $task->set("done", $done); $root_g2_id = g2(GalleryCoreApi::getDefaultAlbumId()); - $root = ORM::factory("g2_map")->where("g2_id", $root_g2_id)->find(); - if (!$root->loaded) { + $root = ORM::factory("g2_map")->where("g2_id", "=", $root_g2_id)->find(); + if (!$root->loaded()) { $root->g2_id = $root_g2_id; $root->g3_id = 1; $root->save(); |