From b2f63869d92ffc5ca1078ae5854e8de4f07a6927 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 13 Jan 2007 22:39:48 +0000 Subject: updated build script. --- build.xml | 30 ++++++++++--- buildscripts/classtree/build.php | 5 ++- buildscripts/index/build.php | 4 +- buildscripts/index/quickstart_index.php | 48 ++++++++++----------- buildscripts/phing/tasks/QuickstartIndexTask.php | 6 +-- demos/quickstart/protected/index/quickstart/_0.cfs | Bin 329302 -> 467144 bytes .../quickstart/protected/index/quickstart/segments | Bin 27 -> 27 bytes framework/PradoBase.php | 2 +- 8 files changed, 57 insertions(+), 38 deletions(-) diff --git a/build.xml b/build.xml index dd29c547..ebd8e43d 100644 --- a/build.xml +++ b/build.xml @@ -1,6 +1,6 @@ + + + + + @@ -62,13 +66,15 @@ - + + + diff --git a/buildscripts/classtree/build.php b/buildscripts/classtree/build.php index 7f5ddcd7..68e0ddc8 100644 --- a/buildscripts/classtree/build.php +++ b/buildscripts/classtree/build.php @@ -17,7 +17,10 @@ $exclusions=array( '.svn', '/I18N/core', '/3rdParty', - '/Web/Security' + '/Web/Security', + '/Configuration', + '/Web/Services/TFeedService.php', + '/Web/Services/IFeedContentProvider.php' ); $a=new ClassTreeBuilder($frameworkPath,$exclusions); $a->buildTree(); diff --git a/buildscripts/index/build.php b/buildscripts/index/build.php index 9ec0d659..0caaafb2 100644 --- a/buildscripts/index/build.php +++ b/buildscripts/index/build.php @@ -9,7 +9,7 @@ //quickstart source and the index data target directories. -$quickstart_source = realpath(dirname(__FILE__).'/../texbuilder/pages.php'); +$quickstart_source = realpath(dirname(__FILE__).'/../texbuilder/quickstart/pages.php'); $quickstart_base = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/pages/'); $quickstart_target = realpath(dirname(__FILE__).'/../../demos/quickstart/protected/index/quickstart/'); @@ -46,7 +46,7 @@ if(isset($argv[1])) echo "Found ".count($hits)." for ".$query." in quick start\n"; foreach($hits as $hit) echo " ".$hit->title."\n"; - + $a = new Zend_Search_Lucene($api_target); $query = $argv[1]; $hits = $a->find(strtolower($query)); diff --git a/buildscripts/index/quickstart_index.php b/buildscripts/index/quickstart_index.php index 565734ef..fb4bc829 100644 --- a/buildscripts/index/quickstart_index.php +++ b/buildscripts/index/quickstart_index.php @@ -4,10 +4,10 @@ class quickstart_index { private $_index; private $_dir; - + private $_base; private $_source; - + public function __construct($index_file, $base, $source) { $this->_index = new Zend_Search_Lucene($index_file, true); @@ -15,7 +15,7 @@ class quickstart_index $this->_base = $base; $this->_source = $source; } - + public function create_index() { echo "Building search index...\n"; @@ -30,13 +30,13 @@ class quickstart_index $file_content = file_get_contents($page); $this->add($file_content,$section, filemtime($page)); $count++; - } + } } - + $this->_index->commit(); - echo "\n {$count} files indexed.\n"; + echo "\n {$count} files indexed.\n"; } - + public function add($content, $section, $mtime) { foreach($this->split_headings($content) as $headers) @@ -44,44 +44,44 @@ class quickstart_index $doc = new Zend_Search_Lucene_Document(); $link = "index.php?page=".preg_replace('/\/|\\\/', '.', $section); $link = str_replace('.page', '', $link).'#'.$headers['section']; - + //unsearchable text $doc->addField(Zend_Search_Lucene_Field::UnIndexed('link', $link)); $doc->addField(Zend_Search_Lucene_Field::UnIndexed('mtime', $mtime)); $doc->addField(Zend_Search_Lucene_Field::UnIndexed('title', $headers['title'])); - $doc->addField(Zend_Search_Lucene_Field::UnIndexed('text', $headers['content'])); - + $doc->addField(Zend_Search_Lucene_Field::UnIndexed('text', $headers['content'])); + //searchable text $doc->addField(Zend_Search_Lucene_Field::Keyword('page', strtolower($headers['title']))); $body = strtolower($this->sanitize($headers['content'])).' '.strtolower($headers['title']); $doc->addField(Zend_Search_Lucene_Field::Unstored('contents',$body)); $this->_index->addDocument($doc); - } + } } - - function sanitize($input) + + function sanitize($input) { return htmlentities(strip_tags( $input )); - } - + } + public function index() { return $this->_index; } - + protected function split_headings($html) { $html = preg_replace('/<\/?com:TContent[^<]*>/', '', $html); - + $html = preg_replace('/([^<]*)<\/b>/', '$1', $html); $html = preg_replace('/([^<]*)<\/i>/', '$1', $html); $html = preg_replace('/([^<]*)<\/tt>/', '$1', $html); - + $html = preg_replace('/]*)>([^<]*)<\/h1>/', '$2', $html); $html = preg_replace('/]*)>([^<]*)<\/h2>/', '$2', $html); $html = preg_replace('/]*)>([^<]*)<\/h3>/', '$2', $html); - - + + $sections = preg_split('/]*>([^<]+)<\/hh>/', $html,-1); $headers = array(); preg_match_all('/]*)>([^<]+)<\/hh>/', $html, $headers); @@ -89,19 +89,17 @@ class quickstart_index for($i = 1, $t = count($sections); $i < $t; $i++) { $content['title'] = trim($this->sanitize($headers[2][$i-1])); - $sec = array(); - preg_match('/"([^"]*)"/', $headers[1][$i-1], $sec); - $content['section'] = str_replace('"', '',$sec[0]); + $content['section'] = str_replace('"', '',trim($headers[1][$i-1],'"')); $content['content'] = trim($this->sanitize($sections[$i])); $contents[] = $content; } return $contents; } - + public function commit() { - $this->_index->commit(); + $this->_index->commit(); $count = $this->_index->count(); echo "\nSaving search index ({$count}) to {$this->_dir}\n\n"; } diff --git a/buildscripts/phing/tasks/QuickstartIndexTask.php b/buildscripts/phing/tasks/QuickstartIndexTask.php index f3107fd3..64a48d4a 100644 --- a/buildscripts/phing/tasks/QuickstartIndexTask.php +++ b/buildscripts/phing/tasks/QuickstartIndexTask.php @@ -4,7 +4,7 @@ require_once 'phing/Task.php'; /** * Task to index quickstart - */ + */ class QuickstartIndexTask extends Task { private $todir; @@ -20,9 +20,9 @@ class QuickstartIndexTask extends Task $zend_path = $srcdir.'/demos/quickstart/protected/index'; set_include_path(get_include_path().PATH_SEPARATOR.realpath($zend_path)); require_once ('Zend/Search/Lucene.php'); - + require_once($srcdir.'/buildscripts/index/quickstart_index.php'); - $quickstart_source = $srcdir.'/buildscripts/texbuilder/pages.php'; + $quickstart_source = $srcdir.'/buildscripts/texbuilder/quickstart/pages.php'; $quickstart_base = $srcdir.'/demos/quickstart/protected/pages/'; $quickstart = new quickstart_index($this->todir, realpath($quickstart_base), realpath($quickstart_source)); $quickstart->create_index(); diff --git a/demos/quickstart/protected/index/quickstart/_0.cfs b/demos/quickstart/protected/index/quickstart/_0.cfs index f3cb1bfb..863a34d0 100644 Binary files a/demos/quickstart/protected/index/quickstart/_0.cfs and b/demos/quickstart/protected/index/quickstart/_0.cfs differ diff --git a/demos/quickstart/protected/index/quickstart/segments b/demos/quickstart/protected/index/quickstart/segments index 5509e664..0c5b6213 100644 Binary files a/demos/quickstart/protected/index/quickstart/segments and b/demos/quickstart/protected/index/quickstart/segments differ diff --git a/framework/PradoBase.php b/framework/PradoBase.php index 4cfedb09..ac3949ba 100644 --- a/framework/PradoBase.php +++ b/framework/PradoBase.php @@ -68,7 +68,7 @@ class PradoBase */ public static function getVersion() { - return '3.1.0b'; + return '3.1.0a'; } /** -- cgit v1.2.3