本文整理汇总了PHP中common_Logger类的典型用法代码示例。如果您正苦于以下问题:PHP common_Logger类的具体用法?PHP common_Logger怎么用?PHP common_Logger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了common_Logger类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: init
/**
* Short description of method init
*
* @access public
* @author Sam
* @param array configuration
* @return boolean
*/
public function init($configuration)
{
parent::init($configuration);
$this->data = array();
$this->archivers = array();
if (isset($configuration['local_server_comment'])) {
$this->comment = strval($configuration['local_server_comment']);
}
foreach ($configuration['archivers'] as $archiverConfig) {
if (isset($archiverConfig['class'])) {
$classname = $archiverConfig['class'];
if (!class_exists($classname)) {
$classname = 'common_profiler_archiver_' . $classname;
}
if (class_exists($classname)) {
$archiver = new $classname();
try {
if ($archiver instanceof common_profiler_archiver_Archiver && !is_null($archiver) && $archiver->init($archiverConfig)) {
$this->archivers[] = $archiver;
}
} catch (InvalidArgumentException $e) {
common_Logger::w('archiver configuration issue: ' . $e->getMessage());
}
}
}
}
return true;
}
开发者ID:nagyist,项目名称:generis,代码行数:36,代码来源:class.SystemProfileAppender.php
示例2: getStrings
public function getStrings($values)
{
$contentStrings = array();
$xmlTokenizer = new taoItems_models_classes_search_XmlItemContentTokenizer();
foreach ($values as $valueUri) {
$file = new core_kernel_file_File($valueUri);
try {
$content = file_get_contents($file->getAbsolutePath());
if ($content === false) {
common_Logger::w('File ' . $file->getAbsolutePath() . ' not found for item');
} else {
// Try to make it a DOM Document...
$dom = new DOMDocument('1.0', 'UTF-8');
if (@$dom->loadXML($content) === true) {
$contentStrings = array_merge($contentStrings, $xmlTokenizer->getStrings($dom));
unset($dom);
} else {
common_Logger::d('Skipped non XML content for ' . $file->getUri());
}
}
} catch (common_Exception $exc) {
common_Logger::w('Invalid file ' . $valueUri . ' for ItemContentTokenizer: ' . $exc->getMessage());
}
}
return $contentStrings;
}
开发者ID:nagyist,项目名称:tao-extension-tao-item,代码行数:26,代码来源:class.ItemContentTokenizer.php
示例3: __construct
/**
*
* @param array callOptions an array of parameters sent to the results storage configuration
* @param mixed $resultServer
* @param string uri or resource
*/
public function __construct($resultServer, $additionalStorages = array())
{
$this->implementations = array();
if (is_object($resultServer) and get_class($resultServer) == 'core_kernel_classes_Resource') {
$this->resultServer = $resultServer;
} else {
if (common_Utils::isUri($resultServer)) {
$this->resultServer = new core_kernel_classes_Resource($resultServer);
}
}
// the static storages
if ($this->resultServer->getUri() != TAO_VOID_RESULT_SERVER) {
$resultServerModels = $this->resultServer->getPropertyValues(new core_kernel_classes_Property(TAO_RESULTSERVER_MODEL_PROP));
if (!isset($resultServerModels) or count($resultServerModels) == 0) {
throw new common_Exception("The result server is not correctly configured (Resource definition)");
}
foreach ($resultServerModels as $resultServerModelUri) {
$resultServerModel = new core_kernel_classes_Resource($resultServerModelUri);
$this->addImplementation($resultServerModel->getUniquePropertyValue(new core_kernel_classes_Property(TAO_RESULTSERVER_MODEL_IMPL_PROP))->literal);
}
}
if (!is_null($additionalStorages)) {
// the dynamic storages
foreach ($additionalStorages as $additionalStorage) {
$this->addImplementation($additionalStorage["implementation"], $additionalStorage["parameters"]);
}
}
common_Logger::i("Result Server Initialized using defintion:" . $this->resultServer->getUri());
// sets the details required depending on the type of storage
}
开发者ID:nagyist,项目名称:extension-tao-outcome,代码行数:36,代码来源:class.ResultServer.php
示例4: setUp
public function setUp()
{
TaoPhpUnitTestRunner::initTest();
$this->disableCache();
// creates a user using remote script from joel
$testUserData = array(PROPERTY_USER_LOGIN => 'tjdoe', PROPERTY_USER_PASSWORD => 'test123', PROPERTY_USER_LASTNAME => 'Doe', PROPERTY_USER_FIRSTNAME => 'John', PROPERTY_USER_MAIL => '[email protected]', PROPERTY_USER_DEFLG => \tao_models_classes_LanguageService::singleton()->getLanguageByCode(DEFAULT_LANG)->getUri(), PROPERTY_USER_UILG => \tao_models_classes_LanguageService::singleton()->getLanguageByCode(DEFAULT_LANG)->getUri(), PROPERTY_USER_ROLES => array(INSTANCE_ROLE_GLOBALMANAGER));
$testUserData[PROPERTY_USER_PASSWORD] = 'test' . rand();
$data = $testUserData;
$data[PROPERTY_USER_PASSWORD] = \core_kernel_users_Service::getPasswordHash()->encrypt($data[PROPERTY_USER_PASSWORD]);
$tmclass = new \core_kernel_classes_Class(CLASS_TAO_USER);
$user = $tmclass->createInstanceWithProperties($data);
\common_Logger::i('Created user ' . $user->getUri());
// prepare a lookup table of languages and values
$usage = new \core_kernel_classes_Resource(INSTANCE_LANGUAGE_USAGE_GUI);
$propValue = new \core_kernel_classes_Property(RDF_VALUE);
$langService = \tao_models_classes_LanguageService::singleton();
$lookup = array();
foreach ($langService->getAvailableLanguagesByUsage($usage) as $lang) {
$lookup[$lang->getUri()] = (string) $lang->getUniquePropertyValue($propValue);
}
$data = array('rootUrl' => ROOT_URL, 'userUri' => $user->getUri(), 'userData' => $testUserData, 'lang' => $lookup);
$this->login = $data['userData'][PROPERTY_USER_LOGIN];
$this->password = $data['userData'][PROPERTY_USER_PASSWORD];
$this->userUri = $data['userUri'];
}
开发者ID:nagyist,项目名称:tao-core,代码行数:25,代码来源:RestTestCase.php
示例5: createFailure
/**
* Create a formatted failure report and log a warning
*
* @param $userMessage
* @param null $model
* @return Report
*/
private function createFailure($userMessage, $model = null)
{
$typeIdentifier = is_null($model) ? 'unknown type' : $model->getTypeIdentifier();
$message = 'The portable element cannot be registered "' . $typeIdentifier . '", reason: ' . $userMessage;
\common_Logger::w($message);
return Report::createFailure($message);
}
开发者ID:oat-sa,项目名称:extension-tao-itemqti,代码行数:14,代码来源:RegisterPortableElement.php
示例6: getDirectory
/**
* (non-PHPdoc)
* @see \oat\tao\model\media\MediaBrowser::getDirectory
*/
public function getDirectory($parentLink = '/', $acceptableMime = array(), $depth = 1)
{
$sysPath = $this->getSysPath($parentLink);
$label = substr($parentLink, strrpos($parentLink, '/') + 1);
if (!$label) {
$label = 'local';
}
$data = array('path' => $parentLink, 'label' => $label);
if ($depth > 0) {
$children = array();
if (is_dir($sysPath)) {
foreach (new DirectoryIterator($sysPath) as $fileinfo) {
if (!$fileinfo->isDot()) {
$subPath = rtrim($parentLink, '/') . '/' . $fileinfo->getFilename();
if ($fileinfo->isDir()) {
$children[] = $this->getDirectory($subPath, $acceptableMime, $depth - 1);
} else {
$file = $this->getFileInfo($subPath, $acceptableMime);
if (!is_null($file) && (count($acceptableMime) == 0 || in_array($file['mime'], $acceptableMime))) {
$children[] = $file;
}
}
}
}
} else {
common_Logger::w('"' . $sysPath . '" is not a directory');
}
$data['children'] = $children;
} else {
$data['url'] = _url('files', 'ItemContent', 'taoItems', array('uri' => $this->item->getUri(), 'lang' => $this->lang, 'path' => $parentLink));
}
return $data;
}
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:37,代码来源:class.ResourceManager.php
示例7: load
/**
* Load the extension.
*
* @access public
* @author Jerome Bogaerts, <[email protected]>
* @param array $extraConstants
* @return mixed
*/
public function load($extraConstants = array())
{
if (!empty($extraConstants)) {
throw new common_exception_Error('Loading extra constants in ' . __CLASS__ . ' nolonger supported');
}
common_Logger::t('Loading extension ' . $this->getExtension()->getId() . ' constants');
// load the constants from the manifest
if ($this->extension->getId() != "generis") {
foreach ($this->extension->getConstants() as $key => $value) {
if (!defined($key) && !is_array($value)) {
define($key, $value);
}
}
}
$constantFile = $this->getExtension()->getDir() . 'includes' . DIRECTORY_SEPARATOR . 'constants.php';
if (file_exists($constantFile)) {
//include the constant file
include_once $constantFile;
//this variable comes from the constant file and contain the const definition
if (isset($todefine)) {
foreach ($todefine as $constName => $constValue) {
if (!defined($constName)) {
define($constName, $constValue);
//constants are defined there!
} else {
common_Logger::d('Constant ' . $constName . ' in ' . $this->getExtension()->getId() . ' has already been defined');
}
}
unset($todefine);
}
}
}
开发者ID:oat-sa,项目名称:generis,代码行数:40,代码来源:class.ExtensionLoader.php
示例8: send
public function send(Message $message)
{
$messageFile = $this->getFilePath($message->getTo());
\common_Logger::d('Wrote message to ' . $messageFile);
$written = file_put_contents($messageFile, $message->getBody());
return $written !== false;
}
开发者ID:nagyist,项目名称:tao-core,代码行数:7,代码来源:FileSink.php
示例9: createModel
/**
* @author "Lionel Lecaque, <[email protected]>"
* @param string $namespace
* @param string $data xml content
*/
public function createModel($namespace, $data)
{
$modelId = $this->getModelId($namespace);
if ($modelId === false) {
common_Logger::d('modelId not found, need to add namespace ' . $namespace);
$this->addNewModel($namespace);
//TODO bad way, need to find better
$modelId = $this->getModelId($namespace);
}
$modelDefinition = new EasyRdf_Graph($namespace);
if (is_file($data)) {
$modelDefinition->parseFile($data);
} else {
$modelDefinition->parse($data);
}
$graph = $modelDefinition->toRdfPhp();
$resources = $modelDefinition->resources();
$format = EasyRdf_Format::getFormat('php');
$data = $modelDefinition->serialise($format);
foreach ($data as $subjectUri => $propertiesValues) {
foreach ($propertiesValues as $prop => $values) {
foreach ($values as $k => $v) {
$this->addStatement($modelId, $subjectUri, $prop, $v['value'], isset($v['lang']) ? $v['lang'] : null);
}
}
}
return true;
}
开发者ID:nagyist,项目名称:generis,代码行数:33,代码来源:class.ModelFactory.php
示例10: initElements
public function initElements()
{
$class = $this->data['class'];
if (!$class instanceof \core_kernel_classes_Class) {
throw new \common_Exception('missing class in simple delivery creation form');
}
$classUriElt = \tao_helpers_form_FormFactory::getElement('classUri', 'Hidden');
$classUriElt->setValue($class->getUri());
$this->form->addElement($classUriElt);
//create the element to select the import format
$formatElt = \tao_helpers_form_FormFactory::getElement('test', 'Combobox');
$formatElt->setDescription(__('Select the test you want to publish to the test-takers'));
$testClass = new \core_kernel_classes_Class(TAO_TEST_CLASS);
$options = array();
$testService = \taoTests_models_classes_TestsService::singleton();
foreach ($testClass->getInstances(true) as $test) {
try {
$testItems = $testService->getTestItems($test);
//Filter tests which has no items
if (!empty($testItems)) {
$options[$test->getUri()] = $test->getLabel();
}
} catch (\Exception $e) {
\common_Logger::w('Unable to load items for test ' . $test->getUri());
}
}
if (empty($options)) {
throw new NoTestsException();
}
$formatElt->setOptions($options);
$formatElt->addValidator(\tao_helpers_form_FormFactory::getValidator('NotEmpty'));
$this->form->addElement($formatElt);
}
开发者ID:oat-sa,项目名称:extension-tao-delivery-rdf,代码行数:33,代码来源:WizardForm.php
示例11: outputFile
public static function outputFile($relPath, $filename = null)
{
$fullpath = self::getExportPath() . DIRECTORY_SEPARATOR . $relPath;
if (tao_helpers_File::securityCheck($fullpath, true) && file_exists($fullpath)) {
Context::getInstance()->getResponse()->setContentHeader(tao_helpers_File::getMimeType($fullpath));
$fileName = empty($filename) ? basename($fullpath) : $filename;
header('Content-Disposition: attachment; fileName="' . $fileName . '"');
header("Content-Length: " . filesize($fullpath));
//Clean all levels of output buffering
while (ob_get_level() > 0) {
ob_end_clean();
}
flush();
$fp = fopen($fullpath, "r");
if ($fp !== false) {
while (!feof($fp)) {
echo fread($fp, 65536);
flush();
}
fclose($fp);
@unlink($fullpath);
} else {
common_Logger::e('Unable to open File to export' . $fullpath);
}
} else {
common_Logger::e('Could not find File to export: ' . $fullpath);
}
}
开发者ID:nagyist,项目名称:tao-core,代码行数:28,代码来源:class.Export.php
示例12: getUncached
private function getUncached($property)
{
$value = array();
switch ($property) {
case PROPERTY_USER_DEFLG:
case PROPERTY_USER_UILG:
$resource = $this->getUserResource()->getOnePropertyValue(new \core_kernel_classes_Property($property));
if (!is_null($resource)) {
if ($resource instanceof \core_kernel_classes_Resource) {
return array($resource->getUniquePropertyValue(new \core_kernel_classes_Property(RDF_VALUE)));
} else {
common_Logger::w('Language ' . $resource . ' is not a resource');
return array(DEFAULT_LANG);
}
} else {
return array(DEFAULT_LANG);
}
break;
case PROPERTY_USER_ROLES:
return array("http://www.tao.lu/Ontologies/TAOItem.rdf#TestAuthor", "http://www.tao.lu/Ontologies/TAOItem.rdf#ItemAuthor");
case "http://www.tao.lu/Ontologies/TAO.rdf#FirstTimeInTao":
return array("http://www.tao.lu/Ontologies/generis.rdf#False");
case "http://www.tao.lu/Ontologies/TAO.rdf#LastExtensionUsed":
return array("tao/Main/index?structure=items&ext=taoItems");
default:
return $this->getUserResource()->getPropertyValues(new \core_kernel_classes_Property($property));
}
}
开发者ID:khaledvic,项目名称:oat-tao-tao-openid-auth,代码行数:28,代码来源:OpenIDUser.php
示例13: files
/**
* Returns a json encoded array describign a directory
*
* @throws common_exception_MissingParameter
* @return string
*/
public function files()
{
if (!$this->hasRequestParameter('uri')) {
throw new common_exception_MissingParameter('uri', __METHOD__);
}
$testUri = $this->getRequestParameter('uri');
$test = new core_kernel_classes_Resource($testUri);
if (!$this->hasRequestParameter('lang')) {
throw new common_exception_MissingParameter('lang', __METHOD__);
}
$testLang = $this->getRequestParameter('lang');
$subPath = $this->hasRequestParameter('path') ? $this->getRequestParameter('path') : '/';
$depth = $this->hasRequestParameter('depth') ? $this->getRequestParameter('depth') : 1;
//build filters
$filters = array();
if ($this->hasRequestParameter('filters')) {
$filterParameter = $this->getRequestParameter('filters');
if (!empty($filterParameter)) {
if (preg_match('/\\/\\*/', $filterParameter)) {
common_Logger::w('Stars mime type are not yet supported, filter "' . $filterParameter . '" will fail');
}
$filters = array_map('trim', explode(',', $filterParameter));
}
}
$data = taoQtiTest_helpers_ResourceManager::buildDirectory($test, $testLang, $subPath, $depth, $filters);
echo json_encode($data);
}
开发者ID:nagyist,项目名称:extension-tao-testqti,代码行数:33,代码来源:class.TestContent.php
示例14: create
/**
* Creates a new delivery
*
* @param core_kernel_classes_Class $deliveryClass
* @param core_kernel_classes_Resource $test
* @param array $properties Array of properties of delivery
* @return common_report_Report
*/
public static function create(\core_kernel_classes_Class $deliveryClass, \core_kernel_classes_Resource $test, $properties = array())
{
\common_Logger::i('Creating delivery with ' . $test->getLabel() . ' under ' . $deliveryClass->getLabel());
$storage = new TrackedStorage();
$testCompilerClass = \taoTests_models_classes_TestsService::singleton()->getCompilerClass($test);
$compiler = new $testCompilerClass($test, $storage);
$report = $compiler->compile();
if ($report->getType() == \common_report_Report::TYPE_SUCCESS) {
//$tz = new \DateTimeZone(\common_session_SessionManager::getSession()->getTimeZone());
$tz = new \DateTimeZone('UTC');
if (!empty($properties[TAO_DELIVERY_START_PROP])) {
$dt = new \DateTime($properties[TAO_DELIVERY_START_PROP], $tz);
$properties[TAO_DELIVERY_START_PROP] = (string) $dt->getTimestamp();
}
if (!empty($properties[TAO_DELIVERY_END_PROP])) {
$dt = new \DateTime($properties[TAO_DELIVERY_END_PROP], $tz);
$properties[TAO_DELIVERY_END_PROP] = (string) $dt->getTimestamp();
}
$serviceCall = $report->getData();
$properties[PROPERTY_COMPILEDDELIVERY_DIRECTORY] = $storage->getSpawnedDirectoryIds();
$compilationInstance = DeliveryAssemblyService::singleton()->createAssemblyFromServiceCall($deliveryClass, $serviceCall, $properties);
$report->setData($compilationInstance);
}
return $report;
}
开发者ID:oat-sa,项目名称:extension-tao-delivery-schedule,代码行数:33,代码来源:DeliveryFactory.php
示例15: scriptRunner
public function scriptRunner($script, $extension)
{
$error = false;
$errorStack = array();
if (isset($extension) && $extension != null) {
$ext = common_ext_ExtensionsManager::singleton()->getExtensionById($extension);
}
if ($script != null) {
$parameters = array();
$options = array('argv' => array(0 => 'Script ' . $script), 'output_mode' => 'log_only');
try {
$scriptName = $script;
if (!class_exists($scriptName)) {
throw new taoUpdate_models_classes_UpdateException('Could not find scriptName class ' . $script);
}
new $scriptName(array('parameters' => $parameters), $options);
$error = false;
} catch (Exception $e) {
common_Logger::e('Error occurs during update ' . $e->getMessage());
$error = true;
$errorStack[] = 'Error in script ' . $script . ' ' . $e->getMessage();
}
if ($error) {
echo json_encode(array('success' => 0, 'failed' => $errorStack));
} else {
echo json_encode(array('success' => 1, 'failed' => array()));
}
} else {
echo json_encode(array('success' => 0, 'failed' => array('not scriptname provided')));
}
}
开发者ID:llecaque,项目名称:extension-tao-update,代码行数:31,代码来源:class.Data.php
示例16: update
/**
*
* @param string $currentVersion
* @return string $versionUpdatedTo
*/
public function update($initialVersion)
{
$currentVersion = $initialVersion;
//migrate from 2.6 to 2.6.1
if ($currentVersion == '2.6') {
//data upgrade
OntologyUpdater::syncModels();
$currentVersion = '2.6.1';
}
if ($currentVersion == '2.6.1') {
$ext = \common_ext_ExtensionsManager::singleton()->getExtensionById('taoDelivery');
$className = $ext->getConfig(\taoDelivery_models_classes_execution_ServiceProxy::CONFIG_KEY);
if (is_string($className)) {
$impl = null;
switch ($className) {
case 'taoDelivery_models_classes_execution_OntologyService':
$impl = new \taoDelivery_models_classes_execution_OntologyService();
break;
case 'taoDelivery_models_classes_execution_KeyValueService':
$impl = new \taoDelivery_models_classes_execution_KeyValueService(array(\taoDelivery_models_classes_execution_KeyValueService::OPTION_PERSISTENCE => 'deliveryExecution'));
break;
default:
\common_Logger::w('Unable to migrate custom execution service');
}
if (!is_null($impl)) {
$proxy = \taoDelivery_models_classes_execution_ServiceProxy::singleton();
$proxy->setImplementation($impl);
$currentVersion = '2.6.2';
}
}
}
return $currentVersion;
}
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:38,代码来源:Updater.php
示例17: complies
/**
* @param array $conditions
* @param string $conditionService
* @return bool
*/
protected function complies(array $conditions, $conditionService)
{
$clientName = $conditionService::singleton()->getClientName();
$clientVersion = $conditionService::singleton()->getClientVersion();
$clientNameResource = $conditionService::singleton()->getClientNameResource();
\common_Logger::i("Detected client: {$clientName} @ {$clientVersion}");
$result = false;
/** @var \core_kernel_classes_Property $browser */
foreach ($conditions as $condition) {
if ($condition->exists() === true) {
/** @var \core_kernel_classes_Resource $requiredName */
$requiredName = $condition->getOnePropertyValue(new \core_kernel_classes_Property($conditionService::PROPERTY_NAME));
if ($clientNameResource && !$clientNameResource->equals($requiredName)) {
\common_Logger::i("Client rejected. Required name is {$requiredName} but current name is {$clientName}.");
continue;
} elseif ($clientNameResource === null) {
\common_Logger::i("Client rejected. Unknown client.");
continue;
}
$requiredVersion = $condition->getOnePropertyValue(new \core_kernel_classes_Property($conditionService::PROPERTY_VERSION));
if (-1 !== version_compare($conditionService::singleton()->getClientVersion(), $requiredVersion)) {
$result = true;
break;
}
}
}
return $result;
}
开发者ID:oat-sa,项目名称:extension-tao-client-restrict,代码行数:33,代码来源:RequirementsService.php
示例18: authenticate
/**
* Short description of method authenticate
*
* @access public
* @author Joel Bout, <[email protected]>
* @param Repository vcs
* @param string login
* @param string password
* @return boolean
*/
public function authenticate(core_kernel_versioning_Repository $vcs, $login, $password)
{
$returnValue = (bool) false;
common_Logger::i(__FUNCTION__ . ' called on local directory', 'LOCALVCS');
$returnValue = is_dir($vcs->getPath());
return (bool) $returnValue;
}
开发者ID:nagyist,项目名称:generis,代码行数:17,代码来源:class.Repository.php
示例19: buildDirectory
public static function buildDirectory(core_kernel_classes_Resource $test, $lang, $relPath = '/', $depth = 1, $filters = array())
{
$baseDir = self::getBaseDir($test);
$path = $baseDir . ltrim($relPath, '/');
$data = array('path' => $relPath);
if ($depth > 0) {
$children = array();
if (is_dir($path)) {
foreach (new DirectoryIterator($path) as $fileinfo) {
if (!$fileinfo->isDot()) {
$subPath = rtrim($relPath, '/') . '/' . $fileinfo->getFilename();
if ($fileinfo->isDir()) {
$children[] = self::buildDirectory($test, $lang, $subPath, $depth - 1, $filters);
} else {
$file = self::buildFile($test, $lang, $subPath, $filters);
if (!is_null($file)) {
$children[] = $file;
}
}
}
}
} else {
common_Logger::w('"' . $path . '" is not a directory');
}
$data['children'] = $children;
} else {
$data['url'] = _url('files', 'TestContent', 'taoQtiTest', array('uri' => $test->getUri(), 'lang' => $lang, 'path' => $relPath));
}
return $data;
}
开发者ID:nagyist,项目名称:extension-tao-testqti,代码行数:30,代码来源:class.ResourceManager.php
示例20: __invoke
public function __invoke($params)
{
$persistenceId = count($params) > 0 ? reset($params) : 'default';
$persistence = $this->getServiceLocator()->get(\common_persistence_Manager::SERVICE_KEY)->getPersistenceById($persistenceId);
$schemaManager = $persistence->getDriver()->getSchemaManager();
$schema = $schemaManager->createSchema();
$fromSchema = clone $schema;
try {
$revisionTable = $schema->createtable(Storage::REVISION_TABLE_NAME);
$revisionTable->addOption('engine', 'MyISAM');
$revisionTable->addColumn(Storage::REVISION_RESOURCE, "string", array("notnull" => false, "length" => 255));
$revisionTable->addColumn(Storage::REVISION_VERSION, "string", array("notnull" => false, "length" => 50));
$revisionTable->addColumn(Storage::REVISION_USER, "string", array("notnull" => true, "length" => 255));
$revisionTable->addColumn(Storage::REVISION_CREATED, "string", array("notnull" => true));
$revisionTable->addColumn(Storage::REVISION_MESSAGE, "string", array("notnull" => true, "length" => 4000));
$revisionTable->setPrimaryKey(array(Storage::REVISION_RESOURCE, Storage::REVISION_VERSION));
$dataTable = $schema->createtable(Storage::DATA_TABLE_NAME);
$dataTable->addOption('engine', 'MyISAM');
$dataTable->addColumn(Storage::DATA_RESOURCE, "string", array("notnull" => false, "length" => 255));
$dataTable->addColumn(Storage::DATA_VERSION, "string", array("notnull" => false, "length" => 50));
$dataTable->addColumn(Storage::DATA_SUBJECT, "string", array("notnull" => true, "length" => 255));
$dataTable->addColumn(Storage::DATA_PREDICATE, "string", array("length" => 255));
// not compatible with oracle
$dataTable->addColumn(Storage::DATA_OBJECT, "text", array("default" => null, "notnull" => false));
$dataTable->addColumn(Storage::DATA_LANGUAGE, "string", array("length" => 50));
$dataTable->addForeignKeyConstraint($revisionTable, array(Storage::REVISION_RESOURCE, Storage::REVISION_VERSION), array(Storage::REVISION_RESOURCE, Storage::REVISION_VERSION));
} catch (SchemaException $e) {
\common_Logger::i('Database Schema already up to date.');
}
$queries = $persistence->getPlatform()->getMigrateSchemaSql($fromSchema, $schema);
foreach ($queries as $query) {
$persistence->exec($query);
}
}
开发者ID:oat-sa,项目名称:extension-tao-revision,代码行数:34,代码来源:CreateTables.php
注:本文中的common_Logger类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论