160 likes | 320 Views
VuFind 2.0 an introduction. Demian Katz VuFind Developer demian.katz@villanova.edu. Overview. Why VuFind 2.0? PHP 5.3 concepts Zend Framework 2 concepts VuFind 2.0 concepts What’s next?. Why VuFind 2.0?. Move to a standard framework Clean up code flow/organization
E N D
VuFind 2.0an introduction Demian Katz VuFind Developer demian.katz@villanova.edu
Overview • Why VuFind 2.0? • PHP 5.3 concepts • Zend Framework 2 concepts • VuFind 2.0 concepts • What’s next?
Why VuFind 2.0? • Move to a standard framework • Clean up code flow/organization • Improve extensibility • Take advantage of PHP improvements • Move away from outdated technologies (PEAR, Smarty, Subversion, etc.) • Bundle all dependencies
PHP 5.3: Namespaces • Namespaces prevent collisions; VuFind 1.x suffered from at least one (SolrUtils). • Key: Learn to love the backslash • namespace VuFind\Config; • use VuFind\Config\Reader as ConfigReader;
PHP 5.3: Closures • A useful tool for functional programming. • The old, procedural way to transform an array: $newArray = array(); foreach ($oldArray as $key => $value) { $newArray[$key] = doStuffTo($value); } $oldArray = $newArray;
PHP 5.3: Closures • The new, functional way to transform an array: $callback = function($i) { return doStuffTo($i); } $array = array_map($callback, $array);
Dependency Injection • A simple concept that is often handled in complex ways (“DI containers”). • When one class depends on another, use constructors or setters to “inject” dependencies. • Replaces use of statics/globals. • Makes code more modular and relationships more explicit. • Often makes testing easier.
Zend Framework 2 Concepts • Module system • Event system • Routing system • Controller classes • Service managers • Database abstraction layer • PHP-based template rendering • Watch the webinars! • http://www.zend.com/en/resources/webinars/framework
VuFind 2.0: Data Model • Search classes produce record driver objects. • Every record is represented by a record driver regardless of source. • VuFind uses “duck typing” to extract appropriate data from record drivers.
VuFind 2.0: Controllers • Old way: one class per action in web/services • New way: one class per controller • Advantage: easier to visualize flow • Advantage: easier to inherit related functionality (AbstractRecord, AbstractSearch)
VuFind 2.0: Templates • Old way: Smarty templates • {$myVariable|escape:html} • {if $this}that{/if} • Custom functionality through Smarty plugins • New way: PHP templates • <?$this->escapeHtml($myVariable);?> • <? if ($this): ?>that<?endif; ?> • Custom functionality through view helpers
VuFind 2.0: Themes • Two officially supported themes: • blueprint: “standard” theme using jQuery and Blueprint CSS library. • jquerymobile: “mobile” theme using jQueryMobile library. • Old YUI/iWebKit-based themes (classic/default/mobile) will not be included.
VuFind 2.0: Extension Points • Local configuration directory • One VuFind install, many configurations • Theme system • More powerful inheritance • Plugin system • Based on ZF2 service locator system • Module system • Override almost anything without touching core code
VuFind 2.0: Install Process • Install dependencies (PHP/Apache/Java/MySQL) • Download and unpack VuFind • php install.php • Link generated Apache configuration • http://localhost/vufind/Install (or http://localhost/vufind/Upgrade)
VuFind 2.0: Source Control and Continuous Integration • Git instead of Subversion • Fork to your heart’s content • Jenkins for continuous integration • Runs tests, checks style, builds API docs • Sends alerts to vufind-admins mailing list • Automatically triggered by Git commits • PHPUnit for testing • Please help us improve test coverage!
What’s Next? • More architectural cleanup • Better Solr connector, better abstract search model, better-defined HTTP/cache/logging services (David Maus) • More intelligent AJAX handling • New features • Better consortial support (ILS multi-driver) • Hierarchical collections • Multi-column search (i.e. Solr/Summon) • Web search