private function completeData($functionName) {/*{{{*/ $className = str_replace("test", '', $functionName); $this->assertTrue(class_exists($className), $className."类不存在\n"); $factory = new OpenFactory; $factory->wrapData(); $dataPath = $configs->standardPath.strtolower($className); $configs = BeanFinder::get('configs'); $resPath = $configs->resPath.strtolower($className); $this->assertTrue(is_dir($resPath), $resPath."路径不存在\n"); $fileList = XString::listFile($resPath); $this->assertNotEmpty($fileList, $className."下没有文件\n"); XString::clearDir($dataPath); foreach ($fileList as $key => $file) { if (strstr($file, 'xml') == false) { unset ($fileList[$key]); } } return $fileList; }/*}}}*/
private static function buildUrl($baseUrl, $fileList) {/*{{{*/ $res = array(); foreach ($fileList as $className => $fileNames) { $res[$className]['ref'] = OpenFactory::getClassRef($className); $res[$className]['className'] = $className; foreach ($fileNames as $fileName) { $res[$className]['url'][] = $baseUrl.$className."/".$fileName; } } return $res; }/*}}}*/
<?php $dir = dirname(__FILE__); include_once($dir.'/../script/init.php'); ini_set('memory_limit','1024M'); $factory = new OpenFactory; $sourceList = array($argv[1]); $factory->buildDataSource($sourceList); $factory->wrapBySourceList($sourceList); $factory->generateIndexBySource($argv[1]); $factory->packageBySource($argv[1]);
<?php $dir = dirname(__FILE__); include_once($dir.'/../script/init.php'); ini_set('memory_limit','1024M'); $sourceName = (isset($argv[1]))?trim($argv[1]):''; if (!$sourceName) { echo "usage: php ".$argv[0]." datasourcename"; exit; } try { $factory = new OpenFactory; echo XDateTime::now()->toString()."\n"; $factory->buildDataSource($sourceName); $factory->wrapDataBySource($sourceName); $factory->generateIndexBySource($sourceName); $factory->packageBySource($sourceName); } catch(Exception $ex) { EmailClient::getInstance()->sendSync(BeanFinder::get('configs')->aladdinMailbox, "阿拉丁数据源定时任务运行异常", $ex->getMessage(), $type='text/html'); }