mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
Linting fixes
This commit is contained in:
parent
5a1da4c2c1
commit
ede2d93363
@ -62,7 +62,7 @@ class RecoverUploadLocationsHelper
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache of the EditableFileField versions
|
* Cache of the EditableFileField versions
|
||||||
*
|
*
|
||||||
* @var EditableFileField
|
* @var EditableFileField
|
||||||
*/
|
*/
|
||||||
private $fieldFolderCache = array();
|
private $fieldFolderCache = array();
|
||||||
@ -115,7 +115,7 @@ class RecoverUploadLocationsHelper
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Process all the files and return the number
|
* Process all the files and return the number
|
||||||
*
|
*
|
||||||
* @return int Number of files processed
|
* @return int Number of files processed
|
||||||
*/
|
*/
|
||||||
protected function process()
|
protected function process()
|
||||||
@ -134,7 +134,7 @@ class RecoverUploadLocationsHelper
|
|||||||
$errorsCount = 0;
|
$errorsCount = 0;
|
||||||
|
|
||||||
// Loop over the files to process
|
// Loop over the files to process
|
||||||
foreach($this->chunk() as $uploadRecord) {
|
foreach ($this->chunk() as $uploadRecord) {
|
||||||
++$processedCount;
|
++$processedCount;
|
||||||
|
|
||||||
$fileId = $uploadRecord['UploadedFileID'];
|
$fileId = $uploadRecord['UploadedFileID'];
|
||||||
@ -171,10 +171,10 @@ class RecoverUploadLocationsHelper
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the EditableFileField version from cache and returns its FolderID
|
* Fetches the EditableFileField version from cache and returns its FolderID
|
||||||
*
|
*
|
||||||
* @param int $fieldId EditableFileField.ID
|
* @param int $fieldId EditableFileField.ID
|
||||||
* @param int EditableFileField Version
|
* @param int EditableFileField Version
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
protected function getExpectedUploadFolderId($fieldId, $fieldVersion)
|
protected function getExpectedUploadFolderId($fieldId, $fieldVersion)
|
||||||
@ -196,11 +196,11 @@ class RecoverUploadLocationsHelper
|
|||||||
/**
|
/**
|
||||||
* Fetches a Folder by its ID, gracefully handling
|
* Fetches a Folder by its ID, gracefully handling
|
||||||
* deleted folders
|
* deleted folders
|
||||||
*
|
*
|
||||||
* @param int $id Folder.ID
|
* @param int $id Folder.ID
|
||||||
*
|
*
|
||||||
* @return Folder
|
* @return Folder
|
||||||
*
|
*
|
||||||
* @throws RuntimeException when folder could not be found
|
* @throws RuntimeException when folder could not be found
|
||||||
*/
|
*/
|
||||||
protected function getFolder($id)
|
protected function getFolder($id)
|
||||||
@ -231,10 +231,10 @@ class RecoverUploadLocationsHelper
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Recover an uploaded file location
|
* Recover an uploaded file location
|
||||||
*
|
*
|
||||||
* @param int $fileId File.ID
|
* @param int $fileId File.ID
|
||||||
* @param int $expectedFolderId ID of the folder where the file should have end up
|
* @param int $expectedFolderId ID of the folder where the file should have end up
|
||||||
*
|
*
|
||||||
* @return int Number of files recovered
|
* @return int Number of files recovered
|
||||||
*/
|
*/
|
||||||
protected function recover($fileId, $expectedFolderId)
|
protected function recover($fileId, $expectedFolderId)
|
||||||
@ -247,7 +247,8 @@ class RecoverUploadLocationsHelper
|
|||||||
|
|
||||||
if ($this->filesVersioned) {
|
if ($this->filesVersioned) {
|
||||||
$draftVersion = Versioned::get_versionnumber_by_stage(File::class, Versioned::DRAFT, $fileId);
|
$draftVersion = Versioned::get_versionnumber_by_stage(File::class, Versioned::DRAFT, $fileId);
|
||||||
$liveVersion = Versioned::get_versionnumber_by_stage(File::class, Versioned::LIVE, $fileId);;
|
$liveVersion = Versioned::get_versionnumber_by_stage(File::class, Versioned::LIVE, $fileId);
|
||||||
|
;
|
||||||
|
|
||||||
if ($draftVersion && $draftVersion != $liveVersion) {
|
if ($draftVersion && $draftVersion != $liveVersion) {
|
||||||
$draft = Versioned::get_version(File::class, $fileId, $draftVersion);
|
$draft = Versioned::get_version(File::class, $fileId, $draftVersion);
|
||||||
@ -305,11 +306,11 @@ class RecoverUploadLocationsHelper
|
|||||||
* when manually moving them to another folder through CMS
|
* when manually moving them to another folder through CMS
|
||||||
*
|
*
|
||||||
* @see https://github.com/silverstripe/silverstripe-userforms/issues/944
|
* @see https://github.com/silverstripe/silverstripe-userforms/issues/944
|
||||||
*
|
*
|
||||||
* @param int $fileId File.ID
|
* @param int $fileId File.ID
|
||||||
* @param File $file The live version of the file
|
* @param File $file The live version of the file
|
||||||
* @param File|null $draft The draft version of the file
|
* @param File|null $draft The draft version of the file
|
||||||
*
|
*
|
||||||
* @return int Number of files recovered
|
* @return int Number of files recovered
|
||||||
*/
|
*/
|
||||||
protected function checkResidual($fileId, File $file, File $draft = null)
|
protected function checkResidual($fileId, File $file, File $draft = null)
|
||||||
@ -370,7 +371,7 @@ class RecoverUploadLocationsHelper
|
|||||||
*
|
*
|
||||||
* @param File $file the file instance
|
* @param File $file the file instance
|
||||||
* @param int $expectedFolder The expected folder
|
* @param int $expectedFolder The expected folder
|
||||||
*
|
*
|
||||||
* @return int How many files have been recovered
|
* @return int How many files have been recovered
|
||||||
*/
|
*/
|
||||||
protected function recoverLiveOnly(File $file, Folder $expectedFolder)
|
protected function recoverLiveOnly(File $file, Folder $expectedFolder)
|
||||||
@ -560,11 +561,11 @@ limit 100
|
|||||||
/**
|
/**
|
||||||
* Returns DataList object containing every
|
* Returns DataList object containing every
|
||||||
* uploaded file record
|
* uploaded file record
|
||||||
*
|
*
|
||||||
* @return DataList
|
* @return DataList
|
||||||
*/
|
*/
|
||||||
private function getCountQuery()
|
private function getCountQuery()
|
||||||
{
|
{
|
||||||
return SubmittedFileField::get()->filter(['UploadedFileID:NOT' => 0]);
|
return SubmittedFileField::get()->filter(['UploadedFileID:NOT' => 0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user