<p>That's a bug in our RedactorClips plugin, actually.  Just fixed it, so if you grab the latest from here (<a href="https://github.com/pixelandtonic/RedactorClips">https://github.com/pixelandtonic/RedactorClips</a>), <code>yiic</code> still should run fine.</p>

CC BY-SA 3.0
2016-09-01T22:22:03.677Z
why is this a bug? I see in the change log that you wrapped some code in the plugins init() method in `if (!craft()->isConsole()) { ... }` (https://github.com/pixelandtonic/RedactorClips/commit/8a28c357e4f9c8d5b5315cf27a7e26385d000bbf). Under what conditions should we plan to do the same in our own plugins?
Ben Parizek
CC BY-SA 3.0
2014-07-08T23:57:33.333Z
2014-07-08T23:57:33.333Z
Brad Bell
<p>I have logged into the server and attempted to create a migration for my plugin.  However I get this output:</p>

<pre><code>exception 'CException' with message 'CHttpRequest is unable to determine the request URI.'
</code></pre>

<p>The request is targeting "/craft/app/framework/web/CHttpRequest.php:519". </p>

<pre><code>Stack trace:
#0 /craft/app/framework/web/CHttpRequest.php(431): CHttpRequest-&gt;getRequestUri()
#1 /httpdocs/craft/app/services/HttpRequestService.php(816): CHttpRequest-&gt;getPathInfo()
#2 /httpdocs/craft/app/services/HttpRequestService.php(43): Craft\HttpRequestService-&gt;getNormalizedPath()
#3 /httpdocs/craft/app/framework/base/CModule.php(387): Craft\HttpRequestService-&gt;init()
#4 /httpdocs/craft/app/framework/base/CModule.php(103): CModule-&gt;getComponent('request')
#5 /httpdocs/craft/plugins/redactorclips/RedactorClipsPlugin.php(31): CModule-&gt;__get('request')
#6 /httpdocs/craft/app/services/PluginsService.php(136): Craft\RedactorClipsPlugin-&gt;init()
#7 /httpdocs/craft/app/etc/console/ConsoleApp.php(53): Craft\PluginsService-&gt;loadPlugins()
#8 /httpdocs/craft/app/framework/base/CApplication.php(165): Craft\ConsoleApp-&gt;init()
#9 /httpdocs/craft/app/framework/YiiBase.php(121): CApplication-&gt;__construct('/var/www/vhosts...')
#10 /httpdocs/craft/app/etc/console/yiic.php(76): YiiBase::createApplication('Craft\ConsoleAp...', '/var/www/vhosts...')
#11 /httpdocs/craft/app/etc/console/yiic(4): require_once('/var/www/vhosts...')
</code></pre>

CC BY-SA 3.0
2014-07-08T23:30:50.897Z
Do you get a full stack trace?  Can you share the entire yiic command you used to attempt to generate it?
Brad Bell
CC BY-SA 3.0
2014-07-08T23:33:17.493Z
I did get a full stack trace. Here is the command I used: " ./yiic migrate create Create_Relations Events".
a-am
CC BY-SA 3.0
2014-07-08T23:39:08.203Z
Can you share the stack trace in the original post (redacting out any sensitive info you don't want to share)?
Brad Bell
CC BY-SA 3.0
2014-07-08T23:54:15.977Z
It is shared with sensitive info redacted.
a-am
<plugin-development><migration>
Why would I get a "CHttpRequest is unable to determine the request URI" when creating a migration?
# Why would I get a "CHttpRequest is unable to determine the request URI" when creating a migration?

(Asked by: username_0 on 2014-07-08)

I have logged into the server and attempted to create a migration for my plugin.  However I get this output:
exception 'CException' with message 'CHttpRequest is unable to determine the request URI.'

The request is targeting "/craft/app/framework/web/CHttpRequest.php:519". 
Stack trace:
#0 /craft/app/framework/web/CHttpRequest.php(431): CHttpRequest->getRequestUri()
#1 /httpdocs/craft/app/services/HttpRequestService.php(816): CHttpRequest->getPathInfo()
#2 /httpdocs/craft/app/services/HttpRequestService.php(43): Craft\HttpRequestService->getNormalizedPath()
#3 /httpdocs/craft/app/framework/base/CModule.php(387): Craft\HttpRequestService->init()
#4 /httpdocs/craft/app/framework/base/CModule.php(103): CModule->getComponent('request')
#5 /httpdocs/craft/plugins/redactorclips/RedactorClipsPlugin.php(31): CModule->__get('request')
#6 /httpdocs/craft/app/services/PluginsService.php(136): Craft\RedactorClipsPlugin->init()
#7 /httpdocs/craft/app/etc/console/ConsoleApp.php(53): Craft\PluginsService->loadPlugins()
#8 /httpdocs/craft/app/framework/base/CApplication.php(165): Craft\ConsoleApp->init()
#9 /httpdocs/craft/app/framework/YiiBase.php(121): CApplication->__construct('/var/www/vhosts...')
#10 /httpdocs/craft/app/etc/console/yiic.php(76): YiiBase::createApplication('Craft\ConsoleAp...', '/var/www/vhosts...')
#11 /httpdocs/craft/app/etc/console/yiic(4): require_once('/var/www/vhosts...')

**Tags:** plugin-development, migration
> **Comments:**
> **username_1**: Do you get a full stack trace?  Can you share the entire yiic command you used to attempt to generate it?  
> **username_0**: I did get a full stack trace. Here is the command I used: " ./yiic migrate create Create_Relations Events".  
> **username_1**: Can you share the stack trace in the original post (redacting out any sensitive info you don't want to share)?  
> **username_0**: It is shared with sensitive info redacted.  

---

## 1 answers

### Answer by username_1 on 2014-07-08. Score: 5 | Accepted answer

That's a bug in our RedactorClips plugin, actually. Just fixed it, so if you grab the latest from here (<https://github.com/pixelandtonic/RedactorClips>), `yiic` still should run fine.

> **Comments:**
> **username_2**: why is this a bug? I see in the change log that you wrapped some code in the plugins init() method in `if (!craft()->isConsole()) { ... }` (https://github.com/pixelandtonic/RedactorClips/commit/8a28c357e4f9c8d5b5315cf27a7e26385d000bbf). Under what conditions should we plan to do the same in our own plugins?  

---

