From 2eea7b874aa06f08ed58a85197473233b54693aa Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 23 Feb 2010 21:08:52 -0800 Subject: Specify the type for movie Item_Models correctly. Fixes ticket #1033. --- modules/g2_import/helpers/g2_import.php | 1 + 1 file changed, 1 insertion(+) (limited to 'modules/g2_import/helpers') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 9a91770a..95ec282d 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -530,6 +530,7 @@ class g2_import_Core { if (in_array($g2_item->getMimeType(), array("video/mp4", "video/x-flv"))) { try { $item = ORM::factory("item"); + $item->type = "movie"; $item->parent_id = $parent->id; $item->set_data_file($g2_path); $item->name = $g2_item->getPathComponent(); -- cgit v1.2.3 From 7f175ea87e9567817d34729dec83f7f36509b894 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 30 Mar 2010 13:18:05 -0700 Subject: Move G2_Import_Exception into libraries because it's not a helper class. --- modules/g2_import/helpers/g2_import.php | 22 +----------- .../g2_import/libraries/G2_Import_Exception.php | 39 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 21 deletions(-) create mode 100644 modules/g2_import/libraries/G2_Import_Exception.php (limited to 'modules/g2_import/helpers') diff --git a/modules/g2_import/helpers/g2_import.php b/modules/g2_import/helpers/g2_import.php index 456c13c4..575d02bb 100644 --- a/modules/g2_import/helpers/g2_import.php +++ b/modules/g2_import/helpers/g2_import.php @@ -265,7 +265,7 @@ class g2_import_Core { $e); } } - + break; case GROUP_ALL_USERS: @@ -1203,23 +1203,3 @@ function g2() { return $args; } } - -/** - * A wrapper for exceptions to report more details in case - * it's a ORM validation exception. - */ -class G2_Import_Exception extends Exception { - public function __construct($message, Exception $previous=null, $additional_messages=null) { - if ($additional_messages) { - $message .= "\n" . implode("\n", $additional_messages); - } - if ($previous && $previous instanceof ORM_Validation_Exception) { - $message .= "\nORM validation errors: " . print_r($previous->validation->errors(), true); - } - if ($previous) { - $message .= "\n" . (string) $previous; - } - // The $previous parameter is supported in PHP 5.3.0+. - parent::__construct($message); - } -} \ No newline at end of file diff --git a/modules/g2_import/libraries/G2_Import_Exception.php b/modules/g2_import/libraries/G2_Import_Exception.php new file mode 100644 index 00000000..591f51cd --- /dev/null +++ b/modules/g2_import/libraries/G2_Import_Exception.php @@ -0,0 +1,39 @@ +validation->errors(), true); + } + if ($previous) { + $message .= "\n" . (string) $previous; + } + // The $previous parameter is supported in PHP 5.3.0+. + parent::__construct($message); + } +} \ No newline at end of file -- cgit v1.2.3