[Agavi-Commits] r4915 - in branches/david-auth: . src/config/defaults src/controller src/exception src/filter src/request

3 views
Skip to first unread message

com...@lists.agavi.org

unread,
Dec 26, 2011, 3:55:12 PM12/26/11
to com...@lists.agavi.org
Author: david
Date: 2011-12-26 21:55:09 +0100 (Mon, 26 Dec 2011)
New Revision: 4915

Added:
branches/david-auth/src/exception/AgaviClassNotFoundException.class.php
branches/david-auth/src/exception/AgaviFileNotFoundException.class.php
Modified:
branches/david-auth/
branches/david-auth/CHANGELOG
branches/david-auth/CHANGELOG-1.0
branches/david-auth/RELEASE_NOTES-1.0
branches/david-auth/src/config/defaults/autoload.xml
branches/david-auth/src/controller/AgaviController.class.php
branches/david-auth/src/controller/AgaviExecutionContainer.class.php
branches/david-auth/src/filter/AgaviExecutionFilter.class.php
branches/david-auth/src/request/AgaviConsoleRequest.class.php
Log:
sync from trunk


Property changes on: branches/david-auth
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/1.0:2658-4898
/branches/config-1.1:4687-4733
/branches/david-azure:4475-4478
/branches/david-numbers:4397-4455
/trunk:4643-4900
+ /branches/1.0:2658-4906
/branches/config-1.1:4687-4733
/branches/david-azure:4475-4478
/branches/david-httpcaching:4759-4912
/branches/david-numbers:4397-4455
/trunk:4643-4914

