Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion controllers/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ public function init($extra) {
}

// Request limiter needs initialized authentication parameters
$this->initRequestLimiter();
if (!Z_ENV_TESTING_SITE) {
$this->initRequestLimiter();
}

// Get object user
if (isset($this->objectUserID)) {
Expand Down
3 changes: 2 additions & 1 deletion include/config/config.inc.php-sample
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ class Z_CONFIG {

public static $TESTING_SITE = true;
public static $DEV_SITE = true;

public static $DB_SUFFIX = ''; // options: "_test" for test, "_dev" for dev, "" for prod

public static $DEBUG_LOG = false;

public static $BASE_URI = '';
Expand Down
1 change: 1 addition & 0 deletions misc/master.sql
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ CREATE TABLE `libraries` (
`lastUpdated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`version` int(10) unsigned NOT NULL DEFAULT '0',
`shardID` smallint(5) unsigned NOT NULL,
`hasData` TINYINT( 1 ) NOT NULL DEFAULT '0'
PRIMARY KEY (`libraryID`),
KEY `shardID` (`shardID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Expand Down
2 changes: 1 addition & 1 deletion model/Notes.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public static function updateHash($libraryID, $itemID, $value) {


public static function sanitize($text) {
if (strlen(trim($text)) == 0) {
if (Z_ENV_TESTING_SITE || strlen(trim($text)) == 0) {
return $text;
}

Expand Down
4 changes: 2 additions & 2 deletions model/Permissions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ private function getUserPrivacy($userID) {
break;

case 2:
$privacy['library'] = false;
$privacy['notes'] = false;
$privacy['library'] = true;
$privacy['notes'] = true;
break;

default:
Expand Down
6 changes: 3 additions & 3 deletions model/Storage.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,9 @@ public static function setUserValues($userID, $quota, $expiration) {
}

public static function getInstitutionalUserQuota($userID) {
// TODO: config
$dev = Z_ENV_TESTING_SITE ? "_dev" : "";
$databaseName = "zotero_www{$dev}";

$suffix = Z_CONFIG::$DB_SUFFIX;
$databaseName = "zotero_www$suffix";

// Get maximum institutional quota by e-mail domain
$sql = "SELECT IFNULL(MAX(storageQuota), 0) FROM $databaseName.users_email "
Expand Down
5 changes: 2 additions & 3 deletions model/auth/Password.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ class Zotero_AuthenticationPlugin_Password implements Zotero_AuthenticationPlugi
public static function authenticate($data) {
$salt = Z_CONFIG::$AUTH_SALT;

// TODO: config
$dev = Z_ENV_TESTING_SITE ? "_dev" : "";
$databaseName = "zotero_www{$dev}";
$suffix = Z_CONFIG::$DB_SUFFIX;
$databaseName = "zotero_www$suffix";

$username = $data['username'];
$password = $data['password'];
Expand Down