Merge pull request #217 from kinglozzer/php72

PHP 7.2 compatibility
This commit is contained in:
Robbie Averill 2019-01-02 12:58:39 +00:00 committed by GitHub
commit e7535a6af6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -8,6 +8,10 @@ if (!file_exists(BASE_PATH . DIRECTORY_SEPARATOR . DMS_DIR)) {
user_error('DMS directory named incorrectly. Please install the DMS module into a folder named: ' . DMS_DIR);
}
// Ensure compatibility with PHP 7.2 ("object" is a reserved word),
// with SilverStripe 3.6 (using Object) and SilverStripe 3.7 (using SS_Object)
if (!class_exists('SS_Object')) class_alias('Object', 'SS_Object');
CMSMenu::remove_menu_item('DMSDocumentAddController');
ShortcodeParser::get('default')->register(

View File

@ -1,5 +1,5 @@
<?php
class DMS extends Object implements DMSInterface
class DMS extends SS_Object implements DMSInterface
{
/**
* Folder to store the documents in

View File

@ -132,7 +132,7 @@ class DMSUploadField extends UploadField
// Search for relations that can hold the uploaded files.
if ($relationClass = $this->getRelationAutosetClass()) {
// Create new object explicitly. Otherwise rely on Upload::load to choose the class.
$fileObject = Object::create($relationClass);
$fileObject = SS_Object::create($relationClass);
}
}