From 9cd8a79ad941930440e0d3244267eb99499409bb Mon Sep 17 00:00:00 2001 From: gwoo Date: Thu, 5 Jul 2007 08:50:56 +0000 Subject: [PATCH] adding support for passing model name to model task, updated isMobile check in requestHandler git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5377 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/console/libs/tasks/model.php | 9 +++++++++ cake/libs/controller/components/request_handler.php | 6 +++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cake/console/libs/tasks/model.php b/cake/console/libs/tasks/model.php index 8ee861277..6af58fbcc 100644 --- a/cake/console/libs/tasks/model.php +++ b/cake/console/libs/tasks/model.php @@ -43,6 +43,15 @@ class ModelTask extends Shell { if (empty($this->args)) { $this->__interactive(); } + + if(!empty($this->args[0])) { + $model = $this->args[0]; + if ($this->__bake($model)) { + if ($this->_checkUnitTest()) { + $this->__bakeTest($model); + } + } + } } /** * Handles interactive baking diff --git a/cake/libs/controller/components/request_handler.php b/cake/libs/controller/components/request_handler.php index c66d4aa37..ea133e561 100644 --- a/cake/libs/controller/components/request_handler.php +++ b/cake/libs/controller/components/request_handler.php @@ -256,7 +256,11 @@ class RequestHandlerComponent extends Object { * @return bool True if user agent is a mobile web browser */ function isMobile() { - return (preg_match('/' . REQUEST_MOBILE_UA . '/i', env('HTTP_USER_AGENT')) > 0 || $this->accepts('wap')); + preg_match('/' . REQUEST_MOBILE_UA . '/i', env('HTTP_USER_AGENT'), $match); + if(!empty($match) || $this->accepts('wap')) { + return true; + } + return false; } /** * Returns true if the client accepts WAP content