[limb-svn] r6337 - in 3.x/trunk/limb: cli/src zfsearch zfsearch/cli zfsearch/lib/Zend zfsearch/src/controller zfsearch/src/indexer
svn at limb-project.com
svn at limb-project.com
Thu Sep 27 15:16:16 MSD 2007
Author: alex433
Date: 2007-09-27 15:16:16 +0400 (Thu, 27 Sep 2007)
New Revision: 6337
URL: http://fisheye.limb-project.com/changelog/limb/?cs=6337
Modified:
3.x/trunk/limb/cli/src/lmbCliRunner.class.php
3.x/trunk/limb/zfsearch/cli/ZendSearchCliCmd.class.php
3.x/trunk/limb/zfsearch/common.inc.php
3.x/trunk/limb/zfsearch/lib/Zend/Exception.php
3.x/trunk/limb/zfsearch/src/controller/ZendSearchController.class.php
3.x/trunk/limb/zfsearch/src/indexer/lmbZendSearchIndexer.class.php
Log:
-- change package name in file headers
-- revert wrong commit limb/cli/src/lmbCliRunner.class.php
Modified: 3.x/trunk/limb/cli/src/lmbCliRunner.class.php
===================================================================
--- 3.x/trunk/limb/cli/src/lmbCliRunner.class.php 2007-09-27 08:33:48 UTC (rev 6336)
+++ 3.x/trunk/limb/cli/src/lmbCliRunner.class.php 2007-09-27 11:16:16 UTC (rev 6337)
@@ -1,122 +1,122 @@
-<?php
+<?php
/*
* Limb PHP Framework
*
* @link http://limb-project.com
* @copyright Copyright © 2004-2007 BIT(http://bit-creative.com)
* @license LGPL http://www.gnu.org/copyleft/lesser.html
- */
-lmb_require('limb/cli/src/lmbCliBaseCmd.class.php');
-
- at define('LIMB_CLI_INCLUDE_PATH', 'cli;*/cli;limb/*/cli');
+ */
+lmb_require('limb/cli/src/lmbCliBaseCmd.class.php');
-/**
- * class lmbCliRunner.
- *
- * @package cli
- * @version $Id$
+ at define('LIMB_CLI_INCLUDE_PATH', 'cli;limb/*/cli');
+
+/**
+ * class lmbCliRunner.
+ *
+ * @package cli
+ * @version $Id$
*/
-class lmbCliRunner
-{
- protected $input;
- protected $output;
- protected $return_on_exit = false;
- protected $use_exception = false;
- protected $search_path;
-
- function __construct($input, $output)
- {
- $this->input = $input;
- $this->output = $output;
- $this->search_path = LIMB_CLI_INCLUDE_PATH;
- }
-
- static function commandToClass($name)
- {
- return lmb_camel_case(self :: sanitizeName($name)) . 'CliCmd';
- }
-
- static function actionToMethod($name)
- {
- return lmb_camel_case(self :: sanitizeName($name));
- }
-
- static function sanitizeName($name)
- {
- $name = preg_replace('~\W~', '_', $name);
- return $name;
- }
-
- function setCommandSearchPath($path)
- {
- $this->search_path = $path;
- }
-
- function returnOnExit($flag = true)
- {
- $this->return_on_exit = $flag;
- }
-
- function throwOnError($flag = true)
- {
- $this->use_exception = $flag;
- }
-
- function execute()
- {
- if(!$command_name = $this->input->getArgument(0))
- $this->_error('You should specify command');
-
- if(!$command = $this->_mapCommandToObject($command_name))
- $this->_error("Command '$command_name' is invalid(could not map it to the command class)");
-
- $argv = $this->input->getArgv();
- array_shift($argv);
-
- $action = 'execute';
-
- if($arg = $this->input->getArgument(1))
- {
- $method = self :: actionToMethod($arg);
- if(method_exists($command, $method))
- {
- $action = $method;
- array_shift($argv);
- }
- }
- return $this->_exit((int)$command->$action($argv));
- }
-
- protected function _exit($code = 0)
- {
- if($this->return_on_exit)
- return $code;
- else
- exit($code);
- }
-
- protected function _error($message = '')
- {
- if($this->use_exception)
- throw new lmbException($message);
- else
- exit(1);
- }
-
- protected function _mapCommandToObject($command_name)
- {
- $items = explode(';', $this->search_path);
- foreach($items as $item)
- {
- $class = self :: commandToClass($command_name);
- $path = $item . '/' . $class . '.class.php';
-
- if($resolved = lmb_glob($path))
- {
- require_once($resolved[0]);
- return new $class($this->output);
- }
- }
- }
-}
-
+class lmbCliRunner
+{
+ protected $input;
+ protected $output;
+ protected $return_on_exit = false;
+ protected $use_exception = false;
+ protected $search_path;
+
+ function __construct($input, $output)
+ {
+ $this->input = $input;
+ $this->output = $output;
+ $this->search_path = LIMB_CLI_INCLUDE_PATH;
+ }
+
+ static function commandToClass($name)
+ {
+ return lmb_camel_case(self :: sanitizeName($name)) . 'CliCmd';
+ }
+
+ static function actionToMethod($name)
+ {
+ return lmb_camel_case(self :: sanitizeName($name));
+ }
+
+ static function sanitizeName($name)
+ {
+ $name = preg_replace('~\W~', '_', $name);
+ return $name;
+ }
+
+ function setCommandSearchPath($path)
+ {
+ $this->search_path = $path;
+ }
+
+ function returnOnExit($flag = true)
+ {
+ $this->return_on_exit = $flag;
+ }
+
+ function throwOnError($flag = true)
+ {
+ $this->use_exception = $flag;
+ }
+
+ function execute()
+ {
+ if(!$command_name = $this->input->getArgument(0))
+ $this->_error('You should specify command');
+
+ if(!$command = $this->_mapCommandToObject($command_name))
+ $this->_error("Command '$command_name' is invalid(could not map it to the command class)");
+
+ $argv = $this->input->getArgv();
+ array_shift($argv);
+
+ $action = 'execute';
+
+ if($arg = $this->input->getArgument(1))
+ {
+ $method = self :: actionToMethod($arg);
+ if(method_exists($command, $method))
+ {
+ $action = $method;
+ array_shift($argv);
+ }
+ }
+ return $this->_exit((int)$command->$action($argv));
+ }
+
+ protected function _exit($code = 0)
+ {
+ if($this->return_on_exit)
+ return $code;
+ else
+ exit($code);
+ }
+
+ protected function _error($message = '')
+ {
+ if($this->use_exception)
+ throw new lmbException($message);
+ else
+ exit(1);
+ }
+
+ protected function _mapCommandToObject($command_name)
+ {
+ $items = explode(';', $this->search_path);
+ foreach($items as $item)
+ {
+ $class = self :: commandToClass($command_name);
+ $path = $item . '/' . $class . '.class.php';
+
+ if($resolved = lmb_glob($path))
+ {
+ require_once($resolved[0]);
+ return new $class($this->output);
+ }
+ }
+ }
+}
+
Modified: 3.x/trunk/limb/zfsearch/cli/ZendSearchCliCmd.class.php
===================================================================
--- 3.x/trunk/limb/zfsearch/cli/ZendSearchCliCmd.class.php 2007-09-27 08:33:48 UTC (rev 6336)
+++ 3.x/trunk/limb/zfsearch/cli/ZendSearchCliCmd.class.php 2007-09-27 11:16:16 UTC (rev 6337)
@@ -9,7 +9,7 @@
/**
* class ZendSearchCliCmd
*
- * @package zend_search
+ * @package zfsearch
* @version $Id$
*/
class ZendSearchCliCmd extends lmbCliBaseCmd
@@ -38,7 +38,7 @@
require_once('limb/web_spider/src/lmbContentTypeFilter.class.php');
require_once('limb/web_spider/src/lmbSearchIndexingObserver.class.php');
require_once('limb/web_spider/src/lmbUriNormalizer.class.php');
- require_once('limb/zend_search/src/indexer/lmbZendSearchIndexer.class.php');
+ require_once('limb/zfsearch/src/indexer/lmbZendSearchIndexer.class.php');
$uri = new lmbUri($input->getArgument(0));
Modified: 3.x/trunk/limb/zfsearch/common.inc.php
===================================================================
--- 3.x/trunk/limb/zfsearch/common.inc.php 2007-09-27 08:33:48 UTC (rev 6336)
+++ 3.x/trunk/limb/zfsearch/common.inc.php 2007-09-27 11:16:16 UTC (rev 6337)
@@ -8,7 +8,7 @@
*/
/**
*
- * @package zend_search
+ * @package zfsearch
* @version $Id$
*/
lmb_require('limb/i18n/utf8.inc.php');
Modified: 3.x/trunk/limb/zfsearch/lib/Zend/Exception.php
===================================================================
--- 3.x/trunk/limb/zfsearch/lib/Zend/Exception.php 2007-09-27 08:33:48 UTC (rev 6336)
+++ 3.x/trunk/limb/zfsearch/lib/Zend/Exception.php 2007-09-27 11:16:16 UTC (rev 6337)
@@ -9,7 +9,7 @@
/**
* class Zend_Exception
*
- * @package zend_search
+ * @package zfsearch
* @version $Id$
*/
lmb_require('limb/core/src/exception/lmbException.class.php');
Modified: 3.x/trunk/limb/zfsearch/src/controller/ZendSearchController.class.php
===================================================================
--- 3.x/trunk/limb/zfsearch/src/controller/ZendSearchController.class.php 2007-09-27 08:33:48 UTC (rev 6336)
+++ 3.x/trunk/limb/zfsearch/src/controller/ZendSearchController.class.php 2007-09-27 11:16:16 UTC (rev 6337)
@@ -9,7 +9,7 @@
/**
* class ZendSearchController
*
- * @package zend_search
+ * @package zfsearch
* @version $Id$
*/
lmb_require('limb/web_app/src/controller/lmbController.class.php');
Modified: 3.x/trunk/limb/zfsearch/src/indexer/lmbZendSearchIndexer.class.php
===================================================================
--- 3.x/trunk/limb/zfsearch/src/indexer/lmbZendSearchIndexer.class.php 2007-09-27 08:33:48 UTC (rev 6336)
+++ 3.x/trunk/limb/zfsearch/src/indexer/lmbZendSearchIndexer.class.php 2007-09-27 11:16:16 UTC (rev 6337)
@@ -9,7 +9,7 @@
/**
* class lmbZendSearchIndexer
*
- * @package zend_search
+ * @package zfsearch
* @version $Id$
*/
class lmbZendSearchIndexer
More information about the limb-svn
mailing list