summaryrefslogtreecommitdiff
path: root/app/Model
diff options
context:
space:
mode:
authorMax Kamashev <kamashev@gollard.ru>2015-09-24 12:07:40 +0300
committerMax Kamashev <kamashev@gollard.ru>2015-09-24 12:07:40 +0300
commit3f5b636c998171837fc2265f760359b421d67b61 (patch)
treea505f4f1767efff50224b649e647a02ae3638e12 /app/Model
parent5b2e49d2945ce2c1daaf4dd78746a910eab9c9c8 (diff)
parent1b0b69a43f7528fd5188d4b48216c6fa7e32eac3 (diff)
Merge branch 'master' of https://github.com/ukko/kanboard into 1245_bug_with_subtask_timer
Diffstat (limited to 'app/Model')
-rw-r--r--app/Model/Action.php26
-rw-r--r--app/Model/File.php4
2 files changed, 29 insertions, 1 deletions
diff --git a/app/Model/Action.php b/app/Model/Action.php
index 87058cce..57bd5b0d 100644
--- a/app/Model/Action.php
+++ b/app/Model/Action.php
@@ -31,6 +31,28 @@ class Action extends Base
const TABLE_PARAMS = 'action_has_params';
/**
+ * Extended actions
+ *
+ * @access private
+ * @var array
+ */
+ private $actions = array();
+
+ /**
+ * Extend the list of default actions
+ *
+ * @access public
+ * @param string $className
+ * @param string $description
+ * @return Action
+ */
+ public function extendActions($className, $description)
+ {
+ $this->actions[$className] = $description;
+ return $this;
+ }
+
+ /**
* Return the name and description of available actions
*
* @access public
@@ -62,6 +84,8 @@ class Action extends Base
'TaskAssignColorLink' => t('Change task color when using a specific task link'),
);
+ $values = array_merge($values, $this->actions);
+
asort($values);
return $values;
@@ -296,7 +320,7 @@ class Action extends Base
*/
public function load($name, $project_id, $event)
{
- $className = '\Action\\'.$name;
+ $className = $name{0} !== '\\' ? '\Action\\'.$name : $name;
return new $className($this->container, $project_id, $event);
}
diff --git a/app/Model/File.php b/app/Model/File.php
index 7adab42b..1d44a415 100644
--- a/app/Model/File.php
+++ b/app/Model/File.php
@@ -54,6 +54,10 @@ class File extends Base
$file = $this->getbyId($file_id);
$this->objectStorage->remove($file['path']);
+ if ($file['is_image'] == 1) {
+ $this->objectStorage->remove($this->getThumbnailPath($file['path']));
+ }
+
return $this->db->table(self::TABLE)->eq('id', $file['id'])->remove();
}
catch (ObjectStorageException $e) {