comanage-dev - [comanage-dev] r403 - in registry/trunk/app: Console/Command Controller Lib
Subject: COmanage Developers List
List archive
- From:
- To:
- Subject: [comanage-dev] r403 - in registry/trunk/app: Console/Command Controller Lib
- Date: Mon, 17 Dec 2012 20:47:51 -0500
Author: benno
Date: 2012-12-17 20:47:51 -0500 (Mon, 17 Dec 2012)
New Revision: 403
Modified:
registry/trunk/app/Console/Command/DatabaseShell.php
registry/trunk/app/Controller/AppController.php
registry/trunk/app/Controller/CoProvisioningTargetsController.php
registry/trunk/app/Lib/lang.php
Log:
PHP strict fixes for CO-354
Modified: registry/trunk/app/Console/Command/DatabaseShell.php
===================================================================
--- registry/trunk/app/Console/Command/DatabaseShell.php 2012-12-12
05:36:10 UTC (rev 402)
+++ registry/trunk/app/Console/Command/DatabaseShell.php 2012-12-18
01:47:51 UTC (rev 403)
@@ -51,8 +51,7 @@
$db->config['database'])) {
// Plugins can have their own schema files, so we need to account
for that
- $schemaSources = array_merge(array("."),
- AppController::availablePlugins('all',
'simple', false));
+ $schemaSources = array_merge(array("."),
AppController::availablePlugins());
foreach($schemaSources as $schemaSource) {
$schemaFile = APP . '/Config/Schema/schema.xml';
Modified: registry/trunk/app/Controller/AppController.php
===================================================================
--- registry/trunk/app/Controller/AppController.php 2012-12-12 05:36:10
UTC (rev 402)
+++ registry/trunk/app/Controller/AppController.php 2012-12-18 01:47:51
UTC (rev 403)
@@ -56,26 +56,36 @@
public $requires_person = false;
/**
- * Determine which plugins of a given type are available.
+ * Determine which plugins of a given type are available. This is a static
function suitable for use
+ * before AppController is instantiated.
+ *
+ * @param String Plugin type, or 'all' for all available plugins
+ * @since COmanage Registry v0.8
+ * @return Array Available plugins
+ */
+
+ public static function availablePlugins() {
+ // This function must be statically called by
lang.php::_bootstrap_plugin_txt(), which under some
+ // circumstances is called before AppController has been instantiated.
+
+ return App::objects('plugin');
+ }
+
+ /**
+ * Determine which plugins of a given type are available, and load them if
not already loaded.
* - postcondition: Primary Plugin Models are loaded (if requested)
*
* @param String Plugin type, or 'all' for all available plugins
* @param String Format to return in: 'list' for list format (suitable
for formhelper selects) or 'simple' for a simple list
- * @param Boolean Whether or not to load the models for the available
plugins (may only be false if $pluginType is 'all')
* @since COmanage Registry v0.8
* @return Array Available plugins
*/
- public function availablePlugins($pluginType, $format='list',
$loadModels=true) {
- // Note the logic in this function is set as is in order that this can
be called
- // from the database console command. Be sure to retest that command if
it changes.
-
+ public function loadAvailablePlugins($pluginType, $format='list') {
$ret = array();
foreach(App::objects('plugin') as $p) {
- if($pluginType != 'all' || $loadModels) {
- $this->loadModel($p . "." . $p);
- }
+ $this->loadModel($p . "." . $p);
if($pluginType == 'all'
|| (isset($this->$p->cmPluginType) && $this->$p->cmPluginType ==
$pluginType)) {
@@ -93,7 +103,7 @@
}
}
- return($ret);
+ return $ret;
}
/**
@@ -1356,7 +1366,7 @@
}
// Determine what menu contents plugins want available
- $plugins = $this->availablePlugins('all', 'simple');
+ $plugins = $this->loadAvailablePlugins('all', 'simple');
foreach($plugins as $plugin) {
if(isset($this->$plugin->cmPluginMenus)) {
Modified: registry/trunk/app/Controller/CoProvisioningTargetsController.php
===================================================================
--- registry/trunk/app/Controller/CoProvisioningTargetsController.php
2012-12-12 05:36:10 UTC (rev 402)
+++ registry/trunk/app/Controller/CoProvisioningTargetsController.php
2012-12-18 01:47:51 UTC (rev 403)
@@ -50,7 +50,7 @@
function beforeFilter() {
parent::beforeFilter();
- $plugins = $this->availablePlugins('provisioner');
+ $plugins = $this->loadAvailablePlugins('provisioner');
// Bind the models so Cake can magically pull associated data
Modified: registry/trunk/app/Lib/lang.php
===================================================================
--- registry/trunk/app/Lib/lang.php 2012-12-12 05:36:10 UTC (rev 402)
+++ registry/trunk/app/Lib/lang.php 2012-12-18 01:47:51 UTC (rev 403)
@@ -642,7 +642,7 @@
{
global $cm_lang, $cm_texts;
- $plugins = AppController::availablePlugins('all', 'simple', false);
+ $plugins = AppController::availablePlugins();
foreach($plugins as $plugin) {
$langfile = APP. '/Plugin/' . $plugin . '/Lib/lang.php';
- [comanage-dev] r403 - in registry/trunk/app: Console/Command Controller Lib, svnlog, 12/17/2012
Archive powered by MHonArc 2.6.16.