Permalink
Browse files

Use CUSTOM_PATH and LIBRARY_ROOT_PATH properly

  • Loading branch information...
1 parent e184e28 commit 4dfc09ebdfd185b414fa355910cc954e0e95db44 @dshafik dshafik committed Apr 20, 2012
View
2 src/frapi/admin/application/Bootstrap.php
@@ -45,7 +45,7 @@ protected function _initConfig()
{
Zend_Registry::set('config', new Zend_Config($this->getOptions()));
- $localConfigPath = ROOT_PATH . DIRECTORY_SEPARATOR . 'custom' .
+ $localConfigPath = CUSTOM_PATH .
DIRECTORY_SEPARATOR . 'Config' . DIRECTORY_SEPARATOR;
Zend_Registry::set('localConfigPath', $localConfigPath);
View
2 src/frapi/admin/application/modules/console/controllers/ActionController.php
@@ -193,7 +193,7 @@ public function syncAction()
{
$this->_helper->viewRenderer->setViewSuffix('txt');
- $dir = ROOT_PATH . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR . 'Action';
+ $dir = CUSTOM_PATH . DIRECTORY_SEPARATOR . 'Action';
if (!is_writable($dir)) {
$this->view->message = $this->tr->_('ACTION_WRITE_ERROR', $dir) . PHP_EOL;
View
6 src/frapi/admin/application/modules/default/controllers/ActionController.php
@@ -140,7 +140,7 @@ public function codeAction()
$name = $actionData['name'];
$file = strtolower($name) . '.php';
- $dir = ROOT_PATH . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR . 'Action';
+ $dir = CUSTOM_PATH . DIRECTORY_SEPARATOR . 'Action';
$file = $dir . DIRECTORY_SEPARATOR . ucfirst($file);
if ($this->_request->isPost()) {
@@ -263,7 +263,7 @@ public function syncAction()
$this->_helper->viewRenderer->setNoRender();
$model = new Default_Model_Action;
- $dir = ROOT_PATH . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR . 'Action';
+ $dir = CUSTOM_PATH . DIRECTORY_SEPARATOR . 'Action';
if (!is_writable($dir)) {
$this->addMessage(sprintf($this->tr->_('ACTION_WRITE_ERROR'), $dir));
$this->_redirect('/action');
@@ -276,7 +276,7 @@ public function syncAction()
public function testAction()
{
$name = 'Testing1';
- $dir = ROOT_PATH . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR . 'Action';
+ $dir = CUSTOM_PATH . DIRECTORY_SEPARATOR . 'Action';
$file = $dir . DIRECTORY_SEPARATOR . $name . '.php';
require_once $file;
View
10 src/frapi/admin/application/modules/default/controllers/IndexController.php
@@ -27,7 +27,7 @@ public function init($styles = array())
/**
* Index action
*
- * The main index does nothing special. it verifies whether or not the
+ * The main index does nothing special. it verifies whether or not the
* setup can be ran by verifying the permissions on the custom directory
* emits meesages when it's not.
*
@@ -39,20 +39,20 @@ public function indexAction()
$user = get_current_user();
$dir = Zend_Registry::get('localConfigPath');
-
+
if (!is_writable($dir)) {
$configPathMessage = $this->tr->_('ACTION_WARNING_CONFIG');
$issues['config-path'] = sprintf($configPathMessage, $dir, $user);
}
-
- $dir = ROOT_PATH . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR . 'Action';
+
+ $dir = CUSTOM_PATH . DIRECTORY_SEPARATOR . 'Action';
if (!is_writable($dir)) {
$actionPathMessage = $this->tr->_('ACTION_WARNING_ACTION');
$issues['custom-action-path'] = sprintf($actionPathMessage, $dir, $user);
}
$this->view->issues = $issues;
-
+
}
}
View
2 src/frapi/admin/application/modules/default/models/Action.php
@@ -342,7 +342,7 @@ public function sync()
}
$name = ucfirst(strtolower($a['name']));
- $dir = ROOT_PATH . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR . 'Action';
+ $dir = CUSTOM_PATH . DIRECTORY_SEPARATOR . 'Action';
$file = $dir . DIRECTORY_SEPARATOR . $name . '.php';
View
14 src/frapi/admin/application/modules/default/models/Output.php
@@ -16,15 +16,15 @@
class Default_Model_Output extends Lupin_Model
{
protected $config;
-
+
public function __construct()
{
$this->config = new Lupin_Config_Xml('outputs');
}
-
+
public function sync()
{
- $path = ROOT_PATH . '/library/Frapi/Output/';
+ $path = LIBRARY_ROOT_PATH . DIRECTORY_SEPARATOR . 'Output' . DIRECTORY_SEPARATOR;
$dir = new DirectoryIterator($path);
$data = array();
foreach ($dir as $d) {
@@ -63,7 +63,7 @@ public function makeDefault($id)
try {
$this->config->update('output', 'name', $id, array('default' => '1'));
} catch (Exception $e) {}
-
+
$this->refreshAPCCache();
}
@@ -79,7 +79,7 @@ public function enable($id)
try {
$this->config->update('output', 'name', $id, array('enabled' => '1'));
} catch (Exception $e) {}
-
+
$this->refreshAPCCache();
}
@@ -89,7 +89,7 @@ public function disable($id)
try {
$this->config->update('output', 'name', $id, array('enabled' => '0'));
} catch (Exception $e) {}
-
+
$this->refreshAPCCache();
}
@@ -103,7 +103,7 @@ public function refreshAPCCache()
$configModel = new Default_Model_Configuration();
$server = $configModel->getKey('api_url');
$hash = isset($server) ? hash('sha1', $server) : '';
-
+
$cache = Frapi_Cache::getInstance(FRAPI_CACHE_ADAPTER);
$cache->delete($hash . '-Output.default-format');

0 comments on commit 4dfc09e

Please sign in to comment.