Modified: branches/david-auth/CHANGELOG
===================================================================
--- branches/david-auth/CHANGELOG 2011-12-26 18:19:50 UTC (rev 4914)
+++ branches/david-auth/CHANGELOG 2011-12-26 20:55:09 UTC (rev 4915)
@@ -22,6 +22,7 @@
ADD: Add support for custom filesystem layouts for modules to the project configuration system (#874) (Noah)
ADD: Response attributes (#1062) (David, TANAKA Koichi)

+CHG: Refactor instantiation of Actions and Views (#1398) (David)
CHG: Remove unlinking of temporary files in AgaviUploadedFile destructor (#1452) (David)
CHG: Overhaul default values in AgaviUploadedFile constructor (#1451) (David)
CHG: Move cleanup and wrapping of uploaded files from AgaviWebRequestDataHolder to AgaviWebRequest (#1450) (David)

Modified: branches/david-auth/CHANGELOG-1.0
===================================================================
--- branches/david-auth/CHANGELOG-1.0 2011-12-26 18:19:50 UTC (rev 4914)
+++ branches/david-auth/CHANGELOG-1.0 2011-12-26 20:55:09 UTC (rev 4915)
@@ -1,6 +1,14 @@
AGAVI CHANGELOG (1.0.x)
=======================

+1.0.7 (December 22, 2011)
+-------------------------
+
+ADD: Configurable context for AgaviFlowTestCase (#1465) (David)
+
+CHG: Redesign welcome page (#1464) (David)
+
+
1.0.7 RC2 (December 14, 2011)
-----------------------------

Modified: branches/david-auth/RELEASE_NOTES-1.0
===================================================================
--- branches/david-auth/RELEASE_NOTES-1.0 2011-12-26 18:19:50 UTC (rev 4914)
+++ branches/david-auth/RELEASE_NOTES-1.0 2011-12-26 20:55:09 UTC (rev 4915)
@@ -1,6 +1,24 @@
AGAVI RELEASE NOTES (1.0.x)
===========================

+Version 1.0.7 - December 22, 2011
+=================================
+
+The getCredentials() method on an Action is no longer called unconditionally (i.e. whether or not the isSecure() method returned false) but only if the Action is "secure".
+
+It is now possible to manually call shutdown() on any database adapter to close the underlying connection; another call to getConnection() will cause a reconnect.
+
+AgaviFormPopulationFilter will now populate multiple forms in the order specified in the "populate" request attribute (when populating via an array with form IDs as keys and parameter holders as values) in namespace "org.agavi.filter.FormPopulationFilter"); however, if the value for a key in the "populate" array is boolean true (to re-populate from request data), this form will always be handled first, so error messages are inserted on that form first.
+
+Testing is now compatible with both PHPUnit 3.5 and 3.6. If you want to specify code coverage filters, AgaviTesting::getCodeCoverageFilter() returns the correct instance (singleton or not depending on the PHPUnit version) for you to use. A base constraint class named "AgaviBaseConstraintBecausePhpunitSucksAtBackwardsCompatibility" can be used for constraints that work with both PHPUnit 3.5 and 3.6; if you implement the new matches() method introduced in PHPUnit 3.6 instead of the old evaluate(), it will automatically be called in the proper fashion depending on the PHPUnit version.
+
+AgaviTesting::dispatch() can now call exit() with the appropriate shell status code (the same as returned by a vanilla PHPUnit run) to indicate success or failures/errors to the calling process. This behavior is triggered when the new optional second argument, defaulting to false, is set to true. If set to false, it returns the PHPUnit result object that may be used by custom code to perform further analysis of the test run.
+
+Several other minor changes and fixes are included in this release as well; most notably, AgaviBooleanValidator's casting and exporting logic has been repaired, and AgaviConsoleRequest now properly creates an AgaviUploadedFile object with STDIN contents (when configured to read those) instead of a plain array. The PHPTAL renderer now supports configuration of character encoding via parameter "encoding".
+
+The timezone database was updated to version 2011n.
+
+
Version 1.0.6 - July 23, 2011
=============================

Modified: branches/david-auth/src/config/defaults/autoload.xml
===================================================================
--- branches/david-auth/src/config/defaults/autoload.xml 2011-12-26 18:19:50 UTC (rev 4914)
+++ branches/david-auth/src/config/defaults/autoload.xml 2011-12-26 20:55:09 UTC (rev 4915)
@@ -92,12 +92,14 @@
<!-- agavi/exception -->
<autoload class="AgaviAutoloadException">%core.agavi_dir%/exception/AgaviAutoloadException.class.php</autoload>
<autoload class="AgaviCacheException">%core.agavi_dir%/exception/AgaviCacheException.class.php</autoload>
+ <autoload class="AgaviClassNotFoundException">%core.agavi_dir%/exception/AgaviClassNotFoundException.class.php</autoload>
<autoload class="AgaviConfigurationException">%core.agavi_dir%/exception/AgaviConfigurationException.class.php</autoload>
<autoload class="AgaviControllerException">%core.agavi_dir%/exception/AgaviControllerException.class.php</autoload>
<autoload class="AgaviDatabaseException">%core.agavi_dir%/exception/AgaviDatabaseException.class.php</autoload>
<autoload class="AgaviException">%core.agavi_dir%/exception/AgaviException.class.php</autoload>
<autoload class="AgaviFactoryException">%core.agavi_dir%/exception/AgaviFactoryException.class.php</autoload>
<autoload class="AgaviFileException">%core.agavi_dir%/exception/AgaviFileException.class.php</autoload>
+ <autoload class="AgaviFileNotFoundException">%core.agavi_dir%/exception/AgaviFileNotFoundException.class.php</autoload>
<autoload class="AgaviFilterException">%core.agavi_dir%/exception/AgaviFilterException.class.php</autoload>
<autoload class="AgaviInitializationException">%core.agavi_dir%/exception/AgaviInitializationException.class.php</autoload>
<autoload class="AgaviDisabledModuleException">%core.agavi_dir%/exception/AgaviDisabledModuleException.class.php</autoload>

Modified: branches/david-auth/src/controller/AgaviController.class.php
===================================================================
--- branches/david-auth/src/controller/AgaviController.class.php 2011-12-26 18:19:50 UTC (rev 4914)
+++ branches/david-auth/src/controller/AgaviController.class.php 2011-12-26 20:55:09 UTC (rev 4915)
@@ -358,11 +358,11 @@
if(false !== ($file = $this->checkActionFile($moduleName, $actionName))) {
require($file);
} else {
- throw new AgaviException('Could not find file for Action "' . $actionName . '" in module "' . $moduleName . '"');
+ throw new AgaviFileNotFoundException(sprintf('Could not find file for Action "%s" in Module "%s".', $actionName, $moduleName));
}

if(!class_exists($class, false)) {
- throw new AgaviException('Could not find Action "' . $longActionName . '" for module "' . $moduleName . '"');
+ throw new AgaviClassNotFoundException(sprintf('Failed to instantiate Action "%s" in Module "%s" because file "%s" does not contain class "%s".', $actionName, $moduleName, $file, $class));
}
}

@@ -454,11 +454,11 @@
if(false !== ($file = $this->checkViewFile($moduleName, $viewName))) {
require($file);
} else {
- throw new AgaviException('Could not find file for View "' . $viewName . '" in module "' . $moduleName . '"');
+ throw new AgaviFileNotFoundException(sprintf('Could not find file for View "%s" in Module "%s".', $viewName, $moduleName));
}

if(!class_exists($class, false)) {
- throw new AgaviException('Could not find View "' . $longViewName . '" for module "' . $moduleName . '"');
+ throw new AgaviClassNotFoundException(sprintf('Failed to instantiate View "%s" in Module "%s" because file "%s" does not contain class "%s".', $viewName, $moduleName, $file, $class));
}
}

Modified: branches/david-auth/src/controller/AgaviExecutionContainer.class.php
===================================================================
--- branches/david-auth/src/controller/AgaviExecutionContainer.class.php 2011-12-26 18:19:50 UTC (rev 4914)
+++ branches/david-auth/src/controller/AgaviExecutionContainer.class.php 2011-12-26 20:55:09 UTC (rev 4915)
@@ -257,31 +257,23 @@
$controller->countExecution();

$moduleName = $this->getModuleName();
- $actionName = $this->getActionName();
-
+
try {
- // TODO: cleanup and merge with createActionInstance once Exceptions have been cleaned up and specced properly so that the two error conditions can be told apart
- if(false === $controller->checkActionFile($moduleName, $actionName)) {
- $this->setNext($this->createSystemActionForwardContainer('error_404'));
- return $this->proceed();
- }
-
- $this->actionInstance = $controller->createActionInstance($moduleName, $actionName);
+ $actionInstance = $this->getActionInstance();
} catch(AgaviDisabledModuleException $e) {
$this->setNext($this->createSystemActionForwardContainer('module_disabled'));
return $this->proceed();
- }
+ } catch(AgaviFileNotFoundException $e) {
+ $this->setNext($this->createSystemActionForwardContainer('error_404'));
+ return $this->proceed();
+ } // do not catch AgaviClassNotFoundException, we want that to bubble up since it means the class in the action file is named incorrectly

-
- // initialize the action
- $this->actionInstance->initialize($this);
-
// copy and merge request data as required
$this->initRequestData();

$filterChain = $this->getFilterChain();

- if(!$this->actionInstance->isSimple()) {
+ if(!$actionInstance->isSimple()) {
// simple actions have no filters

if(AgaviConfig::get('core.available', false)) {
@@ -317,7 +309,7 @@
*/
protected function initRequestData()
{
- if($this->actionInstance->isSimple()) {
+ if($this->getActionInstance()->isSimple()) {
if($this->arguments !== null) {
// clone it so mutating it has no effect on the "outside world"
$this->requestData = clone $this->arguments;
@@ -775,6 +767,18 @@
*/
public function getActionInstance()
{
+ if($this->actionInstance === null) {
+ $controller = $this->context->getController();
+
+ $moduleName = $this->getModuleName();
+ $actionName = $this->getActionName();
+
+ $this->actionInstance = $controller->createActionInstance($moduleName, $actionName);
+
+ // initialize the action
+ $this->actionInstance->initialize($this);
+ }
+
return $this->actionInstance;
}

@@ -788,6 +792,13 @@
*/
public function getViewInstance()
{
+ if($this->viewInstance === null) {
+ // get the view instance
+ $this->viewInstance = $this->getContext()->getController()->createViewInstance($this->getViewModuleName(), $this->getViewName());
+ // initialize the view
+ $this->viewInstance->initialize($this);
+ }
+
return $this->viewInstance;
}

Copied: branches/david-auth/src/exception/AgaviClassNotFoundException.class.php (from rev 4914, trunk/src/exception/AgaviClassNotFoundException.class.php)
===================================================================
--- branches/david-auth/src/exception/AgaviClassNotFoundException.class.php (rev 0)
+++ branches/david-auth/src/exception/AgaviClassNotFoundException.class.php 2011-12-26 20:55:09 UTC (rev 4915)
@@ -0,0 +1,34 @@
+<?php
+
+// +---------------------------------------------------------------------------+
+// | This file is part of the Agavi package. |
+// | Copyright (c) 2005-2011 the Agavi Project. |
+// | |
+// | For the full copyright and license information, please view the LICENSE |
+// | file that was distributed with this source code. You can also view the |
+// | LICENSE file online at http://www.agavi.org/LICENSE.txt |
+// | vi: set noexpandtab: |
+// | Local Variables: |
+// | indent-tabs-mode: t |
+// | End: |
+// +---------------------------------------------------------------------------+
+
+/**
+ * AgaviClassNotFoundException is thrown when a class could not be found.
+ *
+ * @package agavi
+ * @subpackage exception
+ *
+ * @author David Zülke <david....@bitextender.com>
+ * @copyright Authors
+ * @copyright The Agavi Project
+ *
+ * @since 1.1.0
+ *
+ * @version $Id$
+ */
+class AgaviClassNotFoundException extends AgaviException
+{
+}
+
+?>

Copied: branches/david-auth/src/exception/AgaviFileNotFoundException.class.php (from rev 4914, trunk/src/exception/AgaviFileNotFoundException.class.php)
===================================================================
--- branches/david-auth/src/exception/AgaviFileNotFoundException.class.php (rev 0)
+++ branches/david-auth/src/exception/AgaviFileNotFoundException.class.php 2011-12-26 20:55:09 UTC (rev 4915)
@@ -0,0 +1,34 @@
+<?php
+
+// +---------------------------------------------------------------------------+
+// | This file is part of the Agavi package. |
+// | Copyright (c) 2005-2011 the Agavi Project. |
+// | |
+// | For the full copyright and license information, please view the LICENSE |
+// | file that was distributed with this source code. You can also view the |
+// | LICENSE file online at http://www.agavi.org/LICENSE.txt |
+// | vi: set noexpandtab: |
+// | Local Variables: |
+// | indent-tabs-mode: t |
+// | End: |
+// +---------------------------------------------------------------------------+
+
+/**
+ * AgaviFileNotFoundException is thrown when a file could not be found.
+ *
+ * @package agavi
+ * @subpackage exception
+ *
+ * @author David Zülke <david....@bitextender.com>
+ * @copyright Authors
+ * @copyright The Agavi Project
+ *
+ * @since 1.1.0
+ *
+ * @version $Id$
+ */
+class AgaviFileNotFoundException extends AgaviException
+{
+}
+
+?>

Modified: branches/david-auth/src/filter/AgaviExecutionFilter.class.php
===================================================================
--- branches/david-auth/src/filter/AgaviExecutionFilter.class.php 2011-12-26 18:19:50 UTC (rev 4914)
+++ branches/david-auth/src/filter/AgaviExecutionFilter.class.php 2011-12-26 20:55:09 UTC (rev 4915)
@@ -461,10 +461,7 @@

$key = $request->toggleLock();
try {
- // get the view instance
- $viewInstance = $controller->createViewInstance($actionCache['view_module'], $actionCache['view_name']);
- // initialize the view
- $viewInstance->initialize($container);
+ $viewInstance = $container->getViewInstance();
} catch(Exception $e) {
// we caught an exception... unlock the request and rethrow!
$request->toggleLock($key);
@@ -472,9 +469,6 @@
}
$request->toggleLock($key);

- // Set the View Instance in the container
- $container->setViewInstance($viewInstance);
-
$outputType = $container->getOutputType()->getName();

if($isCacheable) {

Modified: branches/david-auth/src/request/AgaviConsoleRequest.class.php
===================================================================
--- branches/david-auth/src/request/AgaviConsoleRequest.class.php 2011-12-26 18:19:50 UTC (rev 4914)
+++ branches/david-auth/src/request/AgaviConsoleRequest.class.php 2011-12-26 20:55:09 UTC (rev 4915)
@@ -82,7 +82,7 @@
}

$files = array();
- if($this->getParameter('read_stdin', true) && ($stdinMeta = stream_get_meta_data(STDIN)) && !$stdinMeta['seekable']) {
+ if($this->getParameter('read_stdin', true) && defined('STDIN') && ($stdinMeta = stream_get_meta_data(STDIN)) && !$stdinMeta['seekable']) {
// if stream_get_meta_data() reports STDIN as not seekable, that means something was piped into our process, and we should put that into a file
// the alternative method to determine this is via posix_isatty(STDIN) which returns false in the same situation, but that requires the posix extension and also doesn't work on Windows
$stdinName = $this->getParameter('stdin_file_name', 'stdin_file');


_______________________________________________
Agavi Commits Mailing List
com...@lists.agavi.org
http://lists.agavi.org/mailman/listinfo/commits

Reply all
Reply to author
Forward
0 new messages