Skip to content

Commit

Permalink
Merge branch 'pkp:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
nongenti authored Jan 4, 2022
2 parents 2d4dc85 + 09b415b commit 1b75174
Show file tree
Hide file tree
Showing 129 changed files with 3,771 additions and 2,106 deletions.
19 changes: 6 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,11 @@ jobs:
script:
- source ./lib/pkp/tools/travis/prepare-tests.sh
- git clone https://github.com/pkp/datasets
- cat datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/database.sql | gzip > ${DATABASEDUMP}
- cp -r datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/files/* files/
- cp -r datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/public/* public/
- cp datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/config.inc.php .
- patch -p1 < datasets/upgrade/3_4_0-add-email-config.diff
- ./lib/pkp/tools/travis/load-database.sh
- ./datasets/tools/dbclient.sh < datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/database.sql
- php tools/upgrade.php check
- php tools/upgrade.php upgrade

Expand All @@ -82,12 +81,11 @@ jobs:
script:
- source ./lib/pkp/tools/travis/prepare-tests.sh
- git clone https://github.com/pkp/datasets
- cat datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/database.sql | gzip > ${DATABASEDUMP}
- cp -r datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/files/* files/
- cp -r datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/public/* public/
- cp datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/config.inc.php .
- patch -p1 < datasets/upgrade/3_4_0-add-email-config.diff
- ./lib/pkp/tools/travis/load-database.sh
- ./datasets/tools/dbclient.sh < datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/database.sql
- php tools/upgrade.php check
- php tools/upgrade.php upgrade

Expand All @@ -96,12 +94,11 @@ jobs:
script:
- source ./lib/pkp/tools/travis/prepare-tests.sh
- git clone https://github.com/pkp/datasets
- cat datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/database.sql | gzip > ${DATABASEDUMP}
- cp -r datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/files/* files/
- cp -r datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/public/* public/
- cp datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/config.inc.php .
- patch -p1 < datasets/upgrade/3_4_0-add-email-config.diff
- ./lib/pkp/tools/travis/load-database.sh
- ./datasets/tools/dbclient.sh < datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/database.sql
- php tools/upgrade.php check
- php tools/upgrade.php upgrade

Expand All @@ -110,12 +107,11 @@ jobs:
script:
- source ./lib/pkp/tools/travis/prepare-tests.sh
- git clone https://github.com/pkp/datasets
- cat datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/database.sql | gzip > ${DATABASEDUMP}
- cp -r datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/files/* files/
- cp -r datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/public/* public/
- cp datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/config.inc.php .
- patch -p1 < datasets/upgrade/3_4_0-add-email-config.diff
- ./lib/pkp/tools/travis/load-database.sh
- ./datasets/tools/dbclient.sh < datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/database.sql
- php tools/upgrade.php check
- php tools/upgrade.php upgrade

Expand All @@ -124,12 +120,11 @@ jobs:
script:
- source ./lib/pkp/tools/travis/prepare-tests.sh
- git clone https://github.com/pkp/datasets
- cat datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/database.sql | gzip > ${DATABASEDUMP}
- cp -r datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/files/* files/
- cp -r datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/public/* public/
- cp datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/config.inc.php .
- patch -p1 < datasets/upgrade/3_4_0-add-email-config.diff
- ./lib/pkp/tools/travis/load-database.sh
- ./datasets/tools/dbclient.sh < datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/database.sql
- php tools/upgrade.php check
- php tools/upgrade.php upgrade

Expand All @@ -138,16 +133,14 @@ jobs:
script:
- source ./lib/pkp/tools/travis/prepare-tests.sh
- git clone https://github.com/pkp/datasets
- cat datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/database.sql | gzip > ${DATABASEDUMP}
- cp -r datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/files/* files/
- cp -r datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/public/* public/
- cp datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/config.inc.php .
- patch -p1 < datasets/upgrade/3_4_0-add-email-config.diff
- ./lib/pkp/tools/travis/load-database.sh
- ./datasets/tools/dbclient.sh < datasets/${APPLICATION}/${DATASET_BRANCH}/${TEST}/database.sql
- php tools/upgrade.php check
- php tools/upgrade.php upgrade


script:
- source ./lib/pkp/tools/travis/prepare-tests.sh
- ./lib/pkp/tools/travis/run-tests.sh
Expand Down
5 changes: 5 additions & 0 deletions classes/core/AppServiceProvider.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
namespace APP\core;

use PKP\core\PKPRequest;
use PKP\submissionFile\Collector as SubmissionFileCollector;
use PKP\submissionFile\SubmissionFile as BaseSubmissionFile;

class AppServiceProvider extends \PKP\core\AppServiceProvider
{
Expand All @@ -28,5 +30,8 @@ public function register()
parent::register();

$this->app->bind(Request::class, PKPRequest::class);

$this->app->bind(\APP\submissionFile\Collector::class, SubmissionFileCollector::class);
$this->app->bind(\APP\submissionFile\SubmissionFile::class, BaseSubmissionFile::class);
}
}
28 changes: 28 additions & 0 deletions classes/emailTemplate/DAO.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php
/**
* @file classes/emailTemplate/DAO.inc.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class DAO
*
* @brief Read and write email templates to the database.
*/

