- if (!empty($opts['master']) && !file_exists($opts['master'])) {
- $this->jerr("master file does not exist : " . $opts['master']);
- }
-
-
- if (empty($cm)) {
- $cm = DB_dataObject::factory('core_email');
- $ret = $cm->get('name',$template_name);
- if($ret && empty($opts['update'])) {
- $this->jerr("use --update to update the template..");
+ if (empty($opts['raw_content'])) {
+ $template_name = preg_replace('/\.[a-z]+$/i', '', basename($opts['file']));
+
+ if (!file_exists($opts['file'])) {
+ $this->jerr("file does not exist : " . $opts['file']);
+ }
+
+
+ if (!empty($opts['master']) && !file_exists($opts['master'])) {
+ $this->jerr("master file does not exist : " . $opts['master']);
+ }
+
+
+ if (empty($cm)) {
+ $cm = DB_dataObject::factory('core_email');
+ $ret = $cm->get('name',$template_name);
+ if($ret && empty($opts['update'])) {
+ $this->jerr("use --update to update the template..");
+ }