Extension talk:Bibwiki

From MediaWiki.org
Jump to navigation Jump to search

Take also a look at the forum.

General discussion[edit]

...

Feature requests[edit]

If a bib item has a URL field, could you make the extension print out a link to that URL in the references section? That would be very useful for me! This extension is great, by the way.

Convert to semantical template[edit]

I really like Bibwiki. Now I want to be able to use the properties stored in the .bib file as semantic properties. So just a template for an article, with author etc. as fields. Can this be done automatically? I could write a script of myself, if I get some pointers, please let me know. Thanks a lot in advance! --FrankLeone 21:44, 16 March 2010 (UTC)

Bugs[edit]

Getting an error under MW 1.15[edit]

When I install as advertised no page on my Wiki will load. I have to comment out the
require_once("$IP/extensions/Bibwiki/Bibwiki.php"); line within LocalSettings.php to view any page. (the require_once("$IP/extensions/Bibwiki/BibCite.php"); is fine)
I do not see an errors appear. HELP, I REALLY NEED BIBTEX!


Got a problem that seems related. In my case the Specialpage:Bibliography opens, but it will not open any other page linked from there, like filtered list of articles, the next articles or any other view of the bibliography.

If you're getting "Cannot redeclare" PHP errors as I was, open up your LocalSettings.php. Change any include statement that you find to include_once. Similarly, change any require statement that you find to require_once. After doing this, Bibwiki worked fine for me. Previously, nothing was working properly. The reason is that Bibwiki has a line that includes LocalSettings.php. If any extensions loaded in LocalSettings.php are loaded with include or require (rather than include_once or require_once, respectively), then they will be included again, which will produce errors. 99.249.52.196 10:16, 18 January 2010 (UTC)

Getting error under MW 1.11[edit]

Invalid argument supplied for foreach() in /my/server/path/installation/extensions/Bibwiki/Bibwiki.body.php on line 4161

Nonetheless, it appears to work, namely is adding to the bib file. Got this when I tried to add a URL entry. Something about $wgTitleLinkTags, which is a global, but is it to be set in the settings file or somewhere else? --Jeffmcneill 00:50, 5 November 2007 (UTC)


Version: Mediawiki 1.10.0[edit]

We followed the http://www.plaschg.net/bibwiki/Main/Configuration as posted but we got an error with the message "Fatal error: Call to a member function read() on a non-object in C:\wamp\www\mediawiki-1.10.0\extensions\Bibwiki\Bibwiki.php on line 3880"

I had the same error with MV 1.10, you can see it in http://www.estigmergia.net/wiki/Especial:Bibliography. I also have the notification "Error: Opening file failed" in that page... --Esenabre 17:55, 8 June 2007 (UTC)

the problem results from a failed read access to $wgBibPath. I guess this is a configuration problem (access rights, PHP configuration etc.). The code which raises the error is:
   ...
   $d = dir($wgBibPath);     # <--- this failes
   while (false !== ($f = $d->read())) {
       if (preg_match('/\.bib$/',$f)) {
   ...
-- Wplaschg 09:37, 11 June 2007 (UTC)

Can't get source script[edit]

Can you maybe paste the script(s) here or nearby? Access to the homepage URL timed out. Hoogs 02:41, 12 July 2007 (UTC)

Same problem for me. The server is not accessable. Is there a mirror or something? --StefanGrossmann 12:16, 15 January 2008 (UTC)

Problem with My Configuration?![edit]

I have followed the installation instructions and keep getting the following error when I try to load the wiki:

Warning: require_once(extensions/Bibwiki/Bibwiki.php) [function.require-once]: failed to open stream: Permission denied in /usr/local/apache2/htdocs/wiki/LocalSettings.php on line 167

Fatal error: require_once() [function.require]: Failed opening required 'extensions/Bibwiki/Bibwiki.php' (include_path='/usr/local/apache2/htdocs/wiki:/usr/local/apache2/htdocs/wiki/includes:/usr/local/apache2/htdocs/wiki/languages:.:/usr/local/php/lib/php') in /usr/local/apache2/htdocs/wiki/LocalSettings.php on line 167

I have installed several other extensions without any trouble. I tried shutting the other extensions off to see if they were clobbering each other, but the error remained. I am using MW 1.11.0. I keep thinking that I must have missed something in my configuration, but I have gone over the instructions repeatedly and cannot figure out what it is I missed. Any help would be greatly appreciated.

--rowenrye 00:44, 31 January 2008 (UTC)

Do I feel dumb or what? Somehow the permissions on my Bibwiki folder were not set properly. I just did chmod 755 and everything works fine. Sorry...

--rowenrye 05:43, 31 January 2008 (UTC)

Persistent links to amazon.de Despite Changing Settings to amazon.com[edit]

I have gone into Bibwiki.body.php and edited the wgAmazonURL value at line 1089 changing

'wgAmazonURL' => 'amazon.de',

to

'wgAmazonURL' => 'amazon.com',

I have also tried allowing the value to be blank, and relying on the statement below:

if (empty($wgAmazonURL)) $wgAmazonURL = "amazon.com";

Despite this, my Amazon links on my Special:Bibliography page persist as amazon.de links. I cannot find any other reference to amazon.de in the Bibwiki files.

In my wiki, I am writing reviews of various books and would like to have the Amazon.com link available automatically for reference as well. I was hoping to use Bibwiki's Amazon link, but I have been unable to change its behavior such that amazon.com is the link that is generated when I look at the bibliography. Please advise. --rowenrye 23:00, 6 February 2008 (UTC)

$wgAmazonURL defines the URL from which Bibwiki *imports* bibliographic data. To change the link to Amazon next to an ISBN, edit the variable $wgISBNLinkTags in the library settings file that you use (default for the english language: libs/Library-US-Washington--LoC.php). You can change the library settings in the Bibwiki preferences. Thanks for the hint: I'll change the link from 'amzon.de' to 'amazon.com' in 'Library-US-Washington--LoC.php' because it doesn't make much sense there. -Wplaschg
Excellent. I had thought $wgAmazonURL was just for the imports, but I could not figure out where the link was being set. I thought I had searched for amazon.de in all the files in the folder, but apparently my searching skills are not as great as I had believed. Your fix worked perfectly. --rowenrye 19:32, 8 February 2008 (UTC)

BibWiki and Skin not Playing Nice Together[edit]

I am very happy with BibWiki and getting happier all the time. One of my (private but someday to be semi-public) wikis is for a nascent education company and is very heavy on reviews and discussions of books. Having a bibliographic extension through which to run all the pages is fantastically helpful. However, I have an aesthetic concern.

I am currently using the skin gumax 3.3. When I load Special:Bibliography the skin does not wrap around it. Instead I just get an old fashioned dull as dishwater web page. All the links are there but the skin is not. I tried switching to Monobook, with identical results. Is this a problem with the skin or a special challenge presented by BibWiki, or am I missing something in my settings? Do I need to use the special skin (BibWikiMonobook) you created in order to get an aesthetically pleasing view of the BibWiki page?

I had wondered if there might be something going that is related to the following statement I find when I view source:

var stylepath = false;

which is as opposed to

var stylepath = "/wiki/skins";

which I see on pages that are working aesthetically. I confess to being a bit of a neophyte here and really have no idea how to fix this. Thanks.

P.S. (directed to Wolfgang) Would you prefer further questions regarding BibWiki be directed to your forum, or is this a good place to post them? --rowenrye 19:53, 8 February 2008 (UTC)

Can you send me or post a screenshot? I've installed gumax and the skin works rather fine for me (screenshot) though I have to mention that the toolbox is missing. You can use both the forum and this page; --Wplaschg 08:39, 14 February 2008 (UTC)
Here is a screenshot of the 'broken' page. I am at a bit of a loss. I had wondered if it might be a permissions issues at play, but I am not sure how to go about diagnosing that. --rowenrye 21:28, 14 February 2008 (UTC)


Errors[edit]

After following these directions, and clicking the Bibliography extension on the special page, the page is blank. WikiMedia-1.12 on RHEL 5.1. 01:41, 7 August 2008 70.62.182.162

Blank Page[edit]

Followed the directions.

Most of my wiki works as normal.

These are blank:

  • Special:Specialpages
  • Special:Bibliography


RHEL 5, MW 1.12, PHP 5.1.6

Notice: Undefined Variable in LocalSettings.php[edit]

After copying in extension/Bibwiki/, adding the two lines in LocalSettings.php, I browse to Special:Bibliography and get the following notifications at the top of the page:

Notice: Undefined variable: wgCommandLineMode in C:\Program Files\EasyPHP\www\gettierology\LocalSettings.php on line 30
Notice: Undefined variable: wgCacheEpoch in C:\Program Files\EasyPHP\www\gettierology\LocalSettings.php on line 119
Notice: Undefined variable: wgUploadDirectory in C:\Program Files\EasyPHP\www\gettierology\extensions\Bibwiki\BibwikiSettings.php on line 113

Still I can generate the BibSettings.php file normally; and when it's done I can see my bibliography. But the Special:Bibliography page is still prefixed with about a hundred notifications like the ones above.

Details of the bug on the Bibwiki forum. (EasyPhp sous WinXp: Apache 2.2.3, Php 5.2, MW 1.13.1, Bibwiki 0.99d.)

It seems adding the two "require_once" lines to LocalSettings is sufficient to generate this error. Yet the variables in questions are defined in LocalSettings itself.

PHP Notice: Undefined variable: wgBibPath[edit]

At lines 116 and 404 of Bibwiki-0.99e-rc1/Bibwiki.i18n.php, there's an unescaped $wgBibPath reference. I believe it was intended to be escaped like the other occurrences in this same file.

I believe this comment relates to the same problem, so I've taken the liberty to move it here (if it doesn't, feel free to move it back). Related discussions at http://www.plaschg.net/bibwiki are here: [1], [2], [3]. Now that bibwiki is discontinued, I'm afraid no solution will offer itself anytime soon. Cavila 12:57, 20 August 2010 (UTC)

Simple Fix[edit]

BibwikiSettings.php references $wgUploadDirectory for defining $wgBookCoverDirectory. So the most simple fix for single wiki's is to define $wgBookCoverDirectory explicitely (like "/var/www/yourwikipath/images").

bibreferences does not render for anonymous....[edit]

Hi, Tried the extension on MW 1.13, and it works great - however there is one glitch, and I'm not sure if it is intended. When I am logged in as user Admin, I place bibreferences tag along with a reference to the bib database, and it shows nicely; however, if I have activated in LocalSettings.php:

$wgGroupPermissions['*']['edit'] = false; # (which changes the "edit" button to "view source" for anonymous / not logged in viewing)

.. then as soon as I log off and go back to being anonymous, then bibreferences doesn't display, although the reference is rendered... Removing the above line seems to fix the problem for me..

A: Here's a fix -- or rather: a workaround. In BibCite.php, modify the linkRef function as follows:

		function linkRef( $key, $count = null, $label = null ) {
			global $wgContLang;

			$saveRefs = $this->mRefs;
			$result = 
				$this->parse(
					wfMsgForContentNoTrans(
						'bibcite_reference_link',
						$this->refKey( $key, $count ),
						$this->referencesKey( $key ),
						$wgContLang->formatNum( is_null( $label ) ? ++$this->mOutCnt : $label )
					)
				);
			$this->mRefs = $saveRefs;
			return $result;
		}

Basically, the calls to the MW parser inside BibCite::parse() clear the object's mRefs array when the user does not have edit privileges. I can't see why that would happen, and it may well be a PHP bug, but the above will save the references before calling the parser and then restore them afterwards. Trohlfing 21:46, 25 February 2010 (UTC)

Bibwiki unable to parse Bibtex entries correctly (MW1.16)[edit]

The problem arises using Medawiki 1.16, PHP 5.26. Bibwiki is unable to parse the different values within the Bibtex-Entries and interprets the whole entry string as the author's name. I found out that this caused by the function parseFields($oldString) in Bibitem.php. This function is supposed to read in all the Bibtex-values within one single Bibtex-entry, but fails. Obviously this is due the regular expression /=/ being evaluated greedy (so "a = b, c = d, e = f" is actually matched by "a" = "b, c = d, e = f"). Because that function is coded unnecessarily complicated, it was easier to replace it by a much simpler one. Code:

       function parseFields($oldString)
       {
               // 03/05/2005 G. Gardey. Do not remove all occurences, juste one
               // * correctly parse an entry ended by: somefield = {aValue}}
               $oldString = trim($oldString);
               $lg = strlen($oldString);
               if($oldString[$lg-1] == "}" || $oldString[$lg-1] == ")" || $oldString[$lg-1] == ",")
                       $oldString = substr($oldString,0,$lg-1);
               // $oldString = rtrim($oldString, "}),");
               $entries = array();
               $success = preg_match_all("/(.*)\s*=\s*[\{\(](.*)[\}\)]\s*,/U", $oldString, $entries);
               $i = 0;
               foreach( $entries[1] as $key ) {
                       $this->mKeys[$i] = strtolower(trim($key));
                       $i++;
               }
               $i = 0;
               foreach( $entries[2] as $value) {
                       $this->mOrigValues[$i] = '{' . $value . '}';
                       $value = preg_replace('/\s+/U', " ", $value);
                       $this->mReplacedValues[$i] = $value;
                       $this->mValues[$i] = preg_replace('/[\{\}\(\)]/', , $value);
                       $i++;
               }
               return;
        }

Please note: This version of the function is unable at the moment to recognize strings (using bibtex @string-syntax)

--80.254.148.123 08:09, 8 December 2010 (UTC)

Blank page (php crash) in Bibliography view[edit]

For large bib entries, Bibliography view causes php to crash ("exit signal Segmentation fault (11)"), resulting in a blank page (no html code transmitted). The crash is caused by the function "bwIsUtf8" in Misc.php. I have no idea why this function causes a crash, but it does. As a quick fix, I have commented out the call from function "bwToUtf8", which seems to fix the problem.

 function bwToUtf8($string) {
       #if (!bwIsUtf8($string))
               return utf8_encode($string);
       return $string;
 }

CiteError9 for non-lowercase bib filenames[edit]

The problem arises for bib filenames using non lower-case characters. The lookup in BibCite.php currently lowers all characters in the bib filename. So here's a fix

   $key = $bibfile->getName() . "/" . strtolower(trim($rv["key"]));

Fatal error: Allowed memory size exceeded[edit]

I got this error when I wanted to save my changes for a wiki article containing Bibwiki references. I think it has something to do with the excessive inclusion of BibwikiSettings.php in Bibfile.php. In every method of that class, there's an include-statement for BibwikiSettings.php. I could resolve the problem by substituting each "include" by "include_once". Dunno if this has any serious side effects, I just made the change and hadn't have time yet to test it further. --Fabian Hachenberg 13:06, 15 December 2010 (UTC)

A couple of unnecessary warnings[edit]

In Bibwiki.body.php, in line 3021 uninitialized array entries are increased. Replace this by

if(array_key_exists($key, $keycounter))
   $keycounter[$key]++; 
else
   $keycounter[$key]=0;

In Misc.php in line 567, it is assumed that the middlename entry was initialized. Replace this by

if(array_key_exists("middlename", $rv))
   $rv["middlename_simplified"] = bwDiacriticsSimplify($rv["middlename"]);
else
   $rv["middlename_simplified"] = "";

--Fabian Hachenberg 13:06, 15 December 2010 (UTC)