namespace APP\emailTemplate;

class DAO extends \PKP\emailTemplate\DAO
{
/**
* Renames app-specific email template variables during installation
*/
protected function variablesToRename(): array
{
return [
'contextName' => 'pressName',
'contextUrl' => 'pressUrl',
];
}
}
28 changes: 19 additions & 9 deletions classes/facades/Repo.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,36 @@

namespace APP\facades;

use Illuminate\Support\Facades\App;
use APP\author\Repository as AuthorRepository;
use APP\publication\Repository as PublicationRepository;
use APP\submission\Repository as SubmissionRepository;
use APP\submissionFile\Repository as SubmissionFileRepository;
use APP\user\Repository as UserRepository;

class Repo extends \PKP\facades\Repo
{
public static function publication(): \APP\publication\Repository
public static function publication(): PublicationRepository
{
return App::make(\APP\publication\Repository::class);
return app()->make(PublicationRepository::class);
}

public static function submission(): \APP\submission\Repository
public static function submission(): SubmissionRepository
{
return App::make(\APP\submission\Repository::class);
return app()->make(SubmissionRepository::class);
}
public static function user(): \APP\user\Repository

public static function user(): UserRepository
{
return app()->make(UserRepository::class);
}

public static function author(): AuthorRepository
{
return App::make(\APP\user\Repository::class);
return app()->make(AuthorRepository::class);
}

public static function author(): \APP\author\Repository
public static function submissionFile(): SubmissionFileRepository
{
return App::make(\APP\author\Repository::class);
return app()->make(SubmissionFileRepository::class);
}
}
2 changes: 0 additions & 2 deletions classes/i18n/AppLocale.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

use PKP\i18n\PKPLocale;

import('lib.pkp.classes.i18n.PKPLocale');

