MAJOR: upgrade to new version of Silverstripe - step: Apply PSR2 Cleanup.

This commit is contained in:
thiemen 2019-04-23 18:32:44 +12:00
parent e392cba53a
commit 682caa3bca
25 changed files with 100 additions and 263 deletions

View File

@ -2,24 +2,6 @@
namespace Sunnysideup\DMS\Cms; namespace Sunnysideup\DMS\Cms;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\CMS\Controllers\CMSMain; use SilverStripe\CMS\Controllers\CMSMain;
use Sunnysideup\DMS\Model\DMSDocumentSet; use Sunnysideup\DMS\Model\DMSDocumentSet;
@ -41,8 +23,6 @@ use SilverStripe\Security\Member;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use SilverStripe\Admin\LeftAndMain; use SilverStripe\Admin\LeftAndMain;
/** /**
* @package dms * @package dms
*/ */
@ -125,14 +105,14 @@ class DMSDocumentAddController extends LeftAndMain
*/ */
Requirements::javascript(SilverStripe\Core\Manifest\ModuleLoader::getModule('silverstripe/framework')->getResource('UPGRADE-FIX-REQUIRED.php')->getRelativePath() . '/javascript/AssetUploadField.js'); Requirements::javascript(SilverStripe\Core\Manifest\ModuleLoader::getModule('silverstripe/framework')->getResource('UPGRADE-FIX-REQUIRED.php')->getRelativePath() . '/javascript/AssetUploadField.js');
/** /**
* ### @@@@ START REPLACEMENT @@@@ ### * ### @@@@ START REPLACEMENT @@@@ ###
* WHY: upgrade to SS4 * WHY: upgrade to SS4
* OLD: FRAMEWORK_DIR (ignore case) * OLD: FRAMEWORK_DIR (ignore case)
* NEW: SilverStripe\Core\Manifest\ModuleLoader::getModule('silverstripe/framework')->getResource('UPGRADE-FIX-REQUIRED.php')->getRelativePath() (COMPLEX) * NEW: SilverStripe\Core\Manifest\ModuleLoader::getModule('silverstripe/framework')->getResource('UPGRADE-FIX-REQUIRED.php')->getRelativePath() (COMPLEX)
* EXP: Please review update and fix as required * EXP: Please review update and fix as required
* ### @@@@ STOP REPLACEMENT @@@@ ### * ### @@@@ STOP REPLACEMENT @@@@ ###
*/ */
Requirements::css(SilverStripe\Core\Manifest\ModuleLoader::getModule('silverstripe/framework')->getResource('UPGRADE-FIX-REQUIRED.php')->getRelativePath() . '/css/AssetUploadField.css'); Requirements::css(SilverStripe\Core\Manifest\ModuleLoader::getModule('silverstripe/framework')->getResource('UPGRADE-FIX-REQUIRED.php')->getRelativePath() . '/css/AssetUploadField.css');
Requirements::css(DMS_DIR . '/dist/css/cmsbundle.css'); Requirements::css(DMS_DIR . '/dist/css/cmsbundle.css');

View File

@ -2,9 +2,6 @@
namespace Sunnysideup\DMS\Cms; namespace Sunnysideup\DMS\Cms;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Forms\TreeDropdownField; use SilverStripe\Forms\TreeDropdownField;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
@ -12,8 +9,6 @@ use SilverStripe\View\Requirements;
use Sunnysideup\DMS\Cms\DMSDocumentAddExistingField; use Sunnysideup\DMS\Cms\DMSDocumentAddExistingField;
use SilverStripe\Forms\CompositeField; use SilverStripe\Forms\CompositeField;
class DMSDocumentAddExistingField extends CompositeField class DMSDocumentAddExistingField extends CompositeField
{ {
public $useFieldContext = true; public $useFieldContext = true;

View File

@ -2,8 +2,6 @@
namespace Sunnysideup\DMS\Cms; namespace Sunnysideup\DMS\Cms;
use CMSForm; use CMSForm;
@ -19,8 +17,6 @@ use SilverStripe\Forms\GridField\GridFieldDataColumns;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Admin\ModelAdmin; use SilverStripe\Admin\ModelAdmin;
class DMSDocumentAdmin extends ModelAdmin class DMSDocumentAdmin extends ModelAdmin
{ {
private static $managed_models = array( private static $managed_models = array(

View File

@ -2,12 +2,6 @@
namespace Sunnysideup\DMS\Cms; namespace Sunnysideup\DMS\Cms;
use Sunnysideup\DMS\Cms\DMSDocumentAddController; use Sunnysideup\DMS\Cms\DMSDocumentAddController;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use Sunnysideup\DMS\Model\DMSDocumentSet; use Sunnysideup\DMS\Model\DMSDocumentSet;
@ -17,8 +11,6 @@ use Sunnysideup\DMS\Cms\DMSGridFieldAddNewButton;
use SilverStripe\Forms\GridField\GridFieldAddNewButton; use SilverStripe\Forms\GridField\GridFieldAddNewButton;
use SilverStripe\Forms\GridField\GridField_HTMLProvider; use SilverStripe\Forms\GridField\GridField_HTMLProvider;
class DMSGridFieldAddNewButton extends GridFieldAddNewButton implements GridField_HTMLProvider class DMSGridFieldAddNewButton extends GridFieldAddNewButton implements GridField_HTMLProvider
{ {
/** /**

View File

@ -2,13 +2,9 @@
namespace Sunnysideup\DMS\Cms; namespace Sunnysideup\DMS\Cms;
use Sunnysideup\DMS\Tools\ShortCodeRelationFinder; use Sunnysideup\DMS\Tools\ShortCodeRelationFinder;
use SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest; use SilverStripe\Forms\GridField\GridFieldDetailForm_ItemRequest;
/** /**
* Custom ItemRequest class the provides custom delete behaviour for the CMSFields of DMSDocument * Custom ItemRequest class the provides custom delete behaviour for the CMSFields of DMSDocument
*/ */

View File

@ -2,18 +2,12 @@
namespace Sunnysideup\DMS\Cms; namespace Sunnysideup\DMS\Cms;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
use SilverStripe\View\ArrayData; use SilverStripe\View\ArrayData;
use SilverStripe\Forms\GridField\GridFieldEditButton; use SilverStripe\Forms\GridField\GridFieldEditButton;
use SilverStripe\Forms\GridField\GridFieldViewButton; use SilverStripe\Forms\GridField\GridFieldViewButton;
use SilverStripe\Forms\GridField\GridField_ColumnProvider; use SilverStripe\Forms\GridField\GridField_ColumnProvider;
class DMSGridFieldEditButton extends GridFieldEditButton implements GridField_ColumnProvider class DMSGridFieldEditButton extends GridFieldEditButton implements GridField_ColumnProvider
{ {

View File

@ -2,11 +2,6 @@
namespace Sunnysideup\DMS\Cms; namespace Sunnysideup\DMS\Cms;
use Exception; use Exception;
@ -28,8 +23,6 @@ use SilverStripe\Forms\FormAction;
use SilverStripe\Forms\Validator; use SilverStripe\Forms\Validator;
use SilverStripe\AssetAdmin\Forms\UploadField; use SilverStripe\AssetAdmin\Forms\UploadField;
/** /**
* Field for uploading files into a DMSDocument. Replacing the existing file. * Field for uploading files into a DMSDocument. Replacing the existing file.
* Not ideally suited for the purpose, as the base implementation * Not ideally suited for the purpose, as the base implementation

View File

@ -9,8 +9,6 @@ namespace Sunnysideup\DMS\Cms;
use Sunnysideup\DMS\Model\DMSDocument; use Sunnysideup\DMS\Model\DMSDocument;
use SilverStripe\Forms\Form; use SilverStripe\Forms\Form;
class DMSUploadField_ItemHandler class DMSUploadField_ItemHandler
{ {
private static $allowed_actions = array( private static $allowed_actions = array(

View File

@ -2,16 +2,11 @@
namespace Sunnysideup\DMS\Cms; namespace Sunnysideup\DMS\Cms;
use SilverStripe\Forms\Form; use SilverStripe\Forms\Form;
use Sunnysideup\DMS\DMS; use Sunnysideup\DMS\DMS;
use SilverStripe\Forms\HiddenField; use SilverStripe\Forms\HiddenField;
use SilverStripe\Core\Extension; use SilverStripe\Core\Extension;
/** /**
* Extends the original toolbar with document picking capability - modified lines are commented. * Extends the original toolbar with document picking capability - modified lines are commented.
*/ */
@ -50,7 +45,7 @@ class DocumentHTMLEditorFieldToolbar extends Extension
$fieldList->push(HiddenField::create('DMSShortcodeHandlerKey', false, DMS::inst()->getShortcodeHandlerKey())); $fieldList->push(HiddenField::create('DMSShortcodeHandlerKey', false, DMS::inst()->getShortcodeHandlerKey()));
// Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js"); // Requirements::javascript(SAPPHIRE_DIR . "/thirdparty/behaviour/behaviour.js");
// Requirements::javascript(SAPPHIRE_DIR . "/javascript/tiny_mce_improvements.js"); // Requirements::javascript(SAPPHIRE_DIR . "/javascript/tiny_mce_improvements.js");
// //
// // create additional field, rebase to 'documents' directory // // create additional field, rebase to 'documents' directory

View File

@ -2,7 +2,6 @@
namespace Sunnysideup\DMS; namespace Sunnysideup\DMS;
use SilverStripe\Core\Injector\Injector; use SilverStripe\Core\Injector\Injector;
@ -19,7 +18,6 @@ use SilverStripe\Core\Config\Config;
use Sunnysideup\DMS\DMS; use Sunnysideup\DMS\DMS;
use Sunnysideup\DMS\Interfaces\DMSInterface; use Sunnysideup\DMS\Interfaces\DMSInterface;
class DMS extends ViewableData implements DMSInterface class DMS extends ViewableData implements DMSInterface
{ {
/** /**

View File

@ -2,15 +2,10 @@
namespace Sunnysideup\DMS; namespace Sunnysideup\DMS;
use SilverStripe\View\Parsers\ShortcodeParser; use SilverStripe\View\Parsers\ShortcodeParser;
use Sunnysideup\DMS\Model\DMSDocument; use Sunnysideup\DMS\Model\DMSDocument;
use SilverStripe\ErrorPage\ErrorPage; use SilverStripe\ErrorPage\ErrorPage;
/** /**
* Handles replacing `dms_document_link` shortcodes with links to the actual * Handles replacing `dms_document_link` shortcodes with links to the actual
* document. * document.

View File

@ -2,9 +2,6 @@
namespace Sunnysideup\DMS\Extensions; namespace Sunnysideup\DMS\Extensions;
use TaxonomyTerm; use TaxonomyTerm;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
@ -13,9 +10,6 @@ use SilverStripe\Core\Config\Config;
use Sunnysideup\DMS\Extensions\DMSTaxonomyTypeExtension; use Sunnysideup\DMS\Extensions\DMSTaxonomyTypeExtension;
use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataExtension;
/** /**
* ### @@@@ START REPLACEMENT @@@@ ### * ### @@@@ START REPLACEMENT @@@@ ###
* WHY: upgrade to SS4 * WHY: upgrade to SS4

View File

@ -2,16 +2,6 @@
namespace Sunnysideup\DMS\Extensions; namespace Sunnysideup\DMS\Extensions;
use Sunnysideup\DMS\Model\DMSDocumentSet; use Sunnysideup\DMS\Model\DMSDocumentSet;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Security\Member; use SilverStripe\Security\Member;
@ -24,8 +14,6 @@ use SilverStripe\ORM\ArrayList;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataExtension;
/** /**
* @package dms * @package dms
*/ */

View File

@ -2,13 +2,10 @@
namespace Sunnysideup\DMS\Extensions; namespace Sunnysideup\DMS\Extensions;
use TaxonomyType; use TaxonomyType;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;
use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataExtension;
/** /**
* Creates default taxonomy type records if they don't exist already * Creates default taxonomy type records if they don't exist already
*/ */

View File

@ -2,15 +2,10 @@
namespace Sunnysideup\DMS\Forms; namespace Sunnysideup\DMS\Forms;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;
use SilverStripe\Core\Convert; use SilverStripe\Core\Convert;
use SilverStripe\Forms\CompositeField; use SilverStripe\Forms\CompositeField;
/** /**
* Combines form inputs into a key-value pair * Combines form inputs into a key-value pair
*/ */
@ -106,7 +101,7 @@ class DMSJsonField extends CompositeField
* *
* @return $this * @return $this
*/ */
public function setValue($value, $data = NULL) public function setValue($value, $data = null)
{ {
$this->value = $value; $this->value = $value;
if (is_string($value) && !empty($value)) { if (is_string($value) && !empty($value)) {

View File

@ -2,14 +2,13 @@
namespace Sunnysideup\DMS\Interfaces; namespace Sunnysideup\DMS\Interfaces;
/** /**
* Interface for a DMSDocument used in the Document Management System. A DMSDocument is create by storing a File * Interface for a DMSDocument used in the Document Management System. A DMSDocument is create by storing a File
* object in an instance of the DMSInterface. All write operations on the DMSDocument create a new relation, so we * object in an instance of the DMSInterface. All write operations on the DMSDocument create a new relation, so we
* never need to explicitly call the write() method on the DMSDocument DataObject * never need to explicitly call the write() method on the DMSDocument DataObject
*/ */
interface DMSDocumentInterface { interface DMSDocumentInterface
{
/** /**
* Returns a link to download this DMSDocument from the DMS store * Returns a link to download this DMSDocument from the DMS store
* @return String * @return String

View File

@ -2,30 +2,13 @@
namespace Sunnysideup\DMS\Interfaces; namespace Sunnysideup\DMS\Interfaces;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
/** /**
* *
*/ */
interface DMSInterface { interface DMSInterface
{
/** /**
* Factory method that returns an instance of the DMS. This could be any class that implements the DMSInterface. * Factory method that returns an instance of the DMS. This could be any class that implements the DMSInterface.
* @static * @static

View File

@ -2,17 +2,6 @@
namespace Sunnysideup\DMS\Model; namespace Sunnysideup\DMS\Model;
use Exception; use Exception;
@ -97,8 +86,6 @@ use SilverStripe\Core\Convert;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
use Sunnysideup\DMS\Interfaces\DMSDocumentInterface; use Sunnysideup\DMS\Interfaces\DMSDocumentInterface;
/** /**
* @package dms * @package dms
* *
@ -142,14 +129,14 @@ class DMSDocument extends DataObject implements DMSDocumentInterface
private static $table_name = 'DMSDocument'; private static $table_name = 'DMSDocument';
/** /**
* ### @@@@ START REPLACEMENT @@@@ ### * ### @@@@ START REPLACEMENT @@@@ ###
* WHY: upgrade to SS4 * WHY: upgrade to SS4
* OLD: private static $db = (case sensitive) * OLD: private static $db = (case sensitive)
* NEW: private static $db = (COMPLEX) * NEW: private static $db = (COMPLEX)
* EXP: Make sure to add a private static $table_name! * EXP: Make sure to add a private static $table_name!
* ### @@@@ STOP REPLACEMENT @@@@ ### * ### @@@@ STOP REPLACEMENT @@@@ ###
*/ */
private static $db = array( private static $db = array(
"Filename" => "Varchar(255)", // eg. 3469~2011-energysaving-report.pdf "Filename" => "Varchar(255)", // eg. 3469~2011-energysaving-report.pdf
"Folder" => "Varchar(255)", // eg. 0 "Folder" => "Varchar(255)", // eg. 0
@ -170,14 +157,14 @@ class DMSDocument extends DataObject implements DMSDocumentInterface
); );
/** /**
* ### @@@@ START REPLACEMENT @@@@ ### * ### @@@@ START REPLACEMENT @@@@ ###
* WHY: upgrade to SS4 * WHY: upgrade to SS4
* OLD: private static $has_one = (case sensitive) * OLD: private static $has_one = (case sensitive)
* NEW: private static $has_one = (COMPLEX) * NEW: private static $has_one = (COMPLEX)
* EXP: Make sure to add a private static $table_name! * EXP: Make sure to add a private static $table_name!
* ### @@@@ STOP REPLACEMENT @@@@ ### * ### @@@@ STOP REPLACEMENT @@@@ ###
*/ */
private static $has_one = array( private static $has_one = array(
'CoverImage' => Image::class, 'CoverImage' => Image::class,
'CreatedBy' => Member::class, 'CreatedBy' => Member::class,
@ -759,14 +746,14 @@ class DMSDocument extends DataObject implements DMSDocumentInterface
DMSDocument_versions::create_version($this); DMSDocument_versions::create_version($this);
} else { //otherwise delete the old document file } else { //otherwise delete the old document file
/** /**
* ### @@@@ START REPLACEMENT @@@@ ### * ### @@@@ START REPLACEMENT @@@@ ###
* WHY: upgrade to SS4 * WHY: upgrade to SS4
* OLD: ->getFullPath() (case sensitive) * OLD: ->getFullPath() (case sensitive)
* NEW: ->getFilename() (COMPLEX) * NEW: ->getFilename() (COMPLEX)
* EXP: You may need to add ASSETS_PATH."/" in front of this ... * EXP: You may need to add ASSETS_PATH."/" in front of this ...
* ### @@@@ STOP REPLACEMENT @@@@ ### * ### @@@@ STOP REPLACEMENT @@@@ ###
*/ */
$oldPath = $this->getFilename(); $oldPath = $this->getFilename();
if (file_exists($oldPath)) { if (file_exists($oldPath)) {
unlink($oldPath); unlink($oldPath);
@ -1303,14 +1290,14 @@ class DMSDocument extends DataObject implements DMSDocumentInterface
$fields->addExtraClass('dmsdocument-documentdetails'); $fields->addExtraClass('dmsdocument-documentdetails');
/** /**
* ### @@@@ START REPLACEMENT @@@@ ### * ### @@@@ START REPLACEMENT @@@@ ###
* WHY: upgrade to SS4 * WHY: upgrade to SS4
* OLD: ->dontEscape (case sensitive) * OLD: ->dontEscape (case sensitive)
* NEW: ->dontEscape (COMPLEX) * NEW: ->dontEscape (COMPLEX)
* EXP: dontEscape is not longer in use for form fields, please use HTMLReadonlyField (or similar) instead. * EXP: dontEscape is not longer in use for form fields, please use HTMLReadonlyField (or similar) instead.
* ### @@@@ STOP REPLACEMENT @@@@ ### * ### @@@@ STOP REPLACEMENT @@@@ ###
*/ */
$urlField->dontEscape = true; $urlField->dontEscape = true;
$this->extend('updateFieldsForFile', $fields); $this->extend('updateFieldsForFile', $fields);

View File

@ -2,18 +2,6 @@
namespace Sunnysideup\DMS\Model; namespace Sunnysideup\DMS\Model;
use GridFieldPaginatorWithShowAll; use GridFieldPaginatorWithShowAll;
use GridFieldSortableRows; use GridFieldSortableRows;
@ -68,7 +56,6 @@ use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\Security\Permission; use SilverStripe\Security\Permission;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
/** /**
* A document set is attached to Pages, and contains many DMSDocuments * A document set is attached to Pages, and contains many DMSDocuments
* *
@ -94,14 +81,14 @@ class DMSDocumentSet extends DataObject
private static $table_name = 'DMSDocumentSet'; private static $table_name = 'DMSDocumentSet';
/** /**
* ### @@@@ START REPLACEMENT @@@@ ### * ### @@@@ START REPLACEMENT @@@@ ###
* WHY: upgrade to SS4 * WHY: upgrade to SS4
* OLD: private static $db = (case sensitive) * OLD: private static $db = (case sensitive)
* NEW: private static $db = (COMPLEX) * NEW: private static $db = (COMPLEX)
* EXP: Make sure to add a private static $table_name! * EXP: Make sure to add a private static $table_name!
* ### @@@@ STOP REPLACEMENT @@@@ ### * ### @@@@ STOP REPLACEMENT @@@@ ###
*/ */
private static $db = array( private static $db = array(
'Title' => 'Varchar(255)', 'Title' => 'Varchar(255)',
'KeyValuePairs' => 'Text', 'KeyValuePairs' => 'Text',
@ -110,14 +97,14 @@ class DMSDocumentSet extends DataObject
); );
/** /**
* ### @@@@ START REPLACEMENT @@@@ ### * ### @@@@ START REPLACEMENT @@@@ ###
* WHY: upgrade to SS4 * WHY: upgrade to SS4
* OLD: private static $has_one = (case sensitive) * OLD: private static $has_one = (case sensitive)
* NEW: private static $has_one = (COMPLEX) * NEW: private static $has_one = (COMPLEX)
* EXP: Make sure to add a private static $table_name! * EXP: Make sure to add a private static $table_name!
* ### @@@@ STOP REPLACEMENT @@@@ ### * ### @@@@ STOP REPLACEMENT @@@@ ###
*/ */
private static $has_one = array( private static $has_one = array(
'Page' => SiteTree::class, 'Page' => SiteTree::class,
); );
@ -509,7 +496,8 @@ class DMSDocumentSet extends DataObject
$member = Member::currentUser(); $member = Member::currentUser();
} }
$result = ($member && $result = (
$member &&
Permission::checkMember( Permission::checkMember(
$member, $member,
array('ADMIN', 'SITETREE_EDIT_ALL', 'CMS_ACCESS_DMSDocumentAdmin') array('ADMIN', 'SITETREE_EDIT_ALL', 'CMS_ACCESS_DMSDocumentAdmin')

View File

@ -2,10 +2,6 @@
namespace Sunnysideup\DMS\Model; namespace Sunnysideup\DMS\Model;
use InvalidArgumentException; use InvalidArgumentException;
use SilverStripe\Versioned\Versioned; use SilverStripe\Versioned\Versioned;
@ -16,8 +12,6 @@ use Sunnysideup\DMS\Model\DMSDocument;
use SilverStripe\Control\HTTPRequest; use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\Controller; use SilverStripe\Control\Controller;
class DMSDocument_Controller extends Controller class DMSDocument_Controller extends Controller
{ {
/** /**

View File

@ -2,12 +2,6 @@
namespace Sunnysideup\DMS\Model; namespace Sunnysideup\DMS\Model;
use Sunnysideup\DMS\Model\DMSDocument; use Sunnysideup\DMS\Model\DMSDocument;
use Sunnysideup\DMS\Interfaces\DMSDocumentInterface; use Sunnysideup\DMS\Interfaces\DMSDocumentInterface;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
@ -17,8 +11,6 @@ use Sunnysideup\DMS\DMS;
use SilverStripe\Assets\File; use SilverStripe\Assets\File;
use SilverStripe\ORM\DB; use SilverStripe\ORM\DB;
/** /**
* DataObject to store versions of uploaded Documents. * DataObject to store versions of uploaded Documents.
* *
@ -38,42 +30,42 @@ class DMSDocument_versions extends DataObject
public static $enable_versions = true; public static $enable_versions = true;
/** /**
* ### @@@@ START REPLACEMENT @@@@ ### * ### @@@@ START REPLACEMENT @@@@ ###
* OLD: private static $db (case sensitive) * OLD: private static $db (case sensitive)
* NEW: * NEW:
private static $table_name = '[SEARCH_REPLACE_CLASS_NAME_GOES_HERE]'; private static $table_name = '[SEARCH_REPLACE_CLASS_NAME_GOES_HERE]';
private static $db (COMPLEX) private static $db (COMPLEX)
* EXP: Check that is class indeed extends DataObject and that it is not a data-extension! * EXP: Check that is class indeed extends DataObject and that it is not a data-extension!
* ### @@@@ STOP REPLACEMENT @@@@ ### * ### @@@@ STOP REPLACEMENT @@@@ ###
*/ */
private static $table_name = 'DMSDocument_versions'; private static $table_name = 'DMSDocument_versions';
/** /**
* ### @@@@ START REPLACEMENT @@@@ ### * ### @@@@ START REPLACEMENT @@@@ ###
* WHY: upgrade to SS4 * WHY: upgrade to SS4
* OLD: private static $db = (case sensitive) * OLD: private static $db = (case sensitive)
* NEW: private static $db = (COMPLEX) * NEW: private static $db = (COMPLEX)
* EXP: Make sure to add a private static $table_name! * EXP: Make sure to add a private static $table_name!
* ### @@@@ STOP REPLACEMENT @@@@ ### * ### @@@@ STOP REPLACEMENT @@@@ ###
*/ */
private static $db = array( private static $db = array(
'VersionCounter' => 'Int', 'VersionCounter' => 'Int',
'VersionViewCount' => 'Int' 'VersionViewCount' => 'Int'
); );
/** /**
* ### @@@@ START REPLACEMENT @@@@ ### * ### @@@@ START REPLACEMENT @@@@ ###
* WHY: upgrade to SS4 * WHY: upgrade to SS4
* OLD: private static $has_one = (case sensitive) * OLD: private static $has_one = (case sensitive)
* NEW: private static $has_one = (COMPLEX) * NEW: private static $has_one = (COMPLEX)
* EXP: Make sure to add a private static $table_name! * EXP: Make sure to add a private static $table_name!
* ### @@@@ STOP REPLACEMENT @@@@ ### * ### @@@@ STOP REPLACEMENT @@@@ ###
*/ */
private static $has_one = array( private static $has_one = array(
'Document' => DMSDocument::class 'Document' => DMSDocument::class
); );
@ -119,14 +111,14 @@ class DMSDocument_versions extends DataObject
$success = false; $success = false;
/** /**
* ### @@@@ START REPLACEMENT @@@@ ### * ### @@@@ START REPLACEMENT @@@@ ###
* WHY: upgrade to SS4 * WHY: upgrade to SS4
* OLD: ->getFullPath() (case sensitive) * OLD: ->getFullPath() (case sensitive)
* NEW: ->getFilename() (COMPLEX) * NEW: ->getFilename() (COMPLEX)
* EXP: You may need to add ASSETS_PATH."/" in front of this ... * EXP: You may need to add ASSETS_PATH."/" in front of this ...
* ### @@@@ STOP REPLACEMENT @@@@ ### * ### @@@@ STOP REPLACEMENT @@@@ ###
*/ */
$existingPath = $doc->getFilename(); $existingPath = $doc->getFilename();
if (is_file($existingPath)) { if (is_file($existingPath)) {
$docData = $doc->toMap(); $docData = $doc->toMap();

View File

@ -2,12 +2,6 @@
namespace Sunnysideup\DMS\Tasks; namespace Sunnysideup\DMS\Tasks;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\ORM\Queries\SQLSelect; use SilverStripe\ORM\Queries\SQLSelect;
use Sunnysideup\DMS\Model\DMSDocument; use Sunnysideup\DMS\Model\DMSDocument;
@ -15,7 +9,6 @@ use Sunnysideup\DMS\Model\DMSDocumentSet;
use SilverStripe\Control\Director; use SilverStripe\Control\Director;
use SilverStripe\Dev\BuildTask; use SilverStripe\Dev\BuildTask;
/** /**
* This build task helps to migrate DMS data structures from DMS 1.x to 2.x which introduces document sets. * This build task helps to migrate DMS data structures from DMS 1.x to 2.x which introduces document sets.
* *

View File

@ -2,10 +2,6 @@
namespace Sunnysideup\DMS\Tools; namespace Sunnysideup\DMS\Tools;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\ORM\DataList; use SilverStripe\ORM\DataList;
use Sunnysideup\DMS\DMS; use Sunnysideup\DMS\DMS;
@ -13,7 +9,6 @@ use SilverStripe\Core\ClassInfo;
use SilverStripe\Dev\TestOnly; use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject; use SilverStripe\ORM\DataObject;
/** /**
* Finds {@link DataObject} instances using certain shortcodes * Finds {@link DataObject} instances using certain shortcodes
* by fulltext-querying only fields which are capable of parsing shortcodes. * by fulltext-querying only fields which are capable of parsing shortcodes.

View File

@ -12,7 +12,7 @@ class DMSSiteTreeExtensionTest extends SapphireTest
{ {
protected static $fixture_file = 'dms/tests/dmstest.yml'; protected static $fixture_file = 'dms/tests/dmstest.yml';
protected $required_extensions = array( protected static $required_extensions = array(
'SiteTree' => array(DMSSiteTreeExtension::class) 'SiteTree' => array(DMSSiteTreeExtension::class)
); );

View File

@ -8,7 +8,7 @@ class DMSTaxonomyTypeExtensionTest extends SapphireTest
{ {
protected $usesDatabase = true; protected $usesDatabase = true;
protected $required_extensions = array( protected static $required_extensions = array(
'TaxonomyType' => array(DMSTaxonomyTypeExtension::class) 'TaxonomyType' => array(DMSTaxonomyTypeExtension::class)
); );