本文整理汇总了PHP中wfDebugLog函数的典型用法代码示例。如果您正苦于以下问题:PHP wfDebugLog函数的具体用法?PHP wfDebugLog怎么用?PHP wfDebugLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfDebugLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onSparkRender
/**
* @since 0.1
*
* @param mixed $input
* @param array $args
* @param Parser $parser
* @param PPFrame $frame
*/
public static function onSparkRender($input, array $args, Parser $parser, $frame = null)
{
global $wgVersion;
global $wgOut;
global $egSparkScriptJquery;
global $egSparkScriptJquerySpark;
static $loadedJs = false;
if (version_compare($wgVersion, '1.17', '<')) {
// We do not have resource loader
if (!$loadedJs) {
$wgOut->addScript('<script src="' . $egSparkScriptJquery . '" type="text/javascript"></script>');
wfDebugLog('spark', "AddScript:" . ' <script src="' . $egSparkScriptJquery . '" type="text/javascript"></script>');
//echo "AddScript:".' <script src="'.$egSparkScriptJquery.'" type="text/javascript"></script>';
$wgOut->addScript('<script src="' . $egSparkScriptJquerySpark . '" type="text/javascript"></script>');
wfDebugLog('spark', "AddScript:" . ' <script src="' . $egSparkScriptJquerySpark . '" type="text/javascript"></script>');
//echo "AddScript:".' <script src="'.$egSparkScriptJquerySpark.'" type="text/javascript"></script>';
$loadedJs = true;
}
} else {
// We have resource loader
// If we have resource loader
if (!$loadedJs) {
$parser->getOutput()->addModules('ext.spark');
$loadedJs = true;
}
}
$tag = new SparkTag($args, $input);
// PPFrame maybe not existing
return $tag->render($parser, $frame);
}
示例2: execute
function execute($par)
{
$this->getParams();
$html = '';
$error = false;
$renderedAds = array();
try {
$campaign = new AdCampaign($this->campaignName);
$ads = $campaign->getAds();
foreach ($ads as $ad) {
$renderedAds[] = Ad::fromName($ad['name'])->renderHtml();
}
} catch (MWException $e) {
wfDebugLog('Promoter', $e->getMessage());
$error = $e->getMessage();
}
if ($this->isPreview) {
$this->setHeaders();
if ($error) {
$html = "Exception {$error}.";
} else {
$html = '<div id="adPreview clearfix">';
foreach ($renderedAds as $ad) {
$html .= '<div class="col-sm-4">' . $ad . '</div>';
}
$html .= '</div>';
}
$this->getOutput()->addHTML($html);
} else {
$this->getOutput()->disable();
$this->sendHeaders();
print_r($renderedAds);
}
}
示例3: onSubmit
public function onSubmit(array $formData)
{
global $IP, $wgCreateWikiSQLfiles;
$DBname = $formData['dbname'];
$founderName = $formData['founder'];
$siteName = $formData['sitename'];
$language = $formData['language'];
$private = $formData['private'];
$reason = $formData['reason'];
$dbw = wfGetDB(DB_MASTER);
$farmerLogEntry = new ManualLogEntry('farmer', 'createwiki');
$farmerLogEntry->setPerformer($this->getUser());
$farmerLogEntry->setTarget($this->getTitle());
$farmerLogEntry->setComment($reason);
$farmerLogEntry->setParameters(array('4::wiki' => $DBname));
$farmerLogID = $farmerLogEntry->insert();
$farmerLogEntry->publish($farmerLogID);
$dbw->query('SET storage_engine=InnoDB;');
$dbw->query('CREATE DATABASE ' . $dbw->addIdentifierQuotes($DBname) . ';');
$dbw->selectDB($DBname);
foreach ($wgCreateWikiSQLfiles as $sqlfile) {
$dbw->sourceFile($sqlfile);
}
$this->writeToDBlist($DBname, $siteName, $language, $private);
$this->createMainPage($language);
$shcreateaccount = exec("/usr/bin/php " . "{$IP}/extensions/CentralAuth/maintenance/createLocalAccount.php " . wfEscapeShellArg($founderName) . " --wiki " . wfEscapeShellArg($DBname));
if (!strpos($shcreateaccount, 'created')) {
wfDebugLog('CreateWiki', 'Failed to create local account for founder. - error: ' . $shcreateaccount);
return wfMessage('createwiki-error-usernotcreated')->escaped();
}
$shpromoteaccount = exec("/usr/bin/php " . "{$IP}/maintenance/createAndPromote.php " . wfEscapeShellArg($founderName) . " --bureaucrat --sysop --force --wiki " . wfEscapeShellArg($DBname));
$this->getOutput()->addHTML('<div class="successbox">' . wfMessage('createwiki-success')->escaped() . '</div>');
return true;
}
示例4: doTransform
function doTransform($image, $dstPath, $dstUrl, $params, $flags = 0)
{
global $wgSVGConverters, $wgSVGConverter, $wgSVGConverterPath;
if (!$this->normaliseParams($image, $params)) {
return new TransformParameterError($params);
}
$clientWidth = $params['width'];
$clientHeight = $params['height'];
$physicalWidth = $params['physicalWidth'];
$physicalHeight = $params['physicalHeight'];
$srcPath = $image->getPath();
if ($flags & self::TRANSFORM_LATER) {
return new ThumbnailImage($image, $dstUrl, $clientWidth, $clientHeight, $dstPath);
}
if (!wfMkdirParents(dirname($dstPath))) {
return new MediaTransformError('thumbnail_error', $clientWidth, $clientHeight, wfMsg('thumbnail_dest_directory'));
}
$err = false;
if (isset($wgSVGConverters[$wgSVGConverter])) {
$cmd = str_replace(array('$path/', '$width', '$height', '$input', '$output'), array($wgSVGConverterPath ? wfEscapeShellArg("{$wgSVGConverterPath}/") : "", intval($physicalWidth), intval($physicalHeight), wfEscapeShellArg($srcPath), wfEscapeShellArg($dstPath)), $wgSVGConverters[$wgSVGConverter]) . " 2>&1";
wfProfileIn('rsvg');
wfDebug(__METHOD__ . ": {$cmd}\n");
$err = wfShellExec($cmd, $retval);
wfProfileOut('rsvg');
}
$removed = $this->removeBadFile($dstPath, $retval);
if ($retval != 0 || $removed) {
wfDebugLog('thumbnail', sprintf('thumbnail failed on %s: error %d "%s" from "%s"', wfHostname(), $retval, trim($err), $cmd));
return new MediaTransformError('thumbnail_error', $clientWidth, $clientHeight, $err);
} else {
return new ThumbnailImage($image, $dstUrl, $clientWidth, $clientHeight, $dstPath);
}
}
示例5: testSomething
public function testSomething()
{
// meaningless set of ids used for repeatability
$ids = array_map(array('Flow\\Model\\UUID', 'create'), array("s3z44zhp93j5vvc8", "s3z44zhqt7yt8220", "s46w00pmmw0otc0q", "s3qvc7cnor86wvb4", "s3qvc7bbcxr3f340", "s3gre9r27pobtg0n", "s3cdl3dfqf8brx18", "s3cdl3dhajnz43r0"));
// Use 2 repos with 2 caches, the one you insert with reads from cache
// the other reads from db due to different cache
$cache[] = new BufferedCache(new BufferedBagOStuff(new \HashBagOStuff()), 600);
$cache[] = new BufferedCache(new BufferedBagOStuff(new \HashBagOStuff()), 600);
$dbf = Container::get('db.factory');
$repo[] = new TreeRepository($dbf, $cache[0]);
$repo[] = new TreeRepository($dbf, $cache[1]);
// id0 as new root
wfDebugLog('Flow', "\n\n************** id0 as new root ************");
$repo[0]->insert($ids[0]);
$this->assertEquals(array($ids[0]), $repo[0]->findRootPath($ids[0]));
$this->assertEquals(array($ids[0]), $repo[1]->findRootPath($ids[0]));
// id1 as child of id0
wfDebugLog('Flow', "\n\n************** id1 as child of id0 ************");
$repo[0]->insert($ids[1], $ids[0]);
$this->assertEquals(array($ids[0], $ids[1]), $repo[0]->findRootPath($ids[1]));
$this->assertEquals(array($ids[0], $ids[1]), $repo[1]->findRootPath($ids[1]));
// id2 as child of id0
wfDebugLog('Flow', "\n\n************** id2 as child of id0 ************");
$repo[0]->insert($ids[2], $ids[0]);
$this->assertEquals(array($ids[0], $ids[2]), $repo[0]->findRootPath($ids[2]));
$this->assertEquals(array($ids[0], $ids[2]), $repo[1]->findRootPath($ids[2]));
// id3 as child of id1
wfDebugLog('Flow', "\n\n************** id3 as child of id1 ************");
$repo[0]->insert($ids[3], $ids[1]);
$this->assertEquals(array($ids[0], $ids[1], $ids[3]), $repo[0]->findRootPath($ids[3]));
$this->assertEquals(array($ids[0], $ids[1], $ids[3]), $repo[1]->findRootPath($ids[3]));
}
示例6: parse
public static function parse($parser)
{
$parser->disableCache();
$title = $parser->getTitle()->getText();
$titleArray = explode(':', $title);
$ontAbbr = $titleArray[0];
$termID = str_replace(' ', '_', $titleArray[1]);
$ontology = new OntologyData($ontAbbr);
$sql = new SQLStore(wfGetDB(DB_SLAVE));
$magics = $sql->getObjectMagicWords($ontAbbr);
$objects = array();
foreach ($magics as $magic => $object) {
$objects[$magic] = $object['iri'];
$objects[$object['iri']] = $object['iri'];
$objects[$object['id']] = $object['iri'];
}
$operations = $GLOBALS['okwRDFConfig']['restriction']['operation'];
$types = $GLOBALS['okwRDFConfig']['restriction']['type'];
$params = array();
for ($i = 2; $i < func_num_args(); $i++) {
$params[] = func_get_arg($i);
}
list($options, $valids, $invalids) = self::extractAxiom($params, $ontology, $objects, $operations, $types, false);
$axioms = array();
foreach ($valids as $index => $value) {
$axioms[] = $value['text'];
$GLOBALS['okwCache']['axiom'][$value['type']][] = $value['text'];
}
wfDebugLog('OntoKiWi', sprintf('OKW\\Parser\\AxiomParser: parsed axiom {%s} for [[%s]]', join(';', $axioms), $title));
wfDebugLog('OntoKiWi', '[caches] OKW\\Parser\\AxiomParser: axiom');
return array('', 'noparse' => true);
}
示例7: updateData
/**
* Does update. First deletes, then inserts.
* @param $data
*/
function updateData(SMWSemanticData $data)
{
$export = SMWExporter::makeExportData($data);
$sparqlDeleteText = "";
$sparqlUpdateText = "INSERT DATA {\n";
// let other extensions add additional RDF data for this page (i.e. Semantic Internal Objects)
//this code is based on the modifications made on SemanticMediaWiki/includes/export/SMW_OWLExport.php
$additionalDataArray = array();
$fullexport = true;
$backlinks = false;
wfRunHooks('smwAddToRDFExport', array($data->getSubject()->getTitle(), &$additionalDataArray, $fullexport, $backlinks));
// this writes update text for each of the Semantic Internal Objects
foreach ($additionalDataArray as $additionalData) {
$subject_uri = SMWExporter::expandURI($additionalData->getSubject()->getName());
// remove subject from triple store
$sparqlDeleteText .= $this->writeDeleteText($subject_uri);
//add new data associated with internal objects
$sparqlUpdateText .= $this->writeUpdateText($additionalData->getTripleList());
}
$subject_uri = SMWExporter::expandURI($export->getSubject()->getName());
// remove subject from triple store
$sparqlDeleteText .= $this->writeDeleteText($subject_uri);
$triple_list = $export->getTripleList();
$sparqlUpdateText .= $this->writeUpdateText($triple_list);
$sparqlUpdateText .= "}";
//delete the old triples
wfDebugLog('SPARQL_LOG', "#===DELETE===\n" . $sparqlDeleteText);
$response = $this->do_joseki_post($sparqlDeleteText);
//insert the new triples
wfDebugLog('SPARQL_LOG', "#===INSERT===\n" . $sparqlUpdateText);
$response = $this->do_joseki_post($sparqlUpdateText);
//can the delete and insert statements be combined, or will this lead to concurrency issues?
return parent::updateData($data);
}
示例8: parse
public static function parse($parser)
{
$parser->disableCache();
$title = $parser->getTitle()->getText();
$titleArray = explode(':', $title);
$ontAbbr = $titleArray[0];
$termID = str_replace(' ', '_', $titleArray[1]);
$ontology = new OntologyData($ontAbbr);
$term = $ontology->parseTermByID($termID);
$params = array();
for ($i = 2; $i < func_num_args(); $i++) {
$params[] = func_get_arg($i);
}
list($options, $valids, $invalids) = self::extractSupClass($params, $ontology);
$pathType = $GLOBALS['okwHierarchyConfig']['pathType'];
$supClasses = array();
if (!empty($valids)) {
foreach ($valids as $index => $value) {
$supClasses[] = $value['iri'];
$hierarchy = $ontology->parseTermHierarchy($term, $pathType, $value['iri']);
if ($value['iri'] == $GLOBALS['okwRDFConfig']['Thing']) {
$GLOBALS['okwCache']['hierarchy'][$index] = $hierarchy;
} else {
foreach ($hierarchy as $path) {
if (!empty($path['path'])) {
$GLOBALS['okwCache']['hierarchy'][$index] = $hierarchy;
}
}
}
}
}
wfDebugLog('OntoKiWi', sprintf('OKW\\Parser\\HierarchyParser: parsed hierarchy {%s} for [[%s]]', join(';', $supClasses), $title));
wfDebugLog('OntoKiWi', '[caches] OKW\\Parser\\HierarchyParser: hierarchy');
return array('', 'noparse' => true);
}
示例9: prefetch
/**
* Marks the given entity ids for prefetching.
*
* @param EntityId[] $entityIds
*/
public function prefetch(array $entityIds)
{
$entityIdCount = count($entityIds);
if ($entityIdCount > $this->maxCacheKeys) {
// Ouch... fetching everything wouldn't fit into the cache, thus
// other functions might not find what they're looking for.
// Create a new, large enough MapCacheLRU to mitigate this.
$this->cache = new MapCacheLRU($entityIdCount + 1);
$this->maxCacheKeys = $entityIdCount + 1;
wfDebugLog('PrefetchingWikiPageEntityMetaDataAccessor', "Needed to create a new MapCacheLRU instance for {$entityIdCount} entities.");
}
if ($entityIdCount + count($this->toFetch) > $this->maxCacheKeys) {
// Fetching everything would exceed the capacity of the cache,
// thus discard all older entity ids as we can safely ignore these.
$this->toFetch = array();
}
foreach ($entityIds as $entityId) {
$idSerialization = $entityId->getSerialization();
if ($this->cache->has($idSerialization)) {
// Make sure the entities we already know about are not going
// to be purged, by requesting them.
$this->cache->get($idSerialization);
} else {
$this->toFetch[$idSerialization] = $entityId;
}
}
}
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:32,代码来源:PrefetchingWikiPageEntityMetaDataAccessor.php
示例10: renderGallery
/**
* Parser hook handler for {{#articletype}}
*
* @param Parser $parser : Parser instance available to render
* wikitext into html, or parser methods.
*
* @return string: HTML to insert in the page.
*/
public static function renderGallery($input, array $args, Parser $parser, PPFrame $frame)
{
$parser->getOutput()->addModules('ext.promoter.gallery');
$pageName = $parser->getTitle()->getText();
try {
$renderedAds = array();
$adChooser = new AdChooser($pageName, !$parser->getUser()->isLoggedIn());
$ads = $adChooser->getAds();
foreach ($ads as $ad) {
$renderedAds[] = Ad::fromName($ad['name'])->renderHtml();
}
} catch (AdCampaignExistenceException $e) {
wfDebugLog('Promoter', $e->getMessage());
//@todo i18n
return '<span class="error">No campaign for this page</span>';
} catch (MWException $e) {
wfDebugLog('Promoter', $e->getMessage());
return '<span class="error text-danger">An error occurred [' . $e->getMessage() . ']</span>';
}
$html = '<div class="promotion-gallery hidden hidden-print">' . '<h5 class="sr-only">זוהי גלריה המקדמת ערכים שונים באתר.</h5>' . '<div class="gallery-controls">' . '<span class="sr-only">בכל רגע מוצגות 3 ידיעות בגלריה. ניתן להציג ידיעה נוספת או לחזור לאחור באמצעות הכפתורים הבאים, או באמצעות מקשי החיצים כאשר הפוקוס הוא על הגלריה</span>' . '<a href="#" class="owl-prev"><span class="fa fa-chevron-right fa-lg" title="הקודם"></span><span class="sr-only">הצגת הידיעה הקודמת</span></a>' . '<a href="#" class="owl-next"><span class="fa fa-chevron-left fa-lg" title="הבא"></span><span class="sr-only">הצגת הידיעה הבאה</span></a>' . '</div>';
if ($args['title']) {
$html .= '<div class="header">' . $args['title'] . '</div>';
}
$html .= '<div class="owl-carousel clearfix" tabindex="0">' . implode('', $renderedAds) . '</div>' . '</div>';
return $html;
}
示例11: ubLog
/**
* Set $wgDebugLogGroups['UploadBlacklist'] to direct logging to a particular
* file instead of the debug log.
*
* @param string $action
* @param string $hash
* @param string $saveName
* @param string $tempName
* @access private
*/
function ubLog( $action, $hash, $saveName, $tempName ) {
global $wgUser;
$user = $wgUser->getName();
$ip = wfGetIP();
$ts = wfTimestamp( TS_DB );
wfDebugLog( 'UploadBlacklist', "$ts $action [$hash] name:$saveName file:$tempName user:$user ip:$ip" );
}
示例12: parse
public static function parse($parser)
{
$parser->disableCache();
$title = $parser->getTitle()->getText();
$titleArray = explode(':', $title);
$ontAbbr = $titleArray[0];
$sql = new SQLStore(wfGetDB(DB_SLAVE));
$magic = $sql->getAnnotationMagicWords($ontAbbr);
$params = array();
for ($i = 2; $i < func_num_args(); $i++) {
$params[] = func_get_arg($i);
}
list($options, $valids, $invalids) = self::extractAnnotation($params, $magic);
$annotations = array();
$cache =& $GLOBALS['okwCache']['annotation'];
foreach ($valids as $index => $annotation) {
$annotations[] = $annotation['iri'];
if (array_key_exists($annotation['iri'], $cache)) {
if ($annotation['type'] == 'unique') {
$cache[$annotation['iri']]['value'] = $annotation['value'];
} else {
$cache[$annotation['iri']]['value'] = array_merge($annotation['value'], $cache[$annotation['iri']]['value']);
}
} else {
$cache[$annotation['iri']]['name'] = $annotation['name'];
$cache[$annotation['iri']]['value'] = $annotation['value'];
}
}
wfDebugLog('OntoKiWi', sprintf('OKW\\Parser\\AnnotationParser: parsed annotation {%s} for [[%s]]', join(';', $annotations), $title));
wfDebugLog('OntoKiWi', '[caches] OKW\\Parser\\AnnotationParser: annotation');
return array('', 'noparse' => true);
}
示例13: getInlineScript
/**
* Get contents of a javascript file for inline use.
*
* Roughly based MediaWiki core methods:
* - ResourceLoader::filter()
* - ResourceLoaderFileModule::readScriptFiles()
*
* @param string $name Path to file relative to /modules/inline/
* @return string Minified script
* @throws Exception If file doesn't exist
*/
protected static function getInlineScript($name)
{
// Get file
$filePath = __DIR__ . '/../../modules/inline/' . $name;
if (!file_exists($filePath)) {
throw new Exception(__METHOD__ . ": file not found: \"{$filePath}\"");
}
$contents = file_get_contents($filePath);
// Try minified from cache
$key = wfMemcKey('centralauth', 'minify-js', md5($contents));
$cache = wfGetCache(CACHE_ANYTHING);
$cacheEntry = $cache->get($key);
if (is_string($cacheEntry)) {
return $cacheEntry;
}
// Compute new value
$result = '';
try {
$result = JavaScriptMinifier::minify($contents) . "\n/* cache key: {$key} */";
$cache->set($key, $result);
} catch (Exception $e) {
MWExceptionHandler::logException($e);
wfDebugLog('CentralAuth', __METHOD__ . ": minification failed for {$name}: {$e}");
$result = ResourceLoader::formatException($e) . "\n" . $contents;
}
return $result;
}
示例14: wmfGetSwiftThumbContainer
/**
* Get the Swift thumbnail container for this wiki.
*
* @param $site string
* @param $lang string
* @param $relPath string Path relative to container
* @return CF_Container|null
*/
function wmfGetSwiftThumbContainer($site, $lang, $relPath)
{
global $wmfSwiftConfig;
// from PrivateSettings.php
$auth = new CF_Authentication($wmfSwiftConfig['user'], $wmfSwiftConfig['key'], NULL, $wmfSwiftConfig['authUrl']);
try {
$auth->authenticate();
} catch (Exception $e) {
wfDebugLog('swiftThumb', "Could not establish a connection to Swift.");
return null;
}
$conn = new CF_Connection($auth);
$wikiId = "{$site}-{$lang}";
// Get the full swift container name, including any shard suffix
$name = "{$wikiId}-local-thumb";
if (in_array($wikiId, array('wikipedia-commons', 'wikipedia-en'))) {
// Code stolen from FileBackend::getContainerShard()
if (preg_match("!^(?:[^/]{2,}/)*[0-9a-f]/(?P<shard>[0-9a-f]{2})(?:/|\$)!", $relPath, $m)) {
$name .= '.' . $m['shard'];
} else {
throw new MWException("Can't determine shard of path '{$relPath}' for '{$wikiId}'.");
}
}
try {
$container = $conn->get_container($name);
} catch (NoSuchContainerException $e) {
// container not created yet
$container = null;
wfDebugLog('swiftThumb', "Could not access `{$name}`; container does not exist.");
}
return $container;
}
示例15: onArticleDeleteComplete
static function onArticleDeleteComplete(&$article, &$user, $reason, $id)
{
$title = $article->getTitle();
if ($title->getNamespace() != NS_LQT_THREAD) {
return true;
}
$threads = Threads::where(array('thread_root' => $id));
if (!count($threads)) {
wfDebugLog('LiquidThreads', __METHOD__ . ": no threads with root {$id}, ignoring...\n");
return true;
}
$thread = array_pop($threads);
// Mark the thread as deleted
$thread->delete($reason);
// Avoid orphaning subthreads, update their parentage.
if ($thread->replies() && $thread->isTopmostThread()) {
$reason = wfMsg('lqt-delete-parent-deleted', $reason);
self::recursivelyDeleteReplies($thread, $reason);
global $wgOut;
$wgOut->addWikiMsg('lqt-delete-replies-done');
} elseif ($thread->replies()) {
foreach ($thread->replies() as $reply) {
$reply->setSuperthread($thread->superthread());
$reply->save();
}
}
// Synchronise the first 500 threads, in reverse order by thread id. If
// there are more threads to synchronise, the job queue will take over.
Threads::synchroniseArticleData($article, 500, 'cascade');
return true;
}