class AppLocale extends PKPLocale
{
/**
Expand Down
11 changes: 4 additions & 7 deletions classes/install/Upgrade.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,11 @@
use APP\facades\Repo;
use APP\i18n\AppLocale;
use Illuminate\Support\Facades\DB;
use PKP\core\PKPString;
use PKP\db\DAORegistry;
use PKP\file\FileManager;
use PKP\identity\Identity;

use PKP\install\Installer;
use PKP\security\Role;
use PKP\submission\SubmissionFile;

use PKP\submissionFile\SubmissionFile;

class Upgrade extends Installer
{
Expand Down Expand Up @@ -263,7 +260,8 @@ public function migrateSubmissionCoverImages()
$context = $contexts[$row->context_id];

// Get existing image paths
$basePath = Services::get('submissionFile')->getSubmissionDir($row->context_id, $row->submission_id);
$basePath = Repo::submissionFile()
->getSubmissionDir($row->context_id, $row->submission_id);
$coverPath = Config::getVar('files', 'files_dir') . '/' . $basePath . '/simple/' . $coverImage['name'];
$coverPathInfo = pathinfo($coverPath);
$thumbPath = Config::getVar('files', 'files_dir') . '/' . $basePath . '/simple/' . $coverImage['thumbnailName'];
Expand Down Expand Up @@ -333,7 +331,6 @@ public function migrateSubmissionCoverImages()
*/
public function _fileStageToPath($fileStage)
{
import('lib.pkp.classes.submission.SubmissionFile');
static $fileStagePathMap = [
SubmissionFile::SUBMISSION_FILE_SUBMISSION => 'submission',
SubmissionFile::SUBMISSION_FILE_NOTE => 'note',
Expand Down
28 changes: 20 additions & 8 deletions classes/log/SubmissionEventLogEntry.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,31 @@
* Log entry event types. All types must be defined here.
*/
// General events 0x10000000
define('SUBMISSION_LOG_PUBLICATION_FORMAT_PUBLISH', 0x10000008);
define('SUBMISSION_LOG_PUBLICATION_FORMAT_UNPUBLISH', 0x10000009);
define('SUBMISSION_LOG_CATALOG_METADATA_UPDATE', 0x10000010);
define('SUBMISSION_LOG_PUBLICATION_FORMAT_METADATA_UPDATE', 0x10000011);
define('SUBMISSION_LOG_PUBLICATION_FORMAT_CREATE', 0x10000012);
define('SUBMISSION_LOG_PUBLICATION_FORMAT_REMOVE', 0x10000013);
define('SUBMISSION_LOG_PUBLICATION_FORMAT_AVAILABLE', 0x10000014);
define('SUBMISSION_LOG_PUBLICATION_FORMAT_UNAVAILABLE', 0x10000015);

class SubmissionEventLogEntry extends PKPSubmissionEventLogEntry
{
public const SUBMISSION_LOG_PUBLICATION_FORMAT_PUBLISH = 268435464;
public const SUBMISSION_LOG_PUBLICATION_FORMAT_UNPUBLISH = 268435465;
public const SUBMISSION_LOG_CATALOG_METADATA_UPDATE = 2268435472;
public const SUBMISSION_LOG_PUBLICATION_FORMAT_METADATA_UPDATE = 68435473;
public const SUBMISSION_LOG_PUBLICATION_FORMAT_CREATE = 268435474;
public const SUBMISSION_LOG_PUBLICATION_FORMAT_REMOVE = 268435475;
public const SUBMISSION_LOG_PUBLICATION_FORMAT_AVAILABLE = 268435476;
public const SUBMISSION_LOG_PUBLICATION_FORMAT_UNAVAILABLE = 268435477;
}

if (!PKP_STRICT_MODE) {
class_alias('\APP\log\SubmissionEventLogEntry', '\SubmissionEventLogEntry');
foreach ([
'SUBMISSION_LOG_PUBLICATION_FORMAT_PUBLISH',
'SUBMISSION_LOG_PUBLICATION_FORMAT_UNPUBLISH',
'SUBMISSION_LOG_CATALOG_METADATA_UPDATE',
'SUBMISSION_LOG_PUBLICATION_FORMAT_METADATA_UPDATE',
'SUBMISSION_LOG_PUBLICATION_FORMAT_CREATE',
'SUBMISSION_LOG_PUBLICATION_FORMAT_REMOVE',
'SUBMISSION_LOG_PUBLICATION_FORMAT_AVAILABLE',
'SUBMISSION_LOG_PUBLICATION_FORMAT_UNAVAILABLE',
] as $constantName) {
define($constantName, constant('\SubmissionEventLogEntry::' . $constantName));
}
}
6 changes: 3 additions & 3 deletions classes/mail/variables/ContextEmailVariable.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ protected static function description(): array
/**
* @copydoc Variable::values()
*/
protected function values(): array
public function values(string $locale): array
{
return array_merge(
parent::description(),
parent::values($locale),
[
self::CONTEXT_NAME => $this->getContextName(),
self::CONTEXT_NAME => $this->context->getLocalizedData('name', $locale),
self::CONTEXT_URL => $this->getContextUrl(),
]
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
use Illuminate\Support\Facades\Schema;
use PKP\core\EntityDAO;
use PKP\services\PKPSchemaService;
use PKP\submission\SubmissionFile;
use PKP\db\DAORegistry;
use PKP\submissionFile\SubmissionFile;

class OMPv3_3_0UpgradeMigration extends \PKP\migration\Migration
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

/**
* @file classes/migration/upgrade/v3_4_0/I7264_UpdateEmailTemplates.inc.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class I7264_UpdateEmailTemplates
* @brief Describe upgrade/downgrade operations for DB table email_templates.
*/

namespace APP\migration\upgrade\v3_4_0;

class I7264_UpdateEmailTemplates extends \PKP\migration\upgrade\v3_4_0\I7264_UpdateEmailTemplates
{
protected function oldNewVariablesMap(): array
{
$oldNewVariablesMap = parent::oldNewVariablesMap();
array_walk_recursive($oldNewVariablesMap, function (&$newVariable, $oldVariable) {
if ($newVariable === 'contextName') {
$newVariable = 'pressName';
} elseif ($newVariable === 'contextUrl') {
$newVariable = 'pressUrl';
}
});

return $oldNewVariablesMap;
}
}
10 changes: 9 additions & 1 deletion classes/oai/omp/PressOAI.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@
* (based on where the request is directed).
*/

use APP\oai\omp\OAIDAO;
namespace APP\oai\omp;

use APP\core\Application;
use PKP\db\DAORegistry;
use PKP\plugins\HookRegistry;
use PKP\oai\OAI;
use PKP\oai\OAIRepository;

Expand Down Expand Up @@ -272,3 +276,7 @@ public function _getIdentifierPrefix()
return 'oai:' . $this->config->repositoryId . ':' . 'publicationFormat/';
}
}

if (!PKP_STRICT_MODE) {
class_alias('\APP\oai\omp\PressOAI', '\PressOAI');
}
11 changes: 5 additions & 6 deletions classes/payment/omp/OMPPaymentManager.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@

namespace APP\payment\omp;

use APP\core\Services;
use APP\facades\Repo;
use PKP\db\DAORegistry;
use PKP\payment\CompletedPayment;
use PKP\payment\PaymentManager;
use PKP\payment\QueuedPayment;
use PKP\plugins\PluginRegistry;

use PKP\submission\SubmissionFile;
use PKP\submissionFile\SubmissionFile;

class OMPPaymentManager extends PaymentManager
{
Expand Down Expand Up @@ -60,8 +61,7 @@ public function createQueuedPayment($request, $type, $userId, $assocId, $amount,

switch ($type) {
case self::PAYMENT_TYPE_PURCHASE_FILE:
import('lib.pkp.classes.submission.SubmissionFile'); // const
$submissionFile = Services::get('submissionFile')->get($assocId);
$submissionFile = Repo::submissionFile()->get($assocId);
if ($submissionFile->getData('fileStage') != SubmissionFile::SUBMISSION_FILE_PROOF) {
throw new Exception('The submission file for this queued payment is not in the correct file stage.');
}
Expand Down Expand Up @@ -142,7 +142,6 @@ public function fulfillQueuedPayment($request, $queuedPayment, $payMethodPluginN
*/
public function createCompletedPayment($queuedPayment, $payMethod)
{
import('lib.pkp.classes.payment.CompletedPayment');
$payment = new CompletedPayment();
$payment->setContextId($queuedPayment->getContextId());
$payment->setType($queuedPayment->getType());
Expand All @@ -164,7 +163,7 @@ public function getPaymentName($payment)
{
switch ($payment->getType()) {
case self::PAYMENT_TYPE_PURCHASE_FILE:
$submissionFile = Services::get('submissionFile')->get($payment->getAssocId());
$submissionFile = Repo::submissionFile()->get($payment->getAssocId());
if (!$submissionFile || $submissionFile->getData('assocType') !== ASSOC_TYPE_PUBLICATION_FORMAT) {
return false;
}
Expand Down
Loading

0 comments on commit 1b75174

Please sign in to comment.