[Solar-svn] Revision 3244
pmjones at solarphp.com
pmjones at solarphp.com
Sat Jul 26 10:32:28 CDT 2008
Solar_Uri_Action: [CHG] When using Apache mod_rewrite, you can now add `SetEnv SOLAR_URI_ACTION_PATH /` and the Solar_Uri_Action class will use that as its default 'path' config value. You can still override in Solar.config.php. This is a convenience for those swapping over from non-rewrite environments to rewrite-aware environments, especially in first-time setup.
Modified: trunk/Solar/Uri/Action.php
===================================================================
--- trunk/Solar/Uri/Action.php 2008-07-26 15:30:41 UTC (rev 3243)
+++ trunk/Solar/Uri/Action.php 2008-07-26 15:32:28 UTC (rev 3244)
@@ -30,12 +30,40 @@
* Keys are ...
*
* `path`
- * : (string) A path prefix specifically for actions, for example '/index.php/'.
+ * : (string) A path prefix specifically for actions. If Apache has used
+ * `SetEnv SOLAR_URI_ACTION_PATH /`, then that is the default value for
+ * this item; otherwise, the default value is "/index.php".
*
* @var array
*
*/
protected $_Solar_Uri_Action = array(
- 'path' => '/index.php/',
+ 'path' => '/index.php',
);
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param array $config User-provided configuration values.
+ *
+ */
+ public function __construct($config = null)
+ {
+ // get the request environment
+ $this->_request = Solar_Registry::get('request');
+
+ // in a standard solar system, when mod_rewrite is turned on, it
+ // may "SetEnv SOLAR_URI_ACTION_PATH /" as a hint for the default
+ // action path. this lets you go from no-rewriting to rewriting in
+ // one easy step, rather than having to remember to change the action
+ // path in the solar config file as well.
+ $this->_Solar_Uri_Action['path'] = $this->_request->server(
+ 'SOLAR_URI_ACTION_PATH',
+ '/index.php'
+ );
+
+ // now do the real construction
+ parent::__construct($config);
+ }
}
More information about the Solar-svn
mailing list