diff --git a/_config/env-check.yml b/_config/env-check.yml deleted file mode 100755 index 5a4dfce..0000000 --- a/_config/env-check.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -Name: a2nt-cms-niceties-env-check ---- - -SilverStripe\EnvironmentCheck\EnvironmentCheckSuite: - registered_checks: - curl: - definition: 'HasFunctionCheck("curl_init")' - title: 'is curl available?' - gd: - definition: 'HasFunctionCheck("imagecreatetruecolor")' - title: 'Does PHP have GD2 support?' - db: - definition: 'DatabaseCheck("Page")' - title: 'Is the database accessible?' - url: - definition: 'URLCheck()' - title: 'Is the homepage accessible?' - registered_suites: - check: - - curl - - gd - - db - - url - health: - - db - - url - diff --git a/src/Forms/GridField/SaveAllButton.php b/src/Forms/GridField/SaveAllButton.php index fd85825..fc3ddb3 100644 --- a/src/Forms/GridField/SaveAllButton.php +++ b/src/Forms/GridField/SaveAllButton.php @@ -44,15 +44,16 @@ class SaveAllButton implements GridField_HTMLProvider, GridField_ActionProvider public function getHTMLFragments($gridField) { - $singleton = singleton($gridField->getModelClass()); + $class = $gridField->getModelClass(); + $singleton = singleton($class); if (!$singleton->canEdit() && !$singleton->canCreate()) { return []; } if (!$this->buttonName) { - if ($this->publish && $singleton->hasExtension('Versioned')) { - $this->buttonName = _t('GridField.SAVE_ALL_AND_PUBLISH', 'Save all and publish'); + if ($this->publish && $singleton->hasExtension(Versioned::class)) { + $this->buttonName = _t('GridField.SAVE_ALL_AND_PUBLISH', 'Save all and Publish'); } else { $this->buttonName = _t('GridField.SAVE_ALL', 'Save all'); } @@ -93,7 +94,9 @@ class SaveAllButton implements GridField_HTMLProvider, GridField_ActionProvider protected function saveAllRecords(GridField $grid, $arguments, $data) { - if (!isset($data[$grid->Name])) { + if (!isset($data[$grid->Name]) + || !isset($data[$grid->Name]['GridFieldEditableColumns']) + ) { return; } @@ -109,7 +112,7 @@ class SaveAllButton implements GridField_HTMLProvider, GridField_ActionProvider } // Only use the viewable list items, since bulk publishing can take a toll on the system - $paginator = $cfg->getComponentByType('GridFieldPaginator'); + $paginator = $cfg->getComponentByType(GridFieldPaginator::class); $list = $paginator ? $paginator->getManipulatedData($grid, $grid->List) : $grid->List; @@ -138,9 +141,12 @@ class SaveAllButton implements GridField_HTMLProvider, GridField_ActionProvider if ($this->publish) { $list->each(function ($item) { - if ($item->hasExtension('Versioned')) { + if ($item->hasExtension(Versioned::class)) { $item->writeToStage('Stage'); - $item->copyVersionToStage('Stage', 'Live'); + + if (!$item->stagesDiffer()) { + $item->copyVersionToStage('Stage', 'Live'); + } } }); }