Commit [r1393] Maximize Restore History

More changes from Thibault:

- Add old-style mysql functions to connect to the database (enabled by default, PDO is now optional)
- Try alternative tag type if first search returned no match
- Update internationalization file to latest mediawiki standards (json format, seems to be backwards compatible)
- Option to get citation (for link/Cite output modes) from show.php (thanks for the pointer there!). This is not a replacement for the database request, but just a way to render a citation. To replace the database request, we'd need a parser as you mentioned. This may be something we can work on in the future if needed.

karnesky 2014-04-18

added /branches/bleeding-edge/contrib/mediawiki/i18n/en.json
removed /branches/bleeding-edge/contrib/mediawiki/Refbase.Renderer.php
changed /branches/bleeding-edge/contrib/mediawiki/README
changed /branches/bleeding-edge/contrib/mediawiki/Refbase.php
changed /branches/bleeding-edge/contrib/mediawiki/Refbase.Hooks.php
changed /branches/bleeding-edge/contrib/mediawiki/include/Refbase.Renderer.Link.php
changed /branches/bleeding-edge/contrib/mediawiki/include/Refbase.Renderer.Cite.php
changed /branches/bleeding-edge/contrib/mediawiki/include/Refbase.CitationCreator.php
changed /branches/bleeding-edge/contrib/mediawiki/include/Refbase.Connector.php
changed /branches/bleeding-edge/contrib/mediawiki/include/Refbase.Renderer.CitationTemplate.php
changed /branches/bleeding-edge/contrib/mediawiki/Refbase.i18n.php
copied /branches/bleeding-edge/contrib/mediawiki/Refbase.Connector.php -> /branches/bleeding-edge/contrib/mediawiki/i18n/qqq.json
/branches/bleeding-edge/contrib/mediawiki/i18n/en.json Diff Switch to side-by-side view
Loading...
/branches/bleeding-edge/contrib/mediawiki/README Diff Switch to side-by-side view
Loading...
/branches/bleeding-edge/contrib/mediawiki/Refbase.php Diff Switch to side-by-side view
Loading...
/branches/bleeding-edge/contrib/mediawiki/Refbase.Hooks.php Diff Switch to side-by-side view
Loading...
/branches/bleeding-edge/contrib/mediawiki/include/Refbase.Renderer.Link.php Diff Switch to side-by-side view
Loading...
/branches/bleeding-edge/contrib/mediawiki/include/Refbase.Renderer.Cite.php Diff Switch to side-by-side view
Loading...
/branches/bleeding-edge/contrib/mediawiki/include/Refbase.CitationCreator.php Diff Switch to side-by-side view
Loading...
/branches/bleeding-edge/contrib/mediawiki/include/Refbase.Connector.php Diff Switch to side-by-side view
Loading...
/branches/bleeding-edge/contrib/mediawiki/include/Refbase.Renderer.CitationTemplate.php Diff Switch to side-by-side view
Loading...
/branches/bleeding-edge/contrib/mediawiki/Refbase.i18n.php Diff Switch to side-by-side view
Loading...
/branches/bleeding-edge/contrib/mediawiki/Refbase.Connector.php to /branches/bleeding-edge/contrib/mediawiki/i18n/qqq.json
--- a/branches/bleeding-edge/contrib/mediawiki/Refbase.Connector.php
+++ b/branches/bleeding-edge/contrib/mediawiki/i18n/qqq.json
@@ -1,98 +1,16 @@
-<?php
-
-/**
- * Refbase database connector
- */
-class RefbaseConnector {
-
-	/// Database location
-	private $dbHost = "";
-
-	/// Database name
-	private $dbName = "";
-
-	/// Database user
-	private $dbUser = "";
-
-	/// Database password
-	private $dbPass = "";
-
-	/// Character set
-	private $dbCharset = "";
-
-	/// Reference table
-	private $dbRefTable = "";
-
-	/// User data table (for cite key entry)
-	private $dbUserDataTable = "";
-
-	/**
-	 * Constructor
-	 */
-	public function __construct() {
-		global $wgRefbaseDbHost;
-		global $wgRefbaseDbName;
-		global $wgRefbaseDbUser;
-		global $wgRefbaseDbPass;
-		global $wgRefbaseDbRefTable;
-		global $wgRefbaseDbUserDataTable;
-		global $wgRefbaseDbCharset;
-
-		// Read from global configuration
-		$this->dbHost          = $wgRefbaseDbHost;
-		$this->dbName          = $wgRefbaseDbName;
-		$this->dbUser          = $wgRefbaseDbUser;
-		$this->dbPass          = $wgRefbaseDbPass;
-		$this->dbRefTable      = $wgRefbaseDbRefTable;
-		$this->dbUserDataTable = $wgRefbaseDbUserDataTable;
-		$this->dbCharset       = $wgRefbaseDbCharset;
-	}
-
-	/**
-	 * Query by serial number or cite key entry
-	 */
-	public function getEntry( $input, $tagType, & $outputEntry ) {
-
-		// List of field to extract
-		$field_list = "r.type, r.author, r.title, r.year, r.publication, " .
-		              "r.volume, r.issue, r.pages, r.publisher, r.place, " .
-		              "r.language, r.issn, r.doi, r.serial";
-
-		// Query string
-		$queryStr = "";
-		if ( $tagType === 'citekey' ) {
-			$queryStr = "SELECT $field_list " .
-			            "FROM " . $this->dbRefTable . " r " .
-			            "INNER JOIN " . $this->dbUserDataTable . " u " .
-			            "ON r.serial = u.data_id " .
-			            "WHERE u.cite_key='$input'";
-		} else {
-			$queryStr = "SELECT $field_list" .
-			            "FROM " . $this->dbRefTable . " r " .
-			            "WHERE r.serial='$input'";
-		}
-
-		// Connect and query
-		$link = new PDO( 'mysql:host=' . $this->dbHost . ';dbname=' .
-		                 $this->dbName . ';charset=' . $this->dbCharset,
-		                 $this->dbUser, $this->dbPass );
-		try {
-			// Perform query
-			$outputEntry = $link->query( $queryStr );
-		} catch( PDOException $ex ) {
-			$outputEntry = wfMessage( 'refbase-error-dbquery' ) .
-			               $ex->getMessage();
-			return false;
-		}
-
-		if ( empty( $outputEntry ) ) {
-			$outputEntry = wfMessage( 'refbase-error-notfound' );
-			return false;
-		}
-
-		return true;
-	}
-
-
+{
+    "@metadata": {
+        "authors": [
+            "thibault marin"
+        ]
+    },
+    "refbase-desc": "{{desc}}",
+    "refbase-error-tagtype"          : "Error message displayed when the tag type used is not supported.",
+    "refbase-error-outputttype"      : "Error message displayed when the output type used is not supported.",
+    "refbase-error-dbquery"          : "Error message displayed when refbase database query failed (followed by error message).",
+    "refbase-error-mysqlconn"        : "Error message displayed when mysql connection failed (using the mysql extension).",
+    "refbase-error-mysqldb"          : "Error message displayed when mysql database selection failed (using the mysql extension), error message follows",
+    "refbase-error-notfound"         : "Error message displayed when key was not gound in database",
+    "refbase-error-cite_journal-type": "Error message displayed when cite_journal is used with non-journal entry.",
+    "refbase-error-citation-type"    : "Error message displayed when trying to create a citation of an unsupported type."
 }
-