/[collab-maint]/ext-maint/ojs/trunk/debian/patches/00_create_test_infrastructure.diff
ViewVC logotype

Contents of /ext-maint/ojs/trunk/debian/patches/00_create_test_infrastructure.diff

Parent Directory Parent Directory | Revision Log Revision Log


Revision 13743 - (hide annotations) (download)
Wed Jul 15 03:35:32 2009 UTC (3 years, 10 months ago) by jerico-guest
File size: 33249 byte(s)
correct line endings
1 jerico-guest 13734 Index: Apache/test/config.pgsql.inc.php
2     ===================================================================
3     --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4 jerico-guest 13738 +++ Apache/test/config.pgsql.inc.php 2009-07-14 15:45:58.781250000 -0300
5 jerico-guest 13734 @@ -0,0 +1,393 @@
6     +; <?php exit(); // DO NOT DELETE ?>
7     +; DO NOT DELETE THE ABOVE LINE!!!
8     +; Doing so will expose this configuration file through your web site!
9     +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10     +
11     +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12     +;
13     +; config.pgsql.inc.php
14     +;
15     +; Copyright (c) 2003-2009 John Willinsky
16     +; Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
17     +;
18 jerico-guest 13738 +; OJS Test configuration settings for the PostgreSQL database.
19 jerico-guest 13734 +;
20     +; $Id: $
21     +;
22     +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
23     +
24     +
25     +;;;;;;;;;;;;;;;;;;;;
26     +; General Settings ;
27     +;;;;;;;;;;;;;;;;;;;;
28     +
29     +[general]
30     +
31     +; Set this to On once the system has been installed
32     +; (This is generally done automatically by the installer)
33     +installed = Off
34     +
35     +; The canonical URL to the OJS installation (excluding the trailing slash)
36     +base_url = "http://pkp.sfu.ca/ojs"
37     +
38     +; Path to the registry directory (containing various settings files)
39     +; Although the files in this directory generally do not contain any
40     +; sensitive information, the directory can be moved to a location that
41     +; is not web-accessible if desired
42     +registry_dir = registry
43     +
44     +; Session cookie name
45     +session_cookie_name = OJSSID
46     +
47     +; Number of days to save login cookie for if user selects to remember
48     +; (set to 0 to force expiration at end of current session)
49     +session_lifetime = 30
50     +
51     +; Enable support for running scheduled tasks
52     +; Set this to On if you have set up the scheduled tasks script to
53     +; execute periodically
54     +scheduled_tasks = Off
55     +
56     +; Short and long date formats
57     +date_format_trunc = "%m-%d"
58     +date_format_short = "%Y-%m-%d"
59     +date_format_long = "%B %e, %Y"
60     +datetime_format_short = "%Y-%m-%d %I:%M %p"
61     +datetime_format_long = "%B %e, %Y - %I:%M %p"
62     +
63     +; Use URL parameters instead of CGI PATH_INFO. This is useful for
64     +; broken server setups that don't support the PATH_INFO environment
65     +; variable.
66     +disable_path_info = Off
67     +
68     +; Base URL override settings: Entries like the following examples can
69     +; be used to override the base URLs used by OJS. If you want to use a
70     +; proxy to rewrite URLs to OJS, configure your proxy's URL here.
71     +; Syntax: base_url[journal_path] = http://www.myUrl.com
72     +; To override URLs that aren't part of a particular journal, use a
73     +; journal_path of "index".
74     +; Examples:
75     +; base_url[index] = http://www.myUrl.com
76     +; base_url[myJournal] = http://www.myUrl.com/myJournal
77     +; base_url[myOtherJournal] = http://myOtherJournal.myUrl.com
78     +
79     +;;;;;;;;;;;;;;;;;;;;;
80     +; Database Settings ;
81     +;;;;;;;;;;;;;;;;;;;;;
82     +
83     +[database]
84     +
85     +driver = pgsql
86     +host = localhost
87     +username = ojs
88     +password = ojs
89     +name = ojs
90     +
91     +; Enable persistent connections (recommended)
92     +persistent = On
93     +
94     +; Enable database debug output (very verbose!)
95     +debug = Off
96     +
97     +;;;;;;;;;;;;;;;;;;
98     +; Cache Settings ;
99     +;;;;;;;;;;;;;;;;;;
100     +
101     +[cache]
102     +
103     +; The type of data caching to use. Options are:
104     +; - memcache: Use the memcache server configured below
105     +; - file: Use file-based caching; configured below
106     +; - none: Use no caching. This may be extremely slow.
107     +; This setting affects locale data, journal settings, and plugin settings.
108     +
109     +cache = file
110     +
111     +; Enable memcache support
112     +memcache_hostname = localhost
113     +memcache_port = 11211
114     +
115     +; For site visitors who are not logged in, many pages are often entirely
116     +; static (e.g. About, the home page, etc). If the option below is enabled,
117     +; these pages will be cached in local flat files for the number of hours
118     +; specified in the web_cache_hours option. This will cut down on server
119     +; overhead for many requests, but should be used with caution because:
120     +; 1) Things like journal metadata changes will not be reflected in cached
121     +; data until the cache expires or is cleared, and
122     +; 2) This caching WILL NOT RESPECT DOMAIN-BASED SUBSCRIPTIONS.
123     +; However, for situations like hosting high-volume open access journals, it's
124     +; an easy way of decreasing server load.
125     +
126     +web_cache = Off
127     +web_cache_hours = 1
128     +
129     +
130     +;;;;;;;;;;;;;;;;;;;;;;;;;
131     +; Localization Settings ;
132     +;;;;;;;;;;;;;;;;;;;;;;;;;
133     +
134     +[i18n]
135     +
136     +; Default locale
137     +locale = en_US
138     +
139     +; Client output/input character set
140     +client_charset = utf-8
141     +
142     +; Database connection character set
143     +; Must be set to "Off" if not supported by the database server
144     +; If enabled, must be the same character set as "client_charset"
145     +; (although the actual name may differ slightly depending on the server)
146     +connection_charset = Off
147     +
148     +; Database storage character set
149     +; Must be set to "Off" if not supported by the database server
150     +database_charset = Off
151     +
152     +; Enable character normalization to utf-8 (recommended)
153     +; If disabled, strings will be passed through in their native encoding
154     +charset_normalization = On
155     +
156     +;;;;;;;;;;;;;;;;;
157     +; File Settings ;
158     +;;;;;;;;;;;;;;;;;
159     +
160     +[files]
161     +
162     +; Complete path to directory to store uploaded files
163     +; (This directory should not be directly web-accessible)
164     +; Windows users should use forward slashes
165     +files_dir = files
166     +
167     +; Path to the directory to store public uploaded files
168     +; (This directory should be web-accessible and the specified path
169     +; should be relative to the base OJS directory)
170     +; Windows users should use forward slashes
171     +public_files_dir = public
172     +
173     +; Permissions mask for created files and directories
174     +umask = 0022
175     +
176     +
177     +;;;;;;;;;;;;;;;;;;;;;;;;;;;;
178     +; Fileinfo (MIME) Settings ;
179     +;;;;;;;;;;;;;;;;;;;;;;;;;;;;
180     +
181     +[finfo]
182     +mime_database_path = /etc/magic.mime
183     +
184     +
185     +;;;;;;;;;;;;;;;;;;;;;
186     +; Security Settings ;
187     +;;;;;;;;;;;;;;;;;;;;;
188     +
189     +[security]
190     +
191     +; Force SSL connections site-wide
192     +force_ssl = Off
193     +
194     +; Force SSL connections for login only
195     +force_login_ssl = Off
196     +
197     +; This check will invalidate a session if the user's IP address changes.
198     +; Enabling this option provides some amount of additional security, but may
199     +; cause problems for users behind a proxy farm (e.g., AOL).
200     +session_check_ip = On
201     +
202     +; The encryption (hashing) algorithm to use for encrypting user passwords
203     +; Valid values are: md5, sha1
204     +; Note that sha1 requires PHP >= 4.3.0
205     +encryption = md5
206     +
207     +; Allowed HTML tags for fields that permit restricted HTML.
208     +allowed_html = "<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <b> <i> <u> <img> <sup> <sub> <br> <p>"
209     +
210     +; Prevent VIM from attempting to highlight the rest of the config file
211     +; with unclosed tags:
212     +; </p></sub></sup></u></i></b></dd></dt></dl></li></ol></ul></code></cite></strong></em></a>
213     +
214     +
215     +;Is implicit authentication enabled or not
216     +
217     +;implicit_auth = On
218     +
219     +;Implicit Auth Header Variables
220     +
221     +;implicit_auth_header_first_name = HTTP_TDL_GIVENNAME
222     +;implicit_auth_header_last_name = HTTP_TDL_SN
223     +;implicit_auth_header_email = HTTP_TDL_MAIL
224     +;implicit_auth_header_phone = HTTP_TDL_TELEPHONENUMBER
225     +;implicit_auth_header_initials = HTTP_TDL_METADATA_INITIALS
226     +;implicit_auth_header_mailing_address = HTTP_TDL_METADATA_TDLHOMEPOSTALADDRESS
227     +;implicit_auth_header_uin = HTTP_TDL_TDLUID
228     +
229     +; A space delimited list of uins to make admin
230     +;implicit_auth_admin_list = "100000040@tdl.org 85B7FA892DAA90F7@utexas.edu 100000012@tdl.org"
231     +
232     +; URL of the implicit auth 'Way Finder' page. See pages/login/LoginHandler.inc.php for usage.
233     +
234     +;implicit_auth_wayf_url = "/Shibboleth.sso/wayf"
235     +
236     +
237     +
238     +;;;;;;;;;;;;;;;;;;
239     +; Email Settings ;
240     +;;;;;;;;;;;;;;;;;;
241     +
242     +[email]
243     +
244     +; Use SMTP for sending mail instead of mail()
245     +; smtp = On
246     +
247     +; SMTP server settings
248     +; smtp_server = mail.example.com
249     +; smtp_port = 25
250     +
251     +; Enable SMTP authentication
252     +; Supported mechanisms: PLAIN, LOGIN, CRAM-MD5, and DIGEST-MD5
253     +; smtp_auth = PLAIN
254     +; smtp_username = username
255     +; smtp_password = password
256     +
257     +; Allow envelope sender to be specified
258     +; (may not be possible with some server configurations)
259     +; allow_envelope_sender = Off
260     +
261     +; Default envelope sender to use if none is specified elsewhere
262     +; default_envelope_sender = my_address@my_host.com
263     +
264     +; Enable attachments in the various "Send Email" pages.
265     +; (Disabling here will not disable attachments on features that
266     +; require them, e.g. attachment-based reviews)
267     +enable_attachments = On
268     +
269     +; Amount of time required between attempts to send non-editorial emails
270     +; in seconds. This can be used to help prevent email relaying via OJS.
271     +time_between_emails = 3600
272     +
273     +; Maximum number of recipients that can be included in a single email
274     +; (either as To:, Cc:, or Bcc: addresses) for a non-priveleged user
275     +max_recipients = 10
276     +
277     +; If enabled, email addresses must be validated before login is possible.
278     +require_validation = Off
279     +
280     +; Maximum number of days before an unvalidated account expires and is deleted
281     +validation_timeout = 14
282     +
283     +; Display an error message when an email is not successfully sent
284     +display_errors = On
285     +
286     +
287     +;;;;;;;;;;;;;;;;;;;
288     +; Search Settings ;
289     +;;;;;;;;;;;;;;;;;;;
290     +
291     +[search]
292     +
293     +; Minimum indexed word length
294     +min_word_length = 3
295     +
296     +; The maximum number of search results fetched per keyword. These results
297     +; are fetched and merged to provide results for searches with several keywords.
298     +results_per_keyword = 500
299     +
300     +; The number of hours for which keyword search results are cached.
301     +result_cache_hours = 1
302     +
303     +; Paths to helper programs for indexing non-text files.
304     +; Programs are assumed to output the converted text to stdout, and "%s" is
305     +; replaced by the file argument.
306     +; Note that using full paths to the binaries is recommended.
307     +; Uncomment applicable lines to enable (at most one per file type).
308     +; Additional "index[MIME_TYPE]" lines can be added for any mime type to be
309     +; indexed.
310     +
311     +; PDF
312     +; index[application/pdf] = "/usr/bin/pstotext %s"
313     +; index[application/pdf] = "/usr/bin/pdftotext %s -"
314     +
315     +; PostScript
316     +; index[application/postscript] = "/usr/bin/pstotext %s"
317     +; index[application/postscript] = "/usr/bin/ps2ascii %s"
318     +
319     +; Microsoft Word
320     +; index[application/msword] = "/usr/bin/antiword %s"
321     +; index[application/msword] = "/usr/bin/catdoc %s"
322     +
323     +
324     +;;;;;;;;;;;;;;;;
325     +; OAI Settings ;
326     +;;;;;;;;;;;;;;;;
327     +
328     +[oai]
329     +
330     +; Enable OAI front-end to the site
331     +oai = On
332     +
333     +; OAI Repository identifier
334     +repository_id = ojs.pkp.sfu.ca
335     +
336     +
337     +;;;;;;;;;;;;;;;;;;;;;;
338     +; Interface Settings ;
339     +;;;;;;;;;;;;;;;;;;;;;;
340     +
341     +[interface]
342     +
343     +; Number of items to display per page; overridable on a per-journal basis
344     +items_per_page = 25
345     +
346     +; Number of page links to display; overridable on a per-journal basis
347     +page_links = 10
348     +
349     +
350     +;;;;;;;;;;;;;;;;;;;;
351     +; Captcha Settings ;
352     +;;;;;;;;;;;;;;;;;;;;
353     +
354     +[captcha]
355     +
356     +; Whether or not to enable Captcha features
357     +captcha = off
358     +
359     +; Whether or not to use Captcha on user registration
360     +captcha_on_register = on
361     +
362     +; Whether or not to use Captcha on user comments
363     +captcha_on_comments = on
364     +
365     +; Font location for font to use in Captcha images
366     +font_location = /usr/share/fonts/truetype/freefont/FreeSerif.ttf
367     +
368     +
369     +;;;;;;;;;;;;;;;;;;
370     +; Proxy Settings ;
371     +;;;;;;;;;;;;;;;;;;
372     +
373     +[proxy]
374     +
375     +; Note that allow_url_fopen must be set to Off before these proxy settings
376     +; will take effect.
377     +
378     +; The HTTP proxy configuration to use
379     +; http_host = localhost
380     +; http_port = 80
381     +; proxy_username = username
382     +; proxy_password = password
383     +
384     +
385     +;;;;;;;;;;;;;;;;;;
386     +; Debug Settings ;
387     +;;;;;;;;;;;;;;;;;;
388     +
389     +[debug]
390     +
391     +; Display execution stats in the footer
392     +show_stats = Off
393     +
394     +; Display a stack trace when a fatal error occurs.
395     +; Note that this may expose private information and should be disabled
396     +; for any production system.
397     +show_stacktrace = Off
398     +
399     Index: Apache/test/dbscripts/xml/test_schema.xml
400     ===================================================================
401     --- /dev/null 1970-01-01 00:00:00.000000000 +0000
402 jerico-guest 13738 +++ Apache/test/dbscripts/xml/test_schema.xml 2009-07-14 15:15:02.468750000 -0300
403 jerico-guest 13734 @@ -0,0 +1,41 @@
404 jerico-guest 13738 +<?xml version="1.0" encoding="UTF-8"?>
405     +<!DOCTYPE schema SYSTEM "dtd/xmlschema.dtd">
406     +
407     +<!--
408     + * test_schema.xml
409     + *
410     + * Copyright (c) 2003-2009 John Willinsky
411     + * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
412     + *
413     + * OJS database test schema in XML.
414     + *
415     + * $Id: $
416     + -->
417     +
418     +<schema version="0.2">
419     + <!--
420     + *
421     + * TABLE test_table
422     + *
423     + -->
424     + <table name="test_table">
425     + <field name="id" type="I8">
426     + <KEY/>
427     + <AUTOINCREMENT/>
428     + </field>
429     + <field name="foreign_key_id" type="I8">
430     + <NOTNULL/>
431     + </field>
432     + <field name="float" type="F" />
433     + <field name="flag" type="I1" />
434     + <field name="string" type="C2" size="6">
435     + <NOTNULL />
436     + <DEFAULT VALUE=""/>
437     + </field>
438     + <field name="text" type="X"/>
439     + <descr>table description</descr>
440     + <index name="index">
441     + <col>foreign_key_id</col>
442     + </index>
443     + </table>
444     +</schema>
445 jerico-guest 13734 Index: Apache/test/phpunit.php
446     ===================================================================
447     --- /dev/null 1970-01-01 00:00:00.000000000 +0000
448 jerico-guest 13738 +++ Apache/test/phpunit.php 2009-07-14 19:20:28.078125000 -0300
449     @@ -0,0 +1,59 @@
450 jerico-guest 13734 +<?php
451     +/* PHPUnit for OJS
452     + *
453     + * We require this file within the ojs workspace to make it callable
454     + * as a php debug script from Eclipse.
455     + *
456     + * Copyright (c) 2002-2009, Sebastian Bergmann <sb@sebastian-bergmann.de>.
457     + * All rights reserved.
458     + *
459     + * Redistribution and use in source and binary forms, with or without
460     + * modification, are permitted provided that the following conditions
461     + * are met:
462     + *
463     + * * Redistributions of source code must retain the above copyright
464     + * notice, this list of conditions and the following disclaimer.
465     + *
466     + * * Redistributions in binary form must reproduce the above copyright
467     + * notice, this list of conditions and the following disclaimer in
468     + * the documentation and/or other materials provided with the
469     + * distribution.
470     + *
471     + * * Neither the name of Sebastian Bergmann nor the names of his
472     + * contributors may be used to endorse or promote products derived
473     + * from this software without specific prior written permission.
474     + *
475     + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
476     + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
477     + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
478     + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
479     + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
480     + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
481     + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
482     + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
483     + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
484     + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
485     + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
486     + * POSSIBILITY OF SUCH DAMAGE.
487     + *
488     + * $Id: phpunit.php 4572 2009-01-28 07:37:41Z sb $
489     + */
490     +
491 jerico-guest 13738 +// Change to base directory
492     +chdir(dirname(dirname(__FILE__)));
493     +define('DONT_DIE_ON_ERROR', true);
494     +
495 jerico-guest 13734 +if (strpos('c:\Programme\PHP5\.\php.exe', '@php_bin') === 0) {
496     + set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
497     +}
498     +
499     +require_once 'PHPUnit/Util/Filter.php';
500     +
501     +PHPUnit_Util_Filter::addFileToFilter(__FILE__, 'PHPUNIT');
502     +
503     +require 'PHPUnit/TextUI/Command.php';
504     +
505     +define('PHPUnit_MAIN_METHOD', 'PHPUnit_TextUI_Command::main');
506     +
507     +PHPUnit_TextUI_Command::main();
508     +?>
509 jerico-guest 13738 Index: Apache/test/OjsTestCase.php
510     ===================================================================
511     --- /dev/null 1970-01-01 00:00:00.000000000 +0000
512     +++ Apache/test/OjsTestCase.php 2009-07-14 19:57:54.281250000 -0300
513     @@ -0,0 +1,35 @@
514     +<?php
515     +// Include required classes and functions
516     +require_once 'PHPUnit/Extensions/OutputTestCase.php';
517     +require_once('includes/driver.inc.php');
518     +
519     +abstract class OjsTestCase extends PHPUnit_Extensions_OutputTestCase {
520     + const
521     + // Available test configurations
522     + CONFIG_PGSQL = 'test/config.pgsql.inc.php',
523     + CONFIG_MYSQL = 'test/config.mysql.inc.php';
524     +
525     + public function setUp() {
526     + // By default we use the MySQL test configuration
527     + $this->setTestConfiguration(self::CONFIG_MYSQL);
528     + }
529     +
530     + /**
531     + * Set a non-default test configuration
532     + * @param $configFile string
533     + */
534     + public function setTestConfiguration($configFile) {
535     + Config::setConfigFileName($configFile);
536     + }
537     +
538     + /**
539     + * Get a connection to the OJS database with the
540     + * test configuration.
541     + * @return DBConnection
542     + */
543     + public function &getDatabaseConnection() {
544     + $dbconn = &DBConnection::getConn();
545     + return $dbconn;
546     + }
547     +}
548     +?>
549     Index: Apache/classes/config/Config.inc.php
550     ===================================================================
551     --- Apache.orig/classes/config/Config.inc.php 2009-07-14 15:14:51.000000000 -0300
552     +++ Apache/classes/config/Config.inc.php 2009-07-14 16:03:40.468750000 -0300
553     @@ -19,13 +19,16 @@
554 jerico-guest 13743 // $Id: Config.inc.php,v 1.10.2.1 2009/04/08 19:42:47 asmecher Exp $
555    
556    
557     -/** The path to the configuration file */
558     +/** The path to the default configuration file */
559     define('CONFIG_FILE', Core::getBaseDir() . DIRECTORY_SEPARATOR . 'config.inc.php');
560    
561     import('config.ConfigParser');
562    
563     class Config {
564     + static $_configData = null;
565     + static $_configFile = CONFIG_FILE;
566    
567     +
568     /**
569     * Retrieve a specified configuration variable.
570     * @param $section string
571 jerico-guest 13738 @@ -42,14 +45,12 @@
572 jerico-guest 13743 * @return array the configuration data
573     */
574     function &getData() {
575     - static $configData;
576     -
577     - if (!isset($configData)) {
578     + if (is_null(self::$_configData)) {
579     // Load configuration data only once per request
580     - $configData = Config::reloadData();
581     + self::$_configData = Config::reloadData();
582     }
583    
584     - return $configData;
585     + return self::$_configData;
586     }
587    
588     /**
589 jerico-guest 13738 @@ -58,19 +59,28 @@
590 jerico-guest 13743 * @return array the configuration data
591     */
592     function &reloadData() {
593     - if (($configData = &ConfigParser::readConfig(CONFIG_FILE)) === false) {
594     - fatalError(sprintf('Cannot read configuration file %s', CONFIG_FILE));
595     + if (($configData = &ConfigParser::readConfig(Config::getConfigFileName())) === false) {
596     + fatalError(sprintf('Cannot read configuration file %s', Config::getConfigFileName()));
597     }
598    
599     return $configData;
600     }
601    
602     /**
603     + * Set the path to the configuration file.
604     + * @param $configFile string
605     + */
606     + function setConfigFileName($configFile) {
607     + self::$_configFile = $configFile;
608     + self::$_configData = null;
609     + }
610     +
611     + /**
612     * Return the path to the configuration file.
613     * @return string
614     */
615     function getConfigFileName() {
616     - return CONFIG_FILE;
617     + return self::$_configFile;
618     }
619    
620     }
621 jerico-guest 13738 Index: Apache/includes/functions.inc.php
622     ===================================================================
623     --- Apache.orig/includes/functions.inc.php 2009-07-14 15:15:01.000000000 -0300
624     +++ Apache/includes/functions.inc.php 2009-07-14 19:24:23.296875000 -0300
625     @@ -145,6 +145,12 @@
626     }
627    
628     error_log("OJS: $reason");
629     +
630     + if (defined('DONT_DIE_ON_ERROR') && DONT_DIE_ON_ERROR == true) {
631     + trigger_error($reason);
632     + return;
633     + }
634     +
635     die(1);
636     }
637    
638     Index: Apache/test/classes/config/ConfigTest.php
639     ===================================================================
640     --- /dev/null 1970-01-01 00:00:00.000000000 +0000
641     +++ Apache/test/classes/config/ConfigTest.php 2009-07-14 19:57:49.875000000 -0300
642     @@ -0,0 +1,73 @@
643     +<?php
644     +// Include required classes and functions
645     +require_once 'PHPUnit/Extensions/OutputTestCase.php';
646     +require_once('includes/driver.inc.php');
647     +
648     +class ConfigTest extends PHPUnit_Extensions_OutputTestCase {
649     + public function testGetDefaultConfigFileName() {
650     + $expectedResult = dirname(dirname(dirname(dirname(__FILE__)))). "\config.inc.php";
651     + self::assertEquals($expectedResult, Config::getConfigFileName());
652     + }
653     +
654     + public function testGetConfigFileName() {
655     + Config::setConfigFileName('some_config');
656     + self::assertEquals('some_config', Config::getConfigFileName());
657     + }
658     +
659     + /**
660     + * @depends testGetConfigFileName
661     + * @expectedException PHPUnit_Framework_Error
662     + */
663     + public function testReloadDataWithNonExistantConfigFile() {
664     + $this->expectOutputString('<h1>Cannot read configuration file some_config</h1>');
665     + Config::reloadData();
666     + }
667     +
668     + /**
669     + * @depends testGetConfigFileName
670     + */
671     + public function testReloadDataAndGetData() {
672     + Config::setConfigFileName('test/config.mysql.inc.php');
673     + $result = Config::reloadData();
674     + $expectedResult = array(
675     + 'installed' => false,
676     + 'base_url' => 'http://pkp.sfu.ca/ojs',
677     + 'registry_dir' => 'registry',
678     + 'session_cookie_name' => 'OJSSID',
679     + 'session_lifetime' => 30,
680     + 'scheduled_tasks' => false,
681     + 'date_format_trunc' => '%m-%d',
682     + 'date_format_short' => '%Y-%m-%d',
683     + 'date_format_long' => '%B %e, %Y',
684     + 'datetime_format_short' => '%Y-%m-%d %I:%M %p',
685     + 'datetime_format_long' => '%B %e, %Y - %I:%M %p',
686     + 'disable_path_info' => false,
687     + );
688     +
689     + // We'll only check part of the configuration data to
690     + // keep the test less verbose.
691     + self::assertEquals($expectedResult, $result['general']);
692     +
693     + $result = &Config::getData();
694     + self::assertEquals($expectedResult, $result['general']);
695     + }
696     +
697     + /**
698     + * @depends testReloadDataAndGetData
699     + */
700     + public function testGetVar() {
701     + self::assertEquals('mysql', Config::getVar('database', 'driver'));
702     + self::assertNull(Config::getVar('general', 'non-existent-config-var'));
703     + self::assertNull(Config::getVar('non-existent-config-section', 'non-existent-config-var'));
704     + }
705     +
706     +
707     + /**
708     + * @depends testGetVar
709     + */
710     + public function testGetVarFromOtherConfig() {
711     + Config::setConfigFileName('test/config.pgsql.inc.php');
712     + self::assertEquals('pgsql', Config::getVar('database', 'driver'));
713     + }
714     +}
715     +?>
716     Index: Apache/test/config.mysql.inc.php
717     ===================================================================
718     --- /dev/null 1970-01-01 00:00:00.000000000 +0000
719     +++ Apache/test/config.mysql.inc.php 2009-07-14 15:46:39.609375000 -0300
720     @@ -0,0 +1,393 @@
721     +; <?php exit(); // DO NOT DELETE ?>
722     +; DO NOT DELETE THE ABOVE LINE!!!
723     +; Doing so will expose this configuration file through your web site!
724     +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
725     +
726     +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
727     +;
728     +; config.mysql.inc.php
729     +;
730     +; Copyright (c) 2003-2009 John Willinsky
731     +; Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
732     +;
733     +; OJS Test configuration settings for the MySQL database.
734     +;
735     +; $Id: $
736     +;
737     +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
738     +
739     +
740     +;;;;;;;;;;;;;;;;;;;;
741     +; General Settings ;
742     +;;;;;;;;;;;;;;;;;;;;
743     +
744     +[general]
745     +
746     +; Set this to On once the system has been installed
747     +; (This is generally done automatically by the installer)
748     +installed = Off
749     +
750     +; The canonical URL to the OJS installation (excluding the trailing slash)
751     +base_url = "http://pkp.sfu.ca/ojs"
752     +
753     +; Path to the registry directory (containing various settings files)
754     +; Although the files in this directory generally do not contain any
755     +; sensitive information, the directory can be moved to a location that
756     +; is not web-accessible if desired
757     +registry_dir = registry
758     +
759     +; Session cookie name
760     +session_cookie_name = OJSSID
761     +
762     +; Number of days to save login cookie for if user selects to remember
763     +; (set to 0 to force expiration at end of current session)
764     +session_lifetime = 30
765     +
766     +; Enable support for running scheduled tasks
767     +; Set this to On if you have set up the scheduled tasks script to
768     +; execute periodically
769     +scheduled_tasks = Off
770     +
771     +; Short and long date formats
772     +date_format_trunc = "%m-%d"
773     +date_format_short = "%Y-%m-%d"
774     +date_format_long = "%B %e, %Y"
775     +datetime_format_short = "%Y-%m-%d %I:%M %p"
776     +datetime_format_long = "%B %e, %Y - %I:%M %p"
777     +
778     +; Use URL parameters instead of CGI PATH_INFO. This is useful for
779     +; broken server setups that don't support the PATH_INFO environment
780     +; variable.
781     +disable_path_info = Off
782     +
783     +; Base URL override settings: Entries like the following examples can
784     +; be used to override the base URLs used by OJS. If you want to use a
785     +; proxy to rewrite URLs to OJS, configure your proxy's URL here.
786     +; Syntax: base_url[journal_path] = http://www.myUrl.com
787     +; To override URLs that aren't part of a particular journal, use a
788     +; journal_path of "index".
789     +; Examples:
790     +; base_url[index] = http://www.myUrl.com
791     +; base_url[myJournal] = http://www.myUrl.com/myJournal
792     +; base_url[myOtherJournal] = http://myOtherJournal.myUrl.com
793     +
794     +;;;;;;;;;;;;;;;;;;;;;
795     +; Database Settings ;
796     +;;;;;;;;;;;;;;;;;;;;;
797     +
798     +[database]
799     +
800     +driver = mysql
801     +host = localhost
802     +username = ojs
803     +password = ojs
804     +name = ojs
805     +
806     +; Enable persistent connections (recommended)
807     +persistent = On
808     +
809     +; Enable database debug output (very verbose!)
810     +debug = Off
811     +
812     +;;;;;;;;;;;;;;;;;;
813     +; Cache Settings ;
814     +;;;;;;;;;;;;;;;;;;
815     +
816     +[cache]
817     +
818     +; The type of data caching to use. Options are:
819     +; - memcache: Use the memcache server configured below
820     +; - file: Use file-based caching; configured below
821     +; - none: Use no caching. This may be extremely slow.
822     +; This setting affects locale data, journal settings, and plugin settings.
823     +
824     +cache = file
825     +
826     +; Enable memcache support
827     +memcache_hostname = localhost
828     +memcache_port = 11211
829     +
830     +; For site visitors who are not logged in, many pages are often entirely
831     +; static (e.g. About, the home page, etc). If the option below is enabled,
832     +; these pages will be cached in local flat files for the number of hours
833     +; specified in the web_cache_hours option. This will cut down on server
834     +; overhead for many requests, but should be used with caution because:
835     +; 1) Things like journal metadata changes will not be reflected in cached
836     +; data until the cache expires or is cleared, and
837     +; 2) This caching WILL NOT RESPECT DOMAIN-BASED SUBSCRIPTIONS.
838     +; However, for situations like hosting high-volume open access journals, it's
839     +; an easy way of decreasing server load.
840     +
841     +web_cache = Off
842     +web_cache_hours = 1
843     +
844     +
845     +;;;;;;;;;;;;;;;;;;;;;;;;;
846     +; Localization Settings ;
847     +;;;;;;;;;;;;;;;;;;;;;;;;;
848     +
849     +[i18n]
850     +
851     +; Default locale
852     +locale = en_US
853     +
854     +; Client output/input character set
855     +client_charset = utf-8
856     +
857     +; Database connection character set
858     +; Must be set to "Off" if not supported by the database server
859     +; If enabled, must be the same character set as "client_charset"
860     +; (although the actual name may differ slightly depending on the server)
861     +connection_charset = Off
862     +
863     +; Database storage character set
864     +; Must be set to "Off" if not supported by the database server
865     +database_charset = Off
866     +
867     +; Enable character normalization to utf-8 (recommended)
868     +; If disabled, strings will be passed through in their native encoding
869     +charset_normalization = On
870     +
871     +;;;;;;;;;;;;;;;;;
872     +; File Settings ;
873     +;;;;;;;;;;;;;;;;;
874     +
875     +[files]
876     +
877     +; Complete path to directory to store uploaded files
878     +; (This directory should not be directly web-accessible)
879     +; Windows users should use forward slashes
880     +files_dir = files
881     +
882     +; Path to the directory to store public uploaded files
883     +; (This directory should be web-accessible and the specified path
884     +; should be relative to the base OJS directory)
885     +; Windows users should use forward slashes
886     +public_files_dir = public
887     +
888     +; Permissions mask for created files and directories
889     +umask = 0022
890     +
891     +
892     +;;;;;;;;;;;;;;;;;;;;;;;;;;;;
893     +; Fileinfo (MIME) Settings ;
894     +;;;;;;;;;;;;;;;;;;;;;;;;;;;;
895     +
896     +[finfo]
897     +mime_database_path = /etc/magic.mime
898     +
899     +
900     +;;;;;;;;;;;;;;;;;;;;;
901     +; Security Settings ;
902     +;;;;;;;;;;;;;;;;;;;;;
903     +
904     +[security]
905     +
906     +; Force SSL connections site-wide
907     +force_ssl = Off
908     +
909     +; Force SSL connections for login only
910     +force_login_ssl = Off
911     +
912     +; This check will invalidate a session if the user's IP address changes.
913     +; Enabling this option provides some amount of additional security, but may
914     +; cause problems for users behind a proxy farm (e.g., AOL).
915     +session_check_ip = On
916     +
917     +; The encryption (hashing) algorithm to use for encrypting user passwords
918     +; Valid values are: md5, sha1
919     +; Note that sha1 requires PHP >= 4.3.0
920     +encryption = md5
921     +
922     +; Allowed HTML tags for fields that permit restricted HTML.
923     +allowed_html = "<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <b> <i> <u> <img> <sup> <sub> <br> <p>"
924     +
925     +; Prevent VIM from attempting to highlight the rest of the config file
926     +; with unclosed tags:
927     +; </p></sub></sup></u></i></b></dd></dt></dl></li></ol></ul></code></cite></strong></em></a>
928     +
929     +
930     +;Is implicit authentication enabled or not
931     +
932     +;implicit_auth = On
933     +
934     +;Implicit Auth Header Variables
935     +
936     +;implicit_auth_header_first_name = HTTP_TDL_GIVENNAME
937     +;implicit_auth_header_last_name = HTTP_TDL_SN
938     +;implicit_auth_header_email = HTTP_TDL_MAIL
939     +;implicit_auth_header_phone = HTTP_TDL_TELEPHONENUMBER
940     +;implicit_auth_header_initials = HTTP_TDL_METADATA_INITIALS
941     +;implicit_auth_header_mailing_address = HTTP_TDL_METADATA_TDLHOMEPOSTALADDRESS
942     +;implicit_auth_header_uin = HTTP_TDL_TDLUID
943     +
944     +; A space delimited list of uins to make admin
945     +;implicit_auth_admin_list = "100000040@tdl.org 85B7FA892DAA90F7@utexas.edu 100000012@tdl.org"
946     +
947     +; URL of the implicit auth 'Way Finder' page. See pages/login/LoginHandler.inc.php for usage.
948     +
949     +;implicit_auth_wayf_url = "/Shibboleth.sso/wayf"
950     +
951     +
952     +
953     +;;;;;;;;;;;;;;;;;;
954     +; Email Settings ;
955     +;;;;;;;;;;;;;;;;;;
956     +
957     +[email]
958     +
959     +; Use SMTP for sending mail instead of mail()
960     +; smtp = On
961     +
962     +; SMTP server settings
963     +; smtp_server = mail.example.com
964     +; smtp_port = 25
965     +
966     +; Enable SMTP authentication
967     +; Supported mechanisms: PLAIN, LOGIN, CRAM-MD5, and DIGEST-MD5
968     +; smtp_auth = PLAIN
969     +; smtp_username = username
970     +; smtp_password = password
971     +
972     +; Allow envelope sender to be specified
973     +; (may not be possible with some server configurations)
974     +; allow_envelope_sender = Off
975     +
976     +; Default envelope sender to use if none is specified elsewhere
977     +; default_envelope_sender = my_address@my_host.com
978     +
979     +; Enable attachments in the various "Send Email" pages.
980     +; (Disabling here will not disable attachments on features that
981     +; require them, e.g. attachment-based reviews)
982     +enable_attachments = On
983     +
984     +; Amount of time required between attempts to send non-editorial emails
985     +; in seconds. This can be used to help prevent email relaying via OJS.
986     +time_between_emails = 3600
987     +
988     +; Maximum number of recipients that can be included in a single email
989     +; (either as To:, Cc:, or Bcc: addresses) for a non-priveleged user
990     +max_recipients = 10
991     +
992     +; If enabled, email addresses must be validated before login is possible.
993     +require_validation = Off
994     +
995     +; Maximum number of days before an unvalidated account expires and is deleted
996     +validation_timeout = 14
997     +
998     +; Display an error message when an email is not successfully sent
999     +display_errors = On
1000     +
1001     +
1002     +;;;;;;;;;;;;;;;;;;;
1003     +; Search Settings ;
1004     +;;;;;;;;;;;;;;;;;;;
1005     +
1006     +[search]
1007     +
1008     +; Minimum indexed word length
1009     +min_word_length = 3
1010     +
1011     +; The maximum number of search results fetched per keyword. These results
1012     +; are fetched and merged to provide results for searches with several keywords.
1013     +results_per_keyword = 500
1014     +
1015     +; The number of hours for which keyword search results are cached.
1016     +result_cache_hours = 1
1017     +
1018     +; Paths to helper programs for indexing non-text files.
1019     +; Programs are assumed to output the converted text to stdout, and "%s" is
1020     +; replaced by the file argument.
1021     +; Note that using full paths to the binaries is recommended.
1022     +; Uncomment applicable lines to enable (at most one per file type).
1023     +; Additional "index[MIME_TYPE]" lines can be added for any mime type to be
1024     +; indexed.
1025     +
1026     +; PDF
1027     +; index[application/pdf] = "/usr/bin/pstotext %s"
1028     +; index[application/pdf] = "/usr/bin/pdftotext %s -"
1029     +
1030     +; PostScript
1031     +; index[application/postscript] = "/usr/bin/pstotext %s"
1032     +; index[application/postscript] = "/usr/bin/ps2ascii %s"
1033     +
1034     +; Microsoft Word
1035     +; index[application/msword] = "/usr/bin/antiword %s"
1036     +; index[application/msword] = "/usr/bin/catdoc %s"
1037     +
1038     +
1039     +;;;;;;;;;;;;;;;;
1040     +; OAI Settings ;
1041     +;;;;;;;;;;;;;;;;
1042     +
1043     +[oai]
1044     +
1045     +; Enable OAI front-end to the site
1046     +oai = On
1047     +
1048     +; OAI Repository identifier
1049     +repository_id = ojs.pkp.sfu.ca
1050     +
1051     +
1052     +;;;;;;;;;;;;;;;;;;;;;;
1053     +; Interface Settings ;
1054     +;;;;;;;;;;;;;;;;;;;;;;
1055     +
1056     +[interface]
1057     +
1058     +; Number of items to display per page; overridable on a per-journal basis
1059     +items_per_page = 25
1060     +
1061     +; Number of page links to display; overridable on a per-journal basis
1062     +page_links = 10
1063     +
1064     +
1065     +;;;;;;;;;;;;;;;;;;;;
1066     +; Captcha Settings ;
1067     +;;;;;;;;;;;;;;;;;;;;
1068     +
1069     +[captcha]
1070     +
1071     +; Whether or not to enable Captcha features
1072     +captcha = off
1073     +
1074     +; Whether or not to use Captcha on user registration
1075     +captcha_on_register = on
1076     +
1077     +; Whether or not to use Captcha on user comments
1078     +captcha_on_comments = on
1079     +
1080     +; Font location for font to use in Captcha images
1081     +font_location = /usr/share/fonts/truetype/freefont/FreeSerif.ttf
1082     +
1083     +
1084     +;;;;;;;;;;;;;;;;;;
1085     +; Proxy Settings ;
1086     +;;;;;;;;;;;;;;;;;;
1087     +
1088     +[proxy]
1089     +
1090     +; Note that allow_url_fopen must be set to Off before these proxy settings
1091     +; will take effect.
1092     +
1093     +; The HTTP proxy configuration to use
1094     +; http_host = localhost
1095     +; http_port = 80
1096     +; proxy_username = username
1097     +; proxy_password = password
1098     +
1099     +
1100     +;;;;;;;;;;;;;;;;;;
1101     +; Debug Settings ;
1102     +;;;;;;;;;;;;;;;;;;
1103     +
1104     +[debug]
1105     +
1106     +; Display execution stats in the footer
1107     +show_stats = Off
1108     +
1109     +; Display a stack trace when a fatal error occurs.
1110     +; Note that this may expose private information and should be disabled
1111     +; for any production system.
1112     +show_stacktrace = Off
1113     +

  ViewVC Help
Powered by ViewVC 1.1.5