Permalink
Browse files

Update to ensure $config->urls->admin is available at module init() t…

…ime. Thanks to @somartist for finding the issue. Note that this update includes a modification to /index.php, which you should replace with the new one -- though no immediate concerns if you don't get to it (just a little unnecessary overhead).
  • Loading branch information...
ryancramerdesign committed Jul 22, 2012
1 parent cca3736 commit 43916ab56eed73e9badcb62ac225f2ddbc285fc3
Showing with 8 additions and 8 deletions.
  1. +0 −6 index.php
  2. +8 −2 wire/core/ProcessWire.php
View
@@ -182,12 +182,6 @@ function ProcessWireBootConfig() {
*/
$wire = new ProcessWire($config);
- /*
- * Store the admin URL in the configuration
- *
- */
- if($config->adminRootPageID) $config->urls->admin = $wire->pages->get($config->adminRootPageID)->url;
-
/*
* If we're not being called from another shell script or PHP page, then run the PageView process
*
View
@@ -89,7 +89,8 @@ public function load(Config $config) {
Wire::setFuel('sanitizer', new Sanitizer());
try {
- Wire::setFuel('db', new Database($config));
+ $db = new Database($config);
+ Wire::setFuel('db', $db);
} catch(WireDatabaseException $e) {
// catch and re-throw to prevent DB connect info from ever appearing in debug backtrace
throw new WireDatabaseException($e->getMessage());
@@ -112,7 +113,9 @@ public function load(Config $config) {
Wire::setFuel('fields', $fields);
Wire::setFuel('fieldgroups', $fieldgroups);
Wire::setFuel('templates', $templates);
- Wire::setFuel('pages', new Pages(), true);
+
+ $pages = new Pages();
+ Wire::setFuel('pages', $pages, true);
$fieldtypes->init();
$fields->init();
@@ -137,6 +140,9 @@ public function load(Config $config) {
Wire::setFuel('user', $users->getCurrentUser());
Wire::setFuel('input', new WireInput());
+ // populate admin URL before modules init()
+ $config->urls->admin = $config->urls->root . ltrim($pages->_path($config->adminRootPageID), '/');
+
$modules->triggerInit();
}

0 comments on commit 43916ab

Please sign in to comment.