本文整理汇总了PHP中common_Logger::d方法的典型用法代码示例。如果您正苦于以下问题:PHP common_Logger::d方法的具体用法?PHP common_Logger::d怎么用?PHP common_Logger::d使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common_Logger
的用法示例。
在下文中一共展示了common_Logger::d方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: export
/**
* (non-PHPdoc)
* @see tao_models_classes_export_ExportHandler::export()
*/
public function export($formValues, $destination)
{
$file = null;
if (isset($formValues['filename']) === true) {
$instances = is_string($formValues['instances']) ? array($formValues['instances']) : $formValues['instances'];
if (count($instances) > 0) {
$fileName = $formValues['filename'] . '_' . time() . '.zip';
$path = tao_helpers_File::concat(array($destination, $fileName));
if (tao_helpers_File::securityCheck($path, true) === false) {
throw new common_Exception('Unauthorized file name for QTI Test ZIP archive.');
}
// Create a new ZIP archive to store data related to the QTI Test.
$zip = new ZipArchive();
if ($zip->open($path, ZipArchive::CREATE) !== true) {
throw new common_Exception("Unable to create ZIP archive for QTI Test at location '" . $path . "'.");
}
// Create an empty IMS Manifest as a basis.
$manifest = taoQtiTest_helpers_Utils::emptyImsManifest();
foreach ($instances as $instance) {
$testResource = new core_kernel_classes_Resource($instance);
$testExporter = new taoQtiTest_models_classes_export_QtiTestExporter($testResource, $zip, $manifest);
common_Logger::d('Export ' . $instance);
$testExporter->export();
}
$file = $path;
$zip->close();
} else {
common_Logger::w("No instance in form to export");
}
} else {
common_Logger::w("Missing filename for QTI Test export using Export Handler '" . __CLASS__ . "'.");
}
return $file;
}
示例3: isDeliveryExecutionAllowed
public function isDeliveryExecutionAllowed(core_kernel_classes_Resource $delivery, User $user)
{
$userUri = $user->getIdentifier();
if (is_null($delivery)) {
common_Logger::w("Attempt to start the compiled delivery " . $delivery->getUri() . " related to no delivery");
return false;
}
//first check the user is assigned
if (!taoDelivery_models_classes_AssignmentService::singleton()->isUserAssigned($delivery, $user)) {
common_Logger::w("User " . $userUri . " attempts to start the compiled delivery " . $delivery->getUri() . " he was not assigned to.");
return false;
}
$settings = $this->getDeliverySettings($delivery);
//check Tokens
$usedTokens = count(taoDelivery_models_classes_execution_ServiceProxy::singleton()->getUserExecutions($delivery, $userUri));
if ($settings[TAO_DELIVERY_MAXEXEC_PROP] != 0 and $usedTokens >= $settings[TAO_DELIVERY_MAXEXEC_PROP]) {
common_Logger::d("Attempt to start the compiled delivery " . $delivery->getUri() . "without tokens");
return false;
}
//check time
$startDate = date_create('@' . $settings[TAO_DELIVERY_START_PROP]);
$endDate = date_create('@' . $settings[TAO_DELIVERY_END_PROP]);
if (!$this->areWeInRange($startDate, $endDate)) {
common_Logger::d("Attempt to start the compiled delivery " . $delivery->getUri() . " at the wrong date");
return false;
}
return true;
}
示例4: 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;
}
示例5: testFileAppender
public function testFileAppender()
{
$tfile = $this->createFile();
$dfile = $this->createFile();
$efile = $this->createFile();
common_log_Dispatcher::singleton()->init(array(array('class' => 'SingleFileAppender', 'threshold' => common_Logger::TRACE_LEVEL, 'file' => $tfile), array('class' => 'SingleFileAppender', 'mask' => 2, 'file' => $dfile), array('class' => 'SingleFileAppender', 'threshold' => common_Logger::ERROR_LEVEL, 'file' => $efile)));
common_Logger::singleton()->enable();
common_Logger::t('message');
$this->assertEntriesInFile($tfile, 1);
$this->assertEntriesInFile($dfile, 0);
$this->assertEntriesInFile($efile, 0);
common_Logger::d('message');
$this->assertEntriesInFile($tfile, 2);
$this->assertEntriesInFile($dfile, 1);
$this->assertEntriesInFile($efile, 0);
common_Logger::e('message');
$this->assertEntriesInFile($tfile, 3);
$this->assertEntriesInFile($dfile, 1);
$this->assertEntriesInFile($efile, 1);
common_Logger::singleton()->disable();
common_Logger::d('message');
$this->assertEntriesInFile($tfile, 3);
$this->assertEntriesInFile($dfile, 1);
$this->assertEntriesInFile($efile, 1);
common_Logger::singleton()->restore();
common_Logger::d('message');
$this->assertEntriesInFile($tfile, 4);
$this->assertEntriesInFile($dfile, 2);
$this->assertEntriesInFile($efile, 1);
common_Logger::singleton()->restore();
}
示例6: run
public function run(Task $task)
{
\common_Logger::d('Running task ' . $task->getId());
$report = new \common_report_Report(\common_report_Report::TYPE_INFO, __('Running task %s', $task->getId()));
$queue = $this->getServiceLocator()->get(Queue::CONFIG_ID);
$queue->updateTaskStatus($task->getId(), Task::STATUS_RUNNING);
try {
$actionService = $this->getServiceLocator()->get(ActionService::SERVICE_ID);
$invocable = $task->getInvocable();
if (is_string($invocable)) {
$invocable = $actionService->resolve($task->getInvocable());
} else {
if ($invocable instanceof ServiceLocatorAwareInterface) {
$invocable->setServiceLocator($this->getServiceLocator());
}
}
$subReport = call_user_func($invocable, $task->getParameters());
$report->add($subReport);
} catch (\Exception $e) {
$message = 'Task ' . $task->getId() . ' failed. Error message: ' . $e->getMessage();
\common_Logger::e($message);
$report = new \common_report_Report(\common_report_Report::TYPE_ERROR, $message);
}
$queue->updateTaskStatus($task->getId(), Task::STATUS_FINISHED, $report);
return $report;
}
示例7: load
/**
* Load the extension.
*
* @access public
* @author Jerome Bogaerts, <jerome@taotesting.com>
* @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);
}
}
}
示例8: createModel
/**
* @author "Lionel Lecaque, <lionel@taotesting.com>"
* @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;
}
示例9: adminPermissions
/**
* Manage permissions
*/
protected function adminPermissions()
{
$resource = new \core_kernel_classes_Resource($this->getRequestParameter('id'));
$accessRights = AdminService::getUsersPermissions($resource->getUri());
$userList = $this->getUserList();
$roleList = $this->getRoleList();
$this->setData('privileges', PermissionProvider::getRightLabels());
$userData = array();
foreach (array_keys($accessRights) as $uri) {
if (isset($userList[$uri])) {
$userData[$uri] = array('label' => $userList[$uri], 'isRole' => false);
unset($userList[$uri]);
} elseif (isset($roleList[$uri])) {
$userData[$uri] = array('label' => $roleList[$uri], 'isRole' => true);
unset($roleList[$uri]);
} else {
\common_Logger::d('unknown user ' . $uri);
}
}
$this->setData('users', $userList);
$this->setData('roles', $roleList);
$this->setData('userPrivileges', $accessRights);
$this->setData('userData', $userData);
$this->setData('uri', $resource->getUri());
$this->setData('label', _dh($resource->getLabel()));
$this->setView('AdminAccessController/index.tpl');
}
示例10: uninstall
/**
* uninstall an extension
*
* @access public
* @author Jerome Bogaerts, <jerome@taotesting.com>
* @return boolean
*/
public function uninstall()
{
common_Logger::i('Uninstalling ' . $this->extension->getId(), 'UNINSTALL');
// uninstall possible
if (is_null($this->extension->getManifest()->getUninstallData())) {
throw new common_Exception('Problem uninstalling extension ' . $this->extension->getId() . ' : Uninstall not supported');
}
// installed?
if (!common_ext_ExtensionsManager::singleton()->isInstalled($this->extension->getId())) {
throw new common_Exception('Problem uninstalling extension ' . $this->extension->getId() . ' : Not installed');
}
// check dependcies
if (helpers_ExtensionHelper::isRequired($this->extension)) {
throw new common_Exception('Problem uninstalling extension ' . $this->extension->getId() . ' : Still required');
}
common_Logger::d('uninstall script for ' . $this->extension->getId());
$this->uninstallScripts();
// hook
$this->extendedUninstall();
common_Logger::d('unregister extension ' . $this->extension->getId());
$this->unregister();
// we purge the whole cache.
$cache = common_cache_FileCache::singleton();
$cache->purge();
common_Logger::i('Uninstalled ' . $this->extension->getId());
return true;
}
示例11: update
/**
*
* @author Lionel Lecaque, lionel@taotesting.com
* @param string $extName
* @param string $file
*/
public static function update($extName, $file)
{
$config = (require_once $file);
$ext = common_ext_ExtensionsManager::singleton()->getExtensionById($extName);
foreach ($config as $key => $value) {
common_Logger::d('Set config ' . $key . ' for extension ' . $extName);
$ext->setConfig($key, $value);
}
}
示例12: buildDiagramData
/**
* Builds a simple Diagram of the Process
*
* @access public
* @author Joel Bout, <joel.bout@tudor.lu>
* @param Resource process
* @return string
*/
public static function buildDiagramData(core_kernel_classes_Resource $process)
{
$returnValue = (string) '';
common_Logger::i("Building diagram for " . $process->getLabel());
$authoringService = wfAuthoring_models_classes_ProcessService::singleton();
$activityService = wfEngine_models_classes_ActivityService::singleton();
$connectorService = wfEngine_models_classes_ConnectorService::singleton();
$activityCardinalityService = wfEngine_models_classes_ActivityCardinalityService::singleton();
$activities = $authoringService->getActivitiesByProcess($process);
$todo = array();
foreach ($activities as $activity) {
if ($activityService->isInitial($activity)) {
$todo[] = $activity;
}
}
$currentLevel = 0;
$diagram = new wfAuthoring_models_classes_ProcessDiagram();
$done = array();
while (!empty($todo)) {
$nextLevel = array();
$posOnLevel = 0;
foreach ($todo as $item) {
$next = array();
if ($activityService->isActivity($item)) {
// add this activity
$diagram->addActivity($item, 54 + 200 * $posOnLevel + 10 * $currentLevel, 35 + 80 * $currentLevel);
$next = array_merge($next, $activityService->getNextConnectors($item));
common_Logger::d('Activity added ' . $item->getUri());
} elseif ($connectorService->isConnector($item)) {
// add this connector
$diagram->addConnector($item, 100 + 200 * $posOnLevel + 10 * $currentLevel, 40 + 80 * $currentLevel);
$next = array_merge($next, $connectorService->getNextActivities($item));
} else {
common_Logger::w('unexpected ressource in process ' . $item->getUri());
}
//replace cardinalities
foreach ($next as $key => $destination) {
if ($activityCardinalityService->isCardinality($destination)) {
// not represented on diagram
$next[$key] = $activityCardinalityService->getDestination($destination);
}
}
//add arrows
foreach ($next as $destination) {
$diagram->addArrow($item, $destination);
}
$posOnLevel++;
$nextLevel = array_merge($nextLevel, $next);
}
$done = array_merge($done, $todo);
$todo = array_diff($nextLevel, $done);
$currentLevel++;
}
$returnValue = $diagram->toJSON();
return (string) $returnValue;
}
示例13: connect
/**
* Connect to Dbal
*
* @param string $id
* @param array $params
* @return \Doctrine\DBAL\Connection;
*/
function connect($id, array $params)
{
common_Logger::d('Running Dbal Driver');
$params['driver'] = str_replace('dbal_', '', $params['driver']);
$config = new \Doctrine\DBAL\Configuration();
// $logger = new Doctrine\DBAL\Logging\EchoSQLLogger();
// $config->setSQLLogger($logger);
$this->connection = \Doctrine\DBAL\DriverManager::getConnection($params, $config);
return new common_persistence_SqlPersistence($params, $this);
}
示例14: getSchemaManager
/**
* (non-PHPdoc)
* @see common_persistence_sql_SchemaManager::getSchemaManager()
*/
public function getSchemaManager()
{
if ($this->schemaManager == null) {
common_Logger::d('init dbal connection to get SchemaMangager');
$config = new \Doctrine\DBAL\Configuration();
$params = $this->getDriver()->getParams();
$connection = \Doctrine\DBAL\DriverManager::getConnection($params, $config);
$this->schemaManager = $connection->getSchemaManager();
}
return $this->schemaManager;
}
示例15: __construct
public function __construct()
{
parent::__construct();
if ($this->hasRequestParameter('standalone') && $this->getRequestParameter('standalone')) {
tao_helpers_Context::load('STANDALONE_MODE');
$this->isStandAlone = true;
$this->setData('client_config_url', $this->getClientConfigUrl());
common_Logger::d('Standalone mode set');
} else {
$this->isStandAlone = false;
}
}