3.4 3.3
Jump to table of contents

Resources

A collection of resources that may help you while coding with these applications.

CacheBuster #

Don’t enable this on a production site. It will slow down your site.

This plugin will clear the template and CSS cache with every request. Enable it so that you don’t have to manually clear the cache every time you make a change.

Postman API #

We use Postman to work with our REST API endpoints. You can import our request collection for OJS following these steps.

  1. In Postman, go to Collections.
  2. Click Import.
  3. Click Link.
  4. Enter https://docs.pkp.sfu.ca/dev/api/OJS-api-postman-collection.json.
  5. Open the collection and click on the Variables tab.
  6. Enter the baseUrl and apiToken in the Current Value column to connect to the journal’s API endpoint .

The baseUrl for a local development instance is usually something like http://localhost:8000/examplejournal/api/v1. The apiToken for a user can be retrieved from their user profile page in the application.

Generate submissions #

A CLI script to generate submissions for import. Run php ojs-generate-submissions.php to create the XML file, then import from Tools > Export/Import > Native Import.

Generate metrics #

A CLI tool is available to generate usage statistics for each submission in your instance. From the root directory of an application, run:

php lib/pkp/generateTestMetrics.php <context_id> <start_date> <end_date>

Dates should be in the format YYYY-MM-DD.

Remove a locale key #

A CLI tool is available to remove locale keys. This can be useful when a locale key is no longer used and needs to be removed from every locale.

Run the following from the root directory of an application.

php lib/pkp/tools/removeLocaleKey.php example.locale.key

It will remove all instances of that locale key from every locale .po file in the application and pkp-lib.

Move a locale key to pkp-lib #

A CLI tool to move a locale key from one file to another and apply the change across all languages. Use this to move a locale key from an application directory to pkp-lib.

Run the following from the root directory of an application.

php lib/pkp/tools/moveLocaleKeysToLib.php example.locale.key emails.po

This will move all translations of example.locale.key from locale/**_**/emails.po to lib/pkp/locale/**_**/emails.po.

Log emails #

Sometimes you need to verify if an email was sent by the application. You can output all emails to the server log by setting the following in your config file:

[email]

; Default method to send emails
; Available options: sendmail, smtp, log
default = log

Or you can run a local SMTP server to receive and store emails. We recommend one of the following apps:

Update your config.inc.php file to send email through the SMTP server. (The port for these test apps is usually 1025.)

[email]

; Default method to send emails
; Available options: sendmail, smtp, log
default = smtp

; Use SMTP for sending mail instead of mail()
smtp = On

; SMTP server settings
smtp_server = localhost
smtp_port = 1025