Skip to content
Browse files

Re-Simplified Bootstrap. Also added Doctrine Free to URL helper, to t…

…ry and limit memory overhead.
  • Loading branch information...
1 parent b90f8e9 commit 49d939cd9851cfd5f60cd96d6f27617df2378756 @balupton balupton committed Nov 10, 2010
Showing with 62 additions and 8 deletions.
  1. +1 −1 Makefile
  2. +1 −2 lib/Bal/Bootstrap.php
  3. +60 −5 lib/Bal/Controller/Plugin/Url.php
View
2 Makefile
@@ -31,4 +31,4 @@ add:
git add .gitignore .htaccess * ;
deploy:
- git checkout v1.0; git merge dev; git checkout master; git merge v1.0; git checkout dev; git push --all; git push beanstalk --all; git push springloops --all;
+ git checkout v1.0; git merge dev; git checkout master; git merge v1.0; git checkout dev; git push --all;
View
3 lib/Bal/Bootstrap.php
@@ -595,7 +595,7 @@ protected function _initModules ( ) {
protected function _initScriptSetup ( ) {
# Bootstrap
$this->bootstrap('modules');
-
+
# Return true
return true;
}
@@ -608,7 +608,6 @@ protected function _initScriptCron ( ) {
# Bootstrap
$this->bootstrap('modules');
$this->bootstrap('DoctrineListeners');
- $this->bootstrap('presentation');
$this->bootstrap('frontController');
$FrontController = $this->getResource('frontController');
$FrontController->setRequest(new Zend_Controller_Request_Http());
View
65 lib/Bal/Controller/Plugin/Url.php
@@ -478,19 +478,30 @@ public function item ( $Item, $param = null, $error = true ) {
* @alias self::file
*/
public function content ( $input ) {
+ # Prepare
+ $clean = false;
if ( is_string($input) ) {
$Item = $this->getItem('Content',$input);
+ $clean = true;
}
else {
$Item = $input;
}
+
+ # Fetch
if ( !delve($Item,'id') ) {
throw new Bal_Exception(array(
'Could not resolve the Content Item',
'input' => $input
));
}
- return $this->map($Item);
+ $result = $this->map($Item);
+
+ # Clean
+ if ( $clean ) $Item->free(true);
+
+ # Return result
+ return $result;
}
/**
@@ -506,16 +517,27 @@ public function media ( $Item ) {
* @return this
*/
public function file ( $Item ) {
+ # Prepare
+ $clean = false;
if ( is_string($Item) && strstr($Item,'/') ) {
$url = $this->getFileUrl($Item);
}
else {
if ( is_string($Item) ) {
$Item = $this->getItem('File',$Item);
+ $clean = true;
}
$url = delve($Item,'url',false);
}
- return $this->hard($url);
+
+ # Fetch
+ $result = $this->hard($url);
+
+ # Clean
+ if ( $clean ) $Item->free(true);
+
+ # Return result
+ return $result;
}
/**
@@ -524,10 +546,21 @@ public function file ( $Item ) {
* @return this
*/
public function user ( $Item ) {
+ # Prepare
+ $clean = false;
if ( is_string($Item) ) {
$Item = $this->getItem('User',$Item);
+ $clean = true;
}
- return $this->route('default')->action('user')->item($Item);
+
+ # Fetch
+ $result = $this->route('default')->action('user')->item($Item);
+
+ # Clean
+ if ( $clean ) $Item->free(true);
+
+ # Return result
+ return $result;
}
/**
@@ -536,10 +569,21 @@ public function user ( $Item ) {
* @return this
*/
public function userActivate ( $Item ) {
+ # Prepare
+ $clean = false;
if ( is_string($Item) ) {
$Item = $this->getItem('User',$Item);
+ $clean = true;
}
- return $this->route('default')->action('user-activate')->item($Item)->param('uid',delve($Item,'uid'));
+
+ # Fetch
+ $result = $this->route('default')->action('user-activate')->item($Item)->param('uid',delve($Item,'uid'));
+
+ # Clean
+ if ( $clean ) $Item->free(true);
+
+ # Return result
+ return $result;
}
/**
@@ -548,10 +592,21 @@ public function userActivate ( $Item ) {
* @return this
*/
public function message ( $Item ) {
+ # Prepare
+ $clean = false;
if ( is_string($Item) ) {
$Item = $this->getItem('Message',$Item);
+ $clean = true;
}
- return $this->route('default')->action('message')->item($Item);
+
+ # Fetch
+ $result = $this->route('default')->action('message')->item($Item);
+
+ # Clean
+ if ( $clean ) $Item->free(true);
+
+ # Return result
+ return $result;
}
# ========================

0 comments on commit 49d939c

Please sign in to comment.
Something went wrong with that request. Please